<inherits name="com.google.gwt.user.theme.standard.Standard"/>
<inherits name="com.google.gwt.http.HTTP"/>
<inherits name="com.google.gwt.json.JSON"/>
+ <inherits name="com.google.gwt.resources.Resources"/>
<entry-point class='gr.grnet.pithos.web.client.Pithos' />
<stylesheet src='pithos.css' />
@Override
public void execute() {
otherSharedTreeView = new OtherSharedTreeView(otherSharedTreeViewModel);
- trees.insert(otherSharedTreeView, 3);
+ trees.insert(otherSharedTreeView, 2);
treeViews.add(otherSharedTreeView);
}
});
--- /dev/null
+/*
+ * Copyright 2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+.disclosurePanel {
+ padding-left: 10px;
+}
--- /dev/null
+/*
+ * Copyright 2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+package gr.grnet.pithos.web.client;
+
+import gr.grnet.pithos.web.client.grouptree.GroupTreeView;
+import gr.grnet.pithos.web.client.grouptree.GroupTreeView.Templates;
+
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.event.logical.shared.OpenEvent;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DisclosurePanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.IsWidget;
+
+public class PithosDisclosurePanel extends Composite {
+
+ public interface Style extends CssResource {
+ String disclosurePanel();
+ }
+
+ public interface Resources extends ClientBundle {
+ @Source("PithosDisclosurePanel.css")
+ Style pithosDisclosurePanelCss();
+
+ @Source("upArrow.png")
+ ImageResource icon();
+
+ @Source("upArrow.png")
+ ImageResource open();
+
+ @Source("downArrow.png")
+ ImageResource closed();
+ }
+
+ DisclosurePanel panel;
+
+ public PithosDisclosurePanel(final Resources resources, final String title, boolean open) {
+ resources.pithosDisclosurePanelCss().ensureInjected();
+ panel = new DisclosurePanel();
+ panel.addStyleName(resources.pithosDisclosurePanelCss().disclosurePanel());
+ panel.setHeader(createHeader(resources, title, open));
+ panel.setOpen(open);
+ panel.setAnimationEnabled(true);
+ panel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
+
+ @Override
+ public void onOpen(OpenEvent<DisclosurePanel> event) {
+ panel.setHeader(createHeader(resources, title, true));
+ }
+ });
+ panel.addCloseHandler(new CloseHandler<DisclosurePanel>() {
+
+ @Override
+ public void onClose(CloseEvent<DisclosurePanel> event) {
+ panel.setHeader(createHeader(resources, title, false));
+ }
+ });
+ initWidget(panel);
+ }
+
+ HTML createHeader(Resources resources, String title, boolean open) {
+ SafeHtmlBuilder sb = new SafeHtmlBuilder();
+ sb.appendHtmlConstant(AbstractImagePrototype.create(resources.icon()).getHTML()).appendHtmlConstant(" ");
+ sb.append(Templates.INSTANCE.nameSpan(title));
+ sb.appendHtmlConstant(AbstractImagePrototype.create(open ? resources.open() : resources.closed()).getHTML());
+ return new HTML(sb.toSafeHtml());
+ }
+
+ public void add(IsWidget widget) {
+ panel.add(widget);
+ }
+}
package gr.grnet.pithos.web.client.foldertree;
import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.PithosDisclosurePanel;
import gr.grnet.pithos.web.client.TreeView;
import com.google.gwt.core.client.GWT;
}
public void openFolder(Folder folder) {
- TreeNode root = ((CellTree) getWidget()).getRootTreeNode();
+ TreeNode root = tree.getRootTreeNode();
openFolder(root, folder);
}
public SafeHtml imageSpan(String name);
}
+ interface Resources extends gr.grnet.pithos.web.client.PithosDisclosurePanel.Resources {
+ @Override
+ @Source("gr/grnet/pithos/resources/home22.png")
+ ImageResource icon();
+ }
+
private FolderTreeViewModel model;
+
+ private CellTree tree;
public FolderTreeView(FolderTreeViewModel viewModel) {
this.model = viewModel;
+
+ PithosDisclosurePanel panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "My Files", true);
+
/*
* Create the tree using the model. We use <code>null</code> as the default
* value of the root node. The default value will be passed to
* CustomTreeModel#getNodeInfo();
*/
CellTree.Resources res = GWT.create(BasicResources.class);
- CellTree tree = new CellTree(model, null, res);
+ tree = new CellTree(model, null, res);
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
- initWidget(tree);
+ panel.add(tree);
+ initWidget(panel);
}
package gr.grnet.pithos.web.client.grouptree;
import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.PithosDisclosurePanel;
import gr.grnet.pithos.web.client.TreeView;
import gr.grnet.pithos.web.client.foldertree.Folder;
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.cellview.client.TreeNode;
import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DisclosurePanel;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Tree;
public class GroupTreeView extends Composite implements TreeView {
}
static Images images = GWT.create(Images.class);
+
+ interface Resources extends gr.grnet.pithos.web.client.PithosDisclosurePanel.Resources {
+ @Override
+ @Source("gr/grnet/pithos/resources/groups22.png")
+ ImageResource icon();
+ }
- static interface Templates extends SafeHtmlTemplates {
+ public static interface Templates extends SafeHtmlTemplates {
public Templates INSTANCE = GWT.create(Templates.class);
@Template("<span>{0}</span>")
public GroupTreeView(GroupTreeViewModel viewModel) {
this.model = viewModel;
+
+ PithosDisclosurePanel panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "Groups", false);
/*
* Create the tree using the model. We use <code>null</code> as the default
* value of the root node. The default value will be passed to
CellTree tree = new CellTree(model, null, res);
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
- initWidget(tree);
+ panel.add(tree);
+
+ initWidget(panel);
}
public void updateGroupNode(Group group) {
package gr.grnet.pithos.web.client.mysharedtree;
import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.PithosDisclosurePanel;
import gr.grnet.pithos.web.client.TreeView;
import gr.grnet.pithos.web.client.foldertree.Folder;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ImageResource;
-import com.google.gwt.resources.client.ClientBundle.Source;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
public SafeHtml nameSpan(String name);
}
+ interface Resources extends gr.grnet.pithos.web.client.PithosDisclosurePanel.Resources {
+ @Override
+ @Source("gr/grnet/pithos/resources/myshared22.png")
+ ImageResource icon();
+ }
+
private MysharedTreeViewModel model;
public MysharedTreeView(MysharedTreeViewModel viewModel) {
this.model = viewModel;
+
+ PithosDisclosurePanel panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "Shared by me", false);
/*
* Create the tree using the model. We use <code>null</code> as the default
* value of the root node. The default value will be passed to
CellTree tree = new CellTree(model, null, res);
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
- initWidget(tree);
+ panel.add(tree);
+ initWidget(panel);
}
package gr.grnet.pithos.web.client.othersharedtree;
import gr.grnet.pithos.web.client.FolderContextMenu;
+import gr.grnet.pithos.web.client.PithosDisclosurePanel;
import gr.grnet.pithos.web.client.TreeView;
import gr.grnet.pithos.web.client.foldertree.Folder;
public SafeHtml nameSpan(String name);
}
+ interface Resources extends gr.grnet.pithos.web.client.PithosDisclosurePanel.Resources {
+ @Override
+ @Source("gr/grnet/pithos/resources/othersshared.png")
+ ImageResource icon();
+ }
+
private OtherSharedTreeViewModel model;
public OtherSharedTreeView(OtherSharedTreeViewModel viewModel) {
this.model = viewModel;
+
+ PithosDisclosurePanel panel = new PithosDisclosurePanel((Resources) GWT.create(Resources.class), "Shared to me", false);
/*
* Create the tree using the model. We use <code>null</code> as the default
* value of the root node. The default value will be passed to
CellTree tree = new CellTree(model, null, res);
tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
- initWidget(tree);
+ panel.add(tree);
+ initWidget(panel);
}