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-unionwizard-widget@120136 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-10-30 16:26:53 +00:00 committed by Giancarlo Panichi
parent 085a025949
commit c85e0b1c52
14 changed files with 384 additions and 180 deletions

View File

@ -4,28 +4,42 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionColumnsMapping;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
import org.gcube.portlets.user.td.widgetcommonevent.client.CommonMessages;
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.user.client.Command;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnMappingCard extends WizardCard {
protected UnionSession unionSession;
protected ColumnMappingCard thisCard;
protected ColumnMappingPanel columnMappingPanel;
private static UnionWizardMessages msgs= GWT.create(UnionWizardMessages.class);
private UnionSession unionSession;
private ColumnMappingCard thisCard;
private ColumnMappingPanel columnMappingPanel;
private CommonMessages msgsCommon;
public ColumnMappingCard(final UnionSession unionSession) {
super("Mapping beetween Tabular Resources", "");
super(msgs.columnMappingCardHead(), "");
Log.debug("ColumnMappingCard");
this.unionSession = unionSession;
thisCard = this;
columnMappingPanel = new ColumnMappingPanel(thisCard,res);
initMessages();
columnMappingPanel = new ColumnMappingPanel(thisCard,res);
setContent(columnMappingPanel);
}
protected void initMessages(){
msgsCommon= GWT.create(CommonMessages.class);
}
@Override
public void setup() {
@ -57,6 +71,8 @@ public class ColumnMappingCard extends WizardCard {
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(true);
setBackButtonVisible(true);
setNextButtonVisible(true);
}
@ -69,8 +85,8 @@ public class ColumnMappingCard extends WizardCard {
Log.debug("No columns match created: "
+columnsMatch);
UtilsGXT3
.info("Attentions",
"Creates a valid column map");
.info(msgsCommon.attention(),
msgs.attentionCreatesAValidColumnMap());
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(true);
@ -96,5 +112,10 @@ public class ColumnMappingCard extends WizardCard {
e.printStackTrace();
}
}
public UnionSession getUnionSession(){
return unionSession;
}
}

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.td.unionwizardwidget.client;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
@ -10,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionColumnsMapping
import org.gcube.portlets.user.td.unionwizardwidget.client.custom.IconButton;
import org.gcube.portlets.user.td.unionwizardwidget.client.properties.ColumnDataProperties;
import org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle;
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.TRId;
@ -52,22 +52,21 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
public class ColumnMappingPanel extends ContentPanel {
private static final String COMBOWIDTH = "200px";
// private static final String COLUMNLABELWIDTH = "120px";
protected ResourceBundle res;
protected ColumnMappingCard parent;
protected VerticalLayoutContainer vert;
protected ArrayList<ColumnData> sourceColumns;
protected ArrayList<ColumnData> unionColumns;
protected ResizeContainer thisPanel;
private UnionWizardMessages msgs;
private CommonMessages msgsCommon;
protected HashMap<ColumnData, ColumnData> columnMap;
protected ArrayList<UnionColumnsMapping> listUnionColumnsMapping;
private ColumnMappingCard parent;
private VerticalLayoutContainer vert;
private ArrayList<ColumnData> sourceColumns;
private ArrayList<ColumnData> unionColumns;
private ResizeContainer thisPanel;
protected String itemIdSourceColumn = "itemIdSourceColumn";
protected String itemIdUnionColumn = "itemIdUnionColumn";
protected String itemIdLabelColumn = "itemIdLabelColumn";
protected String itemIdBtnAdd = "itemIdBtnAdd";
protected String itemIdBtnDel = "itemIdBtnDel";
private ArrayList<UnionColumnsMapping> listUnionColumnsMapping;
private String itemIdSourceColumn = "itemIdSourceColumn";
private String itemIdUnionColumn = "itemIdUnionColumn";
private String itemIdBtnAdd = "itemIdBtnAdd";
private String itemIdBtnDel = "itemIdBtnDel";
/**
*
@ -76,21 +75,23 @@ public class ColumnMappingPanel extends ContentPanel {
*/
public ColumnMappingPanel(ColumnMappingCard parent, ResourceBundle res) {
super();
this.res = res;
this.parent = parent;
thisPanel = this;
initMessages();
Log.debug("ColumnMappingPanel");
init();
retrieveSourceColumns();
}
protected void initMessages() {
msgs = GWT.create(UnionWizardMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
protected void init() {
setHeaderVisible(false);
// setBodyBorder(false);
setBodyStyle("backgroundColor:#DFE8F6;");
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
// Important: fixed rendering of widgets
forceLayoutOnResize = true;
}
@ -105,22 +106,15 @@ public class ColumnMappingPanel extends ContentPanel {
setColumnMap();
/*
* FieldLabel columnLabel = new FieldLabel(null, "Column Label");
* columnLabel.getElement().applyStyles("font-weight:bold");
* columnLabel.setWidth(COLUMNLABELWIDTH);
* columnLabel.setLabelSeparator("");
*/
String currentTRLabel = parent.unionSession.getCurrentTabularResource()
.getName();
String currentTRLabel = parent.getUnionSession()
.getCurrentTabularResource().getName();
FieldLabel sourceColumnLabel = new FieldLabel(null, currentTRLabel);
sourceColumnLabel.getElement().applyStyles("font-weight:bold");
sourceColumnLabel.setWidth(COMBOWIDTH);
sourceColumnLabel.setLabelSeparator("");
String unionTRLabel = parent.unionSession.getUnionTabularResource()
.getName();
String unionTRLabel = parent.getUnionSession()
.getUnionTabularResource().getName();
FieldLabel unionColumnLabel = new FieldLabel(null, unionTRLabel);
unionColumnLabel.getElement().applyStyles("font-weight:bold");
unionColumnLabel.setWidth(COMBOWIDTH);
@ -130,7 +124,6 @@ public class ColumnMappingPanel extends ContentPanel {
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START);
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(sourceColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(unionColumnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
@ -149,7 +142,7 @@ public class ColumnMappingPanel extends ContentPanel {
}
private void retrieveSourceColumns() {
TRId trId = parent.unionSession.getTrId();
TRId trId = parent.getUnionSession().getTrId();
TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() {
@ -163,15 +156,14 @@ public class ColumnMappingPanel extends ContentPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.debug("Error retrieving source columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving source columns",
"Error retrieving source columns on server!");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingSourceColumns());
}
}
}
@ -187,7 +179,8 @@ public class ColumnMappingPanel extends ContentPanel {
}
private void retrieveUnionColumns() {
TRId trId = parent.unionSession.getUnionTabularResource().getTrId();
TRId trId = parent.getUnionSession().getUnionTabularResource()
.getTrId();
TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() {
@ -201,15 +194,14 @@ public class ColumnMappingPanel extends ContentPanel {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.debug("Error retrieving union columns: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error retrieving union columns",
"Error retrieving union columns on server!");
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorRetrievingUnionColumns());
}
}
}
@ -228,14 +220,6 @@ public class ColumnMappingPanel extends ContentPanel {
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
// Column Label
/*
* TextField columnLabel = new TextField();
* columnLabel.setItemId(itemIdLabelColumn);
* columnLabel.setAllowBlank(false);
* columnLabel.setWidth(COLUMNLABELWIDTH);
*/
// Source Combo
ColumnDataProperties propsSourceColumn = GWT
.create(ColumnDataProperties.class);
@ -249,7 +233,7 @@ public class ColumnMappingPanel extends ContentPanel {
Log.debug("ComboSourceColumn created");
comboSourceColumn.setEmptyText("Select a column...");
comboSourceColumn.setEmptyText(msgs.comboSourceColumnEmptyText());
comboSourceColumn.setWidth(COMBOWIDTH);
comboSourceColumn.setEditable(false);
comboSourceColumn.setTriggerAction(TriggerAction.ALL);
@ -267,7 +251,7 @@ public class ColumnMappingPanel extends ContentPanel {
Log.debug("ComboUnionColumn created");
comboUnionColumn.disable();
comboUnionColumn.setEmptyText("Select a column...");
comboUnionColumn.setEmptyText(msgs.comboUnionEmptyText());
comboUnionColumn.setWidth(COMBOWIDTH);
comboUnionColumn.setEditable(false);
comboUnionColumn.setTriggerAction(TriggerAction.ALL);
@ -321,7 +305,7 @@ public class ColumnMappingPanel extends ContentPanel {
updateStoreComboUnionColumn(selectedSourceColumn,
storeComboUnionColumn);
storeComboUnionColumn.commitChanges();
comboUnionColumn.redraw();
comboUnionColumn.enable();
@ -332,7 +316,6 @@ public class ColumnMappingPanel extends ContentPanel {
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START);
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
@ -345,14 +328,6 @@ public class ColumnMappingPanel extends ContentPanel {
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
// Column Label
/*
* TextField columnLabel = new TextField();
* columnLabel.setItemId(itemIdLabelColumn);
* columnLabel.setAllowBlank(false);
* columnLabel.setWidth(COLUMNLABELWIDTH);
*/
// Source Combo
ColumnDataProperties propsSourceColumn = GWT
.create(ColumnDataProperties.class);
@ -366,7 +341,7 @@ public class ColumnMappingPanel extends ContentPanel {
Log.debug("ComboSourceColumn created");
comboSourceColumn.setEmptyText("Select a column...");
comboSourceColumn.setEmptyText(msgs.comboSourceColumnEmptyText());
comboSourceColumn.setWidth(COMBOWIDTH);
comboSourceColumn.setEditable(false);
comboSourceColumn.setTriggerAction(TriggerAction.ALL);
@ -384,7 +359,7 @@ public class ColumnMappingPanel extends ContentPanel {
Log.debug("ComboUnionColumn created");
comboUnionColumn.disable();
comboUnionColumn.setEmptyText("Select a column...");
comboUnionColumn.setEmptyText(msgs.comboUnionEmptyText());
comboUnionColumn.setWidth(COMBOWIDTH);
comboUnionColumn.setEditable(false);
comboUnionColumn.setTriggerAction(TriggerAction.ALL);
@ -449,7 +424,6 @@ public class ColumnMappingPanel extends ContentPanel {
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.START);
// horiz.add(columnLabel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
@ -530,8 +504,6 @@ public class ColumnMappingPanel extends ContentPanel {
}
}
}
/**
*
@ -545,13 +517,6 @@ public class ColumnMappingPanel extends ContentPanel {
for (; i < lenght; i++) {
HBoxLayoutContainer h = (HBoxLayoutContainer) vert.getWidget(i);
if (h != null) {
/*
* TextField columnLabelField = (TextField) h
* .getItemByItemId(itemIdLabelColumn); if (columnLabelField !=
* null) { String columnLabel =
* columnLabelField.getCurrentValue(); if (columnLabel != null
* && !columnLabel.isEmpty()) {
*/
@SuppressWarnings("unchecked")
ComboBox<ColumnData> comboSourceColumn = (ComboBox<ColumnData>) h
.getItemByItemId(itemIdSourceColumn);
@ -571,10 +536,6 @@ public class ColumnMappingPanel extends ContentPanel {
} else {
Log.debug("Source Column is null");
}
/*
* } else { Log.debug("Column Label is null"); } } else {
* Log.debug("Column Label Field is null"); }
*/
} else {
Log.debug("HorizontalContainer is null");
}

View File

@ -6,12 +6,14 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
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.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.Command;
@ -24,17 +26,21 @@ import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
public class TabResourcesSelectionCard extends WizardCard {
protected UnionSession unionSession;
protected TabResourcesSelectionCard thisCard;
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
protected TabResource selectedTabResource = null;
private static UnionWizardMessages msgs= GWT.create(UnionWizardMessages.class);
private CommonMessages msgsCommon;
private UnionSession unionSession;
private TabResourcesSelectionCard thisCard;
private TabResourcesSelectionPanel tabResourcesSelectionPanel;
//private TabResource selectedTabResource = null;
public TabResourcesSelectionCard(final UnionSession unionSession) {
super("Select Tabular Resource for Union", "");
super(msgs.tabResourcesSelectionCardHead(), "");
Log.debug("TabResourcesSelectionCard");
this.unionSession = unionSession;
thisCard = this;
initMessages();
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,
res);
@ -53,6 +59,10 @@ public class TabResourcesSelectionCard extends WizardCard {
setContent(tabResourcesSelectionPanel);
}
protected void initMessages(){
msgsCommon= GWT.create(CommonMessages.class);
}
@Override
public void setup() {
@ -82,14 +92,19 @@ public class TabResourcesSelectionCard extends WizardCard {
};
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setBackButtonVisible(false);
setEnableBackButton(false);
setNextButtonVisible(true);
tabResourcesSelectionPanel.gridDeselectAll();
}
protected void retrieveLastTable() {
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setEnableBackButton(false);
TDGWTServiceAsync.INSTANCE.getLastTable(unionSession
.getUnionTabularResource().getTrId(),
@ -99,8 +114,8 @@ public class TabResourcesSelectionCard extends WizardCard {
public void onFailure(Throwable caught) {
Log.debug("Attention",
"This tabular resource does not have a valid table");
AlertMessageBox d = new AlertMessageBox("Attention",
"This tabular resource does not have a valid table");
AlertMessageBox d = new AlertMessageBox(msgsCommon.attention(),
msgs.attentionThisTabularResourceDoesNotHaveAValidTable());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
@ -123,8 +138,8 @@ public class TabResourcesSelectionCard extends WizardCard {
}
protected void deleteTRWithLastTableNull() {
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
"Would you like to delete this tabular resource without table?");
final ConfirmMessageBox mb = new ConfirmMessageBox(msgs.delete(),
msgs.woultYouLikeToDeleteThisTabularResourceWithoutTable());
/*Next in GXT 3.1.1 */
mb.addDialogHideHandler(new DialogHideHandler() {
@ -133,8 +148,8 @@ public class TabResourcesSelectionCard extends WizardCard {
public void onDialogHide(DialogHideEvent event) {
switch (event.getHideButton()) {
case NO:
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setEnableBackButton(false);
break;
case YES:
callDeleteLastTable();
@ -188,28 +203,29 @@ public class TabResourcesSelectionCard extends WizardCard {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setEnableBackButton(false);
} else {
AlertMessageBox d = new AlertMessageBox(
"Error",
"Error on delete TabResource: "
msgsCommon.error(),
msgs.errorOnDeleteTabularResourceFixed()
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
getWizardWindow().setEnableNextButton(
setEnableNextButton(
true);
getWizardWindow().setEnableBackButton(
setEnableBackButton(
true);
}
});
d.show();
}
}
@ -218,8 +234,8 @@ public class TabResourcesSelectionCard extends WizardCard {
public void onSuccess(Void result) {
tabResourcesSelectionPanel.gridReload();
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setEnableBackButton(false);
}
});
@ -252,16 +268,16 @@ public class TabResourcesSelectionCard extends WizardCard {
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
setEnableNextButton(false);
setEnableBackButton(false);
} else {
UtilsGXT3
.alert("Error",
"Error retrienving information on current tabular resource: ");
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
.alert(msgsCommon.error(),
msgs.errorRetrievingInfomationOnTRFixed());
setEnableNextButton(false);
setEnableBackButton(false);
}
}
}

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
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.tr.TabResource;
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;
@ -59,10 +60,18 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem;
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabResourcesSelectionPanel extends ContentPanel implements
HasSelectionHandlers<TabResource> {
private static final DateTimeFormat sdf = DateTimeFormat
.getFormat("yyyy-MM-dd HH:mm");
private CommonMessages msgsCommon;
private UnionWizardMessages msgs;
private Grid<TabResource> grid;
private ResourceBundle res;
private Menu contextMenu;
@ -70,12 +79,14 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
private TabResource removableTR;
private WizardCard parent;
public TabResourcesSelectionPanel(WizardCard parent, ResourceBundle res) {
this.res = res;
this.parent = parent;
Log.debug("TabResourcesSelectionPanel");
init();
initMessages();
initPanel();
try {
createContextMenu();
buildPanel();
@ -86,7 +97,12 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
}
}
protected void init() {
protected void initMessages() {
msgsCommon = GWT.create(CommonMessages.class);
msgs = GWT.create(UnionWizardMessages.class);
}
protected void initPanel() {
setHeaderVisible(false);
// new Resizable(this, Dir.E, Dir.SE, Dir.S);
@ -95,14 +111,14 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
protected void buildPanel() {
ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Search: "));
toolBar.add(new LabelToolItem(msgsCommon.toolItemSearchLabel()));
final TextField searchField = new TextField();
toolBar.add(searchField);
TextButton btnReload = new TextButton();
// btnReload.setText("Reload");
btnReload.setIcon(res.refresh16());
btnReload.setToolTip("Reload");
btnReload.setToolTip(msgsCommon.toolItemReloadLabel());
toolBar.add(btnReload);
IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>();
@ -112,17 +128,17 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
.create(TabResourceProperties.class);
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
properties.name(), 90, "Name");
properties.name(), 90, msgs.nameColumn());
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
properties.tabResourceType(), 30, "Type");
properties.tabResourceType(), 30, msgs.typeColumn());
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
properties.tableTypeName(), 30, "Table Type");
properties.tableTypeName(), 30, msgs.tableTypeColumn());
ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
properties.agency(), 60, "Agency");
properties.agency(), 60, msgs.agencyColumn());
ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
properties.ownerLogin(), 70, "Owner");
properties.ownerLogin(), 70, msgs.ownerColumn());
ColumnConfig<TabResource, Date> dateColumn = new ColumnConfig<TabResource, Date>(
properties.date(), 50, "Creation Date");
properties.date(), 50, msgs.creationDateColumn());
dateColumn.setCell(new DateCell(sdf));
@ -218,7 +234,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
protected void createContextMenu() {
contextMenu = new Menu();
MenuItem deleteTRItem = new MenuItem("Delete");
MenuItem deleteTRItem = new MenuItem(msgs.itemDelete());
deleteTRItem.setId("DeleteTR");
deleteTRItem
.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle.INSTANCE
@ -273,8 +289,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
Log.debug("Error retrieving tabular resource: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error!",
"Error retrieving tabular resources on server!");
.alert(msgsCommon.error(),
msgs.errorRetrievingTabularResources()
);
}
callback.onFailure(caught);
}
@ -313,10 +330,14 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
grid.getLoader().load();
}
public void gridDeselectAll(){
grid.getSelectionModel().deselectAll();
}
protected void deleteTR(TabResource tabResource) {
removableTR = tabResource;
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
"Would you like to delete this tabular resource?");
final ConfirmMessageBox mb = new ConfirmMessageBox(msgs.delete(),
msgs.woultYouLikeToDeleteThisTabularResource());
/* Next in GXT 3.1.1 */
@ -369,13 +390,13 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
UtilsGXT3.alert(msgsCommon.errorLocked(),
caught.getLocalizedMessage());
} else {
Log.error("Error on delete TabResource: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error on delete TabResource: "
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorOnDeleteTabularResourceFixed()
+ caught.getLocalizedMessage());
}
}

View File

@ -10,6 +10,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
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;
@ -17,6 +18,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;
@ -37,18 +39,18 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
*/
public class UnionOperationInProgressCard extends WizardCard implements
MonitorDialogListener {
protected UnionOperationInProgressCard thisCard;
protected UnionSession unionSession;
protected TRId newTrId;
protected HtmlLayoutContainer resultField;
private static CommonMessages msgsCommon=GWT.create(CommonMessages.class);
private UnionWizardMessages msgs;
private UnionSession unionSession;
private TRId newTrId;
private HtmlLayoutContainer resultField;
public UnionOperationInProgressCard(final UnionSession unionSession) {
super("Operation In Progress", "");
super(msgsCommon.operationInProgress(), "");
this.unionSession = unionSession;
thisCard = this;
initMessages();
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
@ -58,21 +60,21 @@ public class UnionOperationInProgressCard extends WizardCard implements
description.setBorderWidth(0);
description.setHTML(0, 0,
"<span style=\"font-weight:bold;\";>Union with: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.unionWithFixed()+"</span>");
description.setText(0, 1, unionSession.getUnionTabularResource()
.getName());
description.setHTML(1, 0,
"<span style=\"font-weight:bold;\";>Type: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.typeFixed()+"</span>");
description.setText(1, 1, unionSession.getUnionTabularResource()
.getTableTypeName());
description.setHTML(2, 0,
"<span style=\"font-weight:bold;\";>Owner: </span>");
"<span style=\"font-weight:bold;\";>"+msgs.ownerFixed()+"</span>");
description.setText(2, 1, unionSession.getUnionTabularResource()
.getOwnerLogin());
FramedPanel summary = new FramedPanel();
summary.setHeadingText("Union Summary");
summary.setHeadingText(msgs.summaryUnion());
summary.setWidth(400);
summary.add(description);
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
@ -87,7 +89,11 @@ public class UnionOperationInProgressCard extends WizardCard implements
resultField.setVisible(false);
}
protected void initMessages(){
msgs = GWT.create(UnionWizardMessages.class);
}
/**
*
*/
@ -109,18 +115,18 @@ public class UnionOperationInProgressCard extends WizardCard implements
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Locked",
showErrorAndHide(msgsCommon.errorLocked(),
caught.getLocalizedMessage(), "",
caught);
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Final",
showErrorAndHide(msgsCommon.errorFinal(),
caught.getLocalizedMessage(), "",
caught);
} else {
showErrorAndHide("Error in Union",
"An error occured in union.",
showErrorAndHide(msgsCommon.error(),
msgs.errorInUnionFixed(),
caught.getLocalizedMessage(),
caught);
}
@ -152,7 +158,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
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);
Command sayComplete = new Command() {
@ -181,7 +187,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
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) {
@ -190,7 +196,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide("Error in Union", reason, details, caught);
showErrorAndHide(msgsCommon.error(), reason, details, caught);
}
forceLayout();
@ -201,7 +207,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
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);
@ -232,7 +238,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
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);
@ -262,7 +268,7 @@ public class UnionOperationInProgressCard extends WizardCard implements
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

@ -0,0 +1,95 @@
package org.gcube.portlets.user.td.unionwizardwidget.client;
import com.google.gwt.i18n.client.Messages;
import com.google.gwt.safehtml.shared.SafeHtml;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface UnionWizardMessages extends Messages {
@DefaultMessage("Union")
String unionWizardHead();
@DefaultMessage("Select Tabular Resource for Union")
String tabResourcesSelectionCardHead();
@DefaultMessage("This tabular resource does not have a valid table!")
String attentionThisTabularResourceDoesNotHaveAValidTable();
@DefaultMessage("Delete")
String delete();
@DefaultMessage("Would you like to delete this tabular resource?")
String woultYouLikeToDeleteThisTabularResource();
@DefaultMessage("Would you like to delete this tabular resource without table?")
String woultYouLikeToDeleteThisTabularResourceWithoutTable();
@DefaultMessage("Error on delete Tabular Resource: ")
String errorOnDeleteTabularResourceFixed();
@DefaultMessage("Error retrienving information on current tabular resource: ")
String errorRetrievingInfomationOnTRFixed();
@DefaultMessage("Name")
String nameColumn();
@DefaultMessage("Type")
String typeColumn();
@DefaultMessage("Table Type")
String tableTypeColumn();
@DefaultMessage("Agency")
String agencyColumn();
@DefaultMessage("Owner")
SafeHtml ownerColumn();
@DefaultMessage("Creation Date")
String creationDateColumn();
@DefaultMessage("Delete")
String itemDelete();
@DefaultMessage("Error retrieving tabular resources on server!")
String errorRetrievingTabularResources();
@DefaultMessage("Mapping beetween Tabular Resources")
String columnMappingCardHead();
@DefaultMessage("Creates a valid column map!")
String attentionCreatesAValidColumnMap();
@DefaultMessage("Error retrieving source columns on server!")
String errorRetrievingSourceColumns();
@DefaultMessage("Error retrieving union columns on server!")
String errorRetrievingUnionColumns();
@DefaultMessage("Select a column...")
String comboSourceColumnEmptyText();
@DefaultMessage("Select a column...")
String comboUnionEmptyText();
@DefaultMessage("Union with: ")
String unionWithFixed();
@DefaultMessage("Type: ")
String typeFixed();
@DefaultMessage("Owner: ")
String ownerFixed();
@DefaultMessage("Union Summary")
String summaryUnion();
@DefaultMessage("An error occured in union.")
String errorInUnionFixed();
}

View File

@ -14,17 +14,15 @@ import com.google.web.bindery.event.shared.EventBus;
*
*/
public class UnionWizardTD extends WizardWindow {
protected static final int WITHWIZARD = 800;
protected static final int HEIGHTWIZARD = 520;
protected UnionSession unionSession;
protected TRId trId;
private static final int WITHWIZARD = 800;
private static final int HEIGHTWIZARD = 520;
private UnionSession unionSession;
/**
*
* @param trId
* @param title
* @param eventBus
* @param trId tabular resource id
* @param title wizard title
* @param eventBus event bus
*/
public UnionWizardTD(TRId trId, String title, EventBus eventBus) {
super(title, eventBus);
@ -32,7 +30,6 @@ public class UnionWizardTD extends WizardWindow {
setWidth(WITHWIZARD);
setHeight(HEIGHTWIZARD);
this.trId = trId;
unionSession = new UnionSession();
unionSession.setTrId(trId);

View File

@ -4,20 +4,24 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.SimpleEventBus;
/**
*
* @author "Giancarlo Panichi"
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class UnionWizardTDEntry implements EntryPoint {
public class UnionWizardTDEntry implements EntryPoint {
public UnionWizardMessages msgs = GWT.create(UnionWizardMessages.class);
public void onModuleLoad() {
TRId trId=new TRId();
SimpleEventBus eventBus=new SimpleEventBus();
UnionWizardTD unionWizard= new UnionWizardTD(trId, "Union",eventBus);
TRId trId = new TRId();
SimpleEventBus eventBus = new SimpleEventBus();
UnionWizardTD unionWizard = new UnionWizardTD(trId,
msgs.unionWizardHead(), eventBus);
Log.info(unionWizard.getId());
}
}

View File

@ -6,7 +6,12 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface UnionResourceBundle extends ClientBundle {
public static final UnionResourceBundle INSTANCE=GWT.create(UnionResourceBundle.class);

View File

@ -1,2 +0,0 @@
sendButton = Send
nameField = Enter your name

View File

@ -1,2 +0,0 @@
sendButton = Envoyer
nameField = Entrez votre nom

View File

@ -0,0 +1,28 @@
unionWizardHead = Union
tabResourcesSelectionCardHead = Select Tabular Resource for Union
attentionThisTabularResourceDoesNotHaveAValidTable = This tabular resource does not have a valid table!
delete = Delete
woultYouLikeToDeleteThisTabularResource = Would you like to delete this tabular resource?
woultYouLikeToDeleteThisTabularResourceWithoutTable = Would you like to delete this tabular resource without table?
errorOnDeleteTabularResourceFixed = Error on delete Tabular Resource:
errorRetrievingInfomationOnTRFixed = Error retrienving information on current tabular resource:
nameColumn = Name
typeColumn = Type
tableTypeColumn = Table Type
agencyColumn = Agency
ownerColumn = Owner
creationDateColumn = Creation Date
itemDelete = Delete
errorRetrievingTabularResources = Error retrieving tabular resources on server!
columnMappingCardHead = Mapping beetween Tabular Resources
attentionCreatesAValidColumnMap = Creates a valid column map!
errorRetrievingSourceColumns = Error retrieving source columns on server!
errorRetrievingUnionColumns = Error retrieving union columns on server!
comboSourceColumnEmptyText = Select a column...
comboUnionEmptyText = Select a column...
unionWithFixed = Union with:
typeFixed = Type:
ownerFixed = Owner:
summaryUnion = Union Summary
errorInUnionFixed = An error occured in union.

View File

@ -0,0 +1,27 @@
unionWizardHead = Unión
tabResourcesSelectionCardHead = Seleccione una Tabular Resource para la Unión
attentionThisTabularResourceDoesNotHaveAValidTable = Esta tabular resource no tiene una tabla válida!
delete = Borrar
woultYouLikeToDeleteThisTabularResource = Quieres eliminar esta tabular resource?
woultYouLikeToDeleteThisTabularResourceWithoutTable = Quieres eliminar esta tabular resource que no tiene una tabla válida?
errorOnDeleteTabularResourceFixed = Error eliminando la tabular resource:
errorRetrievingInfomationOnTRFixed = Error en la recuperación de información información relacionada con la tabular resource:
nameColumn = Nombre
typeColumn = Tipo
tableTypeColumn = Tipo Tabla
agencyColumn = Agencia
ownerColumn = Propietario
creationDateColumn = Fecha Creacion
itemDelete = Borrar
errorRetrievingTabularResources = Error al recuperar las tabular resources del servidor!
columnMappingCardHead = Correspondencia entre tabular resources
attentionCreatesAValidColumnMap = Crear un mapa válido entre columnas!
errorRetrievingSourceColumns = Error al recuperar las columnas que son fuentes para el mapeo!
errorRetrievingUnionColumns = Error al recuperar las columnas que son la unión para el mapeo!
comboSourceColumnEmptyText = Seleccione una columna...
comboUnionEmptyText = Seleccione una columna...
unionWithFixed = Unión con:
typeFixed = Tipo:
ownerFixed = Propietario:
summaryUnion = Resumen Unión
errorInUnionFixed = Error en la operación de unión.

View File

@ -0,0 +1,27 @@
unionWizardHead = Unione
tabResourcesSelectionCardHead = Seleziona una Tabular Resource per Unione
attentionThisTabularResourceDoesNotHaveAValidTable = Questa tabular resource non ha una tabella valida!
delete = Elimina
woultYouLikeToDeleteThisTabularResource = Si desidera cancellare questa tabular resource?
woultYouLikeToDeleteThisTabularResourceWithoutTable = Si desidera cancellare questa tabular resource senza tabella valida?
errorOnDeleteTabularResourceFixed = Errore eliminando la tabular resource:
errorRetrievingInfomationOnTRFixed = Errore recuperando le informazioni sulla tabular resource:
nameColumn = Nome
typeColumn = Tipo
tableTypeColumn = Tipo Tabella
agencyColumn = Agenzia
ownerColumn = Proprietario
creationDateColumn = Data Creazione
itemDelete = Elimina
errorRetrievingTabularResources = Errore recuperando le tabular resources dal server!
columnMappingCardHead = Mappatura tra tabular resources
attentionCreatesAValidColumnMap = Crea un mappa valida tra colonne!
errorRetrievingSourceColumns = Errore recuperando le colonne sorgenti per la mappatura dal server!
errorRetrievingUnionColumns = Errore recuperando le colonne unione per la mappatura dal server!
comboSourceColumnEmptyText = Seleziona una colonna...
comboUnionEmptyText = Seleziona una colonna...
unionWithFixed = Unione con:
typeFixed = Tipo:
ownerFixed = Proprietario:
summaryUnion = Sommario Unione
errorInUnionFixed = Errore nell''operazione di unione.