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@119885 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-10-20 11:11:54 +00:00 committed by Giancarlo Panichi
parent 7178883fed
commit db1befc86c
16 changed files with 426 additions and 102 deletions

View File

@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleType;
import org.gcube.portlets.user.td.rulewidget.client.multicolumn.data.MapPlaceHolderToColumnRow;
import org.gcube.portlets.user.td.rulewidget.client.multicolumn.data.MapPlaceHolderToColumnRowProperties;
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.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
@ -62,7 +63,9 @@ import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
*
*/
public class RuleOnTableApplyMapColumnCard extends WizardCard {
private static RuleOnTableApplyMessages msgs=GWT.create(RuleOnTableApplyMessages.class);
private CommonMessages msgsCommon;
private RuleOnTableApplyMapColumnCard thisCard;
private ApplyTableRuleSession applyTableRuleSession;
private Grid<MapPlaceHolderToColumnRow> grid;
@ -70,16 +73,21 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
private ArrayList<MapPlaceHolderToColumnRow> rows;
private ArrayList<ColumnData> columns;
private ListStore<ColumnData> storeComboColumnData;
public RuleOnTableApplyMapColumnCard(
ApplyTableRuleSession applyTableRuleSession) {
super("Map columns", "");
super(msgs.ruleOnTableApplyMapColumnCardHead(), "");
this.thisCard = this;
this.applyTableRuleSession = applyTableRuleSession;
initMessages();
createData();
retrieveColumns();
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
protected void createData() {
RuleDescriptionData ruleDescriptionData = applyTableRuleSession
@ -109,8 +117,8 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
}
};
AlertMessageBox d = new AlertMessageBox("Attention",
"This is not a rule on table!");
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
msgs.thisIsNotARuleOnTable());
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();
@ -134,9 +142,9 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
.create(MapPlaceHolderToColumnRowProperties.class);
ColumnConfig<MapPlaceHolderToColumnRow, String> placeHolderCol = new ColumnConfig<MapPlaceHolderToColumnRow, String>(
props.placeHolderLabel(), 220, "Place Holder");
props.placeHolderLabel(), 220, msgs.placeHolderCol());
ColumnConfig<MapPlaceHolderToColumnRow, ColumnData> columnCol = new ColumnConfig<MapPlaceHolderToColumnRow, ColumnData>(
props.column(), 220, "Column");
props.column(), 220, msgs.columnCol());
columnCol.setCell(new AbstractCell<ColumnData>() {
@ -293,13 +301,13 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving column",
UtilsGXT3.alert(msgs.errorRetrievingColumnsHead(),
caught.getMessage());
}
}
@ -376,8 +384,8 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
};
if (store == null || store.size() <= 0) {
AlertMessageBox d = new AlertMessageBox("Attention",
"Error no mapping for this table Rule!");
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
msgs.errorNoMappingForThisTableRule());
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();

View File

@ -0,0 +1,76 @@
package org.gcube.portlets.user.td.rulewidget.client.multicolumn;
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 RuleOnTableApplyMessages extends Messages {
@DefaultMessage("Apply Rule On Table")
String ruleOnTableApplyWizardHead();
@DefaultMessage("Select Rule")
String ruleOnTableApplySelectRuleCardHead();
@DefaultMessage("Name")
String nameCol();
@DefaultMessage("Description")
String descriptionCol();
@DefaultMessage("Owner")
String ownerCol();
@DefaultMessage("Creation Date")
String creationDateCol();
@DefaultMessage("Scope")
String scopeCol();
@DefaultMessage("Error retrieving rules!")
String errorRetrievingRules();
@DefaultMessage("Select a rule!")
String selectARule();
@DefaultMessage("Info")
String infoItemText();
@DefaultMessage("Map columns")
String ruleOnTableApplyMapColumnCardHead();
@DefaultMessage("This is not a rule on table!")
String thisIsNotARuleOnTable();
@DefaultMessage("Place Holder")
String placeHolderCol();
@DefaultMessage("Column")
String columnCol();
@DefaultMessage("Error retrieving columns")
String errorRetrievingColumnsHead();
@DefaultMessage("Error no mapping for this table Rule!")
String errorNoMappingForThisTableRule();
@DefaultMessage("Apply Rule On Table")
String ruleOnTableApplyOperationInProgressCardHead();
@DefaultMessage("Rule Name: ")
String ruleNameLabel();
@DefaultMessage("Rule Description: ")
String ruleDescriptionLabel();
@DefaultMessage("Rule On Table")
String summaryHead();
@DefaultMessage("An error occured in apply rule on table: ")
String errorInApplyRuleOnTable();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyTableRuleSession;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
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.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
@ -16,6 +17,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -36,15 +38,18 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
*/
public class RuleOnTableApplyOperationInProgressCard extends WizardCard
implements MonitorDialogListener {
private static RuleOnTableApplyMessages msgs=GWT.create(RuleOnTableApplyMessages.class);
private CommonMessages msgsCommon;
private HtmlLayoutContainer resultField;
private ApplyTableRuleSession applyTableRuleSession;
public RuleOnTableApplyOperationInProgressCard(
ApplyTableRuleSession applyTableRuleSession) {
super("Apply Rule On Table", "");
super(msgs.ruleOnTableApplyOperationInProgressCardHead(), "");
this.applyTableRuleSession = applyTableRuleSession;
initMessages();
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
@ -56,16 +61,16 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
// display:block;vertical-align:text-top;
description.setHTML(0, 0,
"<span style=\"font-weight:bold;\";>Rule Name: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.ruleNameLabel()+"</span>");
description.setText(0, 1, applyTableRuleSession
.getRuleDescriptionData().getName());
description.setHTML(1, 0,
"<span style=\"font-weight:bold;\";>Rule Description: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.ruleDescriptionLabel()+"</span>");
description.setText(1, 1, applyTableRuleSession
.getRuleDescriptionData().getDescription());
FramedPanel summary = new FramedPanel();
summary.setHeadingText("Rule On Table");
summary.setHeadingText(msgs.summaryHead());
summary.setWidth(400);
summary.add(description);
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
@ -80,6 +85,10 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
resultField.setVisible(false);
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
public void applyTableRule() {
ExpressionServiceAsync.INSTANCE.startApplyTableRule(applyTableRuleSession,
@ -99,11 +108,11 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error","Error ",
showErrorAndHide(msgsCommon.errorLocked(),msgsCommon.errorLocked(),
caught.getLocalizedMessage(), caught);
} else {
showErrorAndHide("Error",
"An error occured in apply rule on table: ",
showErrorAndHide(msgsCommon.error(),
msgs.errorInApplyRuleOnTable(),
caught.getLocalizedMessage(),
caught);
@ -135,7 +144,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
final TRId newTrId = operationResult.getTrId();
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>"+msgsCommon.operationCompleted()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);
@ -166,7 +175,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
public void operationFailed(Throwable caught, String reason, String details) {
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color:red;'>Operation Failed</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color:red;'>"+msgsCommon.operationFailed()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);
if (caught instanceof TDGWTSessionExpiredException) {
@ -175,7 +184,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide("Error",
showErrorAndHide(msgsCommon.error(),
reason,details,caught);
}
@ -187,7 +196,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
final TRId newTrId = operationResult.getTrId();
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>Validation Failed</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>"+msgsCommon.validationFailed()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);
@ -219,7 +228,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
public void operationAborted() {
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>Operation Aborted</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>"+msgsCommon.operationAborted()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);
@ -249,7 +258,7 @@ public class RuleOnTableApplyOperationInProgressCard extends WizardCard
public void operationPutInBackground() {
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>Operation in Background</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>"+msgsCommon.operationInBackground()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.rulewidget.client.RuleInfoDialog;
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.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
@ -78,6 +79,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class RuleOnTableApplySelectRuleCard extends WizardCard {
private static final String GRID_HEIGHT = "334px";
private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
private static RuleOnTableApplyMessages msgs=GWT.create(RuleOnTableApplyMessages.class);
private CommonMessages msgsCommon;
interface RuleOnTableSelectTemplates extends XTemplates {
@XTemplate("<span title=\"{value}\">{value}</span>")
@ -91,15 +94,22 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
private RuleDescriptionData ruleDescriptionData;
public RuleOnTableApplySelectRuleCard(ApplyTableRuleSession applyTableRuleSession) {
super("Select Rule",
super(msgs.ruleOnTableApplySelectRuleCardHead(),
"");
this.thisCard = this;
this.applyTableRuleSession=applyTableRuleSession;
initMessages();
FormPanel panel = createPanel();
setCenterWidget(panel, new MarginData(0));
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
protected FormPanel createPanel() {
FormPanel panel = new FormPanel();
@ -112,14 +122,14 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
//ToolBarHead
ToolBar toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Search: "));
toolBarHead.add(new LabelToolItem(msgsCommon.toolItemSearchLabel()));
final TextField searchField = new TextField();
toolBarHead.add(searchField);
TextButton btnReload = new TextButton();
// btnReload.setText("Reload");
btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
btnReload.setToolTip("Reload");
btnReload.setToolTip(msgsCommon.toolItemReloadLabel());
toolBarHead.add(btnReload);
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
@ -130,7 +140,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
.create(RuleDescriptionDataProperties.class);
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
props.name(), 120, "Name");
props.name(), 120, msgs.nameCol());
nameCol.setCell(new AbstractCell<String>() {
@ -143,7 +153,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
});
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
props.scopeLabel(), 40, "Scope");
props.scopeLabel(), 40, msgs.scopeCol());
nameCol.setCell(new AbstractCell<String>() {
@ -157,7 +167,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
props.description(), 120, "Description");
props.description(), 120, msgs.descriptionCol());
descriptionCol.setCell(new AbstractCell<String>() {
@Override
@ -169,7 +179,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
});
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
props.ownerLogin(), 70, "Owner");
props.ownerLogin(), 70, msgs.ownerCol());
ownerCol.setCell(new AbstractCell<String>() {
@Override
@ -181,7 +191,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
});
ColumnConfig<RuleDescriptionData, Date> creationDateCol = new ColumnConfig<RuleDescriptionData, Date>(
props.creationDate(), 56, "Creation Date");
props.creationDate(), 56, msgs.creationDateCol());
creationDateCol.setCell(new DateCell(sdf));
@ -297,8 +307,8 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
} else {
Log.error("Load rules failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving rules",
"Error retrieving rules");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingRules());
}
callback.onFailure(caught);
@ -385,8 +395,8 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
tdRuleType);
*/
if (ruleDescriptionData == null) {
AlertMessageBox d = new AlertMessageBox("Attention",
"Select one rule!");
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
msgs.selectARule());
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();
@ -421,7 +431,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
Menu contextMenu = new Menu();
MenuItem infoItem = new MenuItem();
infoItem.setText("Info");
infoItem.setText(msgs.infoItemText());
infoItem.setIcon(ResourceBundle.INSTANCE.information());
infoItem.addSelectionHandler(new SelectionHandler<Item>() {

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.web.bindery.event.shared.EventBus;
@ -21,6 +22,7 @@ import com.google.web.bindery.event.shared.EventBus;
public class RuleOnTableApplyWizard extends WizardWindow {
private static final String WIZARDWIDTH = "770px";
private static final String WIZARDHEIGHT = "520px";
private static RuleOnTableApplyMessages msgs=GWT.create(RuleOnTableApplyMessages.class);
private TRId trId;
/**
*
@ -28,7 +30,7 @@ public class RuleOnTableApplyWizard extends WizardWindow {
* @param eventBus
*/
public RuleOnTableApplyWizard(TRId trId, EventBus eventBus) {
super("Apply Rule On Table",eventBus);
super(msgs.ruleOnTableApplyWizardHead(),eventBus);
this.trId=trId;
Log.debug("RuleOnTableApplyWizard");
setWidth(WIZARDWIDTH);

View File

@ -6,6 +6,7 @@ import org.gcube.portlets.user.td.expressionwidget.client.properties.RuleColumnP
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleColumnPlaceHolderDescriptor;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType;
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.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
@ -64,6 +65,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
*/
public class RuleOnTableNewDefinitionCard extends WizardCard {
public interface DataTypePropertiesCombo extends
PropertyAccess<ColumnDataType> {
@ -75,20 +77,30 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
}
private static int seq;
private static RuleOnTableNewMessages msgs = GWT
.create(RuleOnTableNewMessages.class);
private CommonMessages msgsCommon;
private RuleOnTableNewDefinitionCard thisCard;
private TDRuleTableType tdRuleTableType;
private Grid<RuleColumnPlaceHolderDescriptor> grid;
private ListStore<RuleColumnPlaceHolderDescriptor> store;
private boolean addStatus;
public RuleOnTableNewDefinitionCard() {
super("Columns Definition",
"N.B. Use drag and drop in order to change the position of the columns");
super(msgs.ruleOnTableNewDefinitionCardHead(),
msgs.ruleOnTableNewDefinitionCardFoot());
this.thisCard = this;
initMessages();
FormPanel panel = createPanel();
setCenterWidget(panel, new MarginData(0));
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
protected FormPanel createPanel() {
FormPanel panel = new FormPanel();
@ -102,14 +114,14 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
RuleColumnPlaceHolderDescriptorProperties props = GWT
.create(RuleColumnPlaceHolderDescriptorProperties.class);
ColumnConfig<RuleColumnPlaceHolderDescriptor, String> labelColumn = new ColumnConfig<RuleColumnPlaceHolderDescriptor, String>(
props.label(), 220, "Label");
ColumnConfig<RuleColumnPlaceHolderDescriptor, ColumnDataType> columnDataTypeColumn = new ColumnConfig<RuleColumnPlaceHolderDescriptor, ColumnDataType>(
props.columnDataType(), 130, "Data Type");
ColumnConfig<RuleColumnPlaceHolderDescriptor, String> labelCol = new ColumnConfig<RuleColumnPlaceHolderDescriptor, String>(
props.label(), 220, msgs.labelCol());
ColumnConfig<RuleColumnPlaceHolderDescriptor, ColumnDataType> columnDataTypeCol = new ColumnConfig<RuleColumnPlaceHolderDescriptor, ColumnDataType>(
props.columnDataType(), 130, msgs.columnDataTypeCol());
ArrayList<ColumnConfig<RuleColumnPlaceHolderDescriptor, ?>> l = new ArrayList<ColumnConfig<RuleColumnPlaceHolderDescriptor, ?>>();
l.add(labelColumn);
l.add(columnDataTypeColumn);
l.add(labelCol);
l.add(columnDataTypeCol);
ColumnModel<RuleColumnPlaceHolderDescriptor> columns = new ColumnModel<RuleColumnPlaceHolderDescriptor>(
l);
@ -127,7 +139,7 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
grid.setBorders(false);
grid.setLoadMask(true);
grid.setColumnReordering(false);
grid.getView().setAutoExpandColumn(labelColumn);
grid.getView().setAutoExpandColumn(labelCol);
grid.getView().setSortingEnabled(false);
GridDragSource<RuleColumnPlaceHolderDescriptor> ds = new GridDragSource<RuleColumnPlaceHolderDescriptor>(
@ -167,14 +179,14 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
final GridRowEditing<RuleColumnPlaceHolderDescriptor> editing = new GridRowEditing<RuleColumnPlaceHolderDescriptor>(
grid);
editing.addEditor(labelColumn, labelField);
editing.addEditor(columnDataTypeColumn, comboColumnDataType);
editing.addEditor(labelCol, labelField);
editing.addEditor(columnDataTypeCol, comboColumnDataType);
final TextButton addButton = new TextButton("Add Column");
addButton.setIcon(ResourceBundle.INSTANCE.columnAdd24());
addButton.setIconAlign(IconAlign.TOP);
addButton.setToolTip("Add Column");
addButton.addSelectHandler(new SelectHandler() {
final TextButton btnAddColumn = new TextButton(msgs.btnAddColumnText());
btnAddColumn.setIcon(ResourceBundle.INSTANCE.columnAdd24());
btnAddColumn.setIconAlign(IconAlign.TOP);
btnAddColumn.setToolTip(msgs.btnAddColumnToolTip());
btnAddColumn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
@ -193,8 +205,8 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
}
});
TextButton deleteBtn = new TextButton("Delete");
deleteBtn.addSelectHandler(new SelectEvent.SelectHandler() {
TextButton btnDelete = new TextButton(msgs.btnDeleteText());
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
public void onSelect(SelectEvent event) {
GridCell cell = editing.getActiveCell();
int rowIndex = cell.getRow();
@ -205,7 +217,7 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
store.commitChanges();
editing.getCancelButton().setVisible(true);
addButton.setEnabled(true);
btnAddColumn.setEnabled(true);
setEnableNextButton(true);
if (addStatus) {
addStatus = false;
@ -213,14 +225,14 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
}
});
ButtonBar buttonBar = editing.getButtonBar();
buttonBar.add(deleteBtn);
buttonBar.add(btnDelete);
editing.addBeforeStartEditHandler(new BeforeStartEditHandler<RuleColumnPlaceHolderDescriptor>() {
@Override
public void onBeforeStartEdit(
BeforeStartEditEvent<RuleColumnPlaceHolderDescriptor> event) {
addButton.setEnabled(false);
btnAddColumn.setEnabled(false);
setEnableNextButton(false);
}
});
@ -231,7 +243,7 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
public void onCancelEdit(
CancelEditEvent<RuleColumnPlaceHolderDescriptor> event) {
store.rejectChanges();
addButton.setEnabled(true);
btnAddColumn.setEnabled(true);
setEnableNextButton(true);
}
@ -278,14 +290,14 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
store.rejectChanges();
}
UtilsGXT3
.alert("Attention",
"This label is already present, please choose another(case insensitive)!");
.alert(msgsCommon.attention(),
msgs.labelAlreadyPresent());
} else {
store.commitChanges();
}
editing.getCancelButton().setVisible(true);
addButton.setEnabled(true);
btnAddColumn.setEnabled(true);
setEnableNextButton(true);
} catch (Throwable e) {
@ -298,7 +310,7 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
//
ToolBar toolBar = new ToolBar();
toolBar.add(addButton);
toolBar.add(btnAddColumn);
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(grid, new VerticalLayoutData(1, 1, new Margins(0)));
@ -352,8 +364,8 @@ public class RuleOnTableNewDefinitionCard extends WizardCard {
};
if (store == null || store.size() <= 0) {
AlertMessageBox d = new AlertMessageBox("Attention",
"Add at least one column");
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
msgs.addAtLeastOneColumn());
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();

View File

@ -7,9 +7,11 @@ import org.gcube.portlets.user.td.expressionwidget.client.exception.MultiColumnE
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.sencha.gxt.core.client.util.Padding;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
@ -25,20 +27,28 @@ import com.sencha.gxt.widget.core.client.form.FormPanel;
*
*/
public class RuleOnTableNewExpressionCard extends WizardCard {
private static RuleOnTableNewMessages msgs=GWT.create(RuleOnTableNewMessages.class);
private CommonMessages msgsCommon;
private RuleOnTableNewExpressionCard thisCard;
private TDRuleTableType tdRuleTableType;
private RuleDescriptionData ruleDescriptionData;
private MultiColumnExpressionPanel multiColumnExpressionPanel;
public RuleOnTableNewExpressionCard(TDRuleTableType tdRuleTableType) {
super("Create Expression",
super(msgs.ruleOnTableNewExpressionCardHead(),
"");
this.thisCard = this;
this.tdRuleTableType=tdRuleTableType;
initMessages();
FormPanel panel = createPanel();
setCenterWidget(panel, new MarginData(0));
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
protected FormPanel createPanel() {
FormPanel panel = new FormPanel();
@ -50,7 +60,7 @@ public class RuleOnTableNewExpressionCard extends WizardCard {
multiColumnExpressionPanel = new MultiColumnExpressionPanel(null, ruleDescriptionData);
panel.add(multiColumnExpressionPanel);
} catch (Throwable e) {
showErrorAndHide("Error", e.getLocalizedMessage(), e.getLocalizedMessage(), e);
showErrorAndHide(msgsCommon.error(), e.getLocalizedMessage(), e.getLocalizedMessage(), e);
}
return panel;
@ -105,11 +115,11 @@ public class RuleOnTableNewExpressionCard extends WizardCard {
if(multiColumnExpressionPanel!=null){
ruleDescriptionData = multiColumnExpressionPanel.getRuleOnTable();
} else {
showErrorAndHide("Error","Error creating rule on table!", "", new Exception("Error creating rule on table!"));
showErrorAndHide(msgsCommon.error(),msgs.errorCreatingRuleOnTable(), "", new Exception(msgs.errorCreatingRuleOnTable()));
return;
}
} catch (MultiColumnExpressionPanelException e) {
AlertMessageBox d = new AlertMessageBox("Attention",
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
e.getLocalizedMessage());
d.addHideHandler(hideHandler);
d.setModal(false);

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.td.rulewidget.client.multicolumn;
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 RuleOnTableNewMessages extends Messages {
@DefaultMessage("New Rule On Table")
String ruleOnTableNewWizardHead();
@DefaultMessage("Columns Definition")
String ruleOnTableNewDefinitionCardHead();
@DefaultMessage("N.B. Use drag and drop in order to change the position of the columns")
String ruleOnTableNewDefinitionCardFoot();
@DefaultMessage("Label")
String labelCol();
@DefaultMessage("Data Type")
String columnDataTypeCol();
@DefaultMessage("Add Column")
String btnAddColumnText();
@DefaultMessage("Add Column")
String btnAddColumnToolTip();
@DefaultMessage("Delete")
String btnDeleteText();
@DefaultMessage("This label is already present, please choose another(case insensitive)!")
String labelAlreadyPresent();
@DefaultMessage("Add at least one column")
String addAtLeastOneColumn();
@DefaultMessage("Create Expression")
String ruleOnTableNewExpressionCardHead();
@DefaultMessage("Error creating rule on table!")
String errorCreatingRuleOnTable();
@DefaultMessage("Save")
String save();
@DefaultMessage("Rule Name: ")
String ruleNameLabel();
@DefaultMessage("Rule Description: ")
String ruleDescriptionLabel();
@DefaultMessage("Rule On Table")
String summaryHead();
@DefaultMessage("Save Rule")
String ruleSavedHead();
@DefaultMessage("The rule is saved!")
String ruleSaved();
@DefaultMessage("Error saving rule on table ")
String errorSavingRuleOnTable();
}

View File

@ -7,12 +7,14 @@ import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceA
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
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.widgetcommonevent.client.CommonMessages;
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.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -32,18 +34,20 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
*
*/
public class RuleOnTableNewOperationInProgressCard extends WizardCard {
private static RuleOnTableNewMessages msgs = GWT
.create(RuleOnTableNewMessages.class);
protected RuleOnTableNewOperationInProgressCard thisCard;
protected RuleDescriptionData ruleDescriptionData;
protected HtmlLayoutContainer resultField;
private RuleDescriptionData ruleDescriptionData;
private HtmlLayoutContainer resultField;
private CommonMessages msgsCommon;
public RuleOnTableNewOperationInProgressCard(
RuleDescriptionData ruleDescriptionData) {
super("Save", "");
super(msgs.save(), "");
this.ruleDescriptionData = ruleDescriptionData;
thisCard = this;
initMessages();
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
@ -55,14 +59,14 @@ public class RuleOnTableNewOperationInProgressCard extends WizardCard {
// display:block;vertical-align:text-top;
description.setHTML(0, 0,
"<span style=\"font-weight:bold;\";>Rule Name: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.ruleNameLabel()+"</span>");
description.setText(0, 1, ruleDescriptionData.getName());
description.setHTML(1, 0,
"<span style=\"font-weight:bold;\";>Rule Description: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.ruleDescriptionLabel()+"</span>");
description.setText(1, 1, ruleDescriptionData.getDescription());
FramedPanel summary = new FramedPanel();
summary.setHeadingText("Rule On Table");
summary.setHeadingText(msgs.summaryHead());
summary.setWidth(400);
summary.add(description);
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
@ -77,6 +81,10 @@ public class RuleOnTableNewOperationInProgressCard extends WizardCard {
resultField.setVisible(false);
}
protected void initMessages(){
msgsCommon=GWT.create(CommonMessages.class);
}
public void saveRuleOnTable() {
ExpressionServiceAsync.INSTANCE.saveRule(ruleDescriptionData,
@ -87,7 +95,7 @@ public class RuleOnTableNewOperationInProgressCard extends WizardCard {
Log.debug("Saved Rule: " + ruleId);
operationComplete();
UtilsGXT3.info("Save Rule", "The rule is saved!");
UtilsGXT3.info(msgs.ruleSavedHead(), msgs.ruleSaved());
}
@ -101,12 +109,12 @@ public class RuleOnTableNewOperationInProgressCard extends WizardCard {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error",
"Error saving rule on table",
showErrorAndHide(msgsCommon.error(),
msgs.errorSavingRuleOnTable(),
caught.getLocalizedMessage(), caught);
} else {
showErrorAndHide("Error",
"Error saving rule on table: ",
showErrorAndHide(msgsCommon.error(),
msgs.errorSavingRuleOnTable(),
caught.getLocalizedMessage(), caught);
}
@ -131,7 +139,7 @@ public class RuleOnTableNewOperationInProgressCard extends WizardCard {
public void operationComplete() {
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
safeHtmlBuilder
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>");
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>"+msgsCommon.operationCompleted()+"</div>");
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
resultField.setVisible(true);

View File

@ -1,46 +1,43 @@
package org.gcube.portlets.user.td.rulewidget.client.multicolumn;
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class RuleOnTableNewWizard extends WizardWindow {
public class RuleOnTableNewWizard extends WizardWindow {
private static final String WIZARDWIDTH = "950px";
private static final String WIZARDHEIGHT = "512px";
private static RuleOnTableNewMessages msgs = GWT
.create(RuleOnTableNewMessages.class);
/**
*
* @param title
* @param eventBus
*/
public RuleOnTableNewWizard(EventBus eventBus) {
super("New Rule On Table",eventBus);
public RuleOnTableNewWizard(EventBus eventBus) {
super(msgs.ruleOnTableNewWizardHead(), eventBus);
Log.debug("RuleOnTableNewWizard");
setWidth(WIZARDWIDTH);
setHeight(WIZARDHEIGHT);
getHeader().setIcon(ResourceBundle.INSTANCE.ruleTableAdd());
create();
}
private void create() {
RuleOnTableNewDefinitionCard createRuleOnTableDefinitionCard=new RuleOnTableNewDefinitionCard();
RuleOnTableNewDefinitionCard createRuleOnTableDefinitionCard = new RuleOnTableNewDefinitionCard();
addCard(createRuleOnTableDefinitionCard);
createRuleOnTableDefinitionCard.setup();
show();
}
}

View File

@ -0,0 +1,21 @@
ruleOnTableApplyWizardHead = Apply Rule On Table
ruleOnTableApplySelectRuleCardHead = Select Rule
nameCol = Name
descriptionCol = Description
ownerCol = Owner
creationDateCol = Creation Date
scopeCol = Scope
errorRetrievingRules = Error retrieving rules!
selectARule = Select a rule!
infoItemText = Info
ruleOnTableApplyMapColumnCardHead = Map columns
thisIsNotARuleOnTable = This is not a rule on table!
placeHolderCol = Place Holder
columnCol = Column
errorRetrievingColumnsHead = Error retrieving columns
errorNoMappingForThisTableRule = Error no mapping for this table Rule!
ruleOnTableApplyOperationInProgressCardHead = Apply Rule On Table
ruleNameLabel = Rule Name:
ruleDescriptionLabel = Rule Description:
summaryHead = Rule On Table
errorInApplyRuleOnTable = An error occured in apply rule on table:

View File

@ -0,0 +1,21 @@
ruleOnTableApplyWizardHead = Aplica Regla en la Tabla
ruleOnTableApplySelectRuleCardHead = Seleccione Regla
nameCol = Nombre
descriptionCol = Descripción
ownerCol = Propietario
creationDateCol = Fecha Creacion
scopeCol = Scope
errorRetrievingRules = Error al recuperar las reglas!
selectARule = Seleccione una regla!
infoItemText = Info
ruleOnTableApplyMapColumnCardHead = Mapa Columnas
thisIsNotARuleOnTable = Esta no es una regla en la tabla!
placeHolderCol = Place Holder
columnCol = Columna
errorRetrievingColumnsHead = Error al recuperar las columnas
errorNoMappingForThisTableRule = Error ningún mapa para esta regla en la tabla!
ruleOnTableApplyOperationInProgressCardHead = Aplica Regla en la Tabla
ruleNameLabel = Nombre Regla:
ruleDescriptionLabel = Descripción Regla:
summaryHead = Regla en la Tabla
errorInApplyRuleOnTable = Error al aplicar la regla en la tabla:

View File

@ -0,0 +1,21 @@
ruleOnTableApplyWizardHead = Applica Regola su Tabella
ruleOnTableApplySelectRuleCardHead = Seleziona Regola
nameCol = Nome
descriptionCol = Descrizione
ownerCol = Proprietario
creationDateCol = Data Creazione
scopeCol = Scope
errorRetrievingRules = Errore recuperando le regole!
selectARule = Seleziona una regola!
infoItemText = Info
ruleOnTableApplyMapColumnCardHead = Mappa Colonne
thisIsNotARuleOnTable = Questa non è una regola su tabella!
placeHolderCol = Place Holder
columnCol = Colonna
errorRetrievingColumnsHead = Errore recuperando le colonne
errorNoMappingForThisTableRule = Errore nessuna mappa per questa regola su tabella!
ruleOnTableApplyOperationInProgressCardHead = Applica Regola su Tabella
ruleNameLabel = Nome Regola:
ruleDescriptionLabel = Descrizione Regola:
summaryHead = Regola su Tabella
errorInApplyRuleOnTable = Errore applicando la regola su tabella:

View File

@ -0,0 +1,20 @@
ruleOnTableNewWizardHead = New Rule On Table
ruleOnTableNewDefinitionCardHead = Columns Definition
ruleOnTableNewDefinitionCardFoot = N.B. Use drag and drop in order to change the position of the columns
labelCol = Label
columnDataTypeCol = Data Type
btnAddColumnText = Add Column
btnAddColumnToolTip = Add Column
btnDeleteText = Delete
labelAlreadyPresent = This label is already present, please choose another(case insensitive)!
addAtLeastOneColumn = Add at least one column
ruleOnTableNewExpressionCardHead = Create Expression
errorCreatingRuleOnTable = Error creating rule on table!
save = Save
ruleNameLabel = Rule Name:
ruleDescriptionLabel = Rule Description:
summaryHead = Rule On Table
ruleSavedHead = Save Rule
ruleSaved = The rule is saved!
errorSavingRuleOnTable = Error saving rule on table

View File

@ -0,0 +1,19 @@
ruleOnTableNewWizardHead = Nueva Regla en la Tabla
ruleOnTableNewDefinitionCardHead = Definición Columna
ruleOnTableNewDefinitionCardFoot = N.B. Use arrastrar y soltar para cambiar la posición de las columnas
labelCol = Etiqueta
columnDataTypeCol = Tipo de Datos
btnAddColumnText = Añadir Columna
btnAddColumnToolTip = Añadir Columna
btnDeleteText = Borrar
labelAlreadyPresent = Esta etiqueta está presente, seleccione otra(case insensitive)!
addAtLeastOneColumn = Añadir al menos una columna
ruleOnTableNewExpressionCardHead = Crear Expresión
errorCreatingRuleOnTable = Error al crear una regla en la tabla!
save = Guardar
ruleNameLabel = Nombre Regla:
ruleDescriptionLabel = Descripción Regla:
summaryHead = Regla en la Tabla
ruleSavedHead = Guardar Regla
ruleSaved = Regla guardada!
errorSavingRuleOnTable = Error al guardar la regla en la tabla

View File

@ -0,0 +1,19 @@
ruleOnTableNewWizardHead = Nuova Regola su Tabella
ruleOnTableNewDefinitionCardHead = Definizione Colonne
ruleOnTableNewDefinitionCardFoot = N.B. Usa drag and drop per modificare la posizione delle colonne
labelCol = Etichetta
columnDataTypeCol = Tipo di Dato
btnAddColumnText = Aggiungi Colonna
btnAddColumnToolTip = Aggiungi Colonna
btnDeleteText = Elimina
labelAlreadyPresent = Questa etichetta è già presente, sceglierne un''altra(case insensitive)!
addAtLeastOneColumn = Aggiungere almento una colonna
ruleOnTableNewExpressionCardHead = Crea Espressione
errorCreatingRuleOnTable = Errore creando una regola su tabella!
save = Salva
ruleNameLabel = Nome Regola:
ruleDescriptionLabel = Descrizione Regola:
summaryHead = Regola su Tabella
ruleSavedHead = Salva Regola
ruleSaved = La regola è salvata!
errorSavingRuleOnTable = Errore salvando la regola su tabella