Updated Filter

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@113659 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-19 12:07:52 +00:00
parent af5f3ef03a
commit 5a08336675
4 changed files with 189 additions and 86 deletions

View File

@ -1696,7 +1696,7 @@ public class TabularDataController {
Log.debug("Request Open Column Filter Dialog");
if (trId != null) {
ColumnFilterDialog cfDialog = new ColumnFilterDialog(trId,
columnName, eventBus);
columnLocalId, eventBus);
cfDialog.show();
} else {
Log.error("TRId is null");

View File

@ -50,11 +50,6 @@ public class FileToolBar {
private TextButton exportSDMXButton;
private TextButton exportCSVButton;
private TextButton exportJSONButton;
//Template
private TextButton templateNewButton;
private TextButton templateOpenButton;
private TextButton templateDeleteButton;
//Share
private TextButton shareButton;
@ -296,74 +291,6 @@ public class FileToolBar {
exportLayout.setWidget(1, 2, exportJSONButton);
cleanCells(exportLayout.getElement());
// Template
ButtonGroup templateGroup = new ButtonGroup();
templateGroup.setId("Template");
templateGroup.setStyleName("ribbon");
templateGroup.setHeadingText("Template");
//templateGroup.disable();
toolBar.add(templateGroup);
FlexTable templateLayout = new FlexTable();
templateGroup.add(templateLayout);
templateNewButton = new TextButton("New",
TabularDataResources.INSTANCE.templateEdit32());
templateNewButton.enable();
templateNewButton.setToolTip("New");
templateNewButton.setScale(ButtonScale.LARGE);
templateNewButton.setIconAlign(IconAlign.TOP);
templateNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateNewButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_NEW));
}
});
templateLayout.setWidget(0, 0, templateNewButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
templateOpenButton = new TextButton("Open",
TabularDataResources.INSTANCE.templateAdd32());
templateOpenButton.enable();
templateOpenButton.setToolTip("Open");
templateOpenButton.setScale(ButtonScale.LARGE);
templateOpenButton.setIconAlign(IconAlign.TOP);
templateOpenButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateOpenButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_OPEN));
}
});
templateLayout.setWidget(0, 1, templateOpenButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
templateDeleteButton = new TextButton("Delete",
TabularDataResources.INSTANCE.templateDelete32());
templateDeleteButton.enable();
templateDeleteButton.setToolTip("Delete");
templateDeleteButton.setScale(ButtonScale.LARGE);
templateDeleteButton.setIconAlign(IconAlign.TOP);
templateDeleteButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateDeleteButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_DELETE));
}
});
templateLayout.setWidget(0, 2, templateDeleteButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
cleanCells(templateLayout.getElement());
// Share
ButtonGroup shareGroup = new ButtonGroup();
shareGroup.setId("Share");
@ -573,9 +500,6 @@ public class FileToolBar {
exportCSVButton.disable();
exportJSONButton.disable();
exportSDMXButton.disable();
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.disable();
backgroundButton.enable();
historyButton.disable();
@ -595,9 +519,6 @@ public class FileToolBar {
exportCSVButton.disable();
exportJSONButton.disable();
exportSDMXButton.disable();
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.disable();
backgroundButton.enable();
historyButton.disable();
@ -623,9 +544,6 @@ public class FileToolBar {
}
exportCSVButton.enable();
exportJSONButton.enable();
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
timelineButton.enable();
backgroundButton.enable();
historyButton.enable();
@ -644,9 +562,6 @@ public class FileToolBar {
exportCSVButton.disable();
exportJSONButton.disable();
exportSDMXButton.disable();
templateOpenButton.disable();
templateNewButton.disable();
templateDeleteButton.disable();
timelineButton.disable();
backgroundButton.disable();
historyButton.disable();

View File

@ -27,6 +27,7 @@ public class TabularDataRibbon {
private FileToolBar fileToolBar;
private CurationToolBar curationToolBar;
private ModifyToolBar modifyToolBar;
private TemplateToolBar templateToolBar;
private AnalyseToolBar analyseToolBar;
public TabularDataRibbon(EventBus eventBus) {
@ -52,6 +53,11 @@ public class TabularDataRibbon {
con = new VerticalLayoutContainer();
con.add(modifyToolBar.getToolBar(), vldata);
ribbon.add(con, "Modify");
templateToolBar = new TemplateToolBar(eventBus);
con = new VerticalLayoutContainer();
con.add(templateToolBar.getToolBar(), vldata);
ribbon.add(con, "Template");
analyseToolBar = new AnalyseToolBar(eventBus);
con = new VerticalLayoutContainer();

View File

@ -0,0 +1,182 @@
/**
*
*/
package org.gcube.portlets.user.td.client.ribbon;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonArrowAlign;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.widget.core.client.button.ButtonGroup;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateToolBar {
private EventBus eventBus;
private ToolBar toolBar;
//Template
private TextButton templateNewButton;
private TextButton templateOpenButton;
private TextButton templateDeleteButton;
public TemplateToolBar(EventBus eventBus) {
this.eventBus = eventBus;
build();
}
public ToolBar getToolBar() {
return toolBar;
}
protected void build() {
toolBar = new ToolBar();
toolBar.setSpacing(1);
toolBar.setEnableOverflow(false);
// Template
ButtonGroup templateGroup = new ButtonGroup();
templateGroup.setId("Manage");
templateGroup.setStyleName("ribbon");
templateGroup.setHeadingText("Manage");
//templateGroup.disable();
toolBar.add(templateGroup);
FlexTable templateLayout = new FlexTable();
templateGroup.add(templateLayout);
templateNewButton = new TextButton("New",
TabularDataResources.INSTANCE.templateEdit32());
templateNewButton.enable();
templateNewButton.setToolTip("New");
templateNewButton.setScale(ButtonScale.LARGE);
templateNewButton.setIconAlign(IconAlign.TOP);
templateNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateNewButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_NEW));
}
});
templateLayout.setWidget(0, 0, templateNewButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
templateOpenButton = new TextButton("Open",
TabularDataResources.INSTANCE.templateAdd32());
templateOpenButton.enable();
templateOpenButton.setToolTip("Open");
templateOpenButton.setScale(ButtonScale.LARGE);
templateOpenButton.setIconAlign(IconAlign.TOP);
templateOpenButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateOpenButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_OPEN));
}
});
templateLayout.setWidget(0, 1, templateOpenButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
templateDeleteButton = new TextButton("Delete",
TabularDataResources.INSTANCE.templateDelete32());
templateDeleteButton.enable();
templateDeleteButton.setToolTip("Delete");
templateDeleteButton.setScale(ButtonScale.LARGE);
templateDeleteButton.setIconAlign(IconAlign.TOP);
templateDeleteButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
templateDeleteButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(
RibbonType.TEMPLATE_DELETE));
}
});
templateLayout.setWidget(0, 2, templateDeleteButton);
templateLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
cleanCells(templateLayout.getElement());
eventBus.addHandler(UIStateEvent.TYPE,
new UIStateEvent.UIStateHandler() {
public void onUIState(UIStateEvent event) {
setUI(event);
}
});
}
private void cleanCells(Element elem) {
NodeList<Element> tds = elem.<XElement> cast().select("td");
for (int i = 0; i < tds.getLength(); i++) {
Element td = tds.getItem(i);
if (!td.hasChildNodes() && td.getClassName().equals("")) {
td.removeFromParent();
}
}
}
public void setUI(UIStateEvent event) {
UIStateType uiStateType = event.getUIStateType();
try {
switch (uiStateType) {
case START:
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
break;
case TR_CLOSE:
case TR_READONLY:
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
break;
case TR_OPEN:
case TABLEUPDATE:
case TABLECURATION:
templateOpenButton.enable();
templateNewButton.enable();
templateDeleteButton.enable();
break;
case WIZARD_OPEN:
templateOpenButton.disable();
templateNewButton.disable();
templateDeleteButton.disable();
break;
default:
break;
}
} catch (Exception e) {
Log.error("setUI Error : " + e.getLocalizedMessage());
}
}
}