Added GroupBy

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-toolbox-widget@97678 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-24 09:51:41 +00:00 committed by Giancarlo Panichi
parent dfa4761108
commit f0c427e214
2 changed files with 69 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.tablewidget.client.validation.ValidationsTable
import org.gcube.portlets.user.td.tablewidget.client.validation.ValidationsTasksPanel;
import org.gcube.portlets.user.td.toolboxwidget.client.help.HelpPanel;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.tdcolumnoperation.client.GroupByColumnPanel;
import org.gcube.portlets.user.tdcolumnoperation.client.MergeColumnPanel;
import org.gcube.portlets.user.tdcolumnoperation.client.SplitColumnPanel;
@ -44,6 +45,7 @@ public class ToolBox extends TabPanel {
protected HistoryPanel historyPanel;
protected SplitColumnPanel splitColumnPanel;
protected MergeColumnPanel mergeColumnPanel;
protected GroupByColumnPanel groupByPanel;
// protected TdTaskController tdTaskController;
// protected DialogBox tdTaskMainWindow;
@ -151,7 +153,17 @@ public class ToolBox extends TabPanel {
}
public void openGroupByTab(TRId trId, String columnName) {
Log.debug("Open GroupBy Tab");
if (groupByPanel == null) {
addGroupByPanel(trId, columnName);
} else {
groupByPanel.update(trId, columnName);
}
setActiveWidget(mergeColumnPanel);
}
public void openLabelColumnTab(TRId trId, String columnName) {
Log.debug("Open Label Column Tab");
@ -260,6 +272,13 @@ public class ToolBox extends TabPanel {
}
}
public void closeGroupByPanel() {
Log.debug("Close GroupByPanel Tab");
if (groupByPanel != null) {
remove(groupByPanel);
groupByPanel = null;
}
}
public void closeAddColumnPanel() {
@ -352,6 +371,11 @@ public class ToolBox extends TabPanel {
mergeColumnPanel = null;
}
if (groupByPanel != null) {
remove(groupByPanel);
groupByPanel = null;
}
if (addColumnPanel != null) {
remove(addColumnPanel);
@ -536,6 +560,28 @@ public class ToolBox extends TabPanel {
});
};
protected void addGroupByPanel(TRId trId, String columnName) {
TabItemConfig groupByItemConf = new TabItemConfig(
"Group By", true);
groupByPanel = new GroupByColumnPanel(trId, columnName,
eventBus);
add(groupByPanel, groupByItemConf);
addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (groupByPanel == event.getItem()) {
remove(groupByPanel);
groupByPanel = null;
}
}
});
};
protected void addLabelColumnPanel(TRId trId, String columnName) {
TabItemConfig labelColumnItemConf = new TabItemConfig(

View File

@ -141,6 +141,9 @@ public class ToolBoxPanel extends ContentPanel {
case MERGECOLUMNPANEL:
doMergeColumnTab(event);
break;
case GROUPBYPANEL:
doGroupByTab(event);
break;
case LABELCOLUNPANEL:
doLabelColumnTab(event);
break;
@ -275,6 +278,24 @@ public class ToolBoxPanel extends ContentPanel {
}
}
protected void doGroupByTab(WidgetRequestEvent event){
Log.debug("WidgetRequestEvent.GroupByPanel : ["+event.getTrId()+"]");
if (uiStateType == UIStateType.TR_OPEN
|| uiStateType == UIStateType.TABLECURATION
|| uiStateType == UIStateType.TABLEUPDATE) {
if (state == ToolBoxPanelState.OPENED) {
toolBox.openGroupByTab(event.getTrId(), event.getColumnName());
Log.debug("ToolBoxPanelSTate.OPENED Add Tabs");
} else {
enable();
expand();
state = ToolBoxPanelState.OPENED;
toolBox.openGroupByTab(event.getTrId(), event.getColumnName());
}
} else {
Log.debug("ToolBoxPanel No table open");
}
}
protected void doLabelColumnTab(WidgetRequestEvent event){
@ -419,6 +440,7 @@ public class ToolBoxPanel extends ContentPanel {
toolBox.closeDeleteColumnPanel();
toolBox.closeSplitColumnPanel();
toolBox.closeMergeColumnPanel();
toolBox.closeGroupByPanel();
toolBox.closeLabelColumnPanel();
toolBox.closeChangeTableTypePanel();
toolBox.closeDuplicatesRowsPanel();