Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@98772 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e6b7ddfabd
commit
c4e051d0b9
|
@ -5,7 +5,9 @@ import java.util.ArrayList;
|
||||||
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.exception.TDGWTSessionExpiredException;
|
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.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.unionwizardwidget.client.custom.IconButton;
|
||||||
import org.gcube.portlets.user.td.unionwizardwidget.client.properties.ColumnDataProperties;
|
import org.gcube.portlets.user.td.unionwizardwidget.client.properties.ColumnDataProperties;
|
||||||
|
import org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle;
|
||||||
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
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.client.type.SessionExpiredType;
|
||||||
|
@ -14,6 +16,8 @@ import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundl
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
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.dom.ScrollSupport.ScrollMode;
|
||||||
|
@ -22,10 +26,12 @@ import com.sencha.gxt.data.shared.ListStore;
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
import com.sencha.gxt.widget.core.client.Resizable;
|
import com.sencha.gxt.widget.core.client.Resizable;
|
||||||
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||||
|
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
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.BoxLayoutContainer.BoxLayoutPack;
|
||||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
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.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.ResizeContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
@ -40,15 +46,20 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
*/
|
*/
|
||||||
public class ColumnMappingPanel extends ContentPanel {
|
public class ColumnMappingPanel extends ContentPanel {
|
||||||
|
|
||||||
private static final String COMBOWIDTH = null;
|
private static final String COMBOWIDTH = "120px";
|
||||||
protected ResourceBundle res;
|
protected ResourceBundle res;
|
||||||
protected ColumnMappingCard parent;
|
protected ColumnMappingCard parent;
|
||||||
protected VerticalLayoutContainer vert;
|
protected VerticalLayoutContainer vert;
|
||||||
protected ArrayList<ColumnData> sourceColumns;
|
protected ArrayList<ColumnData> sourceColumns;
|
||||||
protected ArrayList<ColumnData> unionColumns;
|
protected ArrayList<ColumnData> unionColumns;
|
||||||
|
protected ResizeContainer thisPanel;
|
||||||
|
|
||||||
protected String itemIdSourceColumn = "itemIdSourceColumn";
|
protected String itemIdSourceColumn = "itemIdSourceColumn";
|
||||||
protected String itemIdUnionColumn = "itemIdUnionColumn";
|
protected String itemIdUnionColumn = "itemIdUnionColumn";
|
||||||
protected String itemIdLabelColumn = "itemIdLabelColumn";
|
protected String itemIdLabelColumn = "itemIdLabelColumn";
|
||||||
|
protected String itemIdBtnAdd="itemIdBtnAdd";
|
||||||
|
protected String itemIdBtnDel="itemIdBtnDel";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -58,7 +69,8 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
public ColumnMappingPanel(ColumnMappingCard parent, ResourceBundle res) {
|
public ColumnMappingPanel(ColumnMappingCard parent, ResourceBundle res) {
|
||||||
this.res = res;
|
this.res = res;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
thisPanel=this;
|
||||||
|
|
||||||
Log.debug("ColumnMappingPanel");
|
Log.debug("ColumnMappingPanel");
|
||||||
init();
|
init();
|
||||||
retrieveSourceColumns();
|
retrieveSourceColumns();
|
||||||
|
@ -78,7 +90,7 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
vert.setScrollMode(ScrollMode.AUTO);
|
vert.setScrollMode(ScrollMode.AUTO);
|
||||||
vert.setAdjustForScroll(true);
|
vert.setAdjustForScroll(true);
|
||||||
|
|
||||||
// setColumnMappingData();
|
setColumnMap();
|
||||||
|
|
||||||
container.add(vert);
|
container.add(vert);
|
||||||
container.forceLayout();
|
container.forceLayout();
|
||||||
|
@ -151,20 +163,104 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
public void onSuccess(ArrayList<ColumnData> result) {
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
unionColumns = result;
|
unionColumns = result;
|
||||||
create();
|
create();
|
||||||
/*
|
|
||||||
* comboColumnReferenceType.reset();
|
|
||||||
* storeComboColumnReferenceType.clear();
|
|
||||||
* storeComboColumnReferenceType.addAll(result);
|
|
||||||
* storeComboColumnReferenceType.commitChanges();
|
|
||||||
* comboColumnReferenceTypeLabel.setVisible(true);
|
|
||||||
* forceLayout();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setColumnMappingData() {
|
protected void setColumnMap() {
|
||||||
|
|
||||||
|
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||||
|
|
||||||
|
// Source Combo
|
||||||
|
ColumnDataProperties propsSourceColumn = GWT
|
||||||
|
.create(ColumnDataProperties.class);
|
||||||
|
ListStore<ColumnData> storeComboSourceColumn = new ListStore<ColumnData>(
|
||||||
|
propsSourceColumn.id());
|
||||||
|
storeComboSourceColumn.addAll(sourceColumns);
|
||||||
|
|
||||||
|
final ComboBox<ColumnData> comboSourceColumn = new ComboBox<ColumnData>(
|
||||||
|
storeComboSourceColumn, propsSourceColumn.label());
|
||||||
|
comboSourceColumn.setItemId(itemIdSourceColumn);
|
||||||
|
|
||||||
|
Log.debug("ComboSourceColumn created");
|
||||||
|
|
||||||
|
comboSourceColumn.setEmptyText("Select a column...");
|
||||||
|
comboSourceColumn.setWidth(COMBOWIDTH);
|
||||||
|
comboSourceColumn.setEditable(false);
|
||||||
|
comboSourceColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
//Union Combo
|
||||||
|
ColumnDataProperties propsUnionColumn = GWT
|
||||||
|
.create(ColumnDataProperties.class);
|
||||||
|
ListStore<ColumnData> storeComboUnionColumn = new ListStore<ColumnData>(
|
||||||
|
propsUnionColumn.id());
|
||||||
|
|
||||||
|
|
||||||
|
final ComboBox<ColumnData> comboUnionColumn = new ComboBox<ColumnData>(
|
||||||
|
storeComboUnionColumn, propsUnionColumn.label());
|
||||||
|
comboUnionColumn.setItemId(itemIdUnionColumn);
|
||||||
|
|
||||||
|
Log.debug("ComboUnionColumn created");
|
||||||
|
|
||||||
|
comboUnionColumn.setEmptyText("Select a column...");
|
||||||
|
comboUnionColumn.setWidth(COMBOWIDTH);
|
||||||
|
comboUnionColumn.setEditable(false);
|
||||||
|
comboUnionColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
|
||||||
|
final IconButton btnAdd = new IconButton();
|
||||||
|
btnAdd.setItemId(itemIdBtnAdd);
|
||||||
|
btnAdd.setIcon(UnionResourceBundle.INSTANCE.add());
|
||||||
|
btnAdd.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
Log.debug("Clicked btnAdd");
|
||||||
|
addColumnMap();
|
||||||
|
thisPanel.forceLayout();
|
||||||
|
vert.forceLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnAdd.setVisible(true);
|
||||||
|
|
||||||
|
final IconButton btnDel = new IconButton();
|
||||||
|
btnDel.setItemId(itemIdBtnDel);
|
||||||
|
btnDel.setIcon(UnionResourceBundle.INSTANCE.delete());
|
||||||
|
btnDel.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
Log.debug("Clicked btnDel");
|
||||||
|
vert.remove(horiz);
|
||||||
|
if (vert.getWidgetCount() == 0) {
|
||||||
|
setColumnMap();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
thisPanel.forceLayout();
|
||||||
|
vert.forceLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnDel.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
|
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
|
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
|
||||||
|
vert.add(horiz);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void addColumnMap() {
|
||||||
|
|
||||||
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
final HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||||
|
|
||||||
|
@ -201,15 +297,18 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
comboUnionColumn.setWidth(COMBOWIDTH);
|
comboUnionColumn.setWidth(COMBOWIDTH);
|
||||||
comboUnionColumn.setEditable(false);
|
comboUnionColumn.setEditable(false);
|
||||||
comboUnionColumn.setTriggerAction(TriggerAction.ALL);
|
comboUnionColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
/*
|
|
||||||
|
|
||||||
final IconButton btnAdd = new IconButton();
|
final IconButton btnAdd = new IconButton();
|
||||||
btnAdd.setItemId(itemIdBtnAdd);
|
btnAdd.setItemId(itemIdBtnAdd);
|
||||||
btnAdd.setIcon(ResourceBundle.INSTANCE.add());
|
btnAdd.setIcon(UnionResourceBundle.INSTANCE.add());
|
||||||
btnAdd.addClickHandler(new ClickHandler() {
|
btnAdd.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
Log.debug("Clicked btnAdd");
|
Log.debug("Clicked btnAdd");
|
||||||
addColumnMappingData();
|
addColumnMap();
|
||||||
thisPanel.forceLayout();
|
thisPanel.forceLayout();
|
||||||
vert.forceLayout();
|
vert.forceLayout();
|
||||||
|
|
||||||
|
@ -219,14 +318,14 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
|
|
||||||
final IconButton btnDel = new IconButton();
|
final IconButton btnDel = new IconButton();
|
||||||
btnDel.setItemId(itemIdBtnDel);
|
btnDel.setItemId(itemIdBtnDel);
|
||||||
btnDel.setIcon(ResourceBundle.INSTANCE.delete());
|
btnDel.setIcon(UnionResourceBundle.INSTANCE.delete());
|
||||||
btnDel.addClickHandler(new ClickHandler() {
|
btnDel.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
Log.debug("Clicked btnDel");
|
Log.debug("Clicked btnDel");
|
||||||
vert.remove(horiz);
|
vert.remove(horiz);
|
||||||
if (vert.getWidgetCount() == 0) {
|
if (vert.getWidgetCount() == 0) {
|
||||||
setColumnMappingData();
|
setColumnMap();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -236,14 +335,15 @@ public class ColumnMappingPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnDel.setVisible(false);
|
btnDel.setVisible(false);
|
||||||
*/
|
|
||||||
|
|
||||||
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
horiz.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
horiz.setPack(BoxLayoutPack.START);
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboSourceColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(comboUnionColumn, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
/*horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
horiz.add(btnAdd, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));*/
|
horiz.add(btnDel, new BoxLayoutData(new Margins(2, 1, 2, 1)));
|
||||||
|
|
||||||
vert.add(horiz);
|
vert.add(horiz);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
contextMenu = new Menu();
|
contextMenu = new Menu();
|
||||||
MenuItem deleteTRItem = new MenuItem("Delete");
|
MenuItem deleteTRItem = new MenuItem("Delete");
|
||||||
deleteTRItem.setId("DeleteTR");
|
deleteTRItem.setId("DeleteTR");
|
||||||
deleteTRItem.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.resources.ResourceBundle.INSTANCE.delete());
|
deleteTRItem.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.resources.UnionResourceBundle.INSTANCE.delete());
|
||||||
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,9 +7,9 @@ import com.google.gwt.resources.client.ClientBundle;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
|
||||||
public interface ResourceBundle extends ClientBundle {
|
public interface UnionResourceBundle extends ClientBundle {
|
||||||
|
|
||||||
public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class);
|
public static final UnionResourceBundle INSTANCE=GWT.create(UnionResourceBundle.class);
|
||||||
|
|
||||||
@Source("UnionWizardTD.css")
|
@Source("UnionWizardTD.css")
|
||||||
UnionCSS unionCss();
|
UnionCSS unionCss();
|
Loading…
Reference in New Issue