915: TDM - Support the Spanish language

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

Updated Spanish Support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget@119877 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-10-19 16:49:22 +00:00 committed by Giancarlo Panichi
parent f7ce270521
commit 7178883fed
37 changed files with 952 additions and 218 deletions

View File

@ -4,6 +4,7 @@ import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
@ -22,28 +23,35 @@ public class RuleActiveDialog extends Window {
private static final String WIDTH = "770px"; private static final String WIDTH = "770px";
private static final String HEIGHT = "428px"; private static final String HEIGHT = "428px";
private TextButton btnClose; private TextButton btnClose;
private RuleActiveMessages msgs;
public RuleActiveDialog(TRId trId, EventBus eventBus) { public RuleActiveDialog(TRId trId, EventBus eventBus) {
initMessages();
initWindow(); initWindow();
RuleActiveTabPanel ruleActiveTabPanel=new RuleActiveTabPanel(trId, eventBus); RuleActiveTabPanel ruleActiveTabPanel=new RuleActiveTabPanel(trId, eventBus);
add(ruleActiveTabPanel); add(ruleActiveTabPanel);
} }
protected void initMessages(){
msgs = GWT.create(RuleActiveMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Active Rules On TabularResource"); setHeadingText(msgs.dialogRuleActiveHead());
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
getHeader().setIcon(ResourceBundle.INSTANCE.ruleTabularResource()); getHeader().setIcon(ResourceBundle.INSTANCE.ruleTabularResource());
btnClose = new TextButton("Close"); btnClose = new TextButton(msgs.btnCloseText());
btnClose.setIcon(ResourceBundle.INSTANCE.close()); btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT); btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setToolTip("Close"); btnClose.setToolTip(msgs.btnCloseToolTip());
btnClose.addSelectHandler(new SelectHandler() { btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {

View File

@ -0,0 +1,78 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleActiveMessages extends Messages {
@DefaultMessage("Active Rules On Tabular Resource")
String dialogRuleActiveHead();
@DefaultMessage("Close")
String btnCloseText();
@DefaultMessage("Close")
String btnCloseToolTip();
@DefaultMessage("Rule On Column")
String ruleOnColumnItemHead();
@DefaultMessage("Rule On Table")
String ruleOnTableItemHead();
@DefaultMessage("No rules on table applied!")
String noRulesOnTableApplied();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Error retrieving active rules")
String errorRetrievingActiveRulesHead();
@DefaultMessage("Error retrieving applied rules")
String errorRetrievingAppliedRulesHead();
@DefaultMessage("Info")
String infoItemText();
@DefaultMessage("Info")
String infoItemToolTip();
@DefaultMessage("Detach")
String detachItemText();
@DefaultMessage("Detach rule")
String detachItemToolTip();
@DefaultMessage("Error in detach rules")
String errorInDetachRulesHead();
@DefaultMessage("Detach Rule")
String ruleIsDetachedHead();
@DefaultMessage("The rule is detached!")
String ruleIsDetached();
@DefaultMessage("The requested columns is null!")
String errorTheRequestedColumnIsNull();
@DefaultMessage("No rules on column applied!")
String noRuleOnColumnApplied();
}

View File

@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseDat
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession; import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -75,13 +76,15 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
private AppliedRulesResponseData appliedRuleResponseData; private AppliedRulesResponseData appliedRuleResponseData;
private VerticalLayoutContainer mainLayoutContainer; private VerticalLayoutContainer mainLayoutContainer;
private RuleActiveMessages msgs;
private CommonMessages msgsCommon;
public RuleActiveOnColumnPanel(TRId trId, EventBus eventBus) { public RuleActiveOnColumnPanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId = trId; this.trId = trId;
Log.debug("RuleActiveOnColumnPanel"); Log.debug("RuleActiveOnColumnPanel");
initMessages();
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
@ -90,6 +93,12 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
retrieveColumns(); retrieveColumns();
} }
protected void initMessages(){
msgs = GWT.create(RuleActiveMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void retrieveColumns() { protected void retrieveColumns() {
TDGWTServiceAsync.INSTANCE.getColumns(trId, TDGWTServiceAsync.INSTANCE.getColumns(trId,
@ -103,19 +112,19 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
if (caught instanceof TDGWTIsFinalException) { if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final", UtilsGXT3.alert(msgsCommon.errorFinal(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.debug("Error retrieving columns: " Log.debug("Error retrieving columns: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Error retrieving columns", .alert(msgsCommon.errorRetrievingColumnsHead(),
"Error retrieving column on server!"); msgsCommon.errorRetrievingColumns());
} }
} }
} }
@ -126,8 +135,8 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
public void onSuccess(ArrayList<ColumnData> result) { public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Retrieved Columns"); Log.debug("Retrieved Columns");
if (result == null) { if (result == null) {
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"The requested columns is null"); msgs.errorTheRequestedColumnIsNull());
} }
columns = result; columns = result;
@ -161,7 +170,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
} }
} }
} else { } else {
FieldLabel noRulesLabel = new FieldLabel(null, "No rules on column applied!"); FieldLabel noRulesLabel = new FieldLabel(null, msgs.noRuleOnColumnApplied());
noRulesLabel.setLabelSeparator(""); noRulesLabel.setLabelSeparator("");
noRulesLabel.setLabelWidth(200); noRulesLabel.setLabelWidth(200);
mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData( mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData(
@ -181,7 +190,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.name(), 120, "Name"); propsRules.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -194,7 +203,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.description(), 120, "Description"); propsRules.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -206,7 +215,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.ownerLogin(), 70, "Owner"); propsRules.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -218,7 +227,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
propsRules.creationDate(), 56, "Creation Date"); propsRules.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -237,35 +246,35 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
propsRules.description()); propsRules.description());
// Applies Rules // Applies Rules
ListStore<RuleDescriptionData> appliedRulesStore = new ListStore<RuleDescriptionData>( ListStore<RuleDescriptionData> appliedRulesOnColumnStore = new ListStore<RuleDescriptionData>(
propsRules.id()); propsRules.id());
if (columnAppliedRules != null && columnAppliedRules.size() > 0) { if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
appliedRulesStore.addAll(columnAppliedRules); appliedRulesOnColumnStore.addAll(columnAppliedRules);
} }
final Grid<RuleDescriptionData> gridAppliedRules = new Grid<RuleDescriptionData>( final Grid<RuleDescriptionData> gridAppliedRulesOnColumn = new Grid<RuleDescriptionData>(
appliedRulesStore, cm); appliedRulesOnColumnStore, cm);
gridAppliedRules.setItemId(column.getColumnId()); gridAppliedRulesOnColumn.setItemId(column.getColumnId());
gridAppliedRules.setHeight(RULES_GRID_HEIGHT); gridAppliedRulesOnColumn.setHeight(RULES_GRID_HEIGHT);
gridAppliedRules.getView().setStripeRows(true); gridAppliedRulesOnColumn.getView().setStripeRows(true);
gridAppliedRules.getView().setColumnLines(true); gridAppliedRulesOnColumn.getView().setColumnLines(true);
gridAppliedRules.getView().setAutoFill(true); gridAppliedRulesOnColumn.getView().setAutoFill(true);
gridAppliedRules.setBorders(false); gridAppliedRulesOnColumn.setBorders(false);
gridAppliedRules.setLoadMask(true); gridAppliedRulesOnColumn.setLoadMask(true);
gridAppliedRules.setColumnReordering(true); gridAppliedRulesOnColumn.setColumnReordering(true);
gridAppliedRules.setColumnResize(true); gridAppliedRulesOnColumn.setColumnResize(true);
gridAppliedRules.getView().setAutoExpandColumn(descriptionCol); gridAppliedRulesOnColumn.getView().setAutoExpandColumn(descriptionCol);
GridFilters<RuleDescriptionData> filtersAppliesRules = new GridFilters<RuleDescriptionData>(); GridFilters<RuleDescriptionData> filtersAppliesRules = new GridFilters<RuleDescriptionData>();
filtersAppliesRules.initPlugin(gridAppliedRules); filtersAppliesRules.initPlugin(gridAppliedRulesOnColumn);
filtersAppliesRules.setLocal(true); filtersAppliesRules.setLocal(true);
filtersAppliesRules.addFilter(nameFilter); filtersAppliesRules.addFilter(nameFilter);
filtersAppliesRules.addFilter(descriptionFilter); filtersAppliesRules.addFilter(descriptionFilter);
createContextMenu(gridAppliedRules); createContextMenu(gridAppliedRulesOnColumn);
FieldLabel rulesAppliedLabel = new FieldLabel(gridAppliedRules, FieldLabel rulesAppliedLabel = new FieldLabel(gridAppliedRulesOnColumn,
column.getLabel()); column.getLabel());
return rulesAppliedLabel; return rulesAppliedLabel;
@ -283,7 +292,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving active rules", UtilsGXT3.alert(msgs.errorRetrievingActiveRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -311,7 +320,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving applied rules", UtilsGXT3.alert(msgs.errorRetrievingAppliedRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -337,8 +346,8 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setToolTip("Info"); infoItem.setToolTip(msgs.infoItemToolTip());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -352,8 +361,8 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
}); });
MenuItem detachItem = new MenuItem(); MenuItem detachItem = new MenuItem();
detachItem.setText("Detach"); detachItem.setText(msgs.detachItemText());
detachItem.setToolTip("Detach rule"); detachItem.setToolTip(msgs.detachItemToolTip());
detachItem.setIcon(ResourceBundle.INSTANCE.ruleColumnDetach()); detachItem.setIcon(ResourceBundle.INSTANCE.ruleColumnDetach());
detachItem.addSelectionHandler(new SelectionHandler<Item>() { detachItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -396,7 +405,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error in detach rules", UtilsGXT3.alert(msgs.errorInDetachRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -406,7 +415,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
public void onSuccess(Void result) { public void onSuccess(Void result) {
updateActiveRulesOnColumn(); updateActiveRulesOnColumn();
Log.debug("The rule is detached!"); Log.debug("The rule is detached!");
UtilsGXT3.info("Detach Rule", "The rule is detached!"); UtilsGXT3.info(msgs.ruleIsDetachedHead(), msgs.ruleIsDetached());
} }
}); });

View File

@ -59,20 +59,25 @@ public class RuleActiveOnTablePanel extends FramedPanel {
@XTemplate("<span title=\"{value}\">{value}</span>") @XTemplate("<span title=\"{value}\">{value}</span>")
SafeHtml format(String value); SafeHtml format(String value);
} }
private RuleActiveMessages msgs;
private EventBus eventBus; private EventBus eventBus;
private TRId trId; private TRId trId;
private AppliedRulesResponseData appliedRuleResponseData; private AppliedRulesResponseData appliedRuleResponseData;
private Grid<RuleDescriptionData> gridAppliedRules; private Grid<RuleDescriptionData> gridAppliedRulesOnTable;
private ListStore<RuleDescriptionData> storeAppliedRules; private ListStore<RuleDescriptionData> storeAppliedRulesOnTable;
private VerticalLayoutContainer mainLayoutContainer; private VerticalLayoutContainer mainLayoutContainer;
public RuleActiveOnTablePanel(TRId trId, EventBus eventBus) { public RuleActiveOnTablePanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId = trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
Log.debug("RuleActiveOnTablePanel"); Log.debug("RuleActiveOnTablePanel");
initMessages();
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
@ -80,7 +85,10 @@ public class RuleActiveOnTablePanel extends FramedPanel {
getActiveRules(); getActiveRules();
} }
protected void initMessages(){
msgs = GWT.create(RuleActiveMessages.class);
}
protected void create() { protected void create() {
Log.debug("Create RuleActiveOnTablePanel(): " + trId); Log.debug("Create RuleActiveOnTablePanel(): " + trId);
@ -92,7 +100,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
ArrayList<RuleDescriptionData> appliedTableRules=appliedRuleResponseData.getTableRules(); ArrayList<RuleDescriptionData> appliedTableRules=appliedRuleResponseData.getTableRules();
if (appliedTableRules == null || appliedTableRules.size() <=0) { if (appliedTableRules == null || appliedTableRules.size() <=0) {
FieldLabel noRulesLabel = new FieldLabel(null, "No rules on table applied!"); FieldLabel noRulesLabel = new FieldLabel(null, msgs.noRulesOnTableApplied());
noRulesLabel.setLabelSeparator(""); noRulesLabel.setLabelSeparator("");
noRulesLabel.setLabelWidth(200); noRulesLabel.setLabelWidth(200);
mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData( mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData(
@ -107,7 +115,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.name(), 120, "Name"); propsRules.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -120,7 +128,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.description(), 120, "Description"); propsRules.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -132,7 +140,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.ownerLogin(), 70, "Owner"); propsRules.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -144,7 +152,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
propsRules.creationDate(), 56, "Creation Date"); propsRules.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -163,34 +171,34 @@ public class RuleActiveOnTablePanel extends FramedPanel {
propsRules.description()); propsRules.description());
// Applies Rules // Applies Rules
storeAppliedRules = new ListStore<RuleDescriptionData>( storeAppliedRulesOnTable = new ListStore<RuleDescriptionData>(
propsRules.id()); propsRules.id());
storeAppliedRules.addAll(appliedTableRules); storeAppliedRulesOnTable.addAll(appliedTableRules);
gridAppliedRules = new Grid<RuleDescriptionData>( gridAppliedRulesOnTable = new Grid<RuleDescriptionData>(
storeAppliedRules, cm); storeAppliedRulesOnTable, cm);
//gridAppliedRules.setHeight(RULES_GRID_HEIGHT); //gridAppliedRules.setHeight(RULES_GRID_HEIGHT);
gridAppliedRules.getView().setStripeRows(true); gridAppliedRulesOnTable.getView().setStripeRows(true);
gridAppliedRules.getView().setColumnLines(true); gridAppliedRulesOnTable.getView().setColumnLines(true);
gridAppliedRules.getView().setAutoFill(true); gridAppliedRulesOnTable.getView().setAutoFill(true);
gridAppliedRules.setBorders(false); gridAppliedRulesOnTable.setBorders(false);
gridAppliedRules.setLoadMask(true); gridAppliedRulesOnTable.setLoadMask(true);
gridAppliedRules.setColumnReordering(true); gridAppliedRulesOnTable.setColumnReordering(true);
gridAppliedRules.setColumnResize(true); gridAppliedRulesOnTable.setColumnResize(true);
gridAppliedRules.getView().setAutoExpandColumn(descriptionCol); gridAppliedRulesOnTable.getView().setAutoExpandColumn(descriptionCol);
GridFilters<RuleDescriptionData> filtersAppliesRules = new GridFilters<RuleDescriptionData>(); GridFilters<RuleDescriptionData> filtersAppliesRulesOnTable = new GridFilters<RuleDescriptionData>();
filtersAppliesRules.initPlugin(gridAppliedRules); filtersAppliesRulesOnTable.initPlugin(gridAppliedRulesOnTable);
filtersAppliesRules.setLocal(true); filtersAppliesRulesOnTable.setLocal(true);
filtersAppliesRules.addFilter(nameFilter); filtersAppliesRulesOnTable.addFilter(nameFilter);
filtersAppliesRules.addFilter(descriptionFilter); filtersAppliesRulesOnTable.addFilter(descriptionFilter);
createContextMenu(gridAppliedRules); createContextMenu(gridAppliedRulesOnTable);
mainLayoutContainer.add(gridAppliedRules, new VerticalLayoutData( mainLayoutContainer.add(gridAppliedRulesOnTable, new VerticalLayoutData(
1, 1, new Margins(0))); 1, 1, new Margins(0)));
add(mainLayoutContainer); add(mainLayoutContainer);
return; return;
@ -208,7 +216,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving active rules", UtilsGXT3.alert(msgs.errorRetrievingActiveRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -236,7 +244,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving applied rules", UtilsGXT3.alert(msgs.errorRetrievingAppliedRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -262,8 +270,8 @@ public class RuleActiveOnTablePanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setToolTip("Info"); infoItem.setToolTip(msgs.infoItemToolTip());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -277,8 +285,8 @@ public class RuleActiveOnTablePanel extends FramedPanel {
}); });
MenuItem detachItem = new MenuItem(); MenuItem detachItem = new MenuItem();
detachItem.setText("Detach"); detachItem.setText(msgs.detachItemText());
detachItem.setToolTip("Detach rule"); detachItem.setToolTip(msgs.detachItemToolTip());
detachItem.setIcon(ResourceBundle.INSTANCE.ruleColumnDetach()); detachItem.setIcon(ResourceBundle.INSTANCE.ruleColumnDetach());
detachItem.addSelectionHandler(new SelectionHandler<Item>() { detachItem.addSelectionHandler(new SelectionHandler<Item>() {
@ -318,7 +326,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error in detach rules", UtilsGXT3.alert(msgs.errorInDetachRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -328,7 +336,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
public void onSuccess(Void result) { public void onSuccess(Void result) {
updateActiveRules(); updateActiveRules();
Log.debug("The rule is detached!"); Log.debug("The rule is detached!");
UtilsGXT3.info("Detach Rule", "The rule is detached!"); UtilsGXT3.info(msgs.ruleIsDetachedHead(), msgs.ruleIsDetached());
} }
}); });

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.rulewidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.TabItemConfig; import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel; import com.sencha.gxt.widget.core.client.TabPanel;
@ -18,10 +19,12 @@ public class RuleActiveTabPanel extends TabPanel {
private RuleActiveOnColumnPanel ruleActiveOnColumnPanel; private RuleActiveOnColumnPanel ruleActiveOnColumnPanel;
private TRId trId; private TRId trId;
private RuleActiveOnTablePanel ruleActiveOnTablePanel; private RuleActiveOnTablePanel ruleActiveOnTablePanel;
private RuleActiveMessages msgs;
public RuleActiveTabPanel(TRId trId, EventBus eventBus) { public RuleActiveTabPanel(TRId trId, EventBus eventBus) {
super(); super();
Log.debug("Create RuleActiveTabPanel"); Log.debug("Create RuleActiveTabPanel");
initMessages();
this.trId=trId; this.trId=trId;
this.eventBus = eventBus; this.eventBus = eventBus;
setBodyBorder(false); setBodyBorder(false);
@ -33,6 +36,10 @@ public class RuleActiveTabPanel extends TabPanel {
startTabs(); startTabs();
} }
protected void initMessages(){
msgs = GWT.create(RuleActiveMessages.class);
}
public void startTabs() { public void startTabs() {
Log.debug("Start RuleActiveTabPanel Tabs"); Log.debug("Start RuleActiveTabPanel Tabs");
setActiveWidget(getWidget(0)); setActiveWidget(getWidget(0));
@ -41,13 +48,13 @@ public class RuleActiveTabPanel extends TabPanel {
public void addTabs(){ public void addTabs(){
TabItemConfig ruleOnColumnItemConf = new TabItemConfig( TabItemConfig ruleOnColumnItemConf = new TabItemConfig(
"Rule On Column", false); msgs.ruleOnColumnItemHead(), false);
ruleActiveOnColumnPanel = new RuleActiveOnColumnPanel(trId,eventBus); ruleActiveOnColumnPanel = new RuleActiveOnColumnPanel(trId,eventBus);
add(ruleActiveOnColumnPanel, ruleOnColumnItemConf); add(ruleActiveOnColumnPanel, ruleOnColumnItemConf);
TabItemConfig ruleOnTableItemConf = new TabItemConfig( TabItemConfig ruleOnTableItemConf = new TabItemConfig(
"Rule On Table", false); msgs.ruleOnTableItemHead(), false);
ruleActiveOnTablePanel = new RuleActiveOnTablePanel(trId,eventBus); ruleActiveOnTablePanel = new RuleActiveOnTablePanel(trId,eventBus);
add(ruleActiveOnTablePanel, ruleOnTableItemConf); add(ruleActiveOnTablePanel, ruleOnTableItemConf);

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredE
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
@ -28,6 +29,7 @@ public class RuleDeleteDialog extends Window {
private static final String HEIGHT = "530px"; private static final String HEIGHT = "530px";
private EventBus eventBus; private EventBus eventBus;
private RuleDeletePanel ruleDeletePanel; private RuleDeletePanel ruleDeletePanel;
private RuleDeleteMessages msgs;
public RuleDeleteDialog(EventBus eventBus) { public RuleDeleteDialog(EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
@ -36,13 +38,17 @@ public class RuleDeleteDialog extends Window {
ruleDeletePanel = new RuleDeletePanel(this, eventBus); ruleDeletePanel = new RuleDeletePanel(this, eventBus);
add(ruleDeletePanel); add(ruleDeletePanel);
} }
protected void initMessages(){
msgs = GWT.create(RuleDeleteMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Delete Rule"); setHeadingText(msgs.dialogRuleDeleteHead());
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
@ -78,7 +84,7 @@ public class RuleDeleteDialog extends Window {
@Override @Override
public void onSuccess(Void v) { public void onSuccess(Void v) {
Log.debug("Rule is deleted!"); Log.debug("Rule is deleted!");
UtilsGXT3.info("Delete Rule", "The rule is deleted!"); UtilsGXT3.info(msgs.ruleIsDeletedHead(), msgs.ruleIsDeleted());
ruleDeletePanel.gridReload(); ruleDeletePanel.gridReload();
} }
@ -91,7 +97,7 @@ public class RuleDeleteDialog extends Window {
Log.error("Error deleting column rule: " Log.error("Error deleting column rule: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
caught.printStackTrace(); caught.printStackTrace();
UtilsGXT3.alert("Error deleting column rule", UtilsGXT3.alert(msgs.errorDeletingRuleOnColumnHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
ruleDeletePanel.gridReload(); ruleDeletePanel.gridReload();

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleDeleteMessages extends Messages {
@DefaultMessage("Delete Rule")
String dialogRuleDeleteHead();
@DefaultMessage("Close")
String btnCloseText();
@DefaultMessage("Close")
String btnCloseToolTip();
@DefaultMessage("Delete Rule")
String ruleIsDeletedHead();
@DefaultMessage("The rule is deleted!")
String ruleIsDeleted();
@DefaultMessage("Error deleting rule on column")
String errorDeletingRuleOnColumnHead();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Scope")
String scopeCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Delete")
String btnDeleteText();
@DefaultMessage("Delete")
String btnDeleteToolTip();
@DefaultMessage("Error retrieving rules")
String errorRetrievingRulesHead();
@DefaultMessage("Error retrieving rules!")
String errorRetrievingRules();
@DefaultMessage("Select the rule to be deleted!")
String selectTheRuleToBeDeleted();
@DefaultMessage("Info")
String infoItemText();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDa
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
@ -85,30 +86,40 @@ public class RuleDeletePanel extends FramedPanel {
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader; private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
private Grid<RuleDescriptionData> grid; private Grid<RuleDescriptionData> grid;
private ExtendedListStore<RuleDescriptionData> store; private ExtendedListStore<RuleDescriptionData> store;
private RuleDeleteMessages msgs;
private CommonMessages msgsCommon;
public RuleDeletePanel(RuleDeleteDialog parent, EventBus eventBus) { public RuleDeletePanel(RuleDeleteDialog parent, EventBus eventBus) {
this.parent = parent; this.parent = parent;
this.eventBus = eventBus;
Log.debug("RuleDeletePanel"); Log.debug("RuleDeletePanel");
initMessages();
initPanel();
create();
}
protected void initMessages(){
msgs = GWT.create(RuleDeleteMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void initPanel(){
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(false); setBodyBorder(false);
this.eventBus = eventBus;
create();
} }
protected void create() { protected void create() {
ToolBar toolBarHead = new ToolBar(); ToolBar toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Search: ")); toolBarHead.add(new LabelToolItem(msgsCommon.toolItemSearchLabel()));
final TextField searchField = new TextField(); final TextField searchField = new TextField();
toolBarHead.add(searchField); toolBarHead.add(searchField);
TextButton btnReload = new TextButton(); TextButton btnReload = new TextButton();
// btnReload.setText("Reload"); // btnReload.setText("Reload");
btnReload.setIcon(ResourceBundle.INSTANCE.refresh()); btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
btnReload.setToolTip("Reload"); btnReload.setToolTip(msgsCommon.toolItemReloadLabel());
toolBarHead.add(btnReload); toolBarHead.add(btnReload);
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>(); IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
@ -119,7 +130,7 @@ public class RuleDeletePanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
props.name(), 120, "Name"); props.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -132,7 +143,7 @@ public class RuleDeletePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
props.scopeLabel(), 40, "Scope"); props.scopeLabel(), 40, msgs.scopeCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -145,7 +156,7 @@ public class RuleDeletePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
props.description(), 120, "Description"); props.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -157,7 +168,7 @@ public class RuleDeletePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
props.ownerLogin(), 70, "Owner"); props.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -169,7 +180,7 @@ public class RuleDeletePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
props.creationDate(), 56, "Creation Date"); props.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -265,10 +276,10 @@ public class RuleDeletePanel extends FramedPanel {
toolBar.addStyleName(ThemeStyles.get().style().borderTop()); toolBar.addStyleName(ThemeStyles.get().style().borderTop());
toolBar.getElement().getStyle().setProperty("borderBottom", "none"); toolBar.getElement().getStyle().setProperty("borderBottom", "none");
btnDelete = new TextButton("Delete"); btnDelete = new TextButton(msgs.btnDeleteText());
btnDelete.setIcon(ResourceBundle.INSTANCE.ruleDelete()); btnDelete.setIcon(ResourceBundle.INSTANCE.ruleDelete());
btnDelete.setIconAlign(IconAlign.RIGHT); btnDelete.setIconAlign(IconAlign.RIGHT);
btnDelete.setToolTip("Delete"); btnDelete.setToolTip(msgs.btnDeleteToolTip());
btnDelete.addSelectHandler(new SelectHandler() { btnDelete.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -278,10 +289,10 @@ public class RuleDeletePanel extends FramedPanel {
} }
}); });
btnClose = new TextButton("Close"); btnClose = new TextButton(msgs.btnCloseText());
btnClose.setIcon(ResourceBundle.INSTANCE.close()); btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT); btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setToolTip("Close"); btnClose.setToolTip(msgs.btnCloseToolTip());
btnClose.addSelectHandler(new SelectHandler() { btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -322,8 +333,8 @@ public class RuleDeletePanel extends FramedPanel {
} else { } else {
Log.error("Load rules failure:" Log.error("Load rules failure:"
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving rules", UtilsGXT3.alert(msgs.errorRetrievingRulesHead(),
"Error retrieving rules"); msgs.errorRetrievingRules());
} }
callback.onFailure(caught); callback.onFailure(caught);
@ -351,7 +362,7 @@ public class RuleDeletePanel extends FramedPanel {
protected void delete() { protected void delete() {
ArrayList<RuleDescriptionData> rules = getSelectedItem(); ArrayList<RuleDescriptionData> rules = getSelectedItem();
if (rules == null || rules.size() == 0) { if (rules == null || rules.size() == 0) {
UtilsGXT3.info("Attention", "Select the rule to be deleted"); UtilsGXT3.info(msgsCommon.attention(), msgs.selectTheRuleToBeDeleted());
} else { } else {
Log.debug("Rules Delete: " + rules); Log.debug("Rules Delete: " + rules);
parent.removeRule(rules); parent.removeRule(rules);
@ -404,7 +415,7 @@ public class RuleDeletePanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.rulewidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.DateTimeFormat;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.Dialog; import com.sencha.gxt.widget.core.client.Dialog;
@ -27,15 +28,22 @@ public class RuleInfoDialog extends Dialog {
private RuleDescriptionData ruleDescriptionData; private RuleDescriptionData ruleDescriptionData;
private RuleInfoMessages msgs;
public RuleInfoDialog(RuleDescriptionData ruleDescriptionData) { public RuleInfoDialog(RuleDescriptionData ruleDescriptionData) {
this.ruleDescriptionData = ruleDescriptionData; this.ruleDescriptionData = ruleDescriptionData;
initMessages();
initWindow(); initWindow();
create(); create();
} }
protected void initMessages(){
msgs = GWT.create(RuleInfoMessages.class);
}
protected void initWindow() { protected void initWindow() {
setModal(true); setModal(true);
setHeadingText("Info Rule"); setHeadingText(msgs.dialogRuleInfoHead());
getHeader().setIcon(ResourceBundle.INSTANCE.information()); getHeader().setIcon(ResourceBundle.INSTANCE.information());
setPredefinedButtons(PredefinedButton.OK); setPredefinedButtons(PredefinedButton.OK);
setHideOnButtonClick(true); setHideOnButtonClick(true);
@ -46,7 +54,7 @@ public class RuleInfoDialog extends Dialog {
protected void create() { protected void create() {
FieldSet configurationFieldSet = new FieldSet(); FieldSet configurationFieldSet = new FieldSet();
configurationFieldSet.setHeadingText("Configuration"); configurationFieldSet.setHeadingText(msgs.configurationFieldSetHead());
configurationFieldSet.setCollapsible(false); configurationFieldSet.setCollapsible(false);
configurationFieldSet.setBorders(true); configurationFieldSet.setBorders(true);
@ -57,14 +65,14 @@ public class RuleInfoDialog extends Dialog {
TextField ruleName = new TextField(); TextField ruleName = new TextField();
ruleName.setValue(ruleDescriptionData.getName()); ruleName.setValue(ruleDescriptionData.getName());
ruleName.setReadOnly(true); ruleName.setReadOnly(true);
FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Name"); FieldLabel ruleNameLabel = new FieldLabel(ruleName, msgs.nameLabel());
configurationFieldSetLayout.add(ruleNameLabel, new VerticalLayoutData( configurationFieldSetLayout.add(ruleNameLabel, new VerticalLayoutData(
1, -1, new Margins(0))); 1, -1, new Margins(0)));
TextField ruleScope = new TextField(); TextField ruleScope = new TextField();
ruleScope.setValue(ruleDescriptionData.getScopeLabel()); ruleScope.setValue(ruleDescriptionData.getScopeLabel());
ruleScope.setReadOnly(true); ruleScope.setReadOnly(true);
FieldLabel ruleScopeLabel = new FieldLabel(ruleScope, "Scope"); FieldLabel ruleScopeLabel = new FieldLabel(ruleScope, msgs.scopeLabel());
configurationFieldSetLayout.add(ruleScopeLabel, new VerticalLayoutData( configurationFieldSetLayout.add(ruleScopeLabel, new VerticalLayoutData(
1, -1, new Margins(0))); 1, -1, new Margins(0)));
@ -72,14 +80,14 @@ public class RuleInfoDialog extends Dialog {
ruleDescription.setValue(ruleDescriptionData.getDescription()); ruleDescription.setValue(ruleDescriptionData.getDescription());
ruleDescription.setReadOnly(true); ruleDescription.setReadOnly(true);
FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription, FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription,
"Description"); msgs.descriptionLabel());
configurationFieldSetLayout.add(ruleDescriptionLabel, configurationFieldSetLayout.add(ruleDescriptionLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
TextField ruleOwner = new TextField(); TextField ruleOwner = new TextField();
ruleOwner.setValue(ruleDescriptionData.getOwnerLogin()); ruleOwner.setValue(ruleDescriptionData.getOwnerLogin());
ruleOwner.setReadOnly(true); ruleOwner.setReadOnly(true);
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner"); FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, msgs.ownerLabel());
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData( configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
1, -1, new Margins(0))); 1, -1, new Margins(0)));
@ -88,7 +96,7 @@ public class RuleInfoDialog extends Dialog {
.getCreationDate())); .getCreationDate()));
ruleCreationDate.setReadOnly(true); ruleCreationDate.setReadOnly(true);
FieldLabel ruleCreationDateLabel = new FieldLabel(ruleCreationDate, FieldLabel ruleCreationDateLabel = new FieldLabel(ruleCreationDate,
"Creation Date"); msgs.creationDateLabel());
configurationFieldSetLayout.add(ruleCreationDateLabel, configurationFieldSetLayout.add(ruleCreationDateLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
@ -97,7 +105,7 @@ public class RuleInfoDialog extends Dialog {
ruleExpression.setReadOnly(true); ruleExpression.setReadOnly(true);
ruleExpression.setHeight("82px"); ruleExpression.setHeight("82px");
FieldLabel ruleExpressionLabel = new FieldLabel(ruleExpression, FieldLabel ruleExpressionLabel = new FieldLabel(ruleExpression,
"Expression"); msgs.expressionLabel());
configurationFieldSetLayout.add(ruleExpressionLabel, configurationFieldSetLayout.add(ruleExpressionLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));

View File

@ -0,0 +1,37 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleInfoMessages extends Messages {
@DefaultMessage("Info Rule")
String dialogRuleInfoHead();
@DefaultMessage("Configuration")
String configurationFieldSetHead();
@DefaultMessage("Name")
String nameLabel();
@DefaultMessage("Scope")
String scopeLabel();
@DefaultMessage("Description")
String descriptionLabel();
@DefaultMessage("Owner")
String ownerLabel();
@DefaultMessage("Creation Date")
String creationDateLabel();
@DefaultMessage("Expression")
String expressionLabel();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRul
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
@ -19,6 +20,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
@ -36,22 +38,30 @@ public class RuleOnColumnApplyDialog extends Window implements
private static final String WIDTH = "780px"; private static final String WIDTH = "780px";
private static final String HEIGHT = "530px"; private static final String HEIGHT = "530px";
private EventBus eventBus; private EventBus eventBus;
private RuleOnColumnApplyMessages msgs;
private CommonMessages msgsCommon;
public RuleOnColumnApplyDialog(TRId trId, EventBus eventBus) { public RuleOnColumnApplyDialog(TRId trId, EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
initMessages();
initWindow(); initWindow();
RuleOnColumnApplyPanel ruleApplyPanel = new RuleOnColumnApplyPanel(this, RuleOnColumnApplyPanel ruleApplyPanel = new RuleOnColumnApplyPanel(this,
trId, eventBus); trId, eventBus);
add(ruleApplyPanel); add(ruleApplyPanel);
} }
protected void initMessages(){
msgs= GWT.create(RuleOnColumnApplyMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Apply Rules On Column"); setHeadingText(msgs.dialogRuleOnColumnHead());
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
@ -90,18 +100,18 @@ public class RuleOnColumnApplyDialog extends Window implements
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
if (caught instanceof TDGWTIsFinalException) { if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Is Final", UtilsGXT3.alert(msgsCommon.errorFinal(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.debug("Apply Rules On Column Error: " Log.debug("Apply Rules On Column Error: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Apply Rules On Column", .alert(msgs.applyRulesOnColumnHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
} }

View File

@ -0,0 +1,74 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleOnColumnApplyMessages extends Messages {
@DefaultMessage("Apply Rules On Column")
String dialogRuleOnColumnHead();
@DefaultMessage("Apply Rules On Column")
String applyRulesOnColumnHead();
@DefaultMessage("The requested columns is null!")
String columnIsNull();
@DefaultMessage("Configuration")
String configurationFieldSetHead();
@DefaultMessage("Select a column...")
String comboColumnsEmptyText();
@DefaultMessage("Column")
String comboColumnsLabel();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Applicable Rules")
String rulesApplicableLabel();
@DefaultMessage("Selected Rules")
String rulesSelectedLabel();
@DefaultMessage("<p>Tip.: Use drag and drop in order to change selected rules.</p>")
String ruleTip();
@DefaultMessage("Apply")
String btnApplyText();
@DefaultMessage("Apply Rule")
String btnApplyToolTip();
@DefaultMessage("Error retrieving applicable rules")
String errorRetrievingApplicableRulesHead();
@DefaultMessage("Error retrieving selected rules")
String errorRetrievingSelectedRulesHead();
@DefaultMessage("Select a rule!")
String selectARule();
@DefaultMessage("Select a column!")
String selectAColumn();
@DefaultMessage("Info")
String infoItemText();
}

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseDat
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession; import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -60,7 +61,6 @@ import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid; import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.grid.filters.GridFilters; import com.sencha.gxt.widget.core.client.grid.filters.GridFilters;
import com.sencha.gxt.widget.core.client.grid.filters.StringFilter; import com.sencha.gxt.widget.core.client.grid.filters.StringFilter;
import com.sencha.gxt.widget.core.client.info.Info;
import com.sencha.gxt.widget.core.client.menu.Item; import com.sencha.gxt.widget.core.client.menu.Item;
import com.sencha.gxt.widget.core.client.menu.Menu; import com.sencha.gxt.widget.core.client.menu.Menu;
import com.sencha.gxt.widget.core.client.menu.MenuItem; import com.sencha.gxt.widget.core.client.menu.MenuItem;
@ -74,7 +74,6 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem;
public class RuleOnColumnApplyPanel extends FramedPanel { public class RuleOnColumnApplyPanel extends FramedPanel {
private static final String WIDTH = "770px"; private static final String WIDTH = "770px";
private static final String HEIGHT = "520px"; private static final String HEIGHT = "520px";
private static final String RULE_TIP = "<p>Tip.: Use drag and drop in order to change selected rules.</p>";
private static final String RULES_GRID_HEIGHT = "184px"; private static final String RULES_GRID_HEIGHT = "184px";
private static final String SET_RULES = "SetRules"; private static final String SET_RULES = "SetRules";
private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
@ -101,21 +100,33 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
private Grid<RuleDescriptionData> gridApplicableRules; private Grid<RuleDescriptionData> gridApplicableRules;
private ListStore<RuleDescriptionData> selectedRulesStore; private ListStore<RuleDescriptionData> selectedRulesStore;
private Grid<RuleDescriptionData> gridSelectedRules; private Grid<RuleDescriptionData> gridSelectedRules;
private RuleOnColumnApplyMessages msgs;
private CommonMessages msgsCommon;
public RuleOnColumnApplyPanel(RuleOnColumnApplyDialog parent, TRId trId, EventBus eventBus) { public RuleOnColumnApplyPanel(RuleOnColumnApplyDialog parent, TRId trId, EventBus eventBus) {
this.parent = parent; this.parent = parent;
this.trId = trId; this.trId = trId;
this.eventBus = eventBus;
applicableRules = new ArrayList<RuleDescriptionData>(); applicableRules = new ArrayList<RuleDescriptionData>();
Log.debug("RuleOnColumnApplyPanel"); Log.debug("RuleOnColumnApplyPanel");
initMessages();
initPanel();
retrieveColumns();
}
protected void initMessages(){
msgs= GWT.create(RuleOnColumnApplyMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void initPanel(){
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(false); setBodyBorder(false);
this.eventBus = eventBus;
retrieveColumns();
} }
protected void retrieveColumns() { protected void retrieveColumns() {
TDGWTServiceAsync.INSTANCE.getColumns(trId, TDGWTServiceAsync.INSTANCE.getColumns(trId,
@ -129,19 +140,19 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
} else { } else {
if (caught instanceof TDGWTIsLockedException) { if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked", UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
if (caught instanceof TDGWTIsFinalException) { if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final", UtilsGXT3.alert(msgsCommon.errorFinal(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} else { } else {
Log.debug("Error retrieving columns: " Log.debug("Error retrieving columns: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3 UtilsGXT3
.alert("Error retrieving columns", .alert(msgsCommon.errorRetrievingColumnsHead(),
"Error retrieving column on server!"); msgsCommon.errorRetrievingColumns());
} }
} }
} }
@ -152,8 +163,8 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
public void onSuccess(ArrayList<ColumnData> result) { public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Retrieved Columns"); Log.debug("Retrieved Columns");
if (result == null) { if (result == null) {
UtilsGXT3.alert("Error", UtilsGXT3.alert(msgsCommon.error(),
"The requested columns is null"); msgs.columnIsNull());
} }
columns = result; columns = result;
@ -168,7 +179,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
Log.debug("Create RuleApplyPanel(): " + trId); Log.debug("Create RuleApplyPanel(): " + trId);
FieldSet configurationFieldSet = new FieldSet(); FieldSet configurationFieldSet = new FieldSet();
configurationFieldSet.setHeadingText("Configuration"); configurationFieldSet.setHeadingText(msgs.configurationFieldSetHead());
configurationFieldSet.setCollapsible(false); configurationFieldSet.setCollapsible(false);
VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer(); VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer();
@ -188,13 +199,13 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
Log.trace("Combo ColumnData created"); Log.trace("Combo ColumnData created");
addHandlersForComboColumn(propsColumnData.label()); addHandlersForComboColumn(propsColumnData.label());
comboColumns.setEmptyText("Select a column..."); comboColumns.setEmptyText(msgs.comboColumnsEmptyText());
comboColumns.setWidth(191); comboColumns.setWidth(191);
comboColumns.setTypeAhead(false); comboColumns.setTypeAhead(false);
comboColumns.setEditable(false); comboColumns.setEditable(false);
comboColumns.setTriggerAction(TriggerAction.ALL); comboColumns.setTriggerAction(TriggerAction.ALL);
FieldLabel comboColumnsLabel = new FieldLabel(comboColumns, "Column"); FieldLabel comboColumnsLabel = new FieldLabel(comboColumns, msgs.comboColumnsLabel());
configurationFieldSetLayout.add(comboColumnsLabel, configurationFieldSetLayout.add(comboColumnsLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
@ -204,7 +215,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.name(), 120, "Name"); propsRules.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -217,7 +228,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.description(), 120, "Description"); propsRules.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -229,7 +240,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.ownerLogin(), 70, "Owner"); propsRules.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -241,7 +252,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
propsRules.creationDate(), 56, "Creation Date"); propsRules.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -321,26 +332,26 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
// //
FieldLabel rulesApplicableLabel = new FieldLabel(gridApplicableRules, FieldLabel rulesApplicableLabel = new FieldLabel(gridApplicableRules,
"Applicable Rules"); msgs.rulesApplicableLabel());
configurationFieldSetLayout.add(rulesApplicableLabel, configurationFieldSetLayout.add(rulesApplicableLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
FieldLabel rulesSelectedLabel = new FieldLabel(gridSelectedRules, FieldLabel rulesSelectedLabel = new FieldLabel(gridSelectedRules,
"Selected Rules"); msgs.rulesSelectedLabel());
configurationFieldSetLayout.add(rulesSelectedLabel, configurationFieldSetLayout.add(rulesSelectedLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
// //
HTML rulesNote = new HTML(RULE_TIP); HTML rulesNote = new HTML(msgs.ruleTip());
configurationFieldSetLayout.add(rulesNote, configurationFieldSetLayout.add(rulesNote,
new VerticalLayoutData(-1, -1, new Margins(0))); new VerticalLayoutData(-1, -1, new Margins(0)));
// Button // Button
btnApply = new TextButton("Apply"); btnApply = new TextButton(msgs.btnApplyText());
btnApply.setIcon(ResourceBundle.INSTANCE.ruleColumnApply()); btnApply.setIcon(ResourceBundle.INSTANCE.ruleColumnApply());
btnApply.setIconAlign(IconAlign.RIGHT); btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setToolTip("Apply Rule"); btnApply.setToolTip(msgs.btnApplyToolTip());
btnApply.addSelectHandler(new SelectHandler() { btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -350,10 +361,10 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
} }
}); });
btnClose = new TextButton("Close"); btnClose = new TextButton(msgsCommon.btnCloseText());
btnClose.setIcon(ResourceBundle.INSTANCE.close()); btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT); btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setToolTip("Close"); btnClose.setToolTip(msgsCommon.btnCloseToolTip());
btnClose.addSelectHandler(new SelectHandler() { btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -382,12 +393,6 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
final LabelProvider<ColumnData> labelProvider) { final LabelProvider<ColumnData> labelProvider) {
comboColumns.addSelectionHandler(new SelectionHandler<ColumnData>() { comboColumns.addSelectionHandler(new SelectionHandler<ColumnData>() {
public void onSelection(SelectionEvent<ColumnData> event) { public void onSelection(SelectionEvent<ColumnData> event) {
Info.display(
"Column Selected",
"You selected "
+ (event.getSelectedItem() == null ? "nothing"
: labelProvider.getLabel(event
.getSelectedItem()) + "!"));
Log.debug("ComboColumn selected: " + event.getSelectedItem()); Log.debug("ComboColumn selected: " + event.getSelectedItem());
ColumnData columnData = event.getSelectedItem(); ColumnData columnData = event.getSelectedItem();
updateRulesInGrids(columnData); updateRulesInGrids(columnData);
@ -431,7 +436,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert( UtilsGXT3.alert(
"Error retrieving applicable rules", msgs.errorRetrievingApplicableRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -478,7 +483,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
Log.error(caught.getLocalizedMessage()); Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving selected rules", UtilsGXT3.alert(msgs.errorRetrievingSelectedRulesHead(),
caught.getLocalizedMessage()); caught.getLocalizedMessage());
} }
@ -560,7 +565,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
if(rulesThatWillBeApplied.size()<=0&&rulesThatWillBeDetach.size()<=0){ if(rulesThatWillBeApplied.size()<=0&&rulesThatWillBeDetach.size()<=0){
Log.error("Select a rule!"); Log.error("Select a rule!");
UtilsGXT3.alert("Attention", "Select a rule!"); UtilsGXT3.alert(msgsCommon.attention(), msgs.selectARule());
return; return;
} }
@ -570,7 +575,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
} else { } else {
Log.error("No column selected"); Log.error("No column selected");
UtilsGXT3.alert("Attention", "Select a column"); UtilsGXT3.alert(msgsCommon.attention(), msgs.selectAColumn());
} }
} }
@ -589,7 +594,7 @@ public class RuleOnColumnApplyPanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {

View File

@ -7,6 +7,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescrip
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -18,26 +19,32 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class RuleOpenDialog extends Window implements RuleEditDialogNotificationListener { public class RuleOpenDialog extends Window implements
RuleEditDialogNotificationListener {
private static final String WIDTH = "770px"; private static final String WIDTH = "770px";
private static final String HEIGHT = "530px"; private static final String HEIGHT = "530px";
private RuleOpenPanel rulesOpenPanel; private RuleOpenPanel rulesOpenPanel;
private EventBus eventBus; private EventBus eventBus;
private RuleOpenMessages msgs;
public RuleOpenDialog(EventBus eventBus) { public RuleOpenDialog(EventBus eventBus) {
this.eventBus=eventBus; this.eventBus = eventBus;
initMessages();
initWindow(); initWindow();
rulesOpenPanel= new RuleOpenPanel(this, rulesOpenPanel = new RuleOpenPanel(this, eventBus);
eventBus);
add(rulesOpenPanel); add(rulesOpenPanel);
} }
protected void initMessages() {
msgs = GWT.create(RuleOpenMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Open Rule"); setHeadingText(msgs.dialogRuleOpenHead());
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;
@ -69,37 +76,32 @@ public class RuleOpenDialog extends Window implements RuleEditDialogNotification
openRuleDialog(ruleDescriptionData); openRuleDialog(ruleDescriptionData);
} }
protected void openRuleDialog(RuleDescriptionData ruleDescriptionData) { protected void openRuleDialog(RuleDescriptionData ruleDescriptionData) {
Log.debug("Request Open New Rule Dialog"); Log.debug("Request Open New Rule Dialog");
RuleEditDialog reDialog = new RuleEditDialog(ruleDescriptionData,eventBus); RuleEditDialog reDialog = new RuleEditDialog(ruleDescriptionData,
eventBus);
reDialog.addRuleEditDialogNotificationListener(this); reDialog.addRuleEditDialogNotificationListener(this);
reDialog.show(); reDialog.show();
} }
@Override @Override
public void onNotification(RuleEditDialogNotification ruleEditDialogNotification) { public void onNotification(
RuleEditDialogNotification ruleEditDialogNotification) {
rulesOpenPanel.gridReload(); rulesOpenPanel.gridReload();
} }
@Override @Override
public void aborted() { public void aborted() {
} }
@Override @Override
public void failed(Throwable throwable) { public void failed(Throwable throwable) {
Log.debug("Error in edit rule: "+throwable.getLocalizedMessage()); Log.debug("Error in edit rule: " + throwable.getLocalizedMessage());
} }
} }

View File

@ -0,0 +1,49 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleOpenMessages extends Messages {
@DefaultMessage("Open Rule")
String dialogRuleOpenHead();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Scope")
String scopeCol();
@DefaultMessage("Edit")
String btnEditText();
@DefaultMessage("Edit rule")
String btnEditToolTip();
@DefaultMessage("Error retrieving rules")
String errorRetrievingRulesHead();
@DefaultMessage("Error retrieving rules!")
String errorRetrievingRules();
@DefaultMessage("Select the rule!")
String selectTheRule();
@DefaultMessage("Info")
String infoItemText();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDa
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
@ -85,36 +86,49 @@ public class RuleOpenPanel extends FramedPanel {
private EventBus eventBus; private EventBus eventBus;
private RuleOpenDialog parent; private RuleOpenDialog parent;
private TextButton btnOpen; private TextButton btnEdit;
private TextButton btnClose; private TextButton btnClose;
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader; private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
private Grid<RuleDescriptionData> grid; private Grid<RuleDescriptionData> grid;
private ExtendedListStore<RuleDescriptionData> store; private ExtendedListStore<RuleDescriptionData> store;
private RuleOpenMessages msgs;
private CommonMessages msgsCommon;
public RuleOpenPanel(RuleOpenDialog parent, EventBus eventBus) { public RuleOpenPanel(RuleOpenDialog parent, EventBus eventBus) {
this.parent = parent; this.parent = parent;
this.eventBus = eventBus;
Log.debug("RuleOpenPanel"); Log.debug("RuleOpenPanel");
initMessages();
initPanel();
create();
}
protected void initMessages() {
msgs = GWT.create(RuleOpenMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void initPanel(){
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(false); setBodyBorder(false);
this.eventBus = eventBus;
create();
} }
protected void create() { protected void create() {
ToolBar toolBarHead = new ToolBar(); ToolBar toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Search: ")); toolBarHead.add(new LabelToolItem(msgsCommon.toolItemSearchLabel()));
final TextField searchField = new TextField(); final TextField searchField = new TextField();
toolBarHead.add(searchField); toolBarHead.add(searchField);
TextButton btnReload = new TextButton(); TextButton btnReload = new TextButton();
// btnReload.setText("Reload"); // btnReload.setText("Reload");
btnReload.setIcon(ResourceBundle.INSTANCE.refresh()); btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
btnReload.setToolTip("Reload"); btnReload.setToolTip(msgsCommon.toolItemReloadLabel());
toolBarHead.add(btnReload); toolBarHead.add(btnReload);
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>(); IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
@ -125,7 +139,7 @@ public class RuleOpenPanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
props.name(), 120, "Name"); props.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -138,7 +152,7 @@ public class RuleOpenPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
props.scopeLabel(), 40, "Scope"); props.scopeLabel(), 40, msgs.scopeCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -151,7 +165,7 @@ public class RuleOpenPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
props.description(), 120, "Description"); props.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -163,7 +177,7 @@ public class RuleOpenPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
props.ownerLogin(), 70, "Owner"); props.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -175,7 +189,7 @@ public class RuleOpenPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
props.creationDate(), 56, "Creation Date"); props.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -270,11 +284,11 @@ public class RuleOpenPanel extends FramedPanel {
toolBar.addStyleName(ThemeStyles.get().style().borderTop()); toolBar.addStyleName(ThemeStyles.get().style().borderTop());
toolBar.getElement().getStyle().setProperty("borderBottom", "none"); toolBar.getElement().getStyle().setProperty("borderBottom", "none");
btnOpen = new TextButton("Edit"); btnEdit = new TextButton(msgs.btnEditText());
btnOpen.setIcon(ResourceBundle.INSTANCE.ruleEdit()); btnEdit.setIcon(ResourceBundle.INSTANCE.ruleEdit());
btnOpen.setIconAlign(IconAlign.RIGHT); btnEdit.setIconAlign(IconAlign.RIGHT);
btnOpen.setToolTip("Edit Rule"); btnEdit.setToolTip(msgs.btnEditToolTip());
btnOpen.addSelectHandler(new SelectHandler() { btnEdit.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
Log.debug("Pressed Open"); Log.debug("Pressed Open");
@ -283,10 +297,10 @@ public class RuleOpenPanel extends FramedPanel {
} }
}); });
btnClose = new TextButton("Close"); btnClose = new TextButton(msgsCommon.btnCloseText());
btnClose.setIcon(ResourceBundle.INSTANCE.close()); btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT); btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setToolTip("Close"); btnClose.setToolTip(msgsCommon.btnCloseToolTip());
btnClose.addSelectHandler(new SelectHandler() { btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -300,7 +314,7 @@ public class RuleOpenPanel extends FramedPanel {
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4)); BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnOpen, boxLayoutData); flowButton.add(btnEdit, boxLayoutData);
flowButton.add(btnClose, boxLayoutData); flowButton.add(btnClose, boxLayoutData);
VerticalLayoutContainer v = new VerticalLayoutContainer(); VerticalLayoutContainer v = new VerticalLayoutContainer();
@ -327,8 +341,8 @@ public class RuleOpenPanel extends FramedPanel {
} else { } else {
Log.error("Load rules failure:" Log.error("Load rules failure:"
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving rules", UtilsGXT3.alert(msgs.errorRetrievingRulesHead(),
"Error retrieving rules"); msgs.errorRetrievingRules());
} }
callback.onFailure(caught); callback.onFailure(caught);
@ -359,7 +373,7 @@ public class RuleOpenPanel extends FramedPanel {
RuleDescriptionData rule = getSelectedItem(); RuleDescriptionData rule = getSelectedItem();
if (rule == null) { if (rule == null) {
UtilsGXT3.info("Attention", "Select the rule"); UtilsGXT3.info(msgsCommon.attention(), msgs.selectTheRule());
} else { } else {
parent.ruleEdit(rule); parent.ruleEdit(rule);
@ -410,7 +424,7 @@ public class RuleOpenPanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {

View File

@ -5,6 +5,7 @@ import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.sharewidget.client.RuleShare; import org.gcube.portlets.user.td.sharewidget.client.RuleShare;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window; import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent;
@ -21,22 +22,27 @@ public class RuleShareDialog extends Window {
private static final String HEIGHT = "530px"; private static final String HEIGHT = "530px";
private EventBus eventBus; private EventBus eventBus;
private RuleShareMessages msgs;
public RuleShareDialog(EventBus eventBus) { public RuleShareDialog(EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
initMessages();
initWindow(); initWindow();
RuleSharePanel templateDeletePanel = new RuleSharePanel(this, RuleSharePanel templateDeletePanel = new RuleSharePanel(this,
eventBus); eventBus);
add(templateDeletePanel); add(templateDeletePanel);
} }
protected void initMessages() {
msgs = GWT.create(RuleShareMessages.class);
}
protected void initWindow() { protected void initWindow() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setBodyBorder(false); setBodyBorder(false);
setResizable(false); setResizable(false);
setHeadingText("Share Rule"); setHeadingText(msgs.dialogRuleShareHead());
setClosable(true); setClosable(true);
setModal(true); setModal(true);
forceLayoutOnResize = true; forceLayoutOnResize = true;

View File

@ -0,0 +1,49 @@
package org.gcube.portlets.user.td.rulewidget.client;
import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface RuleShareMessages extends Messages {
@DefaultMessage("Share Rule")
String dialogRuleShareHead();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Scope")
String scopeCol();
@DefaultMessage("Share")
String btnShareText();
@DefaultMessage("Share")
String btnShareToolTip();
@DefaultMessage("Error retrieving rules")
String errorRetrievingRulesHead();
@DefaultMessage("Error retrieving rules!")
String errorRetrievingRules();
@DefaultMessage("Select the rule")
String selectTheRule();
@DefaultMessage("Info")
String infoItemText();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDa
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
@ -86,6 +87,8 @@ public class RuleSharePanel extends FramedPanel {
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader; private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
private Grid<RuleDescriptionData> grid; private Grid<RuleDescriptionData> grid;
private ExtendedListStore<RuleDescriptionData> store; private ExtendedListStore<RuleDescriptionData> store;
private RuleShareMessages msgs;
private CommonMessages msgsCommon;
interface RuleShareTemplates extends XTemplates { interface RuleShareTemplates extends XTemplates {
@XTemplate("<span title=\"{value}\">{value}</span>") @XTemplate("<span title=\"{value}\">{value}</span>")
@ -94,27 +97,36 @@ public class RuleSharePanel extends FramedPanel {
public RuleSharePanel(RuleShareDialog parent, EventBus eventBus) { public RuleSharePanel(RuleShareDialog parent, EventBus eventBus) {
this.parent = parent; this.parent = parent;
Log.debug("RuleSharePanel");
setWidth(WIDTH);
setHeight(HEIGHT);
setHeaderVisible(false);
setBodyBorder(false);
this.eventBus = eventBus; this.eventBus = eventBus;
Log.debug("RuleSharePanel");
initMessages();
initPanel();
create(); create();
} }
protected void initMessages() {
msgs = GWT.create(RuleShareMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void initPanel(){
setWidth(WIDTH);
setHeight(HEIGHT);
setHeaderVisible(false);
setBodyBorder(false);
}
protected void create() { protected void create() {
ToolBar toolBarHead = new ToolBar(); ToolBar toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Search: ")); toolBarHead.add(new LabelToolItem(msgsCommon.toolItemSearchLabel()));
final TextField searchField = new TextField(); final TextField searchField = new TextField();
toolBarHead.add(searchField); toolBarHead.add(searchField);
TextButton btnReload = new TextButton(); TextButton btnReload = new TextButton();
// btnReload.setText("Reload"); // btnReload.setText("Reload");
btnReload.setIcon(ResourceBundle.INSTANCE.refresh()); btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
btnReload.setToolTip("Reload"); btnReload.setToolTip(msgsCommon.toolItemReloadLabel());
toolBarHead.add(btnReload); toolBarHead.add(btnReload);
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>(); IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
@ -125,7 +137,7 @@ public class RuleSharePanel extends FramedPanel {
.create(RuleDescriptionDataProperties.class); .create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
props.name(), 120, "Name"); props.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -138,7 +150,7 @@ public class RuleSharePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
props.scopeLabel(), 40, "Scope"); props.scopeLabel(), 40, msgs.scopeCol());
nameCol.setCell(new AbstractCell<String>() { nameCol.setCell(new AbstractCell<String>() {
@ -151,7 +163,7 @@ public class RuleSharePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
props.description(), 120, "Description"); props.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -163,7 +175,7 @@ public class RuleSharePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
props.ownerLogin(), 70, "Owner"); props.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() { ownerCol.setCell(new AbstractCell<String>() {
@Override @Override
@ -175,7 +187,7 @@ public class RuleSharePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>( ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
props.creationDate(), 56, "Creation Date"); props.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf)); creationDateCol.setCell(new DateCell(sdf));
@ -272,10 +284,10 @@ public class RuleSharePanel extends FramedPanel {
btnClose = new TextButton("Close"); btnClose = new TextButton(msgsCommon.btnCloseText());
btnClose.setIcon(ResourceBundle.INSTANCE.close()); btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT); btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setToolTip("Close"); btnClose.setToolTip(msgsCommon.btnCloseToolTip());
btnClose.addSelectHandler(new SelectHandler() { btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -284,10 +296,10 @@ public class RuleSharePanel extends FramedPanel {
} }
}); });
btnShare = new TextButton("Share"); btnShare = new TextButton(msgs.btnShareText());
btnShare.setIcon(ResourceBundle.INSTANCE.ruleShare()); btnShare.setIcon(ResourceBundle.INSTANCE.ruleShare());
btnShare.setIconAlign(IconAlign.RIGHT); btnShare.setIconAlign(IconAlign.RIGHT);
btnShare.setToolTip("Share"); btnShare.setToolTip(msgs.btnShareToolTip());
btnShare.addSelectHandler(new SelectHandler() { btnShare.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
@ -328,8 +340,8 @@ public class RuleSharePanel extends FramedPanel {
} else { } else {
Log.error("Load rules failure:" Log.error("Load rules failure:"
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving rules", UtilsGXT3.alert(msgs.errorRetrievingRulesHead(),
"Error retrieving rules"); msgs.errorRetrievingRules());
} }
callback.onFailure(caught); callback.onFailure(caught);
@ -362,7 +374,7 @@ public class RuleSharePanel extends FramedPanel {
ArrayList<RuleDescriptionData> rules = getSelectedItem(); ArrayList<RuleDescriptionData> rules = getSelectedItem();
if (rules == null || rules.size() == 0) { if (rules == null || rules.size() == 0) {
UtilsGXT3.info("Attention", "Select the rule"); UtilsGXT3.info(msgsCommon.attention(), msgs.selectTheRule());
} else { } else {
RuleDescriptionData rule = rules.get(0); RuleDescriptionData rule = rules.get(0);
Log.debug("templateShare: " + rule); Log.debug("templateShare: " + rule);
@ -414,7 +426,7 @@ public class RuleSharePanel extends FramedPanel {
Menu contextMenu = new Menu(); Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem(); MenuItem infoItem = new MenuItem();
infoItem.setText("Info"); infoItem.setText(msgs.infoItemText());
infoItem.setIcon(ResourceBundle.INSTANCE.information()); infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() { infoItem.addSelectionHandler(new SelectionHandler<Item>() {

View File

@ -0,0 +1,21 @@
dialogRuleActiveHead = Active Rules On Tabular Resource
btnCloseText = Close
btnCloseToolTip = Close
ruleOnColumnItemHead = Rule On Column
ruleOnTableItemHead = Rule On Table
noRulesOnTableApplied = No rules on table applied!
nameCol = Name
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
errorRetrievingActiveRulesHead = Error retrieving active rules
errorRetrievingAppliedRulesHead = Error retrieving applied rules
infoItemText = Info
infoItemToolTip = Info
detachItemText = Detach
detachItemToolTip = Detach rule
errorInDetachRulesHead = Error in detach rules
ruleIsDetachedHead = Detach Rule
ruleIsDetached = The rule is detached!
errorTheRequestedColumnIsNull = The requested columns is null!
noRuleOnColumnApplied = No rules on column applied!

View File

@ -0,0 +1,21 @@
dialogRuleActiveHead = Reglas Activas en la Tabular Resource
btnCloseText = Cerrar
btnCloseToolTip = Cerrar
ruleOnColumnItemHead = Regla sobre la Columna
ruleOnTableItemHead = Regla sobre la Tabla
noRulesOnTableApplied = No hay reglas que se aplican sobre la Tabla!
nameCol = Nombre
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
errorRetrievingActiveRulesHead = Error al recuperar las reglas activas
errorRetrievingAppliedRulesHead = Error al recuperar las reglas aplicadas
infoItemText = Info
infoItemToolTip = Información
detachItemText = Inaplicada
detachItemToolTip = Inaplicada regla
errorInDetachRulesHead = Error en la inaplicación de la regla
ruleIsDetachedHead = Inaplica
ruleIsDetached = La regla no se aplica!
errorTheRequestedColumnIsNull = La columna deseada está null!
noRuleOnColumnApplied = No hay reglas que se aplican sobre la Columna!

View File

@ -0,0 +1,21 @@
dialogRuleActiveHead = Regole Attive sulla Tabular Resource
btnCloseText = Chiudi
btnCloseToolTip = Chiudi
ruleOnColumnItemHead = Regole su Colonna
ruleOnTableItemHead = Regole su Tabella
noRulesOnTableApplied = Nessuna regola su tabella applicata!
nameCol = Nome
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
errorRetrievingActiveRulesHead = Errore recuperando le regole attive
errorRetrievingAppliedRulesHead = Errore recuperando le regole applicate
infoItemText = Info
infoItemToolTip = Informazioni
detachItemText = Disapplica
detachItemToolTip = Disapplica regola
errorInDetachRulesHead = Errore disapplicando le regole
ruleIsDetachedHead = Disapplica
ruleIsDetached = La regola non è più applicata!
errorTheRequestedColumnIsNull = La colonna richiesta è nulla!
noRuleOnColumnApplied = Nessuna regola su colonna applicata!

View File

@ -0,0 +1,17 @@
dialogRuleDeleteHead = Delete Rule
btnCloseText = Close
btnCloseToolTip = Close
ruleIsDeletedHead = Delete Rule
ruleIsDeleted = The rule is deleted!
errorDeletingRuleOnColumnHead = Error deleting rule on column
nameCol = Name
scopeCol = Scope
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
btnDeleteText = Delete
btnDeleteToolTip = Delete
errorRetrievingRulesHead = Error retrieving rules
errorRetrievingRules = Error retrieving rules!
selectTheRuleToBeDeleted = Select the rule to be deleted!
infoItemText = Info

View File

@ -0,0 +1,17 @@
dialogRuleDeleteHead = Borrar Regola
btnCloseText = Cerrar
btnCloseToolTip = Cerrar
ruleIsDeletedHead = Borrar Regla
ruleIsDeleted = La regla es eliminada!
errorDeletingRuleOnColumnHead = Error eliminando la regla
nameCol = Nombre
scopeCol = Scope
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
btnDeleteText = Borrar
btnDeleteToolTip = Borrar
errorRetrievingRulesHead = Error al recuperar las reglas
errorRetrievingRules = Error al recuperar las reglas!
selectTheRuleToBeDeleted = Seleccionar la regla para eliminar!
infoItemText = Info

View File

@ -0,0 +1,17 @@
dialogRuleDeleteHead = Elimina Regola
btnCloseText = Chiudi
btnCloseToolTip = Chiudi
ruleIsDeletedHead = Elimina Regola
ruleIsDeleted = La regola è eliminata!
errorDeletingRuleOnColumnHead = Errore eliminando la regola
nameCol = Nome
scopeCol = Scope
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
btnDeleteText = Elimina
btnDeleteToolTip = Elimina
errorRetrievingRulesHead = Errore recuperando le regole
errorRetrievingRules = Errore recuperando le regole!
selectTheRuleToBeDeleted = Seleziona la regole da eliminare!
infoItemText = Info

View File

@ -0,0 +1,8 @@
dialogRuleInfoHead = Info Rule
configurationFieldSetHead = Configuration
nameLabel = Name
scopeLabel = Scope
descriptionLabel = Description
ownerLabel = Owner
creationDateLabel = Creation Date
expressionLabel = Expression

View File

@ -0,0 +1,9 @@
dialogRuleInfoHead = Info Regla
configurationFieldSetHead = Configuración
nameLabel = Nombre
scopeLabel = Scope
descriptionLabel = Descripción
ownerLabel = Propietario
creationDateLabel = Fecha Creacion
expressionLabel = Expresión

View File

@ -0,0 +1,9 @@
dialogRuleInfoHead = Info Regola
configurationFieldSetHead = Configurazione
nameLabel = Nome
scopeLabel = Scope
descriptionLabel = Descrizione
ownerLabel = Proprietario
creationDateLabel = Data Creazione
expressionLabel = Espressione

View File

@ -0,0 +1,20 @@
dialogRuleOnColumnHead = Apply Rules On Column
applyRulesOnColumnHead = Apply Rules On Column
columnIsNull = The requested column is null!
configurationFieldSetHead = Configuration
comboColumnsEmptyText = Select a column...
comboColumnsLabel = Column
nameCol = Name
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
rulesApplicableLabel = Applicable Rules
rulesSelectedLabel = Selected Rules
ruleTip = <p>Tip.: Use drag and drop in order to change selected rules.</p>
btnApplyText = Apply
btnApplyToolTip = Apply Rule
errorRetrievingApplicableRulesHead = Error retrieving applicable rules
errorRetrievingSelectedRulesHead = Error retrieving selected rules
selectARule = Select a rule!
selectAColumn = Select a column!
infoItemText = Info

View File

@ -0,0 +1,21 @@
dialogRuleOnColumnHead = Aplica Regla Sobre La Columna
applyRulesOnColumnHead = Aplica Regla Sobre La Columna
columnIsNull = La columna deseada está null!
configurationFieldSetHead = Configuración
comboColumnsEmptyText = Seleccione una columna...
comboColumnsLabel = Columna
nameCol = Nombre
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
rulesApplicableLabel = Reglas Aplicable
rulesSelectedLabel = Reglas Seleccionadas
ruleTip = <p>Tip.: Use arrastrar y soltar para cambiar las reglas seleccionadas.</p>
btnApplyText = Aplica
btnApplyToolTip = Aplica Reglas
errorRetrievingApplicableRulesHead = Error al recuperar las reglas aplicable
errorRetrievingSelectedRulesHead = Error al recuperar las reglas seleccionadas
selectARule = Seleccione una regla!
selectAColumn = Seleccione una columna!
infoItemText = Info

View File

@ -0,0 +1,20 @@
dialogRuleOnColumnHead = Applica Regole Su Colonna
applyRulesOnColumnHead = Applica Regole Su Colonna
columnIsNull = La colonna richiesta è nulla!
configurationFieldSetHead = Configurazione
comboColumnsEmptyText = Seleziona una colonna...
comboColumnsLabel = Colonna
nameCol = Nome
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
rulesApplicableLabel = Regole Applicabili
rulesSelectedLabel = Regole Selezionate
ruleTip = <p>Tip.: Usa drag and drop per cambiare le regole selezionate.</p>
btnApplyText = Applica
btnApplyToolTip = Applica Regole
errorRetrievingApplicableRulesHead = Errore recuperando le regole applicabili
errorRetrievingSelectedRulesHead = Errore recuperando le regole selezionate
selectARule = Seleziona una regola!
selectAColumn = Seleziona una colonna!
infoItemText = Info

View File

@ -0,0 +1,12 @@
dialogRuleOpenHead = Open Rule
nameCol = Name
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
scopeCol = Scope
btnEditText = Edit
btnEditToolTip = Edit rule
errorRetrievingRulesHead = Error retrieving rules
errorRetrievingRules = Error retrieving rules!
selectTheRule = Select the rule!
infoItemText = Info

View File

@ -0,0 +1,13 @@
dialogRuleOpenHead = Abrir Regla
nameCol = Nombre
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
scopeCol = Scope
btnEditText = Editar
btnEditToolTip = Editar regla
errorRetrievingRulesHead = Error al recuperar las reglas
errorRetrievingRules = Error al recuperar las reglas!
selectTheRule = Seleccione la regla!
infoItemText = Info

View File

@ -0,0 +1,12 @@
dialogRuleOpenHead = Apri Regola
nameCol = Nome
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
scopeCol = Scope
btnEditText = Modifica
btnEditToolTip = Modifica regola
errorRetrievingRulesHead = Errore recuperando le regole
errorRetrievingRules = Errore recuperando le regole!
selectTheRule = Seleziona la regola!
infoItemText = Info

View File

@ -0,0 +1,12 @@
dialogRuleShareHead = Share Rule
nameCol = Name
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
scopeCol = Scope
btnShareText = Share
btnShareToolTip = Share
errorRetrievingRulesHead = Error retrieving rules
errorRetrievingRules = Error retrieving rules!
selectTheRule = Select the rule
infoItemText = Info

View File

@ -0,0 +1,12 @@
dialogRuleShareHead = Compartir Regla
nameCol = Nombre
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
scopeCol = Scope
btnShareText = Compartir
btnShareToolTip = Compartir regla
errorRetrievingRulesHead = Error al recuperar las reglas
errorRetrievingRules = Error al recuperar las reglas!
selectTheRule = Seleccione la regla!
infoItemText = Info

View File

@ -0,0 +1,12 @@
dialogRuleShareHead = Condividi Regola
nameCol = Nome
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
scopeCol = Scope
btnShareText = Condividi
btnShareToolTip = Condividi
errorRetrievingRulesHead = Errore recuperando le regole
errorRetrievingRules = Errore recuperando le regole!
selectTheRule = Seleziona la regola!
infoItemText = Info