root / src / gr / grnet / pithos / web / client / FilesPropertiesDialog.java @ 9326b841
History | View | Annotate | Download (5.4 kB)
1 |
/*
|
---|---|
2 |
* Copyright 2011 GRNET S.A. All rights reserved.
|
3 |
*
|
4 |
* Redistribution and use in source and binary forms, with or
|
5 |
* without modification, are permitted provided that the following
|
6 |
* conditions are met:
|
7 |
*
|
8 |
* 1. Redistributions of source code must retain the above
|
9 |
* copyright notice, this list of conditions and the following
|
10 |
* disclaimer.
|
11 |
*
|
12 |
* 2. Redistributions in binary form must reproduce the above
|
13 |
* copyright notice, this list of conditions and the following
|
14 |
* disclaimer in the documentation and/or other materials
|
15 |
* provided with the distribution.
|
16 |
*
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
* POSSIBILITY OF SUCH DAMAGE.
|
29 |
*
|
30 |
* The views and conclusions contained in the software and
|
31 |
* documentation are those of the authors and should not be
|
32 |
* interpreted as representing official policies, either expressed
|
33 |
* or implied, of GRNET S.A.
|
34 |
*/
|
35 |
package gr.grnet.pithos.web.client; |
36 |
|
37 |
import gr.grnet.pithos.web.client.foldertree.File; |
38 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
39 |
|
40 |
import java.util.List; |
41 |
|
42 |
import com.google.gwt.event.dom.client.ClickEvent; |
43 |
import com.google.gwt.event.dom.client.ClickHandler; |
44 |
import com.google.gwt.user.client.ui.Button; |
45 |
import com.google.gwt.user.client.ui.DecoratedTabPanel; |
46 |
import com.google.gwt.user.client.ui.DisclosurePanel; |
47 |
import com.google.gwt.user.client.ui.FlexTable; |
48 |
import com.google.gwt.user.client.ui.FlowPanel; |
49 |
import com.google.gwt.user.client.ui.FocusPanel; |
50 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
51 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
52 |
import com.google.gwt.user.client.ui.VerticalPanel; |
53 |
|
54 |
/**
|
55 |
* The 'Multiple file properties' dialog box implementation.
|
56 |
*
|
57 |
*/
|
58 |
public class FilesPropertiesDialog extends AbstractPropertiesDialog { |
59 |
|
60 |
private final List<File> files; |
61 |
|
62 |
/**
|
63 |
* The widget's constructor.
|
64 |
*
|
65 |
* @param _files
|
66 |
*/
|
67 |
public FilesPropertiesDialog(Pithos _app, final List<File> _files) { |
68 |
super(_app);
|
69 |
|
70 |
files = _files; |
71 |
|
72 |
// Set the dialog's caption.
|
73 |
setText("Files properties");
|
74 |
|
75 |
// Outer contains inner and buttons.
|
76 |
final VerticalPanel outer = new VerticalPanel(); |
77 |
final FocusPanel focusPanel = new FocusPanel(outer); |
78 |
// Inner contains generalPanel and permPanel.
|
79 |
inner = new VerticalPanel();
|
80 |
|
81 |
inner.add(createGeneralPanel()); |
82 |
|
83 |
outer.add(inner); |
84 |
|
85 |
final HorizontalPanel buttons = new HorizontalPanel(); |
86 |
// Create the 'OK' button, along with a listener that hides the dialog
|
87 |
// when the button is clicked.
|
88 |
final Button ok = new Button("OK", new ClickHandler() { |
89 |
@Override
|
90 |
public void onClick(@SuppressWarnings("unused") ClickEvent event) { |
91 |
accept(); |
92 |
closeDialog(); |
93 |
} |
94 |
}); |
95 |
buttons.add(ok); |
96 |
buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); |
97 |
// Create the 'Cancel' button, along with a listener that hides the
|
98 |
// dialog when the button is clicked.
|
99 |
final Button cancel = new Button("Cancel", new ClickHandler() { |
100 |
@Override
|
101 |
public void onClick(@SuppressWarnings("unused") ClickEvent event) { |
102 |
closeDialog(); |
103 |
} |
104 |
}); |
105 |
buttons.add(cancel); |
106 |
buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); |
107 |
buttons.setSpacing(8);
|
108 |
buttons.addStyleName("pithos-TabPanelBottom");
|
109 |
outer.add(buttons); |
110 |
outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); |
111 |
outer.addStyleName("pithos-TabPanelBottom");
|
112 |
|
113 |
focusPanel.setFocus(true);
|
114 |
setWidget(outer); |
115 |
} |
116 |
|
117 |
private VerticalPanel createGeneralPanel() {
|
118 |
VerticalPanel generalPanel = new VerticalPanel();
|
119 |
|
120 |
final FlexTable generalTable = new FlexTable(); |
121 |
generalTable.setText(0, 0, String.valueOf(files.size())+" files selected"); |
122 |
generalTable.setText(1, 0, "Folder"); |
123 |
generalTable.setText(2, 0, "Tags"); |
124 |
Folder parent = files.get(0).getParent();
|
125 |
if(parent != null) |
126 |
generalTable.setText(1, 1, parent.getName()); |
127 |
else
|
128 |
generalTable.setText(1, 1, "-"); |
129 |
|
130 |
generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); |
131 |
generalTable.getFlexCellFormatter().setColSpan(0, 0, 2); |
132 |
generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels"); |
133 |
generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels"); |
134 |
generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values"); |
135 |
generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values"); |
136 |
generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values"); |
137 |
generalTable.setCellSpacing(4);
|
138 |
|
139 |
generalPanel.add(generalTable); |
140 |
|
141 |
return generalPanel;
|
142 |
} |
143 |
|
144 |
/**
|
145 |
* Accepts any change and updates the file
|
146 |
*
|
147 |
*/
|
148 |
@Override
|
149 |
protected void accept() { |
150 |
} |
151 |
} |