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-table-widget@120311 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
93e46eaf41
commit
9618648d34
|
@ -73,7 +73,7 @@ public interface TableWidgetMessages extends Messages {
|
|||
@DefaultMessage("Error retrieving columns of tabular resource: ")
|
||||
String errorRetrievingColumsOfTabularResourceFixed();
|
||||
|
||||
@DefaultMessage("No Integer or Numeric column is present in the tabular resource!")
|
||||
@DefaultMessage("No Integer or Numeric column is present!")
|
||||
String attentionNoIntegerOrNumericColumnIsPresent();
|
||||
|
||||
@DefaultMessage("Select a column...")
|
||||
|
@ -183,7 +183,62 @@ public interface TableWidgetMessages extends Messages {
|
|||
|
||||
@DefaultMessage("Error retrieving history!")
|
||||
String errorRetrievingHistory();
|
||||
|
||||
@DefaultMessage("Denormalization")
|
||||
String denormalizationDialogHead();
|
||||
|
||||
@DefaultMessage("Select a column...")
|
||||
String comboValueColumnEmptyText();
|
||||
|
||||
@DefaultMessage("Value Column")
|
||||
String comboValueColumnLabel();
|
||||
|
||||
@DefaultMessage("Select a column...")
|
||||
String comboAttributeColumnEmptyText();
|
||||
|
||||
@DefaultMessage("Attribute Column")
|
||||
String comboAttributeColumnLabel();
|
||||
|
||||
@DefaultMessage("Denormalize")
|
||||
String btnDenormalizeText();
|
||||
|
||||
@DefaultMessage("Denormalize")
|
||||
String btnDenormalizeToolTip();
|
||||
|
||||
@DefaultMessage("Attention no value column selected!")
|
||||
String attentionNoValueColumnSelected();
|
||||
|
||||
@DefaultMessage("Attention no attribute column selected!")
|
||||
String attentionNoAttributeColumnSelected();
|
||||
|
||||
@DefaultMessage("Normalization")
|
||||
String normalizeDialogHead();
|
||||
|
||||
@DefaultMessage("Normalize")
|
||||
String btnNormalizeText();
|
||||
|
||||
@DefaultMessage("Normalize")
|
||||
String btnNormalizeToolTip();
|
||||
|
||||
@DefaultMessage("Normalized column")
|
||||
String normalizedColumnNameLabel();
|
||||
|
||||
@DefaultMessage("Value column")
|
||||
String valueColumnNameLabel();
|
||||
|
||||
@DefaultMessage("Columns to Normalize")
|
||||
String columnsToNormalizeLabel();
|
||||
|
||||
@DefaultMessage("Error retrieving columns!")
|
||||
String errorRetrievingColumns();
|
||||
|
||||
@DefaultMessage("This tabular resource has not Integer or Numeric columns, normalize is not applicable!")
|
||||
String attentionThisTabularResourceHasNotIntegerOrNumericColumnsNormalizeIsNotApplicable();
|
||||
|
||||
@DefaultMessage("Attention no column selected!")
|
||||
String attentionNoColumnSelected();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client.normalize;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.TableWidgetMessages;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
|
@ -16,22 +18,30 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
*
|
||||
*/
|
||||
public class DenormalizeDialog extends Window {
|
||||
protected String WIDTH = "650px";
|
||||
protected String HEIGHT = "530px";
|
||||
protected EventBus eventBus;
|
||||
protected DenormalizePanel normalizationPanel;
|
||||
protected TRId trId;
|
||||
|
||||
private static final String WIDTH = "650px";
|
||||
private static final String HEIGHT = "530px";
|
||||
private DenormalizePanel normalizationPanel;
|
||||
private TableWidgetMessages msgs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
* @param eventBus
|
||||
*/
|
||||
public DenormalizeDialog(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("AddColumnDialog");
|
||||
this.eventBus = eventBus;
|
||||
this.trId=trId;
|
||||
initMessages();
|
||||
initWindow();
|
||||
normalizationPanel = new DenormalizePanel(this, trId,eventBus);
|
||||
add(normalizationPanel);
|
||||
}
|
||||
|
||||
protected void initMessages() {
|
||||
msgs = GWT.create(TableWidgetMessages.class);
|
||||
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -42,7 +52,7 @@ public class DenormalizeDialog extends Window {
|
|||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.columnValue());
|
||||
setHeadingText("Denormalization");
|
||||
setHeadingText(msgs.denormalizationDialogHead());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,8 +10,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.TableWidgetMessages;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||
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.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||
|
@ -52,44 +54,47 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 DenormalizePanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected EventBus eventBus;
|
||||
protected ArrayList<String> rows;
|
||||
private TRId trId;
|
||||
private EventBus eventBus;
|
||||
|
||||
protected DenormalizationSession denormalizationSession;
|
||||
private DenormalizationSession denormalizationSession;
|
||||
|
||||
protected ComboBox<ColumnData> comboValueColumn = null;
|
||||
protected ComboBox<ColumnData> comboAttributeColumn = null;
|
||||
protected ListStore<ColumnData> storeComboAttributeColumn;
|
||||
private ComboBox<ColumnData> comboValueColumn = null;
|
||||
private ComboBox<ColumnData> comboAttributeColumn = null;
|
||||
private ListStore<ColumnData> storeComboAttributeColumn;
|
||||
|
||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
private ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
|
||||
protected FieldLabel comboAttributeColumnLabel;
|
||||
private FieldLabel comboAttributeColumnLabel;
|
||||
|
||||
protected TextButton denormalizeButton;
|
||||
private TextButton btnDenormalize;
|
||||
|
||||
protected DenormalizeDialog parent;
|
||||
private DenormalizeDialog parent;
|
||||
|
||||
protected ArrayList<ColumnData> columnsRetrieved;
|
||||
private ArrayList<ColumnData> columnsRetrieved;
|
||||
|
||||
private CommonMessages msgsCommon;
|
||||
private TableWidgetMessages msgs;
|
||||
|
||||
|
||||
public DenormalizePanel(DenormalizeDialog parent, TRId trId,
|
||||
EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
initMessages();
|
||||
create();
|
||||
}
|
||||
|
||||
|
@ -97,9 +102,16 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
this.parent = null;
|
||||
initMessages();
|
||||
create();
|
||||
}
|
||||
|
||||
protected void initMessages() {
|
||||
msgsCommon = GWT.create(CommonMessages.class);
|
||||
msgs = GWT.create(TableWidgetMessages.class);
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
|
||||
setWidth(WIDTH);
|
||||
|
@ -155,12 +167,14 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
addHandlersForComboColumn(propsColumnData.label());
|
||||
|
||||
comboValueColumn.setLoader(loader);
|
||||
comboValueColumn.setEmptyText("Select a column...");
|
||||
comboValueColumn.setEmptyText(msgs.comboValueColumnEmptyText());
|
||||
comboValueColumn.setWidth(191);
|
||||
comboValueColumn.setTypeAhead(false);
|
||||
comboValueColumn.setEditable(false);
|
||||
comboValueColumn.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
FieldLabel comboValueColumnLabel=new FieldLabel(comboValueColumn, msgs.comboValueColumnLabel());
|
||||
|
||||
// Combo Attribute Column
|
||||
storeComboAttributeColumn = new ListStore<ColumnData>(
|
||||
propsColumnData.id());
|
||||
|
@ -174,19 +188,19 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
|
||||
addHandlersForComboAttributeColumn(propsColumnData.label());
|
||||
|
||||
comboAttributeColumn.setEmptyText("Select a column...");
|
||||
comboAttributeColumn.setEmptyText(msgs.comboAttributeColumnEmptyText());
|
||||
comboAttributeColumn.setWidth(191);
|
||||
comboAttributeColumn.setTypeAhead(true);
|
||||
comboAttributeColumn.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboAttributeColumnLabel = new FieldLabel(comboAttributeColumn,
|
||||
"Attribute Column");
|
||||
msgs.comboAttributeColumnLabel());
|
||||
|
||||
// Normalize Button
|
||||
denormalizeButton = new TextButton("Denormalize");
|
||||
denormalizeButton.setIcon(ResourceBundle.INSTANCE.tableDenormalize());
|
||||
denormalizeButton.setIconAlign(IconAlign.RIGHT);
|
||||
denormalizeButton.setTitle("Denormalize");
|
||||
btnDenormalize = new TextButton(msgs.btnDenormalizeText());
|
||||
btnDenormalize.setIcon(ResourceBundle.INSTANCE.tableDenormalize());
|
||||
btnDenormalize.setIconAlign(IconAlign.RIGHT);
|
||||
btnDenormalize.setToolTip(msgs.btnDenormalizeToolTip());
|
||||
|
||||
SelectHandler deleteHandler = new SelectHandler() {
|
||||
|
||||
|
@ -195,14 +209,14 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
};
|
||||
denormalizeButton.addSelectHandler(deleteHandler);
|
||||
btnDenormalize.addSelectHandler(deleteHandler);
|
||||
|
||||
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
||||
hBox.add(denormalizeButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||
hBox.add(btnDenormalize, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
//v.setScrollMode(ScrollMode.AUTO); Set in GXT 3.0.1
|
||||
v.add(new FieldLabel(comboValueColumn, "Value Column"),
|
||||
// v.setScrollMode(ScrollMode.AUTO); Set in GXT 3.0.1
|
||||
v.add(comboValueColumnLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(1)));
|
||||
|
||||
v.add(comboAttributeColumnLabel, new VerticalLayoutData(1, -1,
|
||||
|
@ -212,7 +226,7 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
add(v, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
|
||||
comboAttributeColumnLabel.setVisible(false);
|
||||
denormalizeButton.disable();
|
||||
btnDenormalize.disable();
|
||||
|
||||
}
|
||||
|
||||
|
@ -221,13 +235,6 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
comboValueColumn
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"Value Column Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboValueColumn selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnData valueColumn = event.getSelectedItem();
|
||||
|
@ -242,13 +249,6 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
comboAttributeColumn
|
||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"Attribute Column Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboAttributeColumn selected: "
|
||||
+ event.getSelectedItem());
|
||||
ColumnData attributeColumn = event.getSelectedItem();
|
||||
|
@ -268,13 +268,13 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
}
|
||||
storeComboAttributeColumn.commitChanges();
|
||||
comboAttributeColumnLabel.setVisible(true);
|
||||
denormalizeButton.disable();
|
||||
btnDenormalize.disable();
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
protected void updateComboAttributeColumn(ColumnData columnData) {
|
||||
denormalizeButton.enable();
|
||||
btnDenormalize.enable();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
storeComboAttributeColumn.clear();
|
||||
storeComboAttributeColumn.commitChanges();
|
||||
comboAttributeColumnLabel.setVisible(false);
|
||||
denormalizeButton.disable();
|
||||
btnDenormalize.disable();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
|
@ -299,13 +299,13 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
UtilsGXT3.alert(msgsCommon.errorLocked(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.error("load combo failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving columns of tabular resource:"
|
||||
UtilsGXT3.alert(msgsCommon.error(),
|
||||
msgs.errorRetrievingColumsOfTabularResourceFixed()
|
||||
+ trId.getId());
|
||||
}
|
||||
}
|
||||
|
@ -327,8 +327,8 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
}
|
||||
if (columnsIntegerNumeric.size() < 1) {
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"No Column with data type Integer or Numeric");
|
||||
.alert(msgsCommon.attention(),
|
||||
msgs.attentionNoIntegerOrNumericColumnIsPresent());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -351,14 +351,14 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
|
||||
ColumnData valueColumn = comboValueColumn.getCurrentValue();
|
||||
if (valueColumn == null) {
|
||||
UtilsGXT3.alert("Attention", "Attention no value column selected!");
|
||||
UtilsGXT3.alert(msgsCommon.attention(), msgs.attentionNoValueColumnSelected());
|
||||
return;
|
||||
}
|
||||
|
||||
ColumnData attributeColumn = comboAttributeColumn.getCurrentValue();
|
||||
if (attributeColumn == null) {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Attention no attribute column selected!");
|
||||
UtilsGXT3.alert(msgsCommon.attention(),
|
||||
msgs.attentionNoAttributeColumnSelected());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -375,17 +375,17 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
UtilsGXT3.alert(msgsCommon.errorLocked(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
UtilsGXT3.alert(msgsCommon.errorFinal(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Denormalize Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error on Denormalize",
|
||||
UtilsGXT3.alert(msgsCommon.error(),
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +417,8 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
public void operationComplete(OperationResult operationResult) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.DENORMALIZE, operationResult.getTrId(), why);
|
||||
ChangeTableRequestType.DENORMALIZE, operationResult.getTrId(),
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
}
|
||||
|
@ -430,10 +431,12 @@ public class DenormalizePanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
||||
public void operationStopped(OperationResult operationResult,
|
||||
String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.DENORMALIZE, operationResult.getTrId(), why);
|
||||
ChangeTableRequestType.DENORMALIZE, operationResult.getTrId(),
|
||||
why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client.normalize;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.TableWidgetMessages;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
|
@ -16,22 +18,26 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
*
|
||||
*/
|
||||
public class NormalizeDialog extends Window {
|
||||
protected String WIDTH = "650px";
|
||||
protected String HEIGHT = "530px";
|
||||
protected EventBus eventBus;
|
||||
protected NormalizePanel normalizationPanel;
|
||||
protected TRId trId;
|
||||
|
||||
private static final String WIDTH = "650px";
|
||||
private static final String HEIGHT = "530px";
|
||||
private NormalizePanel normalizationPanel;
|
||||
private TableWidgetMessages msgs;
|
||||
|
||||
public NormalizeDialog(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("AddColumnDialog");
|
||||
this.eventBus = eventBus;
|
||||
this.trId=trId;
|
||||
initMessages();
|
||||
initWindow();
|
||||
normalizationPanel = new NormalizePanel(this, trId,eventBus);
|
||||
add(normalizationPanel);
|
||||
}
|
||||
|
||||
protected void initMessages() {
|
||||
msgs = GWT.create(TableWidgetMessages.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -42,7 +48,7 @@ public class NormalizeDialog extends Window {
|
|||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.columnValue());
|
||||
setHeadingText("Normalization");
|
||||
setHeadingText(msgs.normalizeDialogHead());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,9 +10,11 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.NormalizationSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.TableWidgetMessages;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.properties.ColumnDataProperties;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||
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.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||
|
@ -64,28 +66,30 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
*/
|
||||
public class NormalizePanel extends FramedPanel implements
|
||||
MonitorDialogListener {
|
||||
protected String WIDTH = "640px";
|
||||
protected String HEIGHT = "520px";
|
||||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected EventBus eventBus;
|
||||
protected ArrayList<String> rows;
|
||||
private TRId trId;
|
||||
private EventBus eventBus;
|
||||
|
||||
private NormalizationSession normalizationSession;
|
||||
|
||||
protected NormalizationSession normalizationSession;
|
||||
|
||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
protected Grid<ColumnData> grid;
|
||||
protected CheckBoxSelectionModel<ColumnData> sm;
|
||||
protected FieldLabel columnsSelectLabel;
|
||||
protected TextButton normalizeButton;
|
||||
protected TextField normalizedColumnName;
|
||||
protected TextField valueColumnName;
|
||||
protected NormalizeDialog parent;
|
||||
private ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||
private Grid<ColumnData> grid;
|
||||
private CheckBoxSelectionModel<ColumnData> sm;
|
||||
private TextButton btnNormalize;
|
||||
private TextField normalizedColumnName;
|
||||
private TextField valueColumnName;
|
||||
private NormalizeDialog parent;
|
||||
|
||||
private CommonMessages msgsCommon;
|
||||
private TableWidgetMessages msgs;
|
||||
|
||||
public NormalizePanel(NormalizeDialog parent, TRId trId, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
initMessages();
|
||||
create();
|
||||
}
|
||||
|
||||
|
@ -93,8 +97,15 @@ public class NormalizePanel extends FramedPanel implements
|
|||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
this.parent = null;
|
||||
initMessages();
|
||||
create();
|
||||
}
|
||||
|
||||
protected void initMessages() {
|
||||
msgsCommon = GWT.create(CommonMessages.class);
|
||||
msgs = GWT.create(TableWidgetMessages.class);
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
Log.debug("Create NormalizationPanel(): [" + trId.toString() + "]");
|
||||
|
@ -105,10 +116,10 @@ public class NormalizePanel extends FramedPanel implements
|
|||
setBodyBorder(false);
|
||||
|
||||
// Normalize Button
|
||||
normalizeButton = new TextButton("Normalize");
|
||||
normalizeButton.setIcon(ResourceBundle.INSTANCE.tableNormalize());
|
||||
normalizeButton.setIconAlign(IconAlign.RIGHT);
|
||||
normalizeButton.setTitle("Normalize");
|
||||
btnNormalize = new TextButton(msgs.btnNormalizeText());
|
||||
btnNormalize.setIcon(ResourceBundle.INSTANCE.tableNormalize());
|
||||
btnNormalize.setIconAlign(IconAlign.RIGHT);
|
||||
btnNormalize.setToolTip(msgs.btnNormalizeToolTip());
|
||||
|
||||
SelectHandler normalizeHandler = new SelectHandler() {
|
||||
|
||||
|
@ -117,24 +128,24 @@ public class NormalizePanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
};
|
||||
normalizeButton.addSelectHandler(normalizeHandler);
|
||||
btnNormalize.addSelectHandler(normalizeHandler);
|
||||
|
||||
normalizedColumnName = new TextField();
|
||||
FieldLabel normalizedColumnNameLabel = new FieldLabel(
|
||||
normalizedColumnName, "Normalized column");
|
||||
normalizedColumnName, msgs.normalizedColumnNameLabel());
|
||||
normalizedColumnNameLabel.setLabelWidth(110);
|
||||
|
||||
valueColumnName = new TextField();
|
||||
FieldLabel valueColumnNameLabel = new FieldLabel(valueColumnName,
|
||||
"Value column");
|
||||
msgs.valueColumnNameLabel());
|
||||
valueColumnNameLabel.setLabelWidth(110);
|
||||
|
||||
FieldLabel columnsLabel = new FieldLabel(null, "Columns to Normalize");
|
||||
columnsLabel.setLabelWidth(150);
|
||||
columnsLabel.getElement().applyStyles("font-weight:bold");
|
||||
FieldLabel columnsToNormalizeLabel = new FieldLabel(null, msgs.columnsToNormalizeLabel());
|
||||
columnsToNormalizeLabel.setLabelWidth(150);
|
||||
columnsToNormalizeLabel.getElement().applyStyles("font-weight:bold");
|
||||
|
||||
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
||||
hBox.add(normalizeButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||
hBox.add(btnNormalize, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||
|
||||
// Grid ColumnData
|
||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||
|
@ -198,7 +209,7 @@ public class NormalizePanel extends FramedPanel implements
|
|||
v.setAdjustForScroll(true);
|
||||
v.add(normalizedColumnNameLabel, new VerticalLayoutData(1, -1));
|
||||
v.add(valueColumnNameLabel, new VerticalLayoutData(1, -1));
|
||||
v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2, 1, 5,
|
||||
v.add(columnsToNormalizeLabel, new VerticalLayoutData(-1, -1, new Margins(2, 1, 5,
|
||||
1)));
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
|
||||
|
@ -229,17 +240,17 @@ public class NormalizePanel extends FramedPanel implements
|
|||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
UtilsGXT3.alert(msgsCommon.errorLocked(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.error("load columns failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving columns",
|
||||
"Error retrieving columns");
|
||||
UtilsGXT3.alert(msgsCommon.error(),
|
||||
msgs.errorRetrievingColumns());
|
||||
}
|
||||
}
|
||||
|
||||
normalizeButton.disable();
|
||||
btnNormalize.disable();
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
|
@ -251,13 +262,13 @@ public class NormalizePanel extends FramedPanel implements
|
|||
result));
|
||||
|
||||
} else {
|
||||
normalizeButton.disable();
|
||||
btnNormalize.disable();
|
||||
Log.error("This tabular resource has not Integer or Numeric columns, normalize is not applicable!");
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"This tabular resource has not Integer or Numeric columns, normalize is not applicable!");
|
||||
.alert(msgsCommon.attention(),
|
||||
msgs.attentionThisTabularResourceHasNotIntegerOrNumericColumnsNormalizeIsNotApplicable());
|
||||
callback.onFailure(new Throwable(
|
||||
"This tabular resource has not Integer or Numeric columns, normalize is not applicable!"));
|
||||
msgs.attentionThisTabularResourceHasNotIntegerOrNumericColumnsNormalizeIsNotApplicable()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -282,7 +293,7 @@ public class NormalizePanel extends FramedPanel implements
|
|||
protected void onNormalize() {
|
||||
ArrayList<ColumnData> col = getSelectedItems();
|
||||
if (col == null || col.size() < 1) {
|
||||
UtilsGXT3.alert("Attention", "Attention no column selected!");
|
||||
UtilsGXT3.alert(msgsCommon.attention(), msgs.attentionNoColumnSelected());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -301,17 +312,17 @@ public class NormalizePanel extends FramedPanel implements
|
|||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
UtilsGXT3.alert(msgsCommon.errorLocked(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
UtilsGXT3.alert(msgsCommon.errorFinal(),
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Normalization Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error on Normalization",
|
||||
UtilsGXT3.alert(msgsCommon.error(),
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue