root / src / gr / ebs / gss / client / clipboard / ClipboardItem.java @ 8086761e
History | View | Annotate | Download (3.7 kB)
1 | 14ad7326 | pastith | /*
|
---|---|---|---|
2 | 14ad7326 | pastith | * Copyright 2008, 2009 Electronic Business Systems Ltd.
|
3 | 14ad7326 | pastith | *
|
4 | 14ad7326 | pastith | * This file is part of GSS.
|
5 | 14ad7326 | pastith | *
|
6 | 14ad7326 | pastith | * GSS is free software: you can redistribute it and/or modify
|
7 | 14ad7326 | pastith | * it under the terms of the GNU General Public License as published by
|
8 | 14ad7326 | pastith | * the Free Software Foundation, either version 3 of the License, or
|
9 | 14ad7326 | pastith | * (at your option) any later version.
|
10 | 14ad7326 | pastith | *
|
11 | 14ad7326 | pastith | * GSS is distributed in the hope that it will be useful,
|
12 | 14ad7326 | pastith | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 14ad7326 | pastith | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 14ad7326 | pastith | * GNU General Public License for more details.
|
15 | 14ad7326 | pastith | *
|
16 | 14ad7326 | pastith | * You should have received a copy of the GNU General Public License
|
17 | 14ad7326 | pastith | * along with GSS. If not, see <http://www.gnu.org/licenses/>.
|
18 | 14ad7326 | pastith | */
|
19 | 14ad7326 | pastith | package gr.ebs.gss.client.clipboard; |
20 | 14ad7326 | pastith | |
21 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.FileResource; |
22 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.FolderResource; |
23 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.GroupUserResource; |
24 | 14ad7326 | pastith | |
25 | 14ad7326 | pastith | import java.io.Serializable; |
26 | 14ad7326 | pastith | import java.util.List; |
27 | 14ad7326 | pastith | |
28 | 14ad7326 | pastith | |
29 | 14ad7326 | pastith | /**
|
30 | 14ad7326 | pastith | * @author kman
|
31 | 14ad7326 | pastith | *
|
32 | 14ad7326 | pastith | */
|
33 | 14ad7326 | pastith | public class ClipboardItem implements Serializable{ |
34 | 14ad7326 | pastith | private int operation; |
35 | a52ea5e4 | pastith | private FileResource file;
|
36 | a52ea5e4 | pastith | private List<FileResource> files; |
37 | a52ea5e4 | pastith | private FolderResource folderResource;
|
38 | a52ea5e4 | pastith | private GroupUserResource user;
|
39 | 14ad7326 | pastith | |
40 | 14ad7326 | pastith | public ClipboardItem(){}
|
41 | 14ad7326 | pastith | |
42 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(int anOperation, List<FileResource> theFiles){ |
43 | 86c951b2 | Panagiotis Astithas | operation = anOperation; |
44 | 86c951b2 | Panagiotis Astithas | files = theFiles; |
45 | 14ad7326 | pastith | } |
46 | 14ad7326 | pastith | |
47 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(int anOperation, FileResource aFile){ |
48 | 86c951b2 | Panagiotis Astithas | operation = anOperation; |
49 | 86c951b2 | Panagiotis Astithas | file = aFile; |
50 | 14ad7326 | pastith | } |
51 | 14ad7326 | pastith | |
52 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(int anOperation, FolderResource folder){ |
53 | 86c951b2 | Panagiotis Astithas | operation = anOperation; |
54 | a52ea5e4 | pastith | folderResource = folder; |
55 | 14ad7326 | pastith | } |
56 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(int anOperation, GroupUserResource aUser){ |
57 | 86c951b2 | Panagiotis Astithas | operation = anOperation; |
58 | 86c951b2 | Panagiotis Astithas | user = aUser; |
59 | 14ad7326 | pastith | } |
60 | 14ad7326 | pastith | |
61 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(GroupUserResource aUser){
|
62 | 86c951b2 | Panagiotis Astithas | operation = Clipboard.COPY;
|
63 | 86c951b2 | Panagiotis Astithas | user = aUser; |
64 | 14ad7326 | pastith | } |
65 | 14ad7326 | pastith | |
66 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(List<FileResource> theFiles){ |
67 | 86c951b2 | Panagiotis Astithas | operation = Clipboard.COPY;
|
68 | 86c951b2 | Panagiotis Astithas | files = theFiles; |
69 | 14ad7326 | pastith | } |
70 | 14ad7326 | pastith | |
71 | 86c951b2 | Panagiotis Astithas | public ClipboardItem(FileResource aFile){
|
72 | 86c951b2 | Panagiotis Astithas | operation = Clipboard.COPY;
|
73 | 86c951b2 | Panagiotis Astithas | file = aFile; |
74 | 14ad7326 | pastith | } |
75 | 14ad7326 | pastith | |
76 | a52ea5e4 | pastith | public ClipboardItem(FolderResource folder){
|
77 | 86c951b2 | Panagiotis Astithas | operation = Clipboard.COPY;
|
78 | a52ea5e4 | pastith | folderResource = folder; |
79 | 14ad7326 | pastith | } |
80 | 14ad7326 | pastith | |
81 | 14ad7326 | pastith | /**
|
82 | 14ad7326 | pastith | * Retrieve the user.
|
83 | 14ad7326 | pastith | *
|
84 | 14ad7326 | pastith | * @return the user
|
85 | 14ad7326 | pastith | */
|
86 | a52ea5e4 | pastith | public GroupUserResource getUser() {
|
87 | 14ad7326 | pastith | return user;
|
88 | 14ad7326 | pastith | } |
89 | 14ad7326 | pastith | |
90 | 14ad7326 | pastith | /**
|
91 | 14ad7326 | pastith | * Modify the user.
|
92 | 14ad7326 | pastith | *
|
93 | 86c951b2 | Panagiotis Astithas | * @param aUser the user to set
|
94 | 14ad7326 | pastith | */
|
95 | 86c951b2 | Panagiotis Astithas | public void setUser(GroupUserResource aUser) { |
96 | 86c951b2 | Panagiotis Astithas | user = aUser; |
97 | 14ad7326 | pastith | } |
98 | 14ad7326 | pastith | |
99 | 14ad7326 | pastith | /**
|
100 | 14ad7326 | pastith | * Retrieve the operation.
|
101 | 14ad7326 | pastith | *
|
102 | 14ad7326 | pastith | * @return the operation
|
103 | 14ad7326 | pastith | */
|
104 | 14ad7326 | pastith | public int getOperation() { |
105 | 14ad7326 | pastith | return operation;
|
106 | 14ad7326 | pastith | } |
107 | 14ad7326 | pastith | |
108 | 14ad7326 | pastith | /**
|
109 | 14ad7326 | pastith | * Modify the operation.
|
110 | 14ad7326 | pastith | *
|
111 | 86c951b2 | Panagiotis Astithas | * @param anOperation the operation to set
|
112 | 14ad7326 | pastith | */
|
113 | 86c951b2 | Panagiotis Astithas | public void setOperation(int anOperation) { |
114 | 86c951b2 | Panagiotis Astithas | operation = anOperation; |
115 | 14ad7326 | pastith | } |
116 | 14ad7326 | pastith | |
117 | 14ad7326 | pastith | /**
|
118 | 14ad7326 | pastith | * Retrieve the file.
|
119 | 14ad7326 | pastith | *
|
120 | 14ad7326 | pastith | * @return the file
|
121 | 14ad7326 | pastith | */
|
122 | a52ea5e4 | pastith | public FileResource getFile() {
|
123 | 14ad7326 | pastith | return file;
|
124 | 14ad7326 | pastith | } |
125 | 14ad7326 | pastith | |
126 | 14ad7326 | pastith | /**
|
127 | 14ad7326 | pastith | * Modify the file.
|
128 | 14ad7326 | pastith | *
|
129 | 86c951b2 | Panagiotis Astithas | * @param aFile the file to set
|
130 | 14ad7326 | pastith | */
|
131 | 86c951b2 | Panagiotis Astithas | public void setFile(FileResource aFile) { |
132 | 86c951b2 | Panagiotis Astithas | file = aFile; |
133 | 14ad7326 | pastith | } |
134 | 14ad7326 | pastith | |
135 | 14ad7326 | pastith | /**
|
136 | 14ad7326 | pastith | * Retrieve the files.
|
137 | 14ad7326 | pastith | *
|
138 | 14ad7326 | pastith | * @return the files
|
139 | 14ad7326 | pastith | */
|
140 | a52ea5e4 | pastith | public List<FileResource> getFiles() { |
141 | 14ad7326 | pastith | return files;
|
142 | 14ad7326 | pastith | } |
143 | 14ad7326 | pastith | |
144 | 14ad7326 | pastith | /**
|
145 | 14ad7326 | pastith | * checks whether the clipboard item is a file or folder
|
146 | 14ad7326 | pastith | */
|
147 | 14ad7326 | pastith | public boolean isFileOrFolder(){ |
148 | 080386c0 | fstamatelopoulos | if(file !=null || files != null || folderResource != null) |
149 | 14ad7326 | pastith | return true; |
150 | 14ad7326 | pastith | return false; |
151 | 14ad7326 | pastith | } |
152 | 14ad7326 | pastith | |
153 | 080386c0 | fstamatelopoulos | /**
|
154 | 080386c0 | fstamatelopoulos | * checks whether the clipboard item is a file (or files)
|
155 | 080386c0 | fstamatelopoulos | */
|
156 | 080386c0 | fstamatelopoulos | public boolean isFile() { |
157 | 080386c0 | fstamatelopoulos | if(file !=null || files != null) |
158 | 080386c0 | fstamatelopoulos | return true; |
159 | 080386c0 | fstamatelopoulos | return false; |
160 | 080386c0 | fstamatelopoulos | } |
161 | 14ad7326 | pastith | |
162 | 14ad7326 | pastith | public boolean isUser(){ |
163 | 14ad7326 | pastith | if( user!=null ) |
164 | 14ad7326 | pastith | return true; |
165 | 14ad7326 | pastith | return false; |
166 | 14ad7326 | pastith | } |
167 | 14ad7326 | pastith | |
168 | a52ea5e4 | pastith | /**
|
169 | a52ea5e4 | pastith | * Retrieve the folderResource.
|
170 | a52ea5e4 | pastith | *
|
171 | a52ea5e4 | pastith | * @return the folderResource
|
172 | a52ea5e4 | pastith | */
|
173 | a52ea5e4 | pastith | public FolderResource getFolderResource() {
|
174 | a52ea5e4 | pastith | return folderResource;
|
175 | a52ea5e4 | pastith | } |
176 | a52ea5e4 | pastith | |
177 | a52ea5e4 | pastith | /**
|
178 | a52ea5e4 | pastith | * Modify the folderResource.
|
179 | a52ea5e4 | pastith | *
|
180 | 86c951b2 | Panagiotis Astithas | * @param aFolder the folderResource to set
|
181 | a52ea5e4 | pastith | */
|
182 | 86c951b2 | Panagiotis Astithas | public void setFolderResource(FolderResource aFolder) { |
183 | 86c951b2 | Panagiotis Astithas | folderResource = aFolder; |
184 | a52ea5e4 | pastith | } |
185 | 14ad7326 | pastith | } |