Added CreateDefColumnDialog
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@96174 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
543cb43cf8
commit
76c3941272
|
@ -3770,3 +3770,35 @@ Compiling...
|
|||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||
Compiling...
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
70% complete (ETR: 1 seconds)
|
||||
80% complete (ETR: 1 seconds)
|
||||
90% complete (ETR: 1 seconds)
|
||||
100% complete (ETR: 0 seconds)
|
||||
Compilation completed in 11.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
Public resources found in...
|
||||
Translatable source found in...
|
||||
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
|
||||
Compiling...
|
||||
Compilation completed in 0.00 seconds
|
||||
Removing invalidated units
|
||||
Finding entry point classes
|
||||
|
|
|
@ -79,19 +79,22 @@ public class DeleteColumnPanel extends FramedPanel {
|
|||
private ListStore<ColumnData> store;
|
||||
|
||||
public DeleteColumnPanel(TRId trId, String columnName, EventBus eventBus) {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
this.eventBus = eventBus;
|
||||
Log.debug("DeleteColumnPanel(): [" + trId.toString() + " columnName: "
|
||||
+ columnName + "]");
|
||||
|
||||
init();
|
||||
build();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
}
|
||||
|
||||
protected void build() {
|
||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.create;
|
||||
|
||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType;
|
||||
|
||||
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;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
|
||||
/**
|
||||
* Edit Row
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class CreateDefColumnDialog extends Window {
|
||||
protected String WIDTH = "460px";
|
||||
protected String HEIGHT = "320px";
|
||||
protected EventBus eventBus;
|
||||
protected CreateDefColumnPanel createDefColumnPanel;
|
||||
protected TableType tableType;
|
||||
|
||||
public CreateDefColumnDialog(String id, TableType tableType,EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
this.tableType = tableType;
|
||||
initWindow();
|
||||
createDefColumnPanel = new CreateDefColumnPanel(this,id,tableType, eventBus);
|
||||
add(createDefColumnPanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.columnValue());
|
||||
setHeadingText("Column Definition");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addListener(CreateDefColumnListener listener) {
|
||||
createDefColumnPanel.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeListener(CreateDefColumnListener listener) {
|
||||
createDefColumnPanel.removeListener(listener);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.create;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
|
||||
public interface CreateDefColumnListener {
|
||||
/**
|
||||
* Called when column definition is create without errors
|
||||
*/
|
||||
public void completedDefColumnCreation(DefNewColumn defNewColumn);
|
||||
|
||||
/**
|
||||
* Called when column definition is aborted by the user.
|
||||
*/
|
||||
public void abortedDefColumnCreation();
|
||||
|
||||
/**
|
||||
* Called when the something is failed.
|
||||
*
|
||||
* @param reason
|
||||
* @param detail
|
||||
*/
|
||||
public void failedDefColumnCreation(String reason, String details);
|
||||
}
|
|
@ -0,0 +1,409 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.create;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.resources.ResourceBundle;
|
||||
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.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
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.form.TextField;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class CreateDefColumnPanel extends FramedPanel {
|
||||
protected static final String WIDTH = "460px";
|
||||
protected static final String HEIGHT = "320px";
|
||||
protected static final String FIELDWIDTH = "440px";
|
||||
protected static final String FIELDSHEIGHT = "300px";
|
||||
|
||||
protected ArrayList<CreateDefColumnListener> listeners;
|
||||
|
||||
protected EventBus eventBus;
|
||||
protected CreateDefColumnDialog parent;
|
||||
protected TableType tableType;
|
||||
protected String id;
|
||||
|
||||
protected ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
||||
protected FieldLabel comboColumnTypeCodeLabel;
|
||||
|
||||
protected ComboBox<LocaleTypeElement> comboLocaleType = null;
|
||||
protected FieldLabel comboLocaleTypeLabel;
|
||||
protected ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
|
||||
private TextButton btnSave;
|
||||
private TextButton btnClose;
|
||||
private SimpleContainer form;
|
||||
private VerticalLayoutContainer formLayout;
|
||||
private TextField label;
|
||||
private TextField defaultValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @param eventBus
|
||||
*/
|
||||
public CreateDefColumnPanel(CreateDefColumnDialog parent, String id,
|
||||
TableType tableType, EventBus eventBus) {
|
||||
super();
|
||||
this.parent = parent;
|
||||
this.eventBus = eventBus;
|
||||
this.tableType = tableType;
|
||||
this.id = id;
|
||||
init();
|
||||
create();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
// Label
|
||||
label = new TextField();
|
||||
FieldLabel nameLabel = new FieldLabel(label, "Column Label");
|
||||
|
||||
// Default Value
|
||||
defaultValue = new TextField();
|
||||
FieldLabel defaultValueLabel = new FieldLabel(defaultValue,
|
||||
"Default Value");
|
||||
|
||||
// comboColumnTypeCode
|
||||
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
||||
.create(ColumnTypeCodeProperties.class);
|
||||
ListStore<ColumnTypeCodeElement> storeComboTypeCode = new ListStore<ColumnTypeCodeElement>(
|
||||
propsColumnTypeCode.id());
|
||||
|
||||
switch (tableType) {
|
||||
case CODELIST:
|
||||
storeComboTypeCode.addAll(ColumnTypeCodeStore
|
||||
.getColumnTypeCodesForCodelist());
|
||||
break;
|
||||
case DATASET:
|
||||
storeComboTypeCode.addAll(ColumnTypeCodeStore
|
||||
.getColumnTypeCodesForDataset());
|
||||
break;
|
||||
case GENERIC:
|
||||
storeComboTypeCode.addAll(ColumnTypeCodeStore
|
||||
.getColumnTypeCodesForGeneric());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
comboColumnTypeCode = new ComboBox<ColumnTypeCodeElement>(
|
||||
storeComboTypeCode, propsColumnTypeCode.label());
|
||||
Log.trace("ComboColumnTypeCode created");
|
||||
|
||||
addHandlersForComboColumnTypeCode(propsColumnTypeCode.label());
|
||||
|
||||
comboColumnTypeCode.setEmptyText("Select a column type...");
|
||||
comboColumnTypeCode.setWidth(191);
|
||||
comboColumnTypeCode.setTypeAhead(true);
|
||||
comboColumnTypeCode.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboColumnTypeCodeLabel = new FieldLabel(comboColumnTypeCode,
|
||||
"Column Type");
|
||||
|
||||
// comboLocaleType
|
||||
LocaleTypeProperties propsLocaleType = GWT
|
||||
.create(LocaleTypeProperties.class);
|
||||
storeComboLocaleType = new ListStore<LocaleTypeElement>(
|
||||
propsLocaleType.id());
|
||||
|
||||
comboLocaleType = new ComboBox<LocaleTypeElement>(storeComboLocaleType,
|
||||
propsLocaleType.label()) {
|
||||
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
retriveLocales();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Log.trace("ComboLocaleType created");
|
||||
|
||||
addHandlersForComboLocaleType(propsLocaleType.label());
|
||||
|
||||
comboLocaleType.setEmptyText("Select a locale type...");
|
||||
comboLocaleType.setWidth(191);
|
||||
comboLocaleType.setTypeAhead(true);
|
||||
comboLocaleType.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboLocaleTypeLabel = new FieldLabel(comboLocaleType, "Locale");
|
||||
|
||||
//
|
||||
form = new SimpleContainer();
|
||||
form.setWidth(FIELDWIDTH);
|
||||
form.setHeight(FIELDSHEIGHT);
|
||||
|
||||
formLayout = new VerticalLayoutContainer();
|
||||
formLayout.setScrollMode(ScrollMode.AUTO);
|
||||
|
||||
formLayout
|
||||
.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
formLayout.add(comboColumnTypeCodeLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
formLayout.add(comboLocaleTypeLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
formLayout.add(defaultValueLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
|
||||
form.add(formLayout);
|
||||
|
||||
btnSave = new TextButton("Save");
|
||||
btnSave.setIcon(ResourceBundle.INSTANCE.save());
|
||||
btnSave.setIconAlign(IconAlign.RIGHT);
|
||||
btnSave.setTitle("Save");
|
||||
btnSave.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Save");
|
||||
btnSave.disable();
|
||||
save();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setTitle("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
|
||||
vPanel.add(form, new VerticalLayoutData(1, -1));
|
||||
vPanel.add(flowButton, new VerticalLayoutData(1, -1, new Margins(1)));
|
||||
add(vPanel);
|
||||
|
||||
}
|
||||
|
||||
protected void save() {
|
||||
ColumnTypeCode currentType = null;
|
||||
String localeName = null;
|
||||
|
||||
String lab = label.getCurrentValue();
|
||||
ColumnTypeCodeElement typeElement = comboColumnTypeCode
|
||||
.getCurrentValue();
|
||||
LocaleTypeElement localeElement = comboLocaleType.getCurrentValue();
|
||||
String valueDefault = defaultValue.getCurrentValue();
|
||||
|
||||
if (lab == null || lab.isEmpty()) {
|
||||
UtilsGXT3.alert("Attention", "Add a label");
|
||||
}
|
||||
|
||||
if (typeElement == null) {
|
||||
UtilsGXT3.alert("Attention", "No type selected");
|
||||
} else {
|
||||
if (typeElement.getCode() == null) {
|
||||
UtilsGXT3.alert("Attention", "No type selected");
|
||||
} else {
|
||||
currentType = typeElement.getCode();
|
||||
}
|
||||
}
|
||||
if (currentType != null && currentType == ColumnTypeCode.CODENAME) {
|
||||
if (localeElement == null) {
|
||||
UtilsGXT3.alert("Attention", "No locale selected");
|
||||
} else {
|
||||
if (localeElement.getLocaleName() == null
|
||||
|| localeElement.getLocaleName().isEmpty()) {
|
||||
UtilsGXT3.alert("Attention", "No locale selected");
|
||||
} else {
|
||||
localeName = localeElement.getLocaleName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DefNewColumn defNewColumn = new DefNewColumn(id, lab,
|
||||
currentType, localeName, valueDefault);
|
||||
fireCompleted(defNewColumn);
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (parent != null) {
|
||||
parent.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected void addHandlersForComboColumnTypeCode(
|
||||
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
||||
comboColumnTypeCode
|
||||
.addSelectionHandler(new SelectionHandler<ColumnTypeCodeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<ColumnTypeCodeElement> event) {
|
||||
Info.display(
|
||||
"Column 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 addHandlersForComboLocaleType(
|
||||
final LabelProvider<LocaleTypeElement> labelProvider) {
|
||||
comboLocaleType
|
||||
.addSelectionHandler(new SelectionHandler<LocaleTypeElement>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<LocaleTypeElement> event) {
|
||||
Info.display(
|
||||
"Locale Type Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboLocaleType selected: "
|
||||
+ event.getSelectedItem());
|
||||
LocaleTypeElement localeType = event.getSelectedItem();
|
||||
updateLocaleType(localeType);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
protected void updateColumnType(ColumnTypeCode type) {
|
||||
Log.debug("Update ColumnTypeCode " + type.toString());
|
||||
switch (type) {
|
||||
case CODENAME:
|
||||
comboLocaleTypeLabel.setVisible(true);
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateLocaleType(LocaleTypeElement type) {
|
||||
|
||||
}
|
||||
|
||||
protected void retriveLocales() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getLocales(new AsyncCallback<ArrayList<String>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving locales",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<String> result) {
|
||||
storeComboLocaleType.clear();
|
||||
ArrayList<LocaleTypeElement> locales = new ArrayList<LocaleTypeElement>();
|
||||
LocaleTypeElement locale;
|
||||
for (String local : result) {
|
||||
locale = new LocaleTypeElement(local);
|
||||
locales.add(locale);
|
||||
}
|
||||
storeComboLocaleType.addAll(locales);
|
||||
storeComboLocaleType.commitChanges();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void addListener(CreateDefColumnListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeListener(CreateDefColumnListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void fireCompleted(DefNewColumn defNewColumn) {
|
||||
for (CreateDefColumnListener listener : listeners)
|
||||
listener.completedDefColumnCreation(defNewColumn);
|
||||
close();
|
||||
}
|
||||
|
||||
public void fireAborted() {
|
||||
for (CreateDefColumnListener listener : listeners)
|
||||
listener.abortedDefColumnCreation();
|
||||
close();
|
||||
}
|
||||
|
||||
public void fireFailed(String reason, String details) {
|
||||
for (CreateDefColumnListener listener : listeners)
|
||||
listener.failedDefColumnCreation(reason, details);
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.user.td.columnwidget.client.properties;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistDefColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
|
@ -15,12 +15,12 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
|||
*
|
||||
*/
|
||||
public interface ExtractCodelistDefColumnPropertiesCombo extends
|
||||
PropertyAccess<ExtractCodelistDefColumn> {
|
||||
PropertyAccess<DefNewColumn> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<ExtractCodelistDefColumn> id();
|
||||
ModelKeyProvider<DefNewColumn> id();
|
||||
|
||||
LabelProvider<ExtractCodelistDefColumn> label();
|
||||
LabelProvider<DefNewColumn> label();
|
||||
|
||||
|
||||
}
|
|
@ -6,9 +6,6 @@ import java.util.ArrayList;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
|
@ -19,23 +16,28 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -1908324094430432681L;
|
||||
|
||||
protected static ColumnTypeCodeElement annotation=new ColumnTypeCodeElement(1,ColumnTypeCode.ANNOTATION);
|
||||
protected static ColumnTypeCodeElement attribute=new ColumnTypeCodeElement(2,ColumnTypeCode.ATTRIBUTE);
|
||||
protected static ColumnTypeCodeElement measure=new ColumnTypeCodeElement(3,ColumnTypeCode.MEASURE);
|
||||
protected static ColumnTypeCodeElement code=new ColumnTypeCodeElement(4,ColumnTypeCode.CODE);
|
||||
protected static ColumnTypeCodeElement codeName=new ColumnTypeCodeElement(5,ColumnTypeCode.CODENAME);
|
||||
protected static ColumnTypeCodeElement codeDescription=new ColumnTypeCodeElement(6,ColumnTypeCode.CODEDESCRIPTION);
|
||||
protected static ColumnTypeCodeElement dimension=new ColumnTypeCodeElement(7,ColumnTypeCode.DIMENSION);
|
||||
protected static ColumnTypeCodeElement timeDimension=new ColumnTypeCodeElement(8,ColumnTypeCode.TIMEDIMENSION);
|
||||
|
||||
|
||||
|
||||
protected static ColumnTypeCodeElement annotation = new ColumnTypeCodeElement(
|
||||
1, ColumnTypeCode.ANNOTATION);
|
||||
protected static ColumnTypeCodeElement attribute = new ColumnTypeCodeElement(
|
||||
2, ColumnTypeCode.ATTRIBUTE);
|
||||
protected static ColumnTypeCodeElement measure = new ColumnTypeCodeElement(
|
||||
3, ColumnTypeCode.MEASURE);
|
||||
protected static ColumnTypeCodeElement code = new ColumnTypeCodeElement(4,
|
||||
ColumnTypeCode.CODE);
|
||||
protected static ColumnTypeCodeElement codeName = new ColumnTypeCodeElement(
|
||||
5, ColumnTypeCode.CODENAME);
|
||||
protected static ColumnTypeCodeElement codeDescription = new ColumnTypeCodeElement(
|
||||
6, ColumnTypeCode.CODEDESCRIPTION);
|
||||
protected static ColumnTypeCodeElement dimension = new ColumnTypeCodeElement(
|
||||
7, ColumnTypeCode.DIMENSION);
|
||||
protected static ColumnTypeCodeElement timeDimension = new ColumnTypeCodeElement(
|
||||
8, ColumnTypeCode.TIMEDIMENSION);
|
||||
|
||||
protected static ArrayList<ColumnTypeCodeElement> store;
|
||||
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(TRId trId){
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodes(TRId trId) {
|
||||
store = new ArrayList<ColumnTypeCodeElement>();
|
||||
if(trId.getTabularResourceType().compareTo("Generic")==0){
|
||||
if (trId.getTabularResourceType().compareTo("Generic") == 0) {
|
||||
store.add(annotation);
|
||||
store.add(attribute);
|
||||
store.add(measure);
|
||||
|
@ -45,13 +47,13 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
store.add(dimension);
|
||||
store.add(timeDimension);
|
||||
} else {
|
||||
if(trId.getTabularResourceType().compareTo("Codelist")==0){
|
||||
if (trId.getTabularResourceType().compareTo("Codelist") == 0) {
|
||||
store.add(annotation);
|
||||
store.add(code);
|
||||
store.add(codeName);
|
||||
store.add(codeDescription);
|
||||
} else {
|
||||
if(trId.getTabularResourceType().compareTo("Dataset")==0){
|
||||
if (trId.getTabularResourceType().compareTo("Dataset") == 0) {
|
||||
store.add(attribute);
|
||||
store.add(measure);
|
||||
store.add(dimension);
|
||||
|
@ -67,31 +69,81 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
return store;
|
||||
}
|
||||
|
||||
public static int selectedPosition(String selected){
|
||||
int position=0;
|
||||
if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){
|
||||
position=1;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodesForGeneric() {
|
||||
store = new ArrayList<ColumnTypeCodeElement>();
|
||||
store.add(annotation);
|
||||
store.add(attribute);
|
||||
store.add(measure);
|
||||
store.add(code);
|
||||
store.add(codeName);
|
||||
store.add(codeDescription);
|
||||
store.add(dimension);
|
||||
store.add(timeDimension);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodesForCodelist() {
|
||||
store = new ArrayList<ColumnTypeCodeElement>();
|
||||
store.add(annotation);
|
||||
store.add(code);
|
||||
store.add(codeName);
|
||||
store.add(codeDescription);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
public static ArrayList<ColumnTypeCodeElement> getColumnTypeCodesForDataset() {
|
||||
store = new ArrayList<ColumnTypeCodeElement>();
|
||||
store.add(attribute);
|
||||
store.add(measure);
|
||||
store.add(dimension);
|
||||
store.add(timeDimension);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static int selectedPosition(String selected) {
|
||||
int position = 0;
|
||||
if (selected.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0) {
|
||||
position = 1;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){
|
||||
position=2;
|
||||
if (selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString()) == 0) {
|
||||
position = 2;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){
|
||||
position=3;
|
||||
if (selected.compareTo(ColumnTypeCode.MEASURE.toString()) == 0) {
|
||||
position = 3;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){
|
||||
position=4;
|
||||
if (selected.compareTo(ColumnTypeCode.CODE.toString()) == 0) {
|
||||
position = 4;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){
|
||||
position=5;
|
||||
if (selected.compareTo(ColumnTypeCode.CODENAME
|
||||
.toString()) == 0) {
|
||||
position = 5;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){
|
||||
position=6;
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.CODEDESCRIPTION
|
||||
.toString()) == 0) {
|
||||
position = 6;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){
|
||||
position=7;
|
||||
if (selected.compareTo(ColumnTypeCode.DIMENSION
|
||||
.toString()) == 0) {
|
||||
position = 7;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){
|
||||
position=8;
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.TIMEDIMENSION
|
||||
.toString()) == 0) {
|
||||
position = 8;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -112,29 +164,35 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
return position;
|
||||
}
|
||||
|
||||
public static ColumnTypeCode selected(String selected){
|
||||
if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){
|
||||
public static ColumnTypeCode selected(String selected) {
|
||||
if (selected.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0) {
|
||||
return ColumnTypeCode.ANNOTATION;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString()) == 0) {
|
||||
return ColumnTypeCode.ATTRIBUTE;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.MEASURE.toString()) == 0) {
|
||||
return ColumnTypeCode.MEASURE;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.CODE.toString()) == 0) {
|
||||
return ColumnTypeCode.CODE;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.CODENAME
|
||||
.toString()) == 0) {
|
||||
return ColumnTypeCode.CODENAME;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.CODEDESCRIPTION
|
||||
.toString()) == 0) {
|
||||
return ColumnTypeCode.CODEDESCRIPTION;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.DIMENSION
|
||||
.toString()) == 0) {
|
||||
return ColumnTypeCode.DIMENSION;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.TIMEDIMENSION
|
||||
.toString()) == 0) {
|
||||
return ColumnTypeCode.TIMEDIMENSION;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -155,29 +213,35 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public static ColumnTypeCodeElement selectedElement(String selected){
|
||||
if(selected.compareTo(ColumnTypeCode.ANNOTATION.toString())==0){
|
||||
public static ColumnTypeCodeElement selectedElement(String selected) {
|
||||
if (selected.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0) {
|
||||
return annotation;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.ATTRIBUTE.toString()) == 0) {
|
||||
return attribute;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.MEASURE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.MEASURE.toString()) == 0) {
|
||||
return measure;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODE.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.CODE.toString()) == 0) {
|
||||
return code;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODENAME.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.CODENAME
|
||||
.toString()) == 0) {
|
||||
return codeName;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.CODEDESCRIPTION.toString())==0){
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.CODEDESCRIPTION
|
||||
.toString()) == 0) {
|
||||
return codeDescription;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.DIMENSION.toString())==0){
|
||||
if (selected.compareTo(ColumnTypeCode.DIMENSION
|
||||
.toString()) == 0) {
|
||||
return dimension;
|
||||
} else {
|
||||
if(selected.compareTo(ColumnTypeCode.TIMEDIMENSION.toString())==0){
|
||||
if (selected
|
||||
.compareTo(ColumnTypeCode.TIMEDIMENSION
|
||||
.toString()) == 0) {
|
||||
return timeDimension;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -198,6 +262,4 @@ public class ColumnTypeCodeStore implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue