2 * Copyright 2011 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.DecoratedTabPanel;
\r
46 import com.google.gwt.user.client.ui.DisclosurePanel;
\r
47 import com.google.gwt.user.client.ui.FlexTable;
\r
48 import com.google.gwt.user.client.ui.FlowPanel;
\r
49 import com.google.gwt.user.client.ui.FocusPanel;
\r
50 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
\r
51 import com.google.gwt.user.client.ui.HorizontalPanel;
\r
52 import com.google.gwt.user.client.ui.VerticalPanel;
\r
55 * The 'Multiple file properties' dialog box implementation.
\r
58 public class FilesPropertiesDialog extends AbstractPropertiesDialog {
\r
60 // private final TristateCheckBox versionedCheck;
\r
62 private final List<File> files;
\r
65 * The widget's constructor.
\r
69 public FilesPropertiesDialog(Pithos _app, final List<File> _files) {
\r
74 // Set the dialog's caption.
\r
75 setText("Files properties");
\r
77 // Outer contains inner and buttons.
\r
78 final VerticalPanel outer = new VerticalPanel();
\r
79 final FocusPanel focusPanel = new FocusPanel(outer);
\r
80 // Inner contains generalPanel and permPanel.
\r
81 inner = new DecoratedTabPanel();
\r
82 inner.setAnimationEnabled(true);
\r
84 inner.add(createGeneralPanel(), "General");
\r
89 final HorizontalPanel buttons = new HorizontalPanel();
\r
90 // Create the 'OK' button, along with a listener that hides the dialog
\r
91 // when the button is clicked.
\r
92 final Button ok = new Button("OK", new ClickHandler() {
\r
94 public void onClick(@SuppressWarnings("unused") ClickEvent event) {
\r
100 buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
\r
101 // Create the 'Cancel' button, along with a listener that hides the
\r
102 // dialog when the button is clicked.
\r
103 final Button cancel = new Button("Cancel", new ClickHandler() {
\r
105 public void onClick(@SuppressWarnings("unused") ClickEvent event) {
\r
109 buttons.add(cancel);
\r
110 buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
\r
111 buttons.setSpacing(8);
\r
112 buttons.addStyleName("pithos-TabPanelBottom");
\r
113 outer.add(buttons);
\r
114 outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
\r
115 outer.addStyleName("pithos-TabPanelBottom");
\r
117 focusPanel.setFocus(true);
\r
121 private VerticalPanel createGeneralPanel() {
\r
122 VerticalPanel generalPanel = new VerticalPanel();
\r
124 final FlexTable generalTable = new FlexTable();
\r
125 generalTable.setText(0, 0, String.valueOf(files.size())+" files selected");
\r
126 generalTable.setText(1, 0, "Folder");
\r
127 generalTable.setText(2, 0, "Tags");
\r
128 Folder parent = files.get(0).getParent();
\r
130 generalTable.setText(1, 1, parent.getName());
\r
132 generalTable.setText(1, 1, "-");
\r
134 generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");
\r
135 generalTable.getFlexCellFormatter().setColSpan(0, 0, 2);
\r
136 generalTable.getFlexCellFormatter().setStyleName(1, 0, "props-labels");
\r
137 generalTable.getFlexCellFormatter().setStyleName(2, 0, "props-labels");
\r
138 generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");
\r
139 generalTable.getFlexCellFormatter().setStyleName(1, 1, "props-values");
\r
140 generalTable.getFlexCellFormatter().setStyleName(2, 1, "props-values");
\r
141 generalTable.setCellSpacing(4);
\r
143 generalPanel.add(generalTable);
\r
145 DisclosurePanel allTags = new DisclosurePanel("All tags");
\r
146 allTagsContent = new FlowPanel();
\r
147 allTags.setContent(allTagsContent);
\r
148 generalPanel.add(allTags);
\r
149 generalPanel.setSpacing(4);
\r
151 return generalPanel;
\r
155 * Accepts any change and updates the file
\r
159 protected void accept() {
\r