From 5f1ab3b20976b0a1392654916fd8185ef25b15d7 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 24 Mar 2015 13:08:08 +0000 Subject: [PATCH] Updated Duplicate git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-toolbox-widget@113700 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/td/toolboxwidget/client/ToolBox.java | 100 +++++++++++++----- .../td/toolboxwidget/client/ToolBoxPanel.java | 45 ++++++-- 2 files changed, 113 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBox.java b/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBox.java index 9064a1f..10d6bec 100644 --- a/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBox.java +++ b/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBox.java @@ -15,7 +15,8 @@ import org.gcube.portlets.user.td.tablewidget.client.geospatial.GeospatialCreate import org.gcube.portlets.user.td.tablewidget.client.history.HistoryPanel; import org.gcube.portlets.user.td.tablewidget.client.normalize.DenormalizePanel; import org.gcube.portlets.user.td.tablewidget.client.normalize.NormalizePanel; -import org.gcube.portlets.user.td.tablewidget.client.rows.DuplicatesRowsPanel; +import org.gcube.portlets.user.td.tablewidget.client.rows.DuplicatesRowsDeletePanel; +import org.gcube.portlets.user.td.tablewidget.client.rows.DuplicatesRowsDetectionPanel; import org.gcube.portlets.user.td.tablewidget.client.validation.ValidationsTablePanel; import org.gcube.portlets.user.td.tablewidget.client.validation.ValidationsTasksPanel; import org.gcube.portlets.user.td.toolboxwidget.client.help.HelpPanel; @@ -58,7 +59,8 @@ public class ToolBox extends TabPanel { private ChangeTableTypePanel changeTableTypePanel; private ValidationsTablePanel validationsTablePanel; private ValidationsTasksPanel validationsTasksPanel; - private DuplicatesRowsPanel duplicatesRowsPanel; + private DuplicatesRowsDetectionPanel duplicatesRowsDetectionPanel; + private DuplicatesRowsDeletePanel duplicatesRowsDeletePanel; private HistoryPanel historyPanel; private SplitColumnPanel splitColumnPanel; private MergeColumnPanel mergeColumnPanel; @@ -280,16 +282,29 @@ public class ToolBox extends TabPanel { } - public void openDuplicatesRowsTab(TRId trId) { - Log.debug("Open Duplicates Rows Tab"); - if (duplicatesRowsPanel == null) { - addDuplicatesRowsPanel(trId); + public void openDuplicatesRowsDetectionTab(TRId trId) { + Log.debug("Open Duplicates Rows Detection Tab"); + if (duplicatesRowsDetectionPanel == null) { + addDuplicatesRowsDetectionPanel(trId); } else { - duplicatesRowsPanel.update(trId); + duplicatesRowsDetectionPanel.update(trId); } - setActiveWidget(duplicatesRowsPanel); + setActiveWidget(duplicatesRowsDetectionPanel); } + + public void openDuplicatesRowsDeleteTab(TRId trId) { + Log.debug("Open Duplicates Rows Delete Tab"); + if (duplicatesRowsDeletePanel == null) { + addDuplicatesRowsDeletePanel(trId); + } else { + duplicatesRowsDeletePanel.update(trId); + } + setActiveWidget(duplicatesRowsDeletePanel); + + } + + public void openResourcesTab(TRId trId) { Log.debug("Open Resources Tab"); @@ -466,13 +481,22 @@ public class ToolBox extends TabPanel { } } - public void closeDuplicatesRowsPanel() { - Log.debug("Close DuplicatesRowsPanel Tab"); - if (duplicatesRowsPanel != null) { - remove(duplicatesRowsPanel); - duplicatesRowsPanel = null; + public void closeDuplicatesRowsDetectionPanel() { + Log.debug("Close DuplicatesRowsDetectionPanel Tab"); + if (duplicatesRowsDetectionPanel != null) { + remove(duplicatesRowsDetectionPanel); + duplicatesRowsDetectionPanel = null; } } + + public void closeDuplicatesRowsDeletePanel() { + Log.debug("Close DuplicatesRowsDeletePanel Tab"); + if (duplicatesRowsDeletePanel != null) { + remove(duplicatesRowsDeletePanel); + duplicatesRowsDeletePanel = null; + } + } + public void closeNormalizePanel() { Log.debug("Close NormalizePanel Tab"); @@ -606,9 +630,14 @@ public class ToolBox extends TabPanel { changeTableTypePanel = null; } - if (duplicatesRowsPanel != null) { - remove(duplicatesRowsPanel); - duplicatesRowsPanel = null; + if (duplicatesRowsDetectionPanel != null) { + remove(duplicatesRowsDetectionPanel); + duplicatesRowsDetectionPanel = null; + } + + if (duplicatesRowsDeletePanel != null) { + remove(duplicatesRowsDeletePanel); + duplicatesRowsDeletePanel = null; } if (normalizePanel != null) { @@ -1067,19 +1096,19 @@ public class ToolBox extends TabPanel { } - protected void addDuplicatesRowsPanel(TRId trId) { - TabItemConfig duplicatesRowsDeleteItemConf = new TabItemConfig( - "Duplicate", true); + protected void addDuplicatesRowsDetectionPanel(TRId trId) { + TabItemConfig duplicatesRowsDetectionItemConf = new TabItemConfig( + "Duplicate Detection", true); - duplicatesRowsPanel = new DuplicatesRowsPanel(trId, eventBus); - add(duplicatesRowsPanel, duplicatesRowsDeleteItemConf); + duplicatesRowsDetectionPanel = new DuplicatesRowsDetectionPanel(trId, eventBus); + add(duplicatesRowsDetectionPanel, duplicatesRowsDetectionItemConf); addBeforeCloseHandler(new BeforeCloseHandler() { public void onBeforeClose(BeforeCloseEvent event) { - if (duplicatesRowsPanel == event.getItem()) { - remove(duplicatesRowsPanel); - duplicatesRowsPanel = null; + if (duplicatesRowsDetectionPanel == event.getItem()) { + remove(duplicatesRowsDetectionPanel); + duplicatesRowsDetectionPanel = null; } @@ -1087,6 +1116,29 @@ public class ToolBox extends TabPanel { }); }; + + protected void addDuplicatesRowsDeletePanel(TRId trId) { + TabItemConfig duplicatesRowsDeleteItemConf = new TabItemConfig( + "Delete Duplicate", true); + + duplicatesRowsDeletePanel = new DuplicatesRowsDeletePanel(trId, eventBus); + add(duplicatesRowsDeletePanel, duplicatesRowsDeleteItemConf); + + addBeforeCloseHandler(new BeforeCloseHandler() { + + public void onBeforeClose(BeforeCloseEvent event) { + if (duplicatesRowsDeletePanel == event.getItem()) { + remove(duplicatesRowsDeletePanel); + duplicatesRowsDeletePanel = null; + + } + + } + + }); + }; + + protected void addNormalizePanel(TRId trId) { TabItemConfig normalizeItemConf = new TabItemConfig("Normalize", true); diff --git a/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBoxPanel.java b/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBoxPanel.java index d825d07..74b767c 100644 --- a/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBoxPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/toolboxwidget/client/ToolBoxPanel.java @@ -151,12 +151,14 @@ public class ToolBoxPanel extends ContentPanel { case POSITIONCOLUMNPANEL: doPositionColumnTab(event); break; - case CHANGETABLETYPEPANEL: doChangeTableTypeTab(event); break; - case DUPLICATESROWSPANEL: - doDuplicatesRowsTab(event); + case DUPLICATESROWSDETECTIONPANEL: + doDuplicatesRowsDetectionTab(event); + break; + case DUPLICATESROWSDELETEPANEL: + doDuplicatesRowsDeleteTab(event); break; case VALIDATIONSTASKSPANEL: doValidationsTasksTab(event); @@ -420,25 +422,51 @@ public class ToolBoxPanel extends ContentPanel { } } - protected void doDuplicatesRowsTab(WidgetRequestEvent event) { - Log.debug("WidgetRequestEvent.DuplicateRowsPanel : [" + event.getTrId() + protected void doDuplicatesRowsDetectionTab(WidgetRequestEvent event) { + Log.debug("WidgetRequestEvent.DuplicateRowsDetectionPanel : [" + event.getTrId() + "]"); if (uiStateType == UIStateType.TR_OPEN || uiStateType == UIStateType.TABLECURATION || uiStateType == UIStateType.TABLEUPDATE) { if (state == ToolBoxPanelState.OPENED) { - toolBox.openDuplicatesRowsTab(event.getTrId()); + toolBox.openDuplicatesRowsDetectionTab(event.getTrId()); Log.debug("ToolBoxPanelSTate.OPENED Add Tabs"); } else { enable(); expand(); state = ToolBoxPanelState.OPENED; - toolBox.openDuplicatesRowsTab(event.getTrId()); + toolBox.openDuplicatesRowsDetectionTab(event.getTrId()); } } else { Log.debug("ToolBoxPanel No table open"); } } + + + protected void doDuplicatesRowsDeleteTab(WidgetRequestEvent event) { + Log.debug("WidgetRequestEvent.DuplicateRowsDeletePanel : [" + event.getTrId() + + "]"); + if (uiStateType == UIStateType.TR_OPEN + || uiStateType == UIStateType.TABLECURATION + || uiStateType == UIStateType.TABLEUPDATE) { + if (state == ToolBoxPanelState.OPENED) { + toolBox.openDuplicatesRowsDeleteTab(event.getTrId()); + Log.debug("ToolBoxPanelSTate.OPENED Add Tabs"); + } else { + enable(); + expand(); + state = ToolBoxPanelState.OPENED; + toolBox.openDuplicatesRowsDeleteTab(event.getTrId()); + } + } else { + Log.debug("ToolBoxPanel No table open"); + } + } + + + + + protected void doValidationsTableTab(WidgetRequestEvent event) { Log.debug("WidgetRequestEvent.ValidationsTablePanel : [" @@ -665,7 +693,8 @@ public class ToolBoxPanel extends ContentPanel { toolBox.closePositionColumnPanel(); toolBox.closeLabelColumnPanel(); toolBox.closeChangeTableTypePanel(); - toolBox.closeDuplicatesRowsPanel(); + toolBox.closeDuplicatesRowsDetectionPanel(); + toolBox.closeDuplicatesRowsDeletePanel(); toolBox.closeValidationsTablePanel(); toolBox.closeValidationsTasksPanel(); toolBox.closeNormalizePanel();