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

@ -21,51 +21,49 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*
*/
public class FormulasToolBar {
protected EventBus eventBus;
protected ToolBar toolBar;
//Table
// Table
protected TextButton filterButton;
protected TextButton unionButton;
protected TextButton denormalizeButton;
protected TextButton groupButton;
protected TextButton aggregateButton;
//Column
protected TextButton modifyLabelButton;
protected TextButton modifyColumnTypeButton;
protected TextButton modifyColumnValuesButton;
//History
// Column
protected TextButton changeColumnLabelButton;
protected TextButton removeColumnButton;
protected TextButton changeColumnTypeButton;
protected TextButton filterColumnButton;
protected TextButton modifyColumnValuesOnConditionButton;
protected TextButton addAnnotationColumnButton;
protected TextButton validateColumnDuplicateButton;
// History
protected TextButton historyButton;
protected TextButton discardButton;
protected TextButton discardAllButton;
public FormulasToolBar(EventBus eventBus)
{
public FormulasToolBar(EventBus eventBus) {
this.eventBus = eventBus;
build();
}
public ToolBar getToolBar()
{
public ToolBar getToolBar() {
return toolBar;
}
protected void build()
{
protected void build() {
toolBar = new ToolBar();
toolBar.setSpacing(1);
toolBar.setEnableOverflow(false);
//Table Group
// Table Group
ButtonGroup tableGroup = new ButtonGroup();
tableGroup.setId("Table");
tableGroup.setStyleName("ribbon");
@ -76,73 +74,76 @@ public class FormulasToolBar {
FlexTable tableLayout = new FlexTable();
tableGroup.add(tableLayout);
filterButton = new TextButton("Filter", TabularDataResources.INSTANCE.filter32());
filterButton = new TextButton("Filter",
TabularDataResources.INSTANCE.filter32());
filterButton.setScale(ButtonScale.LARGE);
filterButton.setIconAlign(IconAlign.TOP);
filterButton.setToolTip("Filter table data");
filterButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
filterButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
tableLayout.setWidget(0, 0, filterButton);
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.setIconAlign(IconAlign.TOP);
unionButton.setToolTip("Merge tables data");
unionButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
unionButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
tableLayout.setWidget(0, 1, unionButton);
tableLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
denormalizeButton = new TextButton("Denormalize", TabularDataResources.INSTANCE.denormalize32());
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));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
tableLayout.setWidget(0, 2, denormalizeButton);
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.setIconAlign(IconAlign.TOP);
aggregateButton.setToolTip("Perform data aggregation");
aggregateButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
aggregateButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
tableLayout.setWidget(0, 3, aggregateButton);
tableLayout.getFlexCellFormatter().setRowSpan(0, 3, 2);
cleanCells(tableLayout.getElement());
//Column Group
// Column Group
ButtonGroup columnGroup = new ButtonGroup();
columnGroup.setId("Column");
columnGroup.setStyleName("ribbon");
@ -153,56 +154,144 @@ public class FormulasToolBar {
FlexTable columnLayout = new FlexTable();
columnGroup.add(columnLayout);
modifyLabelButton = new TextButton("Labels", TabularDataResources.INSTANCE.columnLabel32());
modifyLabelButton.setScale(ButtonScale.LARGE);
modifyLabelButton.setIconAlign(IconAlign.TOP);
modifyLabelButton.setToolTip("Change column labels");
modifyLabelButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
modifyLabelButton.addSelectHandler(new SelectHandler() {
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));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
columnLayout.setWidget(0, 0, modifyLabelButton);
columnLayout.setWidget(0, 0, changeColumnLabelButton);
columnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
modifyColumnTypeButton = new TextButton("Type", TabularDataResources.INSTANCE.columnType32());
modifyColumnTypeButton.setScale(ButtonScale.LARGE);
modifyColumnTypeButton.setIconAlign(IconAlign.TOP);
modifyColumnTypeButton.setToolTip("Change the column type");
modifyColumnTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
modifyColumnTypeButton.addSelectHandler(new SelectHandler() {
removeColumnButton = new TextButton("Remove",
TabularDataResources.INSTANCE.columnDelete32());
removeColumnButton.setScale(ButtonScale.LARGE);
removeColumnButton.setIconAlign(IconAlign.TOP);
removeColumnButton.setToolTip("Change column type");
removeColumnButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
removeColumnButton.addSelectHandler(new SelectHandler() {
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);
modifyColumnValuesButton = new TextButton("Values", TabularDataResources.INSTANCE.columnValues32());
modifyColumnValuesButton.setScale(ButtonScale.LARGE);
modifyColumnValuesButton.setIconAlign(IconAlign.TOP);
modifyColumnValuesButton.setToolTip("Modify column values according to an expression");
modifyColumnValuesButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
modifyColumnValuesButton.addSelectHandler(new SelectHandler() {
changeColumnTypeButton = new TextButton("Type",
TabularDataResources.INSTANCE.columnType32());
changeColumnTypeButton.setScale(ButtonScale.LARGE);
changeColumnTypeButton.setIconAlign(IconAlign.TOP);
changeColumnTypeButton.setToolTip("Change column type");
changeColumnTypeButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
changeColumnTypeButton.addSelectHandler(new SelectHandler() {
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);
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();
historyGroup.setId("History");
historyGroup.setStyleName("ribbon");
@ -213,48 +302,49 @@ public class FormulasToolBar {
FlexTable historyLayout = new FlexTable();
historyGroup.add(historyLayout);
historyButton = new TextButton("History", TabularDataResources.INSTANCE.history32());
historyButton = new TextButton("History",
TabularDataResources.INSTANCE.history32());
historyButton.setScale(ButtonScale.LARGE);
historyButton.setIconAlign(IconAlign.TOP);
historyButton.setToolTip("Show history");
historyButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
historyButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
historyLayout.setWidget(0, 0, historyButton);
historyLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
discardButton = new TextButton("Discard", TabularDataResources.INSTANCE.discard());
discardButton = new TextButton("Discard",
TabularDataResources.INSTANCE.discard());
discardButton.setToolTip("Discard the last operation");
historyLayout.setWidget(0, 1, discardButton);
discardButton.addSelectHandler(new SelectHandler() {
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");
historyLayout.setWidget(1, 1, discardAllButton);
discardAllButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
//eventBus.fireEvent(new ImportTableEvent(ImportTableType.JSON));
// eventBus.fireEvent(new
// ImportTableEvent(ImportTableType.JSON));
}
});
cleanCells(historyLayout.getElement());
}
protected void cleanCells(Element elem) {