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
This commit is contained in:
Giancarlo Panichi 2015-03-24 13:08:08 +00:00 committed by Giancarlo Panichi
parent 775b48de5f
commit 5f1ab3b209
2 changed files with 113 additions and 32 deletions

View File

@ -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.history.HistoryPanel;
import org.gcube.portlets.user.td.tablewidget.client.normalize.DenormalizePanel; 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.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.ValidationsTablePanel;
import org.gcube.portlets.user.td.tablewidget.client.validation.ValidationsTasksPanel; 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.toolboxwidget.client.help.HelpPanel;
@ -58,7 +59,8 @@ public class ToolBox extends TabPanel {
private ChangeTableTypePanel changeTableTypePanel; private ChangeTableTypePanel changeTableTypePanel;
private ValidationsTablePanel validationsTablePanel; private ValidationsTablePanel validationsTablePanel;
private ValidationsTasksPanel validationsTasksPanel; private ValidationsTasksPanel validationsTasksPanel;
private DuplicatesRowsPanel duplicatesRowsPanel; private DuplicatesRowsDetectionPanel duplicatesRowsDetectionPanel;
private DuplicatesRowsDeletePanel duplicatesRowsDeletePanel;
private HistoryPanel historyPanel; private HistoryPanel historyPanel;
private SplitColumnPanel splitColumnPanel; private SplitColumnPanel splitColumnPanel;
private MergeColumnPanel mergeColumnPanel; private MergeColumnPanel mergeColumnPanel;
@ -280,16 +282,29 @@ public class ToolBox extends TabPanel {
} }
public void openDuplicatesRowsTab(TRId trId) { public void openDuplicatesRowsDetectionTab(TRId trId) {
Log.debug("Open Duplicates Rows Tab"); Log.debug("Open Duplicates Rows Detection Tab");
if (duplicatesRowsPanel == null) { if (duplicatesRowsDetectionPanel == null) {
addDuplicatesRowsPanel(trId); addDuplicatesRowsDetectionPanel(trId);
} else { } 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) { public void openResourcesTab(TRId trId) {
Log.debug("Open Resources Tab"); Log.debug("Open Resources Tab");
@ -466,13 +481,22 @@ public class ToolBox extends TabPanel {
} }
} }
public void closeDuplicatesRowsPanel() { public void closeDuplicatesRowsDetectionPanel() {
Log.debug("Close DuplicatesRowsPanel Tab"); Log.debug("Close DuplicatesRowsDetectionPanel Tab");
if (duplicatesRowsPanel != null) { if (duplicatesRowsDetectionPanel != null) {
remove(duplicatesRowsPanel); remove(duplicatesRowsDetectionPanel);
duplicatesRowsPanel = null; duplicatesRowsDetectionPanel = null;
} }
} }
public void closeDuplicatesRowsDeletePanel() {
Log.debug("Close DuplicatesRowsDeletePanel Tab");
if (duplicatesRowsDeletePanel != null) {
remove(duplicatesRowsDeletePanel);
duplicatesRowsDeletePanel = null;
}
}
public void closeNormalizePanel() { public void closeNormalizePanel() {
Log.debug("Close NormalizePanel Tab"); Log.debug("Close NormalizePanel Tab");
@ -606,9 +630,14 @@ public class ToolBox extends TabPanel {
changeTableTypePanel = null; changeTableTypePanel = null;
} }
if (duplicatesRowsPanel != null) { if (duplicatesRowsDetectionPanel != null) {
remove(duplicatesRowsPanel); remove(duplicatesRowsDetectionPanel);
duplicatesRowsPanel = null; duplicatesRowsDetectionPanel = null;
}
if (duplicatesRowsDeletePanel != null) {
remove(duplicatesRowsDeletePanel);
duplicatesRowsDeletePanel = null;
} }
if (normalizePanel != null) { if (normalizePanel != null) {
@ -1067,19 +1096,19 @@ public class ToolBox extends TabPanel {
} }
protected void addDuplicatesRowsPanel(TRId trId) { protected void addDuplicatesRowsDetectionPanel(TRId trId) {
TabItemConfig duplicatesRowsDeleteItemConf = new TabItemConfig( TabItemConfig duplicatesRowsDetectionItemConf = new TabItemConfig(
"Duplicate", true); "Duplicate Detection", true);
duplicatesRowsPanel = new DuplicatesRowsPanel(trId, eventBus); duplicatesRowsDetectionPanel = new DuplicatesRowsDetectionPanel(trId, eventBus);
add(duplicatesRowsPanel, duplicatesRowsDeleteItemConf); add(duplicatesRowsDetectionPanel, duplicatesRowsDetectionItemConf);
addBeforeCloseHandler(new BeforeCloseHandler<Widget>() { addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) { public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (duplicatesRowsPanel == event.getItem()) { if (duplicatesRowsDetectionPanel == event.getItem()) {
remove(duplicatesRowsPanel); remove(duplicatesRowsDetectionPanel);
duplicatesRowsPanel = null; 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<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (duplicatesRowsDeletePanel == event.getItem()) {
remove(duplicatesRowsDeletePanel);
duplicatesRowsDeletePanel = null;
}
}
});
};
protected void addNormalizePanel(TRId trId) { protected void addNormalizePanel(TRId trId) {
TabItemConfig normalizeItemConf = new TabItemConfig("Normalize", true); TabItemConfig normalizeItemConf = new TabItemConfig("Normalize", true);

View File

@ -151,12 +151,14 @@ public class ToolBoxPanel extends ContentPanel {
case POSITIONCOLUMNPANEL: case POSITIONCOLUMNPANEL:
doPositionColumnTab(event); doPositionColumnTab(event);
break; break;
case CHANGETABLETYPEPANEL: case CHANGETABLETYPEPANEL:
doChangeTableTypeTab(event); doChangeTableTypeTab(event);
break; break;
case DUPLICATESROWSPANEL: case DUPLICATESROWSDETECTIONPANEL:
doDuplicatesRowsTab(event); doDuplicatesRowsDetectionTab(event);
break;
case DUPLICATESROWSDELETEPANEL:
doDuplicatesRowsDeleteTab(event);
break; break;
case VALIDATIONSTASKSPANEL: case VALIDATIONSTASKSPANEL:
doValidationsTasksTab(event); doValidationsTasksTab(event);
@ -420,25 +422,51 @@ public class ToolBoxPanel extends ContentPanel {
} }
} }
protected void doDuplicatesRowsTab(WidgetRequestEvent event) { protected void doDuplicatesRowsDetectionTab(WidgetRequestEvent event) {
Log.debug("WidgetRequestEvent.DuplicateRowsPanel : [" + event.getTrId() Log.debug("WidgetRequestEvent.DuplicateRowsDetectionPanel : [" + event.getTrId()
+ "]"); + "]");
if (uiStateType == UIStateType.TR_OPEN if (uiStateType == UIStateType.TR_OPEN
|| uiStateType == UIStateType.TABLECURATION || uiStateType == UIStateType.TABLECURATION
|| uiStateType == UIStateType.TABLEUPDATE) { || uiStateType == UIStateType.TABLEUPDATE) {
if (state == ToolBoxPanelState.OPENED) { if (state == ToolBoxPanelState.OPENED) {
toolBox.openDuplicatesRowsTab(event.getTrId()); toolBox.openDuplicatesRowsDetectionTab(event.getTrId());
Log.debug("ToolBoxPanelSTate.OPENED Add Tabs"); Log.debug("ToolBoxPanelSTate.OPENED Add Tabs");
} else { } else {
enable(); enable();
expand(); expand();
state = ToolBoxPanelState.OPENED; state = ToolBoxPanelState.OPENED;
toolBox.openDuplicatesRowsTab(event.getTrId()); toolBox.openDuplicatesRowsDetectionTab(event.getTrId());
} }
} else { } else {
Log.debug("ToolBoxPanel No table open"); 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) { protected void doValidationsTableTab(WidgetRequestEvent event) {
Log.debug("WidgetRequestEvent.ValidationsTablePanel : [" Log.debug("WidgetRequestEvent.ValidationsTablePanel : ["
@ -665,7 +693,8 @@ public class ToolBoxPanel extends ContentPanel {
toolBox.closePositionColumnPanel(); toolBox.closePositionColumnPanel();
toolBox.closeLabelColumnPanel(); toolBox.closeLabelColumnPanel();
toolBox.closeChangeTableTypePanel(); toolBox.closeChangeTableTypePanel();
toolBox.closeDuplicatesRowsPanel(); toolBox.closeDuplicatesRowsDetectionPanel();
toolBox.closeDuplicatesRowsDeletePanel();
toolBox.closeValidationsTablePanel(); toolBox.closeValidationsTablePanel();
toolBox.closeValidationsTasksPanel(); toolBox.closeValidationsTasksPanel();
toolBox.closeNormalizePanel(); toolBox.closeNormalizePanel();