root / src / gr / grnet / pithos / web / client / Clipboard.java @ afb23bf9
History | View | Annotate | Download (2.7 kB)
1 | a57faaf0 | Christos Stathis | /*
|
---|---|---|---|
2 | e6e9f6e6 | Christos KK Loverdos | * Copyright 2011-2013 GRNET S.A. All rights reserved.
|
3 | 63366925 | Christos Stathis | *
|
4 | 63366925 | Christos Stathis | * Redistribution and use in source and binary forms, with or
|
5 | 63366925 | Christos Stathis | * without modification, are permitted provided that the following
|
6 | 63366925 | Christos Stathis | * conditions are met:
|
7 | 63366925 | Christos Stathis | *
|
8 | 63366925 | Christos Stathis | * 1. Redistributions of source code must retain the above
|
9 | 63366925 | Christos Stathis | * copyright notice, this list of conditions and the following
|
10 | 63366925 | Christos Stathis | * disclaimer.
|
11 | 63366925 | Christos Stathis | *
|
12 | 63366925 | Christos Stathis | * 2. Redistributions in binary form must reproduce the above
|
13 | 63366925 | Christos Stathis | * copyright notice, this list of conditions and the following
|
14 | 63366925 | Christos Stathis | * disclaimer in the documentation and/or other materials
|
15 | 63366925 | Christos Stathis | * provided with the distribution.
|
16 | 63366925 | Christos Stathis | *
|
17 | 63366925 | Christos Stathis | * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 | 63366925 | Christos Stathis | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 | 63366925 | Christos Stathis | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 | 63366925 | Christos Stathis | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 | 63366925 | Christos Stathis | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 | 63366925 | Christos Stathis | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 | 63366925 | Christos Stathis | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 | 63366925 | Christos Stathis | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 | 63366925 | Christos Stathis | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 | 63366925 | Christos Stathis | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 | 63366925 | Christos Stathis | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 | 63366925 | Christos Stathis | * POSSIBILITY OF SUCH DAMAGE.
|
29 | 63366925 | Christos Stathis | *
|
30 | 63366925 | Christos Stathis | * The views and conclusions contained in the software and
|
31 | 63366925 | Christos Stathis | * documentation are those of the authors and should not be
|
32 | 63366925 | Christos Stathis | * interpreted as representing official policies, either expressed
|
33 | 63366925 | Christos Stathis | * or implied, of GRNET S.A.
|
34 | a57faaf0 | Christos Stathis | */
|
35 | 1e413f9b | Christos Stathis | package gr.grnet.pithos.web.client; |
36 | a57faaf0 | Christos Stathis | |
37 | 1e413f9b | Christos Stathis | import gr.grnet.pithos.web.client.foldertree.File; |
38 | 1e413f9b | Christos Stathis | import gr.grnet.pithos.web.client.foldertree.Folder; |
39 | 1e413f9b | Christos Stathis | import java.util.List; |
40 | a57faaf0 | Christos Stathis | |
41 | a57faaf0 | Christos Stathis | public class Clipboard { |
42 | a57faaf0 | Christos Stathis | public final static int CUT=1; |
43 | a57faaf0 | Christos Stathis | public final static int COPY=2; |
44 | 1e413f9b | Christos Stathis | |
45 | 1e413f9b | Christos Stathis | private int operation; |
46 | 1e413f9b | Christos Stathis | |
47 | 1e413f9b | Christos Stathis | private List<File> files; |
48 | 1e413f9b | Christos Stathis | |
49 | 1e413f9b | Christos Stathis | private Folder folder;
|
50 | a57faaf0 | Christos Stathis | |
51 | a57faaf0 | Christos Stathis | /**
|
52 | a57faaf0 | Christos Stathis | * Retrieve the item.
|
53 | a57faaf0 | Christos Stathis | *
|
54 | a57faaf0 | Christos Stathis | * @return the item
|
55 | a57faaf0 | Christos Stathis | */
|
56 | 1e413f9b | Christos Stathis | public Object getItem() { |
57 | 1e413f9b | Christos Stathis | if (folder != null) |
58 | 1e413f9b | Christos Stathis | return folder;
|
59 | 1e413f9b | Christos Stathis | if (files != null) |
60 | 1e413f9b | Christos Stathis | return files;
|
61 | 1e413f9b | Christos Stathis | return null; |
62 | a57faaf0 | Christos Stathis | } |
63 | a57faaf0 | Christos Stathis | |
64 | 1e413f9b | Christos Stathis | public void setItem(int _operation, Folder _folder) { |
65 | 1e413f9b | Christos Stathis | operation = _operation; |
66 | 1e413f9b | Christos Stathis | folder = _folder; |
67 | 1e413f9b | Christos Stathis | files = null;
|
68 | a57faaf0 | Christos Stathis | } |
69 | a57faaf0 | Christos Stathis | |
70 | 1e413f9b | Christos Stathis | public void setItem(int _operation, List<File> _files) { |
71 | 1e413f9b | Christos Stathis | operation = _operation; |
72 | 1e413f9b | Christos Stathis | files = _files; |
73 | 1e413f9b | Christos Stathis | folder = null;
|
74 | 1e413f9b | Christos Stathis | } |
75 | a57faaf0 | Christos Stathis | |
76 | 1e413f9b | Christos Stathis | public int getOperation() { |
77 | 1e413f9b | Christos Stathis | return operation;
|
78 | 1e413f9b | Christos Stathis | } |
79 | a57faaf0 | Christos Stathis | |
80 | 1e413f9b | Christos Stathis | public void clear() { |
81 | 1e413f9b | Christos Stathis | folder = null;
|
82 | 1e413f9b | Christos Stathis | files = null;
|
83 | 1e413f9b | Christos Stathis | } |
84 | 390f5c04 | Christos Stathis | |
85 | 390f5c04 | Christos Stathis | public boolean isEmpty() { |
86 | 390f5c04 | Christos Stathis | return (files == null || files.isEmpty()) && folder == null; |
87 | 390f5c04 | Christos Stathis | } |
88 | 390f5c04 | Christos Stathis | |
89 | 390f5c04 | Christos Stathis | public boolean hasFiles() { |
90 | 390f5c04 | Christos Stathis | return files != null && !files.isEmpty(); |
91 | 390f5c04 | Christos Stathis | } |
92 | a57faaf0 | Christos Stathis | } |