81: Allow the creation and use of expressions on multi column in TDM portlet

Task-Url: https://support.d4science.org/issues/81

Added Rule On Table to Ribbon

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@114902 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-05-26 12:43:34 +00:00
parent 312131245d
commit c35ff062c1
7 changed files with 207 additions and 51 deletions

View File

@ -37,6 +37,7 @@ import org.gcube.portlets.user.td.rulewidget.client.RuleApplyDialog;
import org.gcube.portlets.user.td.rulewidget.client.RuleDeleteDialog; import org.gcube.portlets.user.td.rulewidget.client.RuleDeleteDialog;
import org.gcube.portlets.user.td.rulewidget.client.RuleOpenDialog; import org.gcube.portlets.user.td.rulewidget.client.RuleOpenDialog;
import org.gcube.portlets.user.td.rulewidget.client.RuleShareDialog; import org.gcube.portlets.user.td.rulewidget.client.RuleShareDialog;
import org.gcube.portlets.user.td.rulewidget.client.multicolumn.RuleOnTableNewWizard;
import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD; import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD;
import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD; import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD;
import org.gcube.portlets.user.td.sharewidget.client.TRShare; import org.gcube.portlets.user.td.sharewidget.client.TRShare;
@ -894,24 +895,30 @@ public class TabularDataController {
break; break;
case COLUMN_BATCH_REPLACE: case COLUMN_BATCH_REPLACE:
break; break;
case RULE_NEW:
openNewRule();
break;
case RULE_MODIFY: case RULE_MODIFY:
openModifyRule(); openModifyRule();
break; break;
case RULE_DELETE: case RULE_DELETE:
openDeleteRule(); openDeleteRule();
break; break;
case RULE_APPLY:
openApplyRule();
break;
case RULES_ACTIVE: case RULES_ACTIVE:
openRulesAppliedOnTabularResource(); openRulesActiveOnTabularResource();
break; break;
case RULE_SHARE: case RULE_SHARE:
openShareRule(); openShareRule();
break; break;
case RULE_ON_COLUMN_NEW:
openOnColumnNewRule();
break;
case RULE_ON_COLUMN_APPLY:
openOnColumnApplyRule();
break;
case RULE_ON_TABLE_NEW:
openOnTableNewRule();
break;
case RULE_ON_TABLE_APPLY:
openOnTableApplyRule();
break;
case TEMPLATE_OPEN: case TEMPLATE_OPEN:
openTemplateOpen(); openTemplateOpen();
break; break;
@ -1712,12 +1719,7 @@ public class TabularDataController {
}); });
} }
private void openNewRule() {
Log.debug("Request Open New Rule Dialog");
RuleOnColumnCreateDialog cfDialog = new RuleOnColumnCreateDialog(eventBus);
cfDialog.show();
}
private void openModifyRule() { private void openModifyRule() {
Log.debug("Request Open Modify Rule Dialog"); Log.debug("Request Open Modify Rule Dialog");
@ -1726,6 +1728,8 @@ public class TabularDataController {
} }
private void openDeleteRule() { private void openDeleteRule() {
Log.debug("Request Open Delete Rule Dialog"); Log.debug("Request Open Delete Rule Dialog");
RuleDeleteDialog cfDialog = new RuleDeleteDialog(eventBus); RuleDeleteDialog cfDialog = new RuleDeleteDialog(eventBus);
@ -1733,10 +1737,11 @@ public class TabularDataController {
} }
private void openApplyRule() {
Log.debug("Request Open Apply Rule Dialog"); private void openRulesActiveOnTabularResource() {
Log.debug("Request Open Rules Active on TabularResource Dialog");
if (trId != null) { if (trId != null) {
RuleApplyDialog raDialog = new RuleApplyDialog( RuleActiveDialog raDialog = new RuleActiveDialog(
trId, eventBus); trId, eventBus);
raDialog.show(); raDialog.show();
} else { } else {
@ -1755,10 +1760,19 @@ public class TabularDataController {
} }
private void openRulesAppliedOnTabularResource() {
Log.debug("Request Open Rules Applied on TabularResource Dialog");
private void openOnColumnNewRule() {
Log.debug("Request Open On Column New Rule Dialog");
RuleOnColumnCreateDialog cfDialog = new RuleOnColumnCreateDialog(eventBus);
cfDialog.show();
}
private void openOnColumnApplyRule() {
Log.debug("Request Open On Column Apply Rule Dialog");
if (trId != null) { if (trId != null) {
RuleActiveDialog raDialog = new RuleActiveDialog( RuleApplyDialog raDialog = new RuleApplyDialog(
trId, eventBus); trId, eventBus);
raDialog.show(); raDialog.show();
} else { } else {
@ -1770,6 +1784,64 @@ public class TabularDataController {
} }
private void openOnTableNewRule() {
Log.debug("Request Open On Table New Rule Dialog");
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
openWizard();
RuleOnTableNewWizard ruleOnTableNewWizard = new RuleOnTableNewWizard(eventBus);
ruleOnTableNewWizard.addListener(new WizardListener() {
public void failed(String title, String message,
String details, Throwable throwable) {
UtilsGXT3.alert(title, message + " " + details);
resumeUIState();
}
public void completed(TRId id) {
resumeUIState();
}
@Override
public void putInBackground() {
Log.debug("PutInBakground");
resumeUIState();
}
public void aborted() {
resumeUIState();
}
});
ruleOnTableNewWizard.show();
}
public void onFailure(Throwable reason) {
asyncCodeLoadingFailed(reason);
}
});
}
private void openOnTableApplyRule() {
Log.debug("Request Open On Table Apply Rule Dialog");
/*if (trId != null) {
RuleApplyDialog raDialog = new RuleApplyDialog(
trId, eventBus);
raDialog.show();
} else {
Log.error("TRId is null");
UtilsGXT3.alert("Error",
"No current tabular resource present");
}*/
}
private void callDiscard() { private void callDiscard() {

View File

@ -46,6 +46,10 @@ public class RuleToolBar {
private TextButton ruleOnColumnNewButton; private TextButton ruleOnColumnNewButton;
private TextButton ruleOnColumnApplyButton; private TextButton ruleOnColumnApplyButton;
// On Table
private TextButton ruleOnTableNewButton;
private TextButton ruleOnTableApplyButton;
public RuleToolBar(EventBus eventBus) { public RuleToolBar(EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
build(); build();
@ -107,20 +111,17 @@ public class RuleToolBar {
ruleLayout.setWidget(0, 1, ruleDeleteButton); ruleLayout.setWidget(0, 1, ruleDeleteButton);
ruleLayout.getFlexCellFormatter().setRowSpan(0, 1, 2); ruleLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
ruleActiveButton = new TextButton( ruleActiveButton = new TextButton(msgs.ruleActiveButton(),
msgs.ruleActiveButton(),
TabularDataResources.INSTANCE.ruleActive32()); TabularDataResources.INSTANCE.ruleActive32());
ruleActiveButton.disable(); ruleActiveButton.disable();
ruleActiveButton.setScale(ButtonScale.LARGE); ruleActiveButton.setScale(ButtonScale.LARGE);
ruleActiveButton.setIconAlign(IconAlign.TOP); ruleActiveButton.setIconAlign(IconAlign.TOP);
ruleActiveButton.setToolTip(msgs ruleActiveButton.setToolTip(msgs.ruleActiveButtonToolTip());
.ruleActiveButtonToolTip());
ruleActiveButton.setArrowAlign(ButtonArrowAlign.BOTTOM); ruleActiveButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
ruleActiveButton.addSelectHandler(new SelectHandler() { ruleActiveButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent( eventBus.fireEvent(new RibbonEvent(RibbonType.RULES_ACTIVE));
RibbonType.RULES_ACTIVE));
} }
}); });
@ -157,34 +158,34 @@ public class RuleToolBar {
FlexTable ruleOnColumnLayout = new FlexTable(); FlexTable ruleOnColumnLayout = new FlexTable();
ruleOnColumnGroup.add(ruleOnColumnLayout); ruleOnColumnGroup.add(ruleOnColumnLayout);
ruleOnColumnNewButton = new TextButton(msgs.ruleNewButton(), ruleOnColumnNewButton = new TextButton(msgs.ruleOnColumnNewButton(),
TabularDataResources.INSTANCE.ruleColumnAdd32()); TabularDataResources.INSTANCE.ruleColumnAdd32());
ruleOnColumnNewButton.enable(); ruleOnColumnNewButton.enable();
ruleOnColumnNewButton.setToolTip(msgs.ruleNewButtonToolTip()); ruleOnColumnNewButton.setToolTip(msgs.ruleOnColumnNewButtonToolTip());
ruleOnColumnNewButton.setScale(ButtonScale.LARGE); ruleOnColumnNewButton.setScale(ButtonScale.LARGE);
ruleOnColumnNewButton.setIconAlign(IconAlign.TOP); ruleOnColumnNewButton.setIconAlign(IconAlign.TOP);
ruleOnColumnNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM); ruleOnColumnNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
ruleOnColumnNewButton.addSelectHandler(new SelectHandler() { ruleOnColumnNewButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_NEW)); eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_ON_COLUMN_NEW));
} }
}); });
ruleOnColumnLayout.setWidget(0, 0, ruleOnColumnNewButton); ruleOnColumnLayout.setWidget(0, 0, ruleOnColumnNewButton);
ruleOnColumnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2); ruleOnColumnLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
ruleOnColumnApplyButton = new TextButton(msgs.ruleApplyButton(), ruleOnColumnApplyButton = new TextButton(msgs.ruleOnColumnApplyButton(),
TabularDataResources.INSTANCE.ruleColumnApply32()); TabularDataResources.INSTANCE.ruleColumnApply32());
ruleOnColumnApplyButton.disable(); ruleOnColumnApplyButton.disable();
ruleOnColumnApplyButton.setScale(ButtonScale.LARGE); ruleOnColumnApplyButton.setScale(ButtonScale.LARGE);
ruleOnColumnApplyButton.setIconAlign(IconAlign.TOP); ruleOnColumnApplyButton.setIconAlign(IconAlign.TOP);
ruleOnColumnApplyButton.setToolTip(msgs.ruleApplyButtonToolTip()); ruleOnColumnApplyButton.setToolTip(msgs.ruleOnColumnApplyButtonToolTip());
ruleOnColumnApplyButton.setArrowAlign(ButtonArrowAlign.BOTTOM); ruleOnColumnApplyButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
ruleOnColumnApplyButton.addSelectHandler(new SelectHandler() { ruleOnColumnApplyButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_APPLY)); eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_ON_COLUMN_APPLY));
} }
}); });
@ -193,6 +194,53 @@ public class RuleToolBar {
cleanCells(ruleLayout.getElement()); cleanCells(ruleLayout.getElement());
// Table Rules
ButtonGroup ruleOnTableGroup = new ButtonGroup();
ruleOnTableGroup.setId("On Table");
ruleOnTableGroup.setStyleName("ribbon");
ruleOnTableGroup.setHeadingText(msgs.ruleOnTableGroupHeadingText());
toolBar.add(ruleOnTableGroup);
FlexTable ruleOnTableLayout = new FlexTable();
ruleOnTableGroup.add(ruleOnTableLayout);
ruleOnTableNewButton = new TextButton(msgs.ruleOnTableNewButton(),
TabularDataResources.INSTANCE.ruleTableAdd32());
ruleOnTableNewButton.enable();
ruleOnTableNewButton.setToolTip(msgs.ruleOnTableNewButtonToolTip());
ruleOnTableNewButton.setScale(ButtonScale.LARGE);
ruleOnTableNewButton.setIconAlign(IconAlign.TOP);
ruleOnTableNewButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
ruleOnTableNewButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_ON_TABLE_NEW));
}
});
ruleOnTableLayout.setWidget(0, 0, ruleOnTableNewButton);
ruleOnTableLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
ruleOnTableApplyButton = new TextButton(msgs.ruleOnTableApplyButton(),
TabularDataResources.INSTANCE.ruleTableApply32());
ruleOnTableApplyButton.disable();
ruleOnTableApplyButton.setScale(ButtonScale.LARGE);
ruleOnTableApplyButton.setIconAlign(IconAlign.TOP);
ruleOnTableApplyButton.setToolTip(msgs.ruleOnTableApplyButtonToolTip());
ruleOnTableApplyButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
ruleOnTableApplyButton.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
eventBus.fireEvent(new RibbonEvent(RibbonType.RULE_ON_TABLE_APPLY));
}
});
ruleOnTableLayout.setWidget(0, 1, ruleOnTableApplyButton);
ruleOnTableLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
cleanCells(ruleLayout.getElement());
eventBus.addHandler(UIStateEvent.TYPE, eventBus.addHandler(UIStateEvent.TYPE,
new UIStateEvent.UIStateHandler() { new UIStateEvent.UIStateHandler() {
@ -226,6 +274,8 @@ public class RuleToolBar {
ruleShareButton.enable(); ruleShareButton.enable();
ruleOnColumnNewButton.enable(); ruleOnColumnNewButton.enable();
ruleOnColumnApplyButton.disable(); ruleOnColumnApplyButton.disable();
ruleOnTableNewButton.enable();
ruleOnTableApplyButton.disable();
break; break;
case TR_CLOSE: case TR_CLOSE:
case TR_READONLY: case TR_READONLY:
@ -235,7 +285,8 @@ public class RuleToolBar {
ruleShareButton.enable(); ruleShareButton.enable();
ruleOnColumnNewButton.enable(); ruleOnColumnNewButton.enable();
ruleOnColumnApplyButton.disable(); ruleOnColumnApplyButton.disable();
ruleOnTableNewButton.enable();
ruleOnTableApplyButton.disable();
break; break;
case TR_OPEN: case TR_OPEN:
case TABLEUPDATE: case TABLEUPDATE:
@ -246,7 +297,8 @@ public class RuleToolBar {
ruleShareButton.enable(); ruleShareButton.enable();
ruleOnColumnNewButton.enable(); ruleOnColumnNewButton.enable();
ruleOnColumnApplyButton.enable(); ruleOnColumnApplyButton.enable();
ruleOnTableNewButton.enable();
ruleOnTableApplyButton.enable();
break; break;
case WIZARD_OPEN: case WIZARD_OPEN:
ruleOpenButton.disable(); ruleOpenButton.disable();
@ -255,6 +307,8 @@ public class RuleToolBar {
ruleShareButton.disable(); ruleShareButton.disable();
ruleOnColumnNewButton.disable(); ruleOnColumnNewButton.disable();
ruleOnColumnApplyButton.disable(); ruleOnColumnApplyButton.disable();
ruleOnTableNewButton.disable();
ruleOnTableApplyButton.disable();
break; break;
default: default:
break; break;

View File

@ -42,17 +42,31 @@ public interface RuleToolBarMessages extends Messages {
String ruleOnColumnGroupHeadingText(); String ruleOnColumnGroupHeadingText();
@DefaultMessage("New") @DefaultMessage("New")
String ruleNewButton(); String ruleOnColumnNewButton();
@DefaultMessage("New") @DefaultMessage("New")
String ruleNewButtonToolTip(); String ruleOnColumnNewButtonToolTip();
@DefaultMessage("Apply") @DefaultMessage("Apply")
String ruleApplyButton(); String ruleOnColumnApplyButton();
@DefaultMessage("Apply") @DefaultMessage("Apply")
String ruleApplyButtonToolTip(); String ruleOnColumnApplyButtonToolTip();
@DefaultMessage("On Table")
String ruleOnTableGroupHeadingText();
@DefaultMessage("New")
String ruleOnTableNewButton();
@DefaultMessage("New")
String ruleOnTableNewButtonToolTip();
@DefaultMessage("Apply")
String ruleOnTableApplyButton();
@DefaultMessage("Apply")
String ruleOnTableApplyButtonToolTip();

View File

@ -8,7 +8,13 @@ ruleShareButtonToolTip = Share
ruleActiveButton = Active ruleActiveButton = Active
ruleActiveButtonToolTip = Active ruleActiveButtonToolTip = Active
ruleOnColumnGroupHeadingText = On Column ruleOnColumnGroupHeadingText = On Column
ruleNewButton = New ruleOnColumnNewButton = New
ruleNewButtonToolTip = New ruleOnColumnNewButtonToolTip = New
ruleApplyButton = Apply ruleOnColumnApplyButton = Apply
ruleApplyButtonToolTip = Apply ruleOnColumnApplyButtonToolTip = Apply
ruleOnTableGroupHeadingText = On Table
ruleOnTableNewButton = New
ruleOnTableNewButtonToolTip = New
ruleOnTableApplyButton = Apply
ruleOnTableApplyButtonToolTip = Apply

View File

@ -8,7 +8,12 @@ ruleShareButtonToolTip = Cuota
ruleActiveButton = Activo ruleActiveButton = Activo
ruleActiveToolTip = Activo ruleActiveToolTip = Activo
ruleOnColumnGroupHeadingText = On Columna ruleOnColumnGroupHeadingText = On Columna
ruleNewButton = Nuevo ruleOnColumnNewButton = Nuevo
ruleNewButtonToolTip = Nuevo ruleOnColumnNewButtonToolTip = Nuevo
ruleApplyButton = Aplicar ruleOnColumnApplyButton = Aplicar
ruleApplyButtonToolTip = Aplicar ruleOnColumnApplyButtonToolTip = Aplicar
ruleOnTableGroupHeadingText = On Tabla
ruleOnTableNewButton = Nuevo
ruleOnTableNewButtonToolTip = Nuevo
ruleOnTableApplyButton = Aplicar
ruleOnTableApplyButtonToolTip = Aplicar

View File

@ -8,7 +8,12 @@ ruleShareButtonToolTip = Condividi
ruleActiveButton = Attive ruleActiveButton = Attive
ruleActiveButtonToolTip = Attive ruleActiveButtonToolTip = Attive
ruleOnColumnGroupHeadingText = Su Colonna ruleOnColumnGroupHeadingText = Su Colonna
ruleNewButton = Nuova ruleOnColumnNewButton = Nuova
ruleNewButtonToolTip = Nuova ruleOnColumnNewButtonToolTip = Nuova
ruleApplyButton = Applica ruleOnColumnApplyButton = Applica
ruleApplyButtonToolTip = Applica ruleOnColumnApplyButtonToolTip = Applica
ruleOnTableGroupHeadingText = Su Tabella
ruleOnTableNewButton = Nuova
ruleOnTableNewButtonToolTip = Nuova
ruleOnTableApplyButton = Applica
ruleOnTableApplyButtonToolTip = Applica