2 * Copyright 2011-2012 GRNET S.A. All rights reserved.
\r
4 * Redistribution and use in source and binary forms, with or
\r
5 * without modification, are permitted provided that the following
\r
6 * conditions are met:
\r
8 * 1. Redistributions of source code must retain the above
\r
9 * copyright notice, this list of conditions and the following
\r
12 * 2. Redistributions in binary form must reproduce the above
\r
13 * copyright notice, this list of conditions and the following
\r
14 * disclaimer in the documentation and/or other materials
\r
15 * provided with the distribution.
\r
17 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
\r
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
\r
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
\r
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
\r
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
\r
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
\r
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
28 * POSSIBILITY OF SUCH DAMAGE.
\r
30 * The views and conclusions contained in the software and
\r
31 * documentation are those of the authors and should not be
\r
32 * interpreted as representing official policies, either expressed
\r
33 * or implied, of GRNET S.A.
\r
35 package gr.grnet.pithos.web.client;
\r
37 import gr.grnet.pithos.web.client.foldertree.File;
\r
38 import gr.grnet.pithos.web.client.foldertree.Folder;
\r
40 import java.util.List;
\r
42 import com.google.gwt.event.dom.client.ClickEvent;
\r
43 import com.google.gwt.event.dom.client.ClickHandler;
\r
44 import com.google.gwt.user.client.ui.Button;
\r
45 import com.google.gwt.user.client.ui.FlexTable;
\r
46 import com.google.gwt.user.client.ui.FocusPanel;
\r
47 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
\r
48 import com.google.gwt.user.client.ui.HorizontalPanel;
\r
49 import com.google.gwt.user.client.ui.VerticalPanel;
\r
52 * The 'Multiple file properties' dialog box implementation.
\r
55 public class FilesPropertiesDialog extends AbstractPropertiesDialog {
\r
57 private final List<File> files;
\r
60 * The widget's constructor.
\r
64 public FilesPropertiesDialog(Pithos _app, final List<File> _files) {
\r
69 // Set the dialog's caption.
\r
70 setText("Files properties");
\r
72 // Outer contains inner and buttons.
\r
73 final VerticalPanel outer = new VerticalPanel();
\r
74 final FocusPanel focusPanel = new FocusPanel(outer);
\r
75 // Inner contains generalPanel and permPanel.
\r
76 inner = new VerticalPanel();
\r
78 inner.add(createGeneralPanel());
\r
82 final HorizontalPanel buttons = new HorizontalPanel();
\r
83 // Create the 'OK' button, along with a listener that hides the dialog
\r
84 // when the button is clicked.
\r
85 final Button ok = new Button("OK", new ClickHandler() {
\r
87 public void onClick(ClickEvent event) {
\r
93 buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
\r
94 // Create the 'Cancel' button, along with a listener that hides the
\r
95 // dialog when the button is clicked.
\r
96 final Button cancel = new Button("Cancel", new ClickHandler() {
\r
98 public void onClick(ClickEvent event) {
\r
102 buttons.add(cancel);
\r
103 buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
\r
104 buttons.setSpacing(8);
\r
105 buttons.addStyleName("pithos-TabPanelBottom");
\r
106 outer.add(buttons);
\r
107 outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
\r
108 outer.addStyleName("pithos-TabPanelBottom");
\r
110 focusPanel.setFocus(true);
\r
114 private VerticalPanel createGeneralPanel() {
\r
115 VerticalPanel generalPanel = new VerticalPanel();
\r
117 final FlexTable generalTable = new FlexTable();
\r
118 generalTable.setText(0, 0, String.valueOf(files.size())+" files selected");
\r
119 generalTable.setText(1, 0, "Folder");
\r
120 generalTable.setText(2, 0, "Tags");
\r
121 Folder parent = files.get(0).getParent();
\r
123 generalTable.setText(1, 1, parent.getName());
\r
125 generalTable.setText(1, 1, "-");
\r
127 generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");
\r
128 generalTable.getFlexCellFormatter().setColSpan(0, 0, 2);
\r
129 generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");
\r
130 generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels");
\r
131 generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");
\r
132 generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values");
\r
133 generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values");
\r
134 generalTable.setCellSpacing(4);
\r
136 generalPanel.add(generalTable);
\r
138 return generalPanel;
\r
142 * Accepts any change and updates the file
\r
147 protected boolean accept() {
\r