From aa78385090b8278048f576194b7f2099f9973f8d Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Thu, 13 Apr 2017 11:57:13 +0000 Subject: [PATCH] Fixed collapsible tree panel when workspace is displayed on the phone git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@146855 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../workspace/client/WorkspacePortlet.java | 18 +++++++++++++----- .../client/view/WorkspaceFeaturesView.java | 2 +- .../view/panels/GxtBorderLayoutPanel.java | 18 ++++++++++++++++-- src/main/webapp/newtheme.css | 19 ++++++++++--------- src/main/webapp/workspaceportlet.css | 15 --------------- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java index 7a958be..c693bc9 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java @@ -4,6 +4,7 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.RootPanel; @@ -30,13 +31,22 @@ public class WorkspacePortlet implements EntryPoint { public void onResize(ResizeEvent event) { GWT.log("onWindowResized width: "+event.getWidth()+" height: "+event.getHeight()); updateSize(); + updateTreePanelSize(); } }); updateSize(); - // showGuidedTour(); } + private void updateTreePanelSize() { + int rootWidth = Window.getClientWidth() - 2* RootPanel.get(ConstantsPortlet.WORKSPACEDIV).getAbsoluteLeft(); + if (rootWidth < ConstantsPortlet.HIDE_TREE_PANEL_WHEN_WIDTH_LESS_THAN) { + appController.getMainPanel().collapseTreePanel(); + GWT.log("Collapses tree panel"); + appController.getMainPanel().layout(true); + } + } + /** * Update window size */ @@ -55,12 +65,10 @@ public class WorkspacePortlet implements EntryPoint { GWT.log("New workspace dimension Height: "+rootHeight+" Width: "+rootWidth); appController.getMainPanel().setHeight(rootHeight); appController.getMainPanel().setWidth(rootWidth); - if (rootWidth < ConstantsPortlet.HIDE_TREE_PANEL_WHEN_WIDTH_LESS_THAN) { - appController.getMainPanel().collapseTreePanel(); - GWT.log("Collapses tree panel"); - } + } + // private void showGuidedTour() { // GWT.runAsync(GCUBEGuidedTour.class, new RunAsyncCallback() { // public void onSuccess() { diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java index bfe33f1..87a5771 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java @@ -245,7 +245,7 @@ public class WorkspaceFeaturesView extends Composite { overPlk.setWidget(plk); overPlk.setHeading("Workspace Public Link"); String icon = ""+Resources.getIconPublicLink().getSafeHtml().asString()+""; - overPlk.setText(icon+"Create links to files in your Workspace to download them. You can send the links to anyone by pasting them into Workspace Message, your emails, instant messages, etc."); + overPlk.setText(icon+"Create links to files in your Workspace to download them. You can send the links to anyone by pasting them in your emails, instant messages, etc. Any link always point to the latest version."); overPlk.setHtml(true); overPlk.setPlacement(Placement.BOTTOM); overPlk.setTrigger(Trigger.HOVER); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java index 1813132..90a4bd0 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java @@ -1,6 +1,5 @@ package org.gcube.portlets.user.workspace.client.view.panels; -import org.gcube.portal.clientcontext.client.GCubeClientContext; import org.gcube.portlets.user.workspace.client.ConstantsPortlet; import org.gcube.portlets.user.workspace.client.view.ExplorerPanel; import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBottomToolBarItem; @@ -19,6 +18,8 @@ import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; import com.extjs.gxt.ui.client.widget.layout.FitLayout; import com.google.gwt.user.client.Random; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.RootPanel; /** * The Class GxtBorderLayoutPanel. @@ -115,7 +116,16 @@ public class GxtBorderLayoutPanel extends ContentPanel { // northData.setSplit(true); northData.setMargins(new Margins(0, 0, 1, 0)); - BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 330,330,400); + int treePanelWidth = 330; + + //it makes appear the collapse header for mobiles + int leftBorder = RootPanel.get(ConstantsPortlet.WORKSPACEDIV).getAbsoluteLeft(); + int rootWidth = Window.getClientWidth() - 2* leftBorder; + if (rootWidth < ConstantsPortlet.HIDE_TREE_PANEL_WHEN_WIDTH_LESS_THAN) { + west.setHeaderVisible(true); + } + + BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, treePanelWidth,treePanelWidth,treePanelWidth+70); westData.setSplit(true); westData.setCollapsible(true); westData.setMargins(new Margins(0,1,0,0)); @@ -127,6 +137,8 @@ public class GxtBorderLayoutPanel extends ContentPanel { eastData.setSplit(true); eastData.setCollapsible(true); eastData.setMargins(new Margins(0,0,0,1)); + + BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 30,30,30); southData.setSplit(true); @@ -136,6 +148,7 @@ public class GxtBorderLayoutPanel extends ContentPanel { north.add(this.searchAndFilterContainer); north.setScrollMode(Scroll.AUTOY); west.add(this.expPanel); + north.addListener(Events.Resize, new Listener(){ @@ -186,6 +199,7 @@ public class GxtBorderLayoutPanel extends ContentPanel { expPanel.getSmartFolderPanel().setSizeSmartPanel(expPanel.getWidth()-2, expPanel.getHeight()-29); } }); + add(north, northData); add(west, westData); diff --git a/src/main/webapp/newtheme.css b/src/main/webapp/newtheme.css index 952176a..8fbd705 100644 --- a/src/main/webapp/newtheme.css +++ b/src/main/webapp/newtheme.css @@ -1,5 +1,6 @@ .x-menubar { - background: #FFF url(images/bg-pattern.png) repeat; + background-color: #d0def0; + background-image: none !important; } .x-panel-body-noheader { @@ -19,13 +20,14 @@ } .x-panel-header { - background: #FFF url(images/bg-pattern.png) repeat !important; + background-color: #d0def0; + background-image: none !important; } .x-toolbar .xtb-sep { - background-image: none !important; - background-color: transparent; - margin: -2px; + background-image: none !important; + background-color: transparent; + margin: -2px; } .x-accordion-hd { @@ -37,7 +39,7 @@ font-weight: bold !important; } -.x-status-text-panel { +.x-status-text-panel { border-color: transparent; } @@ -45,11 +47,10 @@ color: #226599; } -.x-btn button { +.x-btn button { color: #226599; } - .ext-el-mask-msg { -webkit-border-radius: 5px; -moz-border-radius: 5px; @@ -62,4 +63,4 @@ .ext-el-mask-msg div { border-color: transparent; background-color: transparent; -} +} \ No newline at end of file diff --git a/src/main/webapp/workspaceportlet.css b/src/main/webapp/workspaceportlet.css index 0dbf195..7c10afd 100644 --- a/src/main/webapp/workspaceportlet.css +++ b/src/main/webapp/workspaceportlet.css @@ -8,21 +8,6 @@ #SearchAndFilter { background-color: #d0def0; - /* Mozilla Firefox */ -/* background-image: -moz-linear-gradient(top, #DFEAF8 0%, #d0def0 100%); */ -/* /* Webkit (Safari/Chrome 10) */ - */ - /* background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #DFEAF8), */ -/* color-stop(1, #d0def0)); */ -/* /* Webkit (Chrome 11+) */ - */ - /* background-image: -webkit-linear-gradient(top, #DFEAF8 0%, #d0def0 100%); */ -/* /* W3C Markup, IE10 Release Preview */ - */ - /* background-image: linear-gradient(to bottom, #DFEAF8 0%, #d0def0 100%); */ -/* /* IE10 Consumer Preview */ - */ - /* background-image: -ms-linear-gradient(top, #DFEAF8 0%, #d0def0 100%); */ } #VerticalPanelSearchAndFilter table {