Added PeriodDataType
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@111640 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1a88c3ee03
commit
9f4939d9e3
|
@ -11,22 +11,21 @@ import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPrope
|
|||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
|
||||
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.TabResourceProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.TimeDimensionTypeProperties;
|
||||
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.ColumnDataTypeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.LocaleTypeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
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.ColumnData;
|
||||
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.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingList;
|
||||
|
@ -43,7 +42,6 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeMap;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.PeriodDataType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -120,9 +118,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
private FieldLabel comboColumnMappingLabel;
|
||||
private ListStore<ColumnMappingList> storeComboColumnMapping;
|
||||
|
||||
private ComboBox<TimeDimensionTypeElement> comboTimeDimensionType = null;
|
||||
private ComboBox<PeriodDataType> comboTimeDimensionType = null;
|
||||
private FieldLabel comboTimeDimensionTypeLabel;
|
||||
|
||||
private ListStore<PeriodDataType> storeComboTimeDimensionType;
|
||||
|
||||
private ComboBox<LocaleTypeElement> comboLocaleType = null;
|
||||
private FieldLabel comboLocaleTypeLabel;
|
||||
private ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
|
@ -133,6 +132,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
|
||||
private ChangeColumnTypeSession changeColumnTypeSession;
|
||||
private boolean panelCreated;
|
||||
|
||||
|
||||
public ChangeColumnTypePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
|
@ -411,15 +411,23 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
comboColumnMappingLabel = new FieldLabel(comboColumnMapping, "Mapping");
|
||||
|
||||
// comboTimeDimensionType
|
||||
TimeDimensionTypeProperties propsTimeDimensionType = GWT
|
||||
.create(TimeDimensionTypeProperties.class);
|
||||
ListStore<TimeDimensionTypeElement> storeComboTimeDimensionType = new ListStore<TimeDimensionTypeElement>(
|
||||
propsTimeDimensionType.id());
|
||||
storeComboTimeDimensionType.addAll(TimeDimensionTypeStore
|
||||
.getTimeDimensionType());
|
||||
|
||||
comboTimeDimensionType = new ComboBox<TimeDimensionTypeElement>(
|
||||
storeComboTimeDimensionType, propsTimeDimensionType.label());
|
||||
PeriodDataTypeProperties propsTimeDimensionType = GWT
|
||||
.create(PeriodDataTypeProperties.class);
|
||||
storeComboTimeDimensionType = new ListStore<PeriodDataType>(
|
||||
propsTimeDimensionType.name());
|
||||
|
||||
comboTimeDimensionType = new ComboBox<PeriodDataType>(
|
||||
storeComboTimeDimensionType, propsTimeDimensionType.label()){
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
retrievePeriodDataType();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Log.trace("ComboTimeDimensionType created");
|
||||
|
||||
addHandlersForComboTimeDimensionType(propsTimeDimensionType.label());
|
||||
|
@ -668,11 +676,11 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
protected void addHandlersForComboTimeDimensionType(
|
||||
final LabelProvider<TimeDimensionTypeElement> labelProvider) {
|
||||
final LabelProvider<PeriodDataType> labelProvider) {
|
||||
comboTimeDimensionType
|
||||
.addSelectionHandler(new SelectionHandler<TimeDimensionTypeElement>() {
|
||||
.addSelectionHandler(new SelectionHandler<PeriodDataType>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<TimeDimensionTypeElement> event) {
|
||||
SelectionEvent<PeriodDataType> event) {
|
||||
Info.display(
|
||||
"Time Dimension Type Selected",
|
||||
"You selected "
|
||||
|
@ -682,9 +690,9 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
+ "!"));
|
||||
Log.debug("ComboTimeDimensionType selected: "
|
||||
+ event.getSelectedItem());
|
||||
TimeDimensionTypeElement timeDimensionType = event
|
||||
PeriodDataType timeDimensionType = event
|
||||
.getSelectedItem();
|
||||
updateTimeDimensionType(timeDimensionType.getType());
|
||||
updateTimeDimensionType(timeDimensionType);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -872,14 +880,10 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
|
||||
if (type == ColumnTypeCode.TIMEDIMENSION) {
|
||||
changeColumnTypeSession
|
||||
.setTimeDimensionType(TimeDimensionTypeStore
|
||||
.selectedTimeDimension(cd
|
||||
.getPeriodDataType()
|
||||
.getPeriodDataTypeLabel()));
|
||||
comboTimeDimensionType.setValue(TimeDimensionTypeStore
|
||||
.selectedTimeDimensionElement(cd
|
||||
.getPeriodDataType()
|
||||
.getPeriodDataTypeLabel()));
|
||||
.setTimeDimensionType(cd
|
||||
.getPeriodDataType());
|
||||
comboTimeDimensionType.setValue(cd
|
||||
.getPeriodDataType());
|
||||
} else {
|
||||
// TODO
|
||||
if (type == ColumnTypeCode.DIMENSION) {
|
||||
|
@ -1142,19 +1146,13 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
break;
|
||||
case TIMEDIMENSION:
|
||||
changeColumnTypeSession.setColumnTypeCodeTarget(type);
|
||||
TimeDimensionTypeElement timeDimensionTypeElement = comboTimeDimensionType
|
||||
PeriodDataType periodDataType = comboTimeDimensionType
|
||||
.getCurrentValue();
|
||||
if (timeDimensionTypeElement != null) {
|
||||
PeriodDataType timeDimensionType = timeDimensionTypeElement
|
||||
.getType();
|
||||
if (timeDimensionType != null) {
|
||||
if (periodDataType != null) {
|
||||
changeColumnTypeSession
|
||||
.setTimeDimensionType(timeDimensionType);
|
||||
.setTimeDimensionType(periodDataType);
|
||||
callChangeColumnType();
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Time Dimension type not selected!");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
|
@ -1414,7 +1412,48 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
protected void retrievePeriodDataType() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getPeriodDataTypes(new AsyncCallback<ArrayList<PeriodDataType>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving period type",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<PeriodDataType> result) {
|
||||
storeComboTimeDimensionType.clear();
|
||||
storeComboTimeDimensionType.addAll(result);
|
||||
storeComboTimeDimensionType.commitChanges();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setLocale(String locale) {
|
||||
for (LocaleTypeElement loc : storeComboLocaleType.getAll()) {
|
||||
if (loc.getLocaleName().compareTo(locale) == 0) {
|
||||
|
|
|
@ -9,16 +9,14 @@ import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPrope
|
|||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties;
|
||||
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.TabResourceProperties;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.properties.TimeDimensionTypeProperties;
|
||||
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.ColumnDataTypeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.LocaleTypeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeElement;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeStore;
|
||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
|
@ -26,6 +24,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedExcep
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.PeriodDataType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
|
@ -39,7 +38,6 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.PeriodDataType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -81,51 +79,54 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
|
||||
+ "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
|
||||
|
||||
protected static final String WIDTH = "640px";
|
||||
protected static final String HEIGHT = "520px";
|
||||
private static final String WIDTH = "640px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
protected EventBus eventBus;
|
||||
protected AddColumnDialog parent;
|
||||
protected TRId trId;
|
||||
private EventBus eventBus;
|
||||
private AddColumnDialog parent;
|
||||
private TRId trId;
|
||||
|
||||
protected AddColumnPanel thisPanel;
|
||||
//private AddColumnPanel thisPanel;
|
||||
|
||||
protected ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||
protected FieldLabel comboColumnTypeCodeLabel;
|
||||
private ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||
//private FieldLabel comboColumnTypeCodeLabel;
|
||||
|
||||
protected ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
||||
protected FieldLabel comboMeasureTypeLabel;
|
||||
private ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
||||
private FieldLabel comboMeasureTypeLabel;
|
||||
|
||||
protected ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||
protected FieldLabel comboAttributeTypeLabel;
|
||||
private ComboBox<ColumnDataTypeElement> comboAttributeType = null;
|
||||
private FieldLabel comboAttributeTypeLabel;
|
||||
|
||||
protected ComboBox<TabResource> comboDimensionType = null;
|
||||
protected FieldLabel comboDimensionTypeLabel;
|
||||
private ComboBox<TabResource> comboDimensionType = null;
|
||||
private FieldLabel comboDimensionTypeLabel;
|
||||
|
||||
protected ComboBox<ColumnData> comboColumnReferenceType = null;
|
||||
protected FieldLabel comboColumnReferenceTypeLabel;
|
||||
protected ListStore<ColumnData> storeComboColumnReferenceType;
|
||||
private ComboBox<ColumnData> comboColumnReferenceType = null;
|
||||
private FieldLabel comboColumnReferenceTypeLabel;
|
||||
private ListStore<ColumnData> storeComboColumnReferenceType;
|
||||
|
||||
protected ComboBox<TimeDimensionTypeElement> comboTimeDimensionType = null;
|
||||
protected FieldLabel comboTimeDimensionTypeLabel;
|
||||
private ComboBox<PeriodDataType> comboTimeDimensionType = null;
|
||||
private FieldLabel comboTimeDimensionTypeLabel;
|
||||
private ListStore<PeriodDataType> storeComboTimeDimensionType;
|
||||
|
||||
protected ComboBox<LocaleTypeElement> comboLocaleType = null;
|
||||
protected FieldLabel comboLocaleTypeLabel;
|
||||
protected ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
private ComboBox<LocaleTypeElement> comboLocaleType = null;
|
||||
private FieldLabel comboLocaleTypeLabel;
|
||||
private ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
|
||||
protected AddColumnSession addColumnSession;
|
||||
private AddColumnSession addColumnSession;
|
||||
|
||||
protected TextButton btnAddColumn;
|
||||
private TextButton btnAddColumn;
|
||||
|
||||
protected TextField label;
|
||||
protected TextField defaultValueString;
|
||||
protected DateField defaultValueDate;
|
||||
private TextField label;
|
||||
private TextField defaultValueString;
|
||||
private DateField defaultValueDate;
|
||||
|
||||
protected FieldLabel defaultStringLabel;
|
||||
protected FieldLabel defaultDateLabel;
|
||||
private FieldLabel defaultStringLabel;
|
||||
private FieldLabel defaultDateLabel;
|
||||
|
||||
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
|
@ -134,7 +135,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
public AddColumnPanel(AddColumnDialog parent, TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("CreateDefColumnPanel[parent: " + parent + ", trId: " + trId);
|
||||
this.thisPanel = this;
|
||||
//this.thisPanel = this;
|
||||
this.parent = parent;
|
||||
this.eventBus = eventBus;
|
||||
this.trId = trId;
|
||||
|
@ -150,7 +151,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
public AddColumnPanel(TRId trId, EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("CreateDefColumnPanel[trId: " + trId);
|
||||
this.thisPanel = this;
|
||||
//this.thisPanel = this;
|
||||
this.eventBus = eventBus;
|
||||
this.trId = trId;
|
||||
init();
|
||||
|
@ -249,7 +250,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
retriveLocales();
|
||||
retrieveLocales();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -305,14 +306,22 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
comboColumnReferenceType, "Column");
|
||||
|
||||
// comboTimeDimensionType
|
||||
TimeDimensionTypeProperties propsTimeDimensionType = GWT
|
||||
.create(TimeDimensionTypeProperties.class);
|
||||
ListStore<TimeDimensionTypeElement> storeComboTimeDimensionType = new ListStore<TimeDimensionTypeElement>(
|
||||
propsTimeDimensionType.id());
|
||||
storeComboTimeDimensionType.addAll(TimeDimensionTypeStore
|
||||
.getTimeDimensionType());
|
||||
comboTimeDimensionType = new ComboBox<TimeDimensionTypeElement>(
|
||||
storeComboTimeDimensionType, propsTimeDimensionType.label());
|
||||
PeriodDataTypeProperties propsTimeDimensionType = GWT
|
||||
.create(PeriodDataTypeProperties.class);
|
||||
storeComboTimeDimensionType = new ListStore<PeriodDataType>(
|
||||
propsTimeDimensionType.name());
|
||||
|
||||
comboTimeDimensionType = new ComboBox<PeriodDataType>(
|
||||
storeComboTimeDimensionType, propsTimeDimensionType.label()){
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
retrievePeriodDataType();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Log.trace("ComboTimeDimensionType created");
|
||||
|
||||
addHandlersForComboTimeDimensionType(propsTimeDimensionType.label());
|
||||
|
@ -507,11 +516,11 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
}
|
||||
|
||||
protected void addHandlersForComboTimeDimensionType(
|
||||
final LabelProvider<TimeDimensionTypeElement> labelProvider) {
|
||||
final LabelProvider<PeriodDataType> labelProvider) {
|
||||
comboTimeDimensionType
|
||||
.addSelectionHandler(new SelectionHandler<TimeDimensionTypeElement>() {
|
||||
.addSelectionHandler(new SelectionHandler<PeriodDataType>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<TimeDimensionTypeElement> event) {
|
||||
SelectionEvent<PeriodDataType> event) {
|
||||
Info.display(
|
||||
"Time Dimension Type Selected",
|
||||
"You selected "
|
||||
|
@ -521,9 +530,9 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
+ "!"));
|
||||
Log.debug("ComboTimeDimensionType selected: "
|
||||
+ event.getSelectedItem());
|
||||
TimeDimensionTypeElement timeDimensionType = event
|
||||
PeriodDataType timeDimensionType = event
|
||||
.getSelectedItem();
|
||||
updateTimeDimensionType(timeDimensionType.getType());
|
||||
updateTimeDimensionType(timeDimensionType);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -788,22 +797,15 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
}
|
||||
break;
|
||||
case TIMEDIMENSION:
|
||||
TimeDimensionTypeElement timeDimensionTypeElement = comboTimeDimensionType
|
||||
PeriodDataType periodDataType = comboTimeDimensionType
|
||||
.getCurrentValue();
|
||||
if (timeDimensionTypeElement != null) {
|
||||
PeriodDataType timeDimensionType = timeDimensionTypeElement
|
||||
.getType();
|
||||
if (timeDimensionType != null) {
|
||||
if (periodDataType != null) {
|
||||
defNewColumn = new DefNewColumn(labelS, type,
|
||||
timeDimensionType, defaultV);
|
||||
periodDataType, defaultV);
|
||||
addColumnSession = new AddColumnSession(trId,
|
||||
defNewColumn);
|
||||
callAddColumm();
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Time Dimension type not selected!");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Time Dimension type not selected!");
|
||||
|
@ -931,7 +933,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
|
||||
protected void retriveLocales() {
|
||||
protected void retrieveLocales() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getLocales(new AsyncCallback<ArrayList<String>>() {
|
||||
|
||||
|
@ -976,6 +978,48 @@ public class AddColumnPanel extends FramedPanel implements
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void retrievePeriodDataType() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getPeriodDataTypes(new AsyncCallback<ArrayList<PeriodDataType>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving period type",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<PeriodDataType> result) {
|
||||
storeComboTimeDimensionType.clear();
|
||||
storeComboTimeDimensionType.addAll(result);
|
||||
storeComboTimeDimensionType.commitChanges();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setLocale(String locale) {
|
||||
for (LocaleTypeElement loc : storeComboLocaleType.getAll()) {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.properties;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.PeriodDataType;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface PeriodDataTypeProperties extends
|
||||
PropertyAccess<PeriodDataType> {
|
||||
|
||||
@Path("name")
|
||||
ModelKeyProvider<PeriodDataType> name();
|
||||
|
||||
LabelProvider<PeriodDataType> label();
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.properties;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.store.TimeDimensionTypeElement;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface TimeDimensionTypeProperties extends
|
||||
PropertyAccess<TimeDimensionTypeElement> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<TimeDimensionTypeElement> id();
|
||||
|
||||
LabelProvider<TimeDimensionTypeElement> label();
|
||||
|
||||
//ValueProvider<TimeDimensionTypeElement,String> viewLabel();
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.PeriodDataType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TimeDimensionTypeElement {
|
||||
|
||||
protected int id; // For insert in table only
|
||||
protected PeriodDataType type;
|
||||
|
||||
|
||||
public TimeDimensionTypeElement(int id,PeriodDataType type){
|
||||
this.id=id;
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public PeriodDataType getType() {
|
||||
return type;
|
||||
}
|
||||
public void setCode(PeriodDataType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return type.getPeriodDataTypeLabel();
|
||||
}
|
||||
|
||||
public String getViewLabel() {
|
||||
return type.getPeriodDataTypeLabel();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TimeDimensionTypeElement [id=" + id + ", type=" + type + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.PeriodDataType;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TimeDimensionTypeStore implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5669638279415262224L;
|
||||
|
||||
private static ArrayList<TimeDimensionTypeElement> store;
|
||||
|
||||
private static TimeDimensionTypeElement dayElement=new TimeDimensionTypeElement(1,PeriodDataType.DAY);
|
||||
private static TimeDimensionTypeElement monthElement=new TimeDimensionTypeElement(2,PeriodDataType.MONTH);
|
||||
private static TimeDimensionTypeElement quarterElement=new TimeDimensionTypeElement(3,PeriodDataType.QUARTER);
|
||||
private static TimeDimensionTypeElement yearElement=new TimeDimensionTypeElement(4,PeriodDataType.YEAR);
|
||||
private static TimeDimensionTypeElement decadeElement=new TimeDimensionTypeElement(5,PeriodDataType.DECADE);
|
||||
private static TimeDimensionTypeElement centuryElement=new TimeDimensionTypeElement(6,PeriodDataType.CENTURY);
|
||||
|
||||
|
||||
public static ArrayList<TimeDimensionTypeElement> getTimeDimensionType(){
|
||||
store=new ArrayList<TimeDimensionTypeElement>();
|
||||
store.add(dayElement);
|
||||
store.add(monthElement);
|
||||
store.add(quarterElement);
|
||||
store.add(yearElement);
|
||||
store.add(decadeElement);
|
||||
store.add(centuryElement);
|
||||
return store;
|
||||
}
|
||||
|
||||
public static int selectedTimeDimensionPosition(String selected){
|
||||
int position=0;
|
||||
if(selected.compareTo(PeriodDataType.DAY.toString())==0){
|
||||
position=1;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.MONTH.toString())==0){
|
||||
position=2;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.QUARTER.toString())==0){
|
||||
position=3;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.YEAR.toString())==0){
|
||||
position=4;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.DECADE.toString())==0){
|
||||
position=5;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.CENTURY.toString())==0){
|
||||
position=6;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
public static PeriodDataType selectedTimeDimension(String selected){
|
||||
return PeriodDataType.getPeriodFromString(selected);
|
||||
}
|
||||
|
||||
public static TimeDimensionTypeElement selectedTimeDimensionElement(String selected){
|
||||
if(selected.compareTo(PeriodDataType.DAY.toString())==0){
|
||||
return dayElement;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.MONTH.toString())==0){
|
||||
return monthElement;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.QUARTER.toString())==0){
|
||||
return quarterElement;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.YEAR.toString())==0){
|
||||
return yearElement;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.DECADE.toString())==0){
|
||||
return decadeElement;
|
||||
} else {
|
||||
if(selected.compareTo(PeriodDataType.CENTURY.toString())==0){
|
||||
return centuryElement;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue