Francesco Mangiacrapa 2014-07-28 14:21:45 +00:00
parent 11990c8cf7
commit a298411b47
10 changed files with 203 additions and 163 deletions

View File

@ -5,7 +5,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="workspace-tree-widget-6.6.6-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/WorkspaceTree(branch6.6.6)/WorkspaceTree(branch6.6.6)">
<dependent-module archiveName="workspace-tree-widget-6.6.6-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/WorkspaceTree/WorkspaceTree">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="workspace-sharing-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-sharing-widget/workspace-sharing-widget">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace</artifactId>
<packaging>war</packaging>
<version>6.6.6-SNAPSHOT</version>
<version>6.6.7-SNAPSHOT</version>
<name>gCube Workspace Portlet</name>
<description>
gcube Workspace Portlet is a portlet for users workspace management
@ -56,6 +56,13 @@
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.2.1.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>

View File

@ -40,7 +40,8 @@ public class WorkspacePortlet implements EntryPoint {
});
updateSize();
showGuidedTour();
// showGuidedTour();
}

View File

@ -50,6 +50,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
private void initLayout(){
north.setId("NorthPanel");
// north.setStyleAttribute("background-color", "#d0def0");
north.setLayout(new FitLayout());
west.setId("WestPanel");
west.setLayout(new FitLayout());
@ -83,8 +85,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
// center.add(this.gridFilter);
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 55, 55, 70);
northData.setCollapsible(true);
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 70, 70, 70);
northData.setCollapsible(true);
northData.setSplit(true); //Split bar between regions
// northData.setFloatable(true);
@ -112,6 +114,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
southData.setMargins(new Margins(1, 0, 0, 0));
north.add(this.searchAndFilterContainer);
north.setScrollMode(Scroll.AUTOY);
west.add(this.expPanel);

View File

@ -66,19 +66,21 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
setLayout(new FitLayout());
setBorders(true);
setId("SearchAndFilter");
this.setId("SearchAndFilter");
this.setBorders(false);
// this.setStyleAttribute("background-color", "#d0def0");
this.comboBoxGxt = new GxtComboBox();
this.cbViewScope = this.comboBoxGxt.getComboViewScope();
this.cbNameFilter = this.comboBoxGxt.getComboStringFilter();
this.textSearch.setId("TextSearch");
// this.textSearch.setStyleAttribute("margin-bottom", "0px");
this.cbViewScope.setWidth(360);
// this.cbViewScope.setAutoWidth(true);
this.toolbarPahtPanel = toolBarPathPanel;
verticalPanel.add(this.toolbarPahtPanel.getToolBarPathPanel());
hp.setStyleAttribute("padding", "2px");
hp.setStyleAttribute("margin-left", "2px");
seVisibleButtonsCancelSave(false);
@ -104,13 +106,17 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
// hp.add(bCancel);
hp.add(bSave);
hp.setHeight(20);
hpMain.setHeight(20);
bSearch.setWidth("70px");
bSave.setWidth("70px");
hp2.setHorizontalAlign(HorizontalAlignment.RIGHT);
hp2.setVerticalAlign(VerticalAlignment.MIDDLE);
//hp2.add(txtViewScope);
hp2.add(cbViewScope);
// hp2.add(cbViewScope);
cbViewScope.setStyleAttribute("margin-left", "132px");
cbViewScope.setStyleAttribute("margin-top", "2px");
@ -120,9 +126,11 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
//SOLUTION FOR SCOPE INVISIBLE
cbViewScope.setVisible(false);
hpMain.add(hp2);
// hpMain.add(hp2);
// verticalPanel.setLayout(new FitLayout());
verticalPanel.add(hpMain);
// verticalPanel.setStyleAttribute("background-color", "#d0def0");
this.addListeners();

View File

@ -0,0 +1,118 @@
/**
*
*/
package org.gcube.portlets.user.workspace.client.view.toolbars;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppController;
import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jul 28, 2014
*
*/
public class Breadcrumbs extends Composite {
/**
*
*/
public static final String DIVIDER = ">";
private String rootName;
private LinkedHashMap<String, FileModel> hashFileModel = new LinkedHashMap<String, FileModel>();// Ordered-HashMap
private FileModel lastParent;
private static BreadcrumbsUiBinder uiBinder = GWT.create(BreadcrumbsUiBinder.class);
@UiField
com.github.gwtbootstrap.client.ui.Breadcrumbs breadcrumbs;
interface BreadcrumbsUiBinder extends UiBinder<Widget, Breadcrumbs> {
}
public Breadcrumbs(String rootName) {
this.rootName = rootName;
initWidget(uiBinder.createAndBindUi(this));
breadcrumbs.setDivider(DIVIDER);
// initBreadcrumb(true);
this.addStyleName("Breadcrumbs-Personal");
}
public void setPath(List<FileModel> parents) {
resetBreadcrumbs();
if (parents != null && parents.size() > 0) {
hashFileModel = new LinkedHashMap<String, FileModel>();
for (FileModel parent : parents) {
addNavigationLink(parent);
hashFileModel.put(parent.getIdentifier(), parent);
}
lastParent = parents.get(parents.size() - 1);
}
}
/**
*
*/
private void initBreadcrumb(boolean addFakeRootName) {
resetBreadcrumbs();
if (addFakeRootName) {
NavLink navLink = new NavLink(rootName);
breadcrumbs.add(navLink);
}
}
private void resetBreadcrumbs() {
breadcrumbs.clear();
}
// @UiHandler("add")
public void addNavigationLink(FileModel parent) {
final NavLink navLink = new NavLink(parent.getName());
navLink.setName(parent.getIdentifier());
breadcrumbs.add(navLink);
navLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
FileModel target = hashFileModel.get(navLink.getName());
AppController.getEventBus().fireEvent(
new PathElementSelectedEvent(target));
}
});
}
public boolean breadcrumbIsEmpty() {
if (hashFileModel.size() == 0)
return true;
return false;
}
public FileModel getLastParent() {
return lastParent;
}
}

View File

@ -0,0 +1,18 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.pretty {
background-color: #d0def0;
}
</ui:style>
<!-- <g:FlowPanel styleName="{style.pretty}"> -->
<g:FlowPanel>
<b:FluidRow>
<b:Breadcrumbs ui:field="breadcrumbs">
</b:Breadcrumbs>
</b:FluidRow>
</g:FlowPanel>
</ui:UiBinder>

View File

@ -1,23 +1,10 @@
package org.gcube.portlets.user.workspace.client.view.toolbars;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppController;
import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.WidgetComponent;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Composite;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
@ -26,161 +13,33 @@ import com.google.gwt.user.client.ui.Image;
public class GxtBreadcrumbPathPanel {
private static final String ROOT_NAME = "Workspace";
private HorizontalPanel hpToolBar = new HorizontalPanel();
private Text txtPath = new Text("PATH ");
private LinkedHashMap<String, FileModel> hashFileModel = new LinkedHashMap<String, FileModel>();// Ordered-HashMap
boolean rootAdded = false;
protected WidgetComponent hardDiskIcon = new WidgetComponent(new Image (Resources.getImageHardDisk()));
private FileModel lastParent;
private Breadcrumbs breadCrumbs = new Breadcrumbs(ROOT_NAME);
public GxtBreadcrumbPathPanel() {
hpToolBar = new HorizontalPanel();
// hpToolBar.setScrollMode(Scroll.AUTOX);
hpToolBar.setId("myToolbarPath");
hpToolBar.setHeight("25px");
initToolbar();
}
/*
* private void createScrollers() { int h = hpToolBar.getHeight(); El
* scrollLeft =
* hpToolBar.el().insertFirst("<div class='x-tab-scroller-left'></div>");
* addStyleOnOver(scrollLeft.dom, "x-tab-scroller-left-over");
* scrollLeft.setHeight(h);
*
* El scrollRight =
* hpToolBar.el().insertFirst("<div class='x-tab-scroller-right'></div>");
* addStyleOnOver(scrollRight.dom, "x-tab-scroller-right-over");
* scrollRight.setHeight(h);
*
* }
*
* public El fly(Element elem) { return El.fly(elem, "component"); }
*
* private Map<String, String> overElements;
*
*
* protected void addStyleOnOver(Element elem, String style) { if
* (overElements == null) { overElements = new FastMap<String>(); }
* overElements.put(fly(elem).getId(), style); }
*/
public HorizontalPanel getToolBarPathPanel() {
return hpToolBar;
public Composite getToolBarPathPanel() {
return breadCrumbs;
}
public void setPath(List<FileModel> parents) {
initToolbarWithoutFakeRoot();
// refreshSize();
if (parents != null && parents.size() > 0) {
ArrayList<Button> listButtons = new ArrayList<Button>();
hashFileModel = new LinkedHashMap<String, FileModel>();
// arrayFileModel = new ArrayList<FileModel>();
for (FileModel parent : parents) {
Button butt = new Button(parent.getName());
butt.setId(parent.getIdentifier());
butt.setStyleAttribute("top", "-4px");
butt.setStyleName("button-hyperlink");
// butt.setHeight(12);
hashFileModel.put(parent.getIdentifier(), parent);
// arrayFileModel.set(parent.getIdentifier(),parent);
butt.addListener(Events.OnClick, new Listener<ButtonEvent>() {
@Override
public void handleEvent(ButtonEvent be) {
// Window.alert("Name " + be.getButton().getText() +
// " ID: "+ be.getButton().getId());
FileModel target = hashFileModel.get(be.getButton().getId());
AppController.getEventBus().fireEvent(new PathElementSelectedEvent(target));
}
});
listButtons.add(butt);
}
int size = listButtons.size();
for (int i = 0; i < size - 1; i++) {
hpToolBar.add(listButtons.get(i));
hpToolBar.add(new WidgetComponent(new Image(Resources.getImagePathSeparator())));
// toolBar.getWidth();
}
lastParent = parents.get(parents.size()-1);
hpToolBar.add(listButtons.get(size - 1)); // Add last element
hpToolBar.layout(true);
// int currentWidth = hpToolBar.el().getChild(0).getRegion().right;
// int maxWidth = hpToolBar.getWidth();
// GWT.log("toolBar maxWidth width is: "+maxWidth);
// GWT.log("toolBar currentWidth is: "+currentWidth);
}
breadCrumbs.setPath(parents);
}
public boolean breadcrumbIsEmpty(){
if(hashFileModel.size() == 0)
return true;
return false;
return breadCrumbs.breadcrumbIsEmpty();
}
public FileModel getLastParent(){
return lastParent;
}
private void initToolbar() {
hpToolBar.removeAll();
hpToolBar.setStyleName("myToolbar");
hpToolBar.setStyleAttribute("padding-top", "5px");
txtPath.setStyleAttribute("padding-right", "10px");
hpToolBar.add(new WidgetComponent(new Image(Resources.getImagePathSeparator())));
hpToolBar.layout(true);
Button butt = new Button(ROOT_NAME);
butt.setId("");
butt.setStyleAttribute("top", "-4px");
butt.setStyleName("button-hyperlink");
hpToolBar.add(butt);
}
private void initToolbarWithoutFakeRoot() {
hpToolBar.removeAll();
hpToolBar.setStyleName("myToolbar");
hpToolBar.setStyleAttribute("padding-top", "5px");
txtPath.setStyleAttribute("padding-right", "10px");
hpToolBar.add(new WidgetComponent(new Image(Resources.getImagePathSeparator())));
hpToolBar.layout(true);
return breadCrumbs.getLastParent();
}
/**
*
*/
public void refreshSize() {
GWT.log("Refreshed size");
// TODO Auto-generated method stub
}
}

View File

@ -5,7 +5,10 @@
<!-- inherits GCUBE Quick tour -->
<inherits name='org.gcube.portlets.widgets.guidedtour.GuidedTour' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Moduel GXT -->
<inherits name='com.extjs.gxt.ui.GXT' />

View File

@ -10,7 +10,7 @@
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) );
color-stop(1, #d0def0));
/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(top, #DFEAF8 0%, #d0def0 100%);
/* W3C Markup, IE10 Release Preview */
@ -296,4 +296,24 @@
.myWebDavStyle {
font-family: Arial, "Times New Roman", Times;
font-size: 12px;
}
.Breadcrumbs-Personal .breadcrumb {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0) !important;
font-size: 13px;
padding: 5px 5px !important;
margin: 2px !important;
}
.Breadcrumbs-Personal .breadcrumb li {
text-shadow: none !important;
}
.Breadcrumbs-Personal .breadcrumb .divider {
/* color: blue !important; */
color: #AABBCC;
}
.Breadcrumbs-Personal .breadcrumb a {
color: #226599;
}