From 4974bebfa6eb324bdddebe7739d56f72a934ebcc Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 30 Jan 2014 17:34:27 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@90794 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/client/ribbon/CurationToolBar.java | 181 ++++++++++++++++-- .../user/td/client/ribbon/ModifyToolBar.java | 41 +--- 2 files changed, 171 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/CurationToolBar.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/CurationToolBar.java index 02d3740..ea808c9 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/CurationToolBar.java +++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/CurationToolBar.java @@ -21,9 +21,9 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar; /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ public class CurationToolBar { @@ -35,7 +35,16 @@ public class CurationToolBar { protected TextButton rulesButton; protected TextButton normalizeButton; protected TextButton manageRulesButton; - private TextButton applyTemplateButton; + protected TextButton applyTemplateButton; + + protected TextButton denormalizeButton; + protected TextButton changeColumnLabelButton; + protected TextButton columnTypeButton; + protected TextButton tableTypeButton; + protected TextButton addColumnButton; + protected TextButton deleteColumnButton; + private TextButton extractCodelistButton; + private TextButton generateSummaryButton; public CurationToolBar(EventBus eventBus) { this.eventBus = eventBus; @@ -70,7 +79,6 @@ public class CurationToolBar { rulesButton.setArrowAlign(ButtonArrowAlign.BOTTOM); rulesButton.addSelectHandler(new SelectHandler() { - public void onSelect(SelectEvent event) { // eventBus.fireEvent(new // ImportTableEvent(ImportTableType.JSON));taskButton @@ -79,7 +87,7 @@ public class CurationToolBar { validationLayout.setWidget(0, 1, rulesButton); validationLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); - + manageRulesButton = new TextButton("Manage Rules", TabularDataResources.INSTANCE.wrenchManage32()); manageRulesButton.setScale(ButtonScale.LARGE); @@ -96,13 +104,13 @@ public class CurationToolBar { validationLayout.setWidget(0, 2, manageRulesButton); validationLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); - duplicateDetectionButton = new TextButton("Duplicate Detection", TabularDataResources.INSTANCE.tableDuplicateRows32()); duplicateDetectionButton.setScale(ButtonScale.LARGE); duplicateDetectionButton.setIconAlign(IconAlign.TOP); - duplicateDetectionButton.setToolTip("Detects duplicate lines in the table"); + duplicateDetectionButton + .setToolTip("Detects duplicate lines in the table"); duplicateDetectionButton.setArrowAlign(ButtonArrowAlign.BOTTOM); duplicateDetectionButton.addSelectHandler(new SelectHandler() { @@ -114,7 +122,7 @@ public class CurationToolBar { validationLayout.setWidget(0, 3, duplicateDetectionButton); validationLayout.getFlexCellFormatter().setRowSpan(0, 3, 2); - + applyTemplateButton = new TextButton("Apply Template", TabularDataResources.INSTANCE.template32()); applyTemplateButton.setScale(ButtonScale.LARGE); @@ -145,6 +153,108 @@ public class CurationToolBar { FlexTable structureLayout = new FlexTable(); structureGroup.add(structureLayout); + tableTypeButton = new TextButton("Table Type", + TabularDataResources.INSTANCE.cog32()); + tableTypeButton.setScale(ButtonScale.LARGE); + tableTypeButton.setIconAlign(IconAlign.TOP); + tableTypeButton.setToolTip("Change table type"); + tableTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + tableTypeButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 0, tableTypeButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); + + changeColumnLabelButton = new TextButton("Labels", + TabularDataResources.INSTANCE.columnLabel32()); + changeColumnLabelButton.setScale(ButtonScale.LARGE); + changeColumnLabelButton.setIconAlign(IconAlign.TOP); + changeColumnLabelButton.setToolTip("Change column labels"); + changeColumnLabelButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + changeColumnLabelButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 1, changeColumnLabelButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); + + columnTypeButton = new TextButton("Column Type", + TabularDataResources.INSTANCE.columnLabel32()); + columnTypeButton.setScale(ButtonScale.LARGE); + columnTypeButton.setIconAlign(IconAlign.TOP); + columnTypeButton.setToolTip("Change column type"); + columnTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + columnTypeButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 2, columnTypeButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); + + addColumnButton = new TextButton("Add Column", + TabularDataResources.INSTANCE.columnLabel32()); + addColumnButton.setScale(ButtonScale.LARGE); + addColumnButton.setIconAlign(IconAlign.TOP); + addColumnButton.setToolTip("Add column"); + addColumnButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + addColumnButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 3, addColumnButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 3, 2); + + deleteColumnButton = new TextButton("Delete Column", + TabularDataResources.INSTANCE.columnLabel32()); + deleteColumnButton.setScale(ButtonScale.LARGE); + deleteColumnButton.setIconAlign(IconAlign.TOP); + deleteColumnButton.setToolTip("Delete column"); + deleteColumnButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + deleteColumnButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 4, deleteColumnButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 4, 2); + + denormalizeButton = new TextButton("Denormalize", + TabularDataResources.INSTANCE.denormalize32()); + denormalizeButton.setScale(ButtonScale.LARGE); + denormalizeButton.setIconAlign(IconAlign.TOP); + denormalizeButton.setToolTip("Denormalize table"); + denormalizeButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + denormalizeButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + structureLayout.setWidget(0, 5, denormalizeButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 5, 2); + normalizeButton = new TextButton("Normalize", TabularDataResources.INSTANCE.cog32()); normalizeButton.setScale(ButtonScale.LARGE); @@ -159,13 +269,56 @@ public class CurationToolBar { } }); - structureLayout.setWidget(0, 1, normalizeButton); - structureLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); - - - + structureLayout.setWidget(0, 6, normalizeButton); + structureLayout.getFlexCellFormatter().setRowSpan(0, 6, 2); cleanCells(structureLayout.getElement()); + // Helper + ButtonGroup helperGroup = new ButtonGroup(); + helperGroup.setId("Helper"); + helperGroup.setStyleName("ribbon"); + helperGroup.setHeadingText("Helper"); + helperGroup.disable(); + toolBar.add(helperGroup); + + FlexTable helperLayout = new FlexTable(); + helperGroup.add(helperLayout); + + extractCodelistButton = new TextButton("Extract Codelist", + TabularDataResources.INSTANCE.cog32()); + extractCodelistButton.setScale(ButtonScale.LARGE); + extractCodelistButton.setIconAlign(IconAlign.TOP); + extractCodelistButton.setToolTip("Extract Codelist"); + extractCodelistButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + extractCodelistButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + helperLayout.setWidget(0, 0, extractCodelistButton); + helperLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); + + generateSummaryButton = new TextButton("Generate Summary", + TabularDataResources.INSTANCE.cog32()); + generateSummaryButton.setScale(ButtonScale.LARGE); + generateSummaryButton.setIconAlign(IconAlign.TOP); + generateSummaryButton.setToolTip("Generate Summary"); + generateSummaryButton.setArrowAlign(ButtonArrowAlign.BOTTOM); + generateSummaryButton.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + // eventBus.fireEvent(new + // ImportTableEvent(ImportTableType.JSON)); + } + }); + + helperLayout.setWidget(0, 1, generateSummaryButton); + helperLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); + cleanCells(helperLayout.getElement()); + } protected void cleanCells(Element elem) { diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/ModifyToolBar.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/ModifyToolBar.java index a5b9c04..9d1116d 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/ModifyToolBar.java +++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/ModifyToolBar.java @@ -36,7 +36,6 @@ public class ModifyToolBar { protected TextButton groupbyButton; // Column - protected TextButton changeColumnLabelButton; protected TextButton removeColumnButton; protected TextButton changeColumnTypeButton; protected TextButton filterColumnButton; @@ -105,23 +104,7 @@ public class ModifyToolBar { tableLayout.setWidget(0, 1, unionButton); tableLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); - denormalizeButton = new TextButton("Denormalize", - TabularDataResources.INSTANCE.denormalize32()); - denormalizeButton.setScale(ButtonScale.LARGE); - denormalizeButton.setIconAlign(IconAlign.TOP); - denormalizeButton.setToolTip("Denormalize table"); - denormalizeButton.setArrowAlign(ButtonArrowAlign.BOTTOM); - denormalizeButton.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); - } - }); - - tableLayout.setWidget(0, 2, denormalizeButton); - tableLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); - + groupbyButton = new TextButton("Group By", TabularDataResources.INSTANCE.group32()); groupbyButton.setScale(ButtonScale.LARGE); @@ -136,8 +119,8 @@ public class ModifyToolBar { } }); - tableLayout.setWidget(0, 3, groupbyButton); - tableLayout.getFlexCellFormatter().setRowSpan(0, 3, 2); + tableLayout.setWidget(0, 2, groupbyButton); + tableLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); cleanCells(tableLayout.getElement()); // Column Group @@ -151,23 +134,7 @@ public class ModifyToolBar { FlexTable columnLayout = new FlexTable(); columnGroup.add(columnLayout); - changeColumnLabelButton = new TextButton("Labels", - TabularDataResources.INSTANCE.columnLabel32()); - changeColumnLabelButton.setScale(ButtonScale.LARGE); - changeColumnLabelButton.setIconAlign(IconAlign.TOP); - changeColumnLabelButton.setToolTip("Change column labels"); - changeColumnLabelButton.setArrowAlign(ButtonArrowAlign.BOTTOM); - changeColumnLabelButton.addSelectHandler(new SelectHandler() { - - public void onSelect(SelectEvent event) { - // eventBus.fireEvent(new - // ImportTableEvent(ImportTableType.JSON)); - } - }); - - columnLayout.setWidget(0, 0, changeColumnLabelButton); - columnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); - + removeColumnButton = new TextButton("Remove", TabularDataResources.INSTANCE.columnDelete32()); removeColumnButton.setScale(ButtonScale.LARGE);