Updated PeriodDataType

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@111727 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-02-05 14:47:07 +00:00
parent c8b2e4c86a
commit a5a9eec7dc
2 changed files with 48 additions and 48 deletions

View File

@ -13,7 +13,7 @@ import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeP
import org.gcube.portlets.user.td.columnwidget.client.properties.LocaleTypeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.LocaleTypeProperties;
import org.gcube.portlets.user.td.columnwidget.client.properties.PeriodDataTypeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.PeriodDataTypeProperties;
import org.gcube.portlets.user.td.columnwidget.client.properties.TabResourceProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.TabResourceProperties;
import org.gcube.portlets.user.td.columnwidget.client.properties.TimeDataFormatProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ValueDataFormatProperties;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeElement; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeElement;
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeStore; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeStore;
@ -29,7 +29,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.PeriodDataType; import org.gcube.portlets.user.td.gwtservice.shared.tr.PeriodDataType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn; import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TimeDataFormat; import org.gcube.portlets.user.td.gwtservice.shared.tr.ValueDataFormat;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
@ -124,10 +124,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
private FieldLabel comboPeriodTypeLabel; private FieldLabel comboPeriodTypeLabel;
private ListStore<PeriodDataType> storeComboPeriodType; private ListStore<PeriodDataType> storeComboPeriodType;
private ListStore<TimeDataFormat> storeComboTimeDataFormat; private ListStore<ValueDataFormat> storeComboValueDataFormat;
private ComboBox<TimeDataFormat> comboTimeDataFormat; private ComboBox<ValueDataFormat> comboValueDataFormat;
private FieldLabel comboTimeDataFormatLabel; private FieldLabel comboValueDataFormatLabel;
private ComboBox<LocaleTypeElement> comboLocaleType = null; private ComboBox<LocaleTypeElement> comboLocaleType = null;
private FieldLabel comboLocaleTypeLabel; private FieldLabel comboLocaleTypeLabel;
private ListStore<LocaleTypeElement> storeComboLocaleType; private ListStore<LocaleTypeElement> storeComboLocaleType;
@ -444,23 +444,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboPeriodTypeLabel = new FieldLabel(comboPeriodType, "Period Type"); comboPeriodTypeLabel = new FieldLabel(comboPeriodType, "Period Type");
// comboTimeDataFormat // comboTimeDataFormat
TimeDataFormatProperties propsTimeDataFormat = GWT ValueDataFormatProperties propsTimeDataFormat = GWT
.create(TimeDataFormatProperties.class); .create(ValueDataFormatProperties.class);
storeComboTimeDataFormat = new ListStore<TimeDataFormat>( storeComboValueDataFormat = new ListStore<ValueDataFormat>(
propsTimeDataFormat.id()); propsTimeDataFormat.id());
comboTimeDataFormat = new ComboBox<TimeDataFormat>( comboValueDataFormat = new ComboBox<ValueDataFormat>(
storeComboTimeDataFormat, propsTimeDataFormat.example()); storeComboValueDataFormat, propsTimeDataFormat.example());
Log.trace("ComboTimeDataFormat created"); Log.trace("ComboTimeDataFormat created");
addHandlersForComboTimeDataFormat(propsTimeDataFormat.example()); addHandlersForComboTimeDataFormat(propsTimeDataFormat.example());
comboTimeDataFormat.setEmptyText("Select a time format..."); comboValueDataFormat.setEmptyText("Select a time format...");
comboTimeDataFormat.setWidth(191); comboValueDataFormat.setWidth(191);
comboTimeDataFormat.setTypeAhead(true); comboValueDataFormat.setTypeAhead(true);
comboTimeDataFormat.setTriggerAction(TriggerAction.ALL); comboValueDataFormat.setTriggerAction(TriggerAction.ALL);
comboTimeDataFormatLabel = new FieldLabel(comboTimeDataFormat, comboValueDataFormatLabel = new FieldLabel(comboValueDataFormat,
"Time Format"); "Time Format");
// Change // Change
@ -499,7 +499,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
*/ */
v.add(comboPeriodTypeLabel, new VerticalLayoutData(1, -1, v.add(comboPeriodTypeLabel, new VerticalLayoutData(1, -1,
new Margins(1))); new Margins(1)));
v.add(comboTimeDataFormatLabel, new VerticalLayoutData(1, -1, v.add(comboValueDataFormatLabel, new VerticalLayoutData(1, -1,
new Margins(1))); new Margins(1)));
v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); v.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
add(v, new VerticalLayoutData(1, 1, new Margins(0))); add(v, new VerticalLayoutData(1, 1, new Margins(0)));
@ -516,7 +516,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormat.setValidateOnBlur(false); comboValueDataFormat.setValidateOnBlur(false);
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
} }
@ -708,10 +708,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
protected void addHandlersForComboTimeDataFormat( protected void addHandlersForComboTimeDataFormat(
final LabelProvider<TimeDataFormat> labelProvider) { final LabelProvider<ValueDataFormat> labelProvider) {
comboTimeDataFormat comboValueDataFormat
.addSelectionHandler(new SelectionHandler<TimeDataFormat>() { .addSelectionHandler(new SelectionHandler<ValueDataFormat>() {
public void onSelection(SelectionEvent<TimeDataFormat> event) { public void onSelection(SelectionEvent<ValueDataFormat> event) {
Info.display( Info.display(
"Time Format Selected", "Time Format Selected",
"You selected " "You selected "
@ -721,7 +721,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
+ "!")); + "!"));
Log.debug("ComboTimeDataFormat selected: " Log.debug("ComboTimeDataFormat selected: "
+ event.getSelectedItem()); + event.getSelectedItem());
TimeDataFormat timeDataFormat = event.getSelectedItem(); ValueDataFormat timeDataFormat = event.getSelectedItem();
updateTimeDataFormat(timeDataFormat); updateTimeDataFormat(timeDataFormat);
} }
@ -739,7 +739,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormatLabel.setVisible(false); comboValueDataFormatLabel.setVisible(false);
break; break;
case ATTRIBUTE: case ATTRIBUTE:
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
@ -749,7 +749,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormatLabel.setVisible(false); comboValueDataFormatLabel.setVisible(false);
break; break;
case DIMENSION: case DIMENSION:
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
@ -759,7 +759,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormatLabel.setVisible(false); comboValueDataFormatLabel.setVisible(false);
break; break;
case MEASURE: case MEASURE:
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
@ -769,7 +769,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormatLabel.setVisible(false); comboValueDataFormatLabel.setVisible(false);
break; break;
case TIMEDIMENSION: case TIMEDIMENSION:
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
@ -779,7 +779,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(true); comboPeriodTypeLabel.setVisible(true);
comboTimeDataFormatLabel.setVisible(true); comboValueDataFormatLabel.setVisible(true);
break; break;
default: default:
comboLocaleTypeLabel.setVisible(false); comboLocaleTypeLabel.setVisible(false);
@ -789,7 +789,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
comboColumnReferenceTypeLabel.setVisible(false); comboColumnReferenceTypeLabel.setVisible(false);
comboColumnMappingLabel.setVisible(false); comboColumnMappingLabel.setVisible(false);
comboPeriodTypeLabel.setVisible(false); comboPeriodTypeLabel.setVisible(false);
comboTimeDataFormatLabel.setVisible(false); comboValueDataFormatLabel.setVisible(false);
break; break;
} }
@ -813,17 +813,17 @@ public class ChangeColumnTypePanel extends FramedPanel implements
} }
protected void updatePeriodType(PeriodDataType periodDataType) { protected void updatePeriodType(PeriodDataType periodDataType) {
ArrayList<TimeDataFormat> timeDataFormats = periodDataType ArrayList<ValueDataFormat> timeDataFormats = periodDataType
.getTimeDataFormats(); .getTimeDataFormats();
comboTimeDataFormat.clear(); comboValueDataFormat.clear();
comboTimeDataFormat.reset(); comboValueDataFormat.reset();
comboTimeDataFormat.getStore().clear(); comboValueDataFormat.getStore().clear();
comboTimeDataFormat.getStore().addAll(timeDataFormats); comboValueDataFormat.getStore().addAll(timeDataFormats);
comboTimeDataFormat.redraw(); comboValueDataFormat.redraw();
} }
protected void updateTimeDataFormat(TimeDataFormat type) { protected void updateTimeDataFormat(ValueDataFormat type) {
} }
@ -928,13 +928,13 @@ public class ChangeColumnTypePanel extends FramedPanel implements
changeColumnTypeSession.setPeriodDataType(cd changeColumnTypeSession.setPeriodDataType(cd
.getPeriodDataType()); .getPeriodDataType());
comboPeriodType.setValue(cd.getPeriodDataType()); comboPeriodType.setValue(cd.getPeriodDataType());
ArrayList<TimeDataFormat> timeDataFormats = cd ArrayList<ValueDataFormat> timeDataFormats = cd
.getPeriodDataType().getTimeDataFormats(); .getPeriodDataType().getTimeDataFormats();
comboTimeDataFormat.clear(); comboValueDataFormat.clear();
comboTimeDataFormat.reset(); comboValueDataFormat.reset();
comboTimeDataFormat.getStore().clear(); comboValueDataFormat.getStore().clear();
comboTimeDataFormat.getStore().addAll(timeDataFormats); comboValueDataFormat.getStore().addAll(timeDataFormats);
comboTimeDataFormat.redraw(); comboValueDataFormat.redraw();
} else { } else {
// TODO // TODO
if (type == ColumnTypeCode.DIMENSION) { if (type == ColumnTypeCode.DIMENSION) {
@ -1202,7 +1202,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
if (periodDataType != null) { if (periodDataType != null) {
changeColumnTypeSession changeColumnTypeSession
.setPeriodDataType(periodDataType); .setPeriodDataType(periodDataType);
TimeDataFormat timeDataFormat = comboTimeDataFormat ValueDataFormat timeDataFormat = comboValueDataFormat
.getCurrentValue(); .getCurrentValue();
if (timeDataFormat != null) { if (timeDataFormat != null) {
changeColumnTypeSession changeColumnTypeSession

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.td.columnwidget.client.properties; package org.gcube.portlets.user.td.columnwidget.client.properties;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TimeDataFormat; import org.gcube.portlets.user.td.gwtservice.shared.tr.ValueDataFormat;
import com.google.gwt.editor.client.Editor.Path; import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;
@ -13,12 +13,12 @@ import com.sencha.gxt.data.shared.PropertyAccess;
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public interface TimeDataFormatProperties extends public interface ValueDataFormatProperties extends
PropertyAccess<TimeDataFormat> { PropertyAccess<ValueDataFormat> {
@Path("id") @Path("id")
ModelKeyProvider<TimeDataFormat> id(); ModelKeyProvider<ValueDataFormat> id();
LabelProvider<TimeDataFormat> example(); LabelProvider<ValueDataFormat> example();
} }