Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@87239 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-20 11:03:55 +00:00
parent 7726ff52fb
commit 784c626884
1 changed files with 181 additions and 91 deletions

View File

@ -36,35 +36,33 @@ public class FormulasToolBar {
protected TextButton aggregateButton; protected TextButton aggregateButton;
// Column // Column
protected TextButton modifyLabelButton; protected TextButton changeColumnLabelButton;
protected TextButton modifyColumnTypeButton; protected TextButton removeColumnButton;
protected TextButton modifyColumnValuesButton; protected TextButton changeColumnTypeButton;
protected TextButton filterColumnButton;
protected TextButton modifyColumnValuesOnConditionButton;
protected TextButton addAnnotationColumnButton;
protected TextButton validateColumnDuplicateButton;
// History // History
protected TextButton historyButton; protected TextButton historyButton;
protected TextButton discardButton; protected TextButton discardButton;
protected TextButton discardAllButton; protected TextButton discardAllButton;
public FormulasToolBar(EventBus eventBus) public FormulasToolBar(EventBus eventBus) {
{
this.eventBus = eventBus; this.eventBus = eventBus;
build(); build();
} }
public ToolBar getToolBar() public ToolBar getToolBar() {
{
return toolBar; return toolBar;
} }
protected void build() protected void build() {
{
toolBar = new ToolBar(); toolBar = new ToolBar();
toolBar.setSpacing(1); toolBar.setSpacing(1);
toolBar.setEnableOverflow(false); toolBar.setEnableOverflow(false);
// Table Group // Table Group
ButtonGroup tableGroup = new ButtonGroup(); ButtonGroup tableGroup = new ButtonGroup();
tableGroup.setId("Table"); tableGroup.setId("Table");
@ -76,23 +74,25 @@ public class FormulasToolBar {
FlexTable tableLayout = new FlexTable(); FlexTable tableLayout = new FlexTable();
tableGroup.add(tableLayout); tableGroup.add(tableLayout);
filterButton = new TextButton("Filter", TabularDataResources.INSTANCE.filter32()); filterButton = new TextButton("Filter",
TabularDataResources.INSTANCE.filter32());
filterButton.setScale(ButtonScale.LARGE); filterButton.setScale(ButtonScale.LARGE);
filterButton.setIconAlign(IconAlign.TOP); filterButton.setIconAlign(IconAlign.TOP);
filterButton.setToolTip("Filter table data"); filterButton.setToolTip("Filter table data");
filterButton.setArrowAlign(ButtonArrowAlign.BOTTOM); filterButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
filterButton.addSelectHandler(new SelectHandler() { filterButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
tableLayout.setWidget(0, 0, filterButton); tableLayout.setWidget(0, 0, filterButton);
tableLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); tableLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
unionButton = new TextButton("Union", TabularDataResources.INSTANCE.union32()); unionButton = new TextButton("Union",
TabularDataResources.INSTANCE.union32());
unionButton.setScale(ButtonScale.LARGE); unionButton.setScale(ButtonScale.LARGE);
unionButton.setIconAlign(IconAlign.TOP); unionButton.setIconAlign(IconAlign.TOP);
unionButton.setToolTip("Merge tables data"); unionButton.setToolTip("Merge tables data");
@ -100,15 +100,16 @@ public class FormulasToolBar {
unionButton.addSelectHandler(new SelectHandler() { unionButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
tableLayout.setWidget(0, 1, unionButton); tableLayout.setWidget(0, 1, unionButton);
tableLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); tableLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
denormalizeButton = new TextButton("Denormalize",
denormalizeButton = new TextButton("Denormalize", TabularDataResources.INSTANCE.denormalize32()); TabularDataResources.INSTANCE.denormalize32());
denormalizeButton.setScale(ButtonScale.LARGE); denormalizeButton.setScale(ButtonScale.LARGE);
denormalizeButton.setIconAlign(IconAlign.TOP); denormalizeButton.setIconAlign(IconAlign.TOP);
denormalizeButton.setToolTip("Denormalize table"); denormalizeButton.setToolTip("Denormalize table");
@ -116,16 +117,16 @@ public class FormulasToolBar {
denormalizeButton.addSelectHandler(new SelectHandler() { denormalizeButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
tableLayout.setWidget(0, 2, denormalizeButton); tableLayout.setWidget(0, 2, denormalizeButton);
tableLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); tableLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
aggregateButton = new TextButton("Aggregate",
TabularDataResources.INSTANCE.aggregate32());
aggregateButton = new TextButton("Aggregate", TabularDataResources.INSTANCE.aggregate32());
aggregateButton.setScale(ButtonScale.LARGE); aggregateButton.setScale(ButtonScale.LARGE);
aggregateButton.setIconAlign(IconAlign.TOP); aggregateButton.setIconAlign(IconAlign.TOP);
aggregateButton.setToolTip("Perform data aggregation"); aggregateButton.setToolTip("Perform data aggregation");
@ -133,7 +134,8 @@ public class FormulasToolBar {
aggregateButton.addSelectHandler(new SelectHandler() { aggregateButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
@ -141,7 +143,6 @@ public class FormulasToolBar {
tableLayout.getFlexCellFormatter().setRowSpan(0, 3, 2); tableLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
cleanCells(tableLayout.getElement()); cleanCells(tableLayout.getElement());
// Column Group // Column Group
ButtonGroup columnGroup = new ButtonGroup(); ButtonGroup columnGroup = new ButtonGroup();
columnGroup.setId("Column"); columnGroup.setId("Column");
@ -153,54 +154,142 @@ public class FormulasToolBar {
FlexTable columnLayout = new FlexTable(); FlexTable columnLayout = new FlexTable();
columnGroup.add(columnLayout); columnGroup.add(columnLayout);
modifyLabelButton = new TextButton("Labels", TabularDataResources.INSTANCE.columnLabel32()); changeColumnLabelButton = new TextButton("Labels",
modifyLabelButton.setScale(ButtonScale.LARGE); TabularDataResources.INSTANCE.columnLabel32());
modifyLabelButton.setIconAlign(IconAlign.TOP); changeColumnLabelButton.setScale(ButtonScale.LARGE);
modifyLabelButton.setToolTip("Change column labels"); changeColumnLabelButton.setIconAlign(IconAlign.TOP);
modifyLabelButton.setArrowAlign(ButtonArrowAlign.BOTTOM); changeColumnLabelButton.setToolTip("Change column labels");
modifyLabelButton.addSelectHandler(new SelectHandler() { changeColumnLabelButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
changeColumnLabelButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
columnLayout.setWidget(0, 0, modifyLabelButton); columnLayout.setWidget(0, 0, changeColumnLabelButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); columnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
removeColumnButton = new TextButton("Remove",
modifyColumnTypeButton = new TextButton("Type", TabularDataResources.INSTANCE.columnType32()); TabularDataResources.INSTANCE.columnDelete32());
modifyColumnTypeButton.setScale(ButtonScale.LARGE); removeColumnButton.setScale(ButtonScale.LARGE);
modifyColumnTypeButton.setIconAlign(IconAlign.TOP); removeColumnButton.setIconAlign(IconAlign.TOP);
modifyColumnTypeButton.setToolTip("Change the column type"); removeColumnButton.setToolTip("Change column type");
modifyColumnTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM); removeColumnButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
modifyColumnTypeButton.addSelectHandler(new SelectHandler() { removeColumnButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
columnLayout.setWidget(0, 1, modifyColumnTypeButton); columnLayout.setWidget(0, 1, removeColumnButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); columnLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
modifyColumnValuesButton = new TextButton("Values", TabularDataResources.INSTANCE.columnValues32()); changeColumnTypeButton = new TextButton("Type",
modifyColumnValuesButton.setScale(ButtonScale.LARGE); TabularDataResources.INSTANCE.columnType32());
modifyColumnValuesButton.setIconAlign(IconAlign.TOP); changeColumnTypeButton.setScale(ButtonScale.LARGE);
modifyColumnValuesButton.setToolTip("Modify column values according to an expression"); changeColumnTypeButton.setIconAlign(IconAlign.TOP);
modifyColumnValuesButton.setArrowAlign(ButtonArrowAlign.BOTTOM); changeColumnTypeButton.setToolTip("Change column type");
modifyColumnValuesButton.addSelectHandler(new SelectHandler() { changeColumnTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
changeColumnTypeButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
columnLayout.setWidget(0, 2, modifyColumnValuesButton); columnLayout.setWidget(0, 1, changeColumnTypeButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 2, 2); columnLayout.getFlexCellFormatter().setRowSpan(0, 2, 2);
cleanCells(columnLayout.getElement());
filterColumnButton = new TextButton("Filter",
TabularDataResources.INSTANCE.columnFilter32());
filterColumnButton.setScale(ButtonScale.LARGE);
filterColumnButton.setIconAlign(IconAlign.TOP);
filterColumnButton
.setToolTip("Filter column values according to an condition");
filterColumnButton
.setArrowAlign(ButtonArrowAlign.BOTTOM);
filterColumnButton
.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
columnLayout.setWidget(0, 3, filterColumnButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
modifyColumnValuesOnConditionButton = new TextButton("Values",
TabularDataResources.INSTANCE.columnValues32());
modifyColumnValuesOnConditionButton.setScale(ButtonScale.LARGE);
modifyColumnValuesOnConditionButton.setIconAlign(IconAlign.TOP);
modifyColumnValuesOnConditionButton
.setToolTip("Modify column values according to an condition");
modifyColumnValuesOnConditionButton
.setArrowAlign(ButtonArrowAlign.BOTTOM);
modifyColumnValuesOnConditionButton
.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
columnLayout.setWidget(0, 4, modifyColumnValuesOnConditionButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 4, 2);
addAnnotationColumnButton = new TextButton("Annotation",
TabularDataResources.INSTANCE.columnAdd32());
addAnnotationColumnButton.setScale(ButtonScale.LARGE);
addAnnotationColumnButton.setIconAlign(IconAlign.TOP);
addAnnotationColumnButton
.setToolTip("Add annotation column");
addAnnotationColumnButton
.setArrowAlign(ButtonArrowAlign.BOTTOM);
addAnnotationColumnButton
.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
columnLayout.setWidget(0, 5, addAnnotationColumnButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 5, 2);
validateColumnDuplicateButton = new TextButton("Duplicate",
TabularDataResources.INSTANCE.validateAdd32());
validateColumnDuplicateButton.setScale(ButtonScale.LARGE);
validateColumnDuplicateButton.setIconAlign(IconAlign.TOP);
validateColumnDuplicateButton
.setToolTip("Validate column duplicate");
validateColumnDuplicateButton
.setArrowAlign(ButtonArrowAlign.BOTTOM);
validateColumnDuplicateButton
.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
columnLayout.setWidget(0, 6, validateColumnDuplicateButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 6, 2);
cleanCells(columnLayout.getElement());
// History Group // History Group
ButtonGroup historyGroup = new ButtonGroup(); ButtonGroup historyGroup = new ButtonGroup();
@ -213,7 +302,8 @@ public class FormulasToolBar {
FlexTable historyLayout = new FlexTable(); FlexTable historyLayout = new FlexTable();
historyGroup.add(historyLayout); historyGroup.add(historyLayout);
historyButton = new TextButton("History", TabularDataResources.INSTANCE.history32()); historyButton = new TextButton("History",
TabularDataResources.INSTANCE.history32());
historyButton.setScale(ButtonScale.LARGE); historyButton.setScale(ButtonScale.LARGE);
historyButton.setIconAlign(IconAlign.TOP); historyButton.setIconAlign(IconAlign.TOP);
historyButton.setToolTip("Show history"); historyButton.setToolTip("Show history");
@ -221,40 +311,40 @@ public class FormulasToolBar {
historyButton.addSelectHandler(new SelectHandler() { historyButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
historyLayout.setWidget(0, 0, historyButton); historyLayout.setWidget(0, 0, historyButton);
historyLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); historyLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
discardButton = new TextButton("Discard",
discardButton = new TextButton("Discard", TabularDataResources.INSTANCE.discard()); TabularDataResources.INSTANCE.discard());
discardButton.setToolTip("Discard the last operation"); discardButton.setToolTip("Discard the last operation");
historyLayout.setWidget(0, 1, discardButton); historyLayout.setWidget(0, 1, discardButton);
discardButton.addSelectHandler(new SelectHandler() { discardButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.CSV)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.CSV));
} }
}); });
discardAllButton = new TextButton("Discard All", TabularDataResources.INSTANCE.discardAll()); discardAllButton = new TextButton("Discard All",
TabularDataResources.INSTANCE.discardAll());
discardAllButton.setToolTip("Discard all unsaved operations"); discardAllButton.setToolTip("Discard all unsaved operations");
historyLayout.setWidget(1, 1, discardAllButton); historyLayout.setWidget(1, 1, discardAllButton);
discardAllButton.addSelectHandler(new SelectHandler() { discardAllButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON)); // eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
} }
}); });
cleanCells(historyLayout.getElement()); cleanCells(historyLayout.getElement());
} }
protected void cleanCells(Element elem) { protected void cleanCells(Element elem) {