Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90498 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ca7f76b5e6
commit
cf1f9b2083
|
@ -10,6 +10,9 @@
|
||||||
<dependent-module archiveName="tabular-model-3.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-model/tabular-model">
|
<dependent-module archiveName="tabular-model-3.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-model/tabular-model">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="tabular-data-widget-common-event-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget-common-event/tabular-data-widget-common-event">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<property name="context-root" value="tabular-data-column-widget"/>
|
<property name="context-root" value="tabular-data-column-widget"/>
|
||||||
<property name="java-output-path" value="/tabular-data-column-widget/target/tabular-data-column-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/tabular-data-column-widget/target/tabular-data-column-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -3,9 +3,17 @@ package org.gcube.portlets.user.td.columnwidget.client;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties;
|
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties;
|
||||||
|
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.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.gwtservice.client.rpc.TDGWTServiceAsync;
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
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.ColumnTypeCode;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -47,40 +55,46 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
protected String columnName;
|
protected String columnName;
|
||||||
protected ColumnData column;
|
protected ColumnData column;
|
||||||
protected ComboBox<ColumnData> comboColumn = null;
|
protected ComboBox<ColumnData> comboColumn = null;
|
||||||
protected ComboBox<ColumnTypeCode> comboTypeColumn = null;
|
protected ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||||
|
protected ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
||||||
|
protected TextField labelColumn;
|
||||||
|
protected FieldLabel comboMeasureTypeLabel;
|
||||||
|
|
||||||
|
public ChangeColumnTypePanel(TRId trId, String columnName) {
|
||||||
public ChangeColumnTypePanel(TRId trId, String columnName){
|
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
this.trId=trId;
|
this.trId = trId;
|
||||||
this.columnName=columnName;
|
this.columnName = columnName;
|
||||||
|
|
||||||
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||||
|
|
||||||
ContentPanel panel = new ContentPanel();
|
ContentPanel panel = new ContentPanel();
|
||||||
panel.setHeaderVisible(false);
|
panel.setHeaderVisible(false);
|
||||||
|
|
||||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
ColumnDataProperties propsColumnData = GWT
|
||||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
.create(ColumnDataProperties.class);
|
||||||
|
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
||||||
Log.trace("Store created");
|
propsColumnData.id());
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
|
||||||
|
Log.trace("StoreCombo created");
|
||||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
loadData(loadConfig, callback);
|
loadData(loadConfig, callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(proxy);
|
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||||
|
proxy);
|
||||||
loader.setRemoteSort(false);
|
loader.setRemoteSort(false);
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(store));
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||||
Log.trace("Loader created");
|
storeCombo));
|
||||||
|
Log.trace("LoaderCombo created");
|
||||||
|
|
||||||
comboColumn = new ComboBox<ColumnData>(store, props.label()){
|
comboColumn = new ComboBox<ColumnData>(storeCombo,
|
||||||
|
propsColumnData.label()) {
|
||||||
|
|
||||||
protected void onAfterFirstAttach() {
|
protected void onAfterFirstAttach() {
|
||||||
super.onAfterFirstAttach();
|
super.onAfterFirstAttach();
|
||||||
|
@ -91,36 +105,79 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Log.trace("Combo created");
|
Log.trace("Combo ColumnData created");
|
||||||
|
|
||||||
addHandlersForEventObservation(comboColumn, props.label());
|
addHandlersForEventObservation(comboColumn, propsColumnData.label());
|
||||||
|
|
||||||
comboColumn.setEmptyText("Select a column...");
|
comboColumn.setEmptyText("Select a column...");
|
||||||
comboColumn.setWidth(150);
|
comboColumn.setWidth(150);
|
||||||
comboColumn.setTypeAhead(true);
|
comboColumn.setTypeAhead(true);
|
||||||
|
comboColumn.setEditable(true);
|
||||||
comboColumn.setTriggerAction(TriggerAction.ALL);
|
comboColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
comboColumn.setLoader(loader);
|
comboColumn.setLoader(loader);
|
||||||
|
|
||||||
|
// comboColumnTypeCode
|
||||||
|
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
||||||
|
.create(ColumnTypeCodeProperties.class);
|
||||||
|
ListStore<ColumnTypeCodeElement> storeComboTypeCode = new ListStore<ColumnTypeCodeElement>(
|
||||||
|
propsColumnTypeCode.id());
|
||||||
|
storeComboTypeCode.addAll(ColumnTypeCodeStore.getColumnTypeCodes());
|
||||||
|
|
||||||
|
comboColumnTypeCode = new ComboBox<ColumnTypeCodeElement>(
|
||||||
|
storeComboTypeCode, propsColumnTypeCode.label());
|
||||||
|
Log.trace("ComboColumnTypeCode created");
|
||||||
|
|
||||||
|
addHandlersForComboColumnTypeCode(propsColumnTypeCode.label());
|
||||||
|
|
||||||
|
comboColumnTypeCode.setEmptyText("Select a column type...");
|
||||||
|
comboColumnTypeCode.setWidth(150);
|
||||||
|
comboColumnTypeCode.setTypeAhead(true);
|
||||||
|
comboColumnTypeCode.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
// comboMeasureType
|
||||||
|
ColumnDataTypeProperties propsMeasureType = GWT
|
||||||
|
.create(ColumnDataTypeProperties.class);
|
||||||
|
ListStore<ColumnDataTypeElement> storeComboMeasureType = new ListStore<ColumnDataTypeElement>(
|
||||||
|
propsMeasureType.id());
|
||||||
|
storeComboMeasureType.addAll(ColumnDataTypeStore.getMeasureType());
|
||||||
|
|
||||||
|
comboMeasureType = new ComboBox<ColumnDataTypeElement>(
|
||||||
|
storeComboMeasureType, propsMeasureType.label());
|
||||||
|
Log.trace("ComboMeasureType created");
|
||||||
|
|
||||||
|
addHandlersForComboMeasureType(propsMeasureType.label());
|
||||||
|
|
||||||
|
comboMeasureType.setEmptyText("Select a column type...");
|
||||||
|
comboMeasureType.setWidth(150);
|
||||||
|
comboMeasureType.setTypeAhead(true);
|
||||||
|
comboMeasureType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
comboMeasureTypeLabel=new FieldLabel(comboMeasureType, "Measure Type");
|
||||||
|
comboMeasureTypeLabel.setVisible(false);
|
||||||
|
|
||||||
FramedPanel form = new FramedPanel();
|
FramedPanel form = new FramedPanel();
|
||||||
form.setHeaderVisible(false);
|
form.setHeaderVisible(false);
|
||||||
//form.setWidth(350);
|
// form.setWidth(350);
|
||||||
form.setBodyStyle("background: none;");
|
form.setBodyStyle("background: none;");
|
||||||
|
|
||||||
TextField labelColumn=new TextField();
|
labelColumn = new TextField();
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.add(new FieldLabel(comboColumn, "Column"), new VerticalLayoutData(1,
|
||||||
|
-1));
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
v.add(new FieldLabel(labelColumn, "Label"), new VerticalLayoutData(1,
|
||||||
v.add(new FieldLabel(comboColumn, "Column"), new VerticalLayoutData(1, -1));
|
-1));
|
||||||
v.add(new FieldLabel(labelColumn, "Label"), new VerticalLayoutData(1, -1));
|
v.add(new FieldLabel(comboColumnTypeCode, "Column Type"),
|
||||||
|
new VerticalLayoutData(1, -1));
|
||||||
form.add(v);
|
v.add(comboMeasureTypeLabel,
|
||||||
form.addButton(new TextButton("Change"));
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
|
||||||
panel.add(form);
|
form.add(v);
|
||||||
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
form.addButton(new TextButton("Change"));
|
||||||
|
|
||||||
|
panel.add(form);
|
||||||
|
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
||||||
add(basicLayout);
|
add(basicLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,6 +208,61 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void addHandlersForComboColumnTypeCode(final LabelProvider<ColumnTypeCodeElement> labelProvider){
|
||||||
|
comboColumnTypeCode.addSelectionHandler(new SelectionHandler<ColumnTypeCodeElement>() {
|
||||||
|
public void onSelection(SelectionEvent<ColumnTypeCodeElement> event) {
|
||||||
|
Info.display(
|
||||||
|
"Type Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: labelProvider.getLabel(event
|
||||||
|
.getSelectedItem()) + "!"));
|
||||||
|
Log.debug("ComboColumnTypeCode selected: "+event.getSelectedItem());
|
||||||
|
ColumnTypeCodeElement columnType=event.getSelectedItem();
|
||||||
|
updateColumnType(columnType.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addHandlersForComboMeasureType(final LabelProvider<ColumnDataTypeElement> labelProvider){
|
||||||
|
comboMeasureType.addSelectionHandler(new SelectionHandler<ColumnDataTypeElement>() {
|
||||||
|
public void onSelection(SelectionEvent<ColumnDataTypeElement> event) {
|
||||||
|
Info.display(
|
||||||
|
"Type Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: labelProvider.getLabel(event
|
||||||
|
.getSelectedItem()) + "!"));
|
||||||
|
Log.debug("ComboMeasureType selected: "+event.getSelectedItem());
|
||||||
|
ColumnDataTypeElement measureType=event.getSelectedItem();
|
||||||
|
updateMeasureType(measureType.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void updateColumnType(ColumnTypeCode type){
|
||||||
|
if(type==ColumnTypeCode.MEASURE){
|
||||||
|
comboMeasureTypeLabel.setVisible(true);
|
||||||
|
} else {
|
||||||
|
comboMeasureTypeLabel.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateMeasureType(ColumnDataType type){
|
||||||
|
/*if(type==ColumnDataType.Integer){
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
@ -168,6 +280,9 @@ public class ChangeColumnTypePanel extends FramedPanel {
|
||||||
for (ColumnData cd : result) {
|
for (ColumnData cd : result) {
|
||||||
if (cd.getName().compareTo(columnName) == 0) {
|
if (cd.getName().compareTo(columnName) == 0) {
|
||||||
comboColumn.setValue(cd);
|
comboColumn.setValue(cd);
|
||||||
|
labelColumn.setValue(cd.getLabel());
|
||||||
|
comboColumnTypeCode.select(ColumnTypeCodeStore
|
||||||
|
.selected(cd.getTypeCode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.properties;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeElement;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
public interface ColumnDataTypeProperties extends
|
||||||
|
PropertyAccess<ColumnDataTypeElement> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<ColumnDataTypeElement> id();
|
||||||
|
|
||||||
|
LabelProvider<ColumnDataTypeElement> label();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
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.ColumnTypeCode;
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElement;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -9,12 +10,12 @@ import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
public interface ColumnTypeCodeProperties extends
|
public interface ColumnTypeCodeProperties extends
|
||||||
PropertyAccess<ColumnTypeCode> {
|
PropertyAccess<ColumnTypeCodeElement> {
|
||||||
|
|
||||||
@Path("id")
|
@Path("id")
|
||||||
ModelKeyProvider<String> id();
|
ModelKeyProvider<ColumnTypeCodeElement> id();
|
||||||
|
|
||||||
LabelProvider<String> label();
|
LabelProvider<ColumnTypeCodeElement> label();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ColumnDataTypeElement {
|
||||||
|
|
||||||
|
protected int id; // For insert in table only
|
||||||
|
protected ColumnDataType type;
|
||||||
|
|
||||||
|
|
||||||
|
public ColumnDataTypeElement(int id,ColumnDataType type){
|
||||||
|
this.id=id;
|
||||||
|
this.type=type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnDataType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setCode(ColumnDataType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return type.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ColumnTypeCode [id=" + id + ", code=" + type + ", getLabel()="
|
||||||
|
+ getLabel() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
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.ColumnDataType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ColumnDataTypeStore implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1908324094430432681L;
|
||||||
|
|
||||||
|
protected static ArrayList<ColumnDataTypeElement> store;
|
||||||
|
|
||||||
|
public static ArrayList<ColumnDataTypeElement> getMeasureType(){
|
||||||
|
store=new ArrayList<ColumnDataTypeElement>();
|
||||||
|
store.add(new ColumnDataTypeElement(1,ColumnDataType.Integer));
|
||||||
|
store.add(new ColumnDataTypeElement(2,ColumnDataType.Numeric));
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int selectedMeasure(String selected){
|
||||||
|
int position=0;
|
||||||
|
if(selected.compareTo(ColumnDataType.Integer.toString())==0){
|
||||||
|
position=1;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnDataType.Numeric.toString())==0){
|
||||||
|
position=2;
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.store;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ColumnTypeCodeElement {
|
||||||
|
|
||||||
|
protected int id; // For insert in table only
|
||||||
|
protected ColumnTypeCode code;
|
||||||
|
|
||||||
|
|
||||||
|
public ColumnTypeCodeElement(int id,ColumnTypeCode code){
|
||||||
|
this.id=id;
|
||||||
|
this.code=code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColumnTypeCode getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
public void setCode(ColumnTypeCode code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return code.getColumnTypeCodeLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ColumnTypeCode [id=" + id + ", code=" + code + ", getLabel()="
|
||||||
|
+ getLabel() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
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.ColumnTypeCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ColumnTypeCodeStore implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1908324094430432681L;
|
||||||
|
|
||||||
|
protected static ArrayList<ColumnTypeCodeElement> store = new ArrayList<ColumnTypeCodeElement>();
|
||||||
|
|
||||||
|
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(){
|
||||||
|
store.add(new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION));
|
||||||
|
store.add(new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE));
|
||||||
|
store.add(new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE));
|
||||||
|
store.add(new ColumnTypeCodeElement(4,ColumnTypeCode.CODE));
|
||||||
|
store.add(new ColumnTypeCodeElement(5,ColumnTypeCode.CODENAME));
|
||||||
|
store.add(new ColumnTypeCodeElement(6,ColumnTypeCode.CODEDESCRIPTION));
|
||||||
|
store.add(new ColumnTypeCodeElement(7,ColumnTypeCode.DIMENSION));
|
||||||
|
store.add(new ColumnTypeCodeElement(8,ColumnTypeCode.TIMEDIMENSION));
|
||||||
|
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int selected(String selected){
|
||||||
|
int position=0;
|
||||||
|
if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){
|
||||||
|
position=1;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){
|
||||||
|
position=2;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){
|
||||||
|
position=3;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){
|
||||||
|
position=4;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){
|
||||||
|
position=5;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){
|
||||||
|
position=6;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){
|
||||||
|
position=7;
|
||||||
|
} else {
|
||||||
|
if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){
|
||||||
|
position=8;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue