Update ReplaceBatch
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94769 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
861419721f
commit
b8200c67fc
|
@ -2536,3 +2536,99 @@ Compiling...
|
||||||
Compilation completed in 0.00 seconds
|
Compilation completed in 0.00 seconds
|
||||||
Removing invalidated units
|
Removing invalidated units
|
||||||
Finding entry point classes
|
Finding entry point classes
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
10% complete (ETR: 22 seconds)
|
||||||
|
10% complete (ETR: 22 seconds)
|
||||||
|
20% complete (ETR: 21 seconds)
|
||||||
|
30% complete (ETR: 16 seconds)
|
||||||
|
40% complete (ETR: 11 seconds)
|
||||||
|
50% complete (ETR: 9 seconds)
|
||||||
|
60% complete (ETR: 7 seconds)
|
||||||
|
70% complete (ETR: 5 seconds)
|
||||||
|
80% complete (ETR: 3 seconds)
|
||||||
|
90% complete (ETR: 1 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 18.15 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
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
20% complete (ETR: 15 seconds)
|
||||||
|
20% complete (ETR: 15 seconds)
|
||||||
|
20% complete (ETR: 15 seconds)
|
||||||
|
30% complete (ETR: 14 seconds)
|
||||||
|
40% complete (ETR: 11 seconds)
|
||||||
|
50% complete (ETR: 9 seconds)
|
||||||
|
60% complete (ETR: 7 seconds)
|
||||||
|
70% complete (ETR: 7 seconds)
|
||||||
|
80% complete (ETR: 4 seconds)
|
||||||
|
90% complete (ETR: 2 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 21.55 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
|
||||||
|
Public resources found in...
|
||||||
|
Translatable source found in...
|
||||||
|
Found 0 cached/archived units. Used 0 / 2719 units from cache.
|
||||||
|
Compiling...
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
50% complete (ETR: 5 seconds)
|
||||||
|
60% complete (ETR: 3 seconds)
|
||||||
|
70% complete (ETR: 2 seconds)
|
||||||
|
80% complete (ETR: 1 seconds)
|
||||||
|
90% complete (ETR: 1 seconds)
|
||||||
|
100% complete (ETR: 0 seconds)
|
||||||
|
Compilation completed in 17.30 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
|
||||||
|
|
|
@ -860,7 +860,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
public void selected(TabResource tabResource) {
|
public void selected(TabResource tabResource) {
|
||||||
Log.debug("Selected Codelist: " + tabResource);
|
Log.debug("Selected Codelist: " + tabResource);
|
||||||
comboDimensionType.setValue(tabResource);
|
comboDimensionType.setValue(tabResource);
|
||||||
retriveColumnData(tabResource);
|
retrieveColumnData(tabResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -876,7 +876,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retriveColumnData(TabResource tabResource) {
|
protected void retrieveColumnData(TabResource tabResource) {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(
|
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(
|
||||||
tabResource.getTrId(),
|
tabResource.getTrId(),
|
||||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.custom.ActionButtonCell;
|
import org.gcube.portlets.user.td.columnwidget.client.custom.ActionButtonCell;
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistDialog;
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistListener;
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
|
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
|
||||||
|
@ -81,7 +83,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ReplaceBatchPanel extends FramedPanel implements
|
public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
SingleValueReplaceListener, DimensionRowSelectionListener {
|
SingleValueReplaceListener, DimensionRowSelectionListener, ConnectCodelistListener {
|
||||||
protected String WIDTH = "560px";
|
protected String WIDTH = "560px";
|
||||||
protected String HEIGHT = "520px";
|
protected String HEIGHT = "520px";
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
@ -100,9 +102,13 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
private TextButton btnSave;
|
private TextButton btnSave;
|
||||||
private TextButton btnClose;
|
private TextButton btnClose;
|
||||||
|
private TextButton btnConnect;
|
||||||
|
|
||||||
private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null;
|
private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
|
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
|
||||||
protected Grid<ReplaceEntry> grid;
|
protected Grid<ReplaceEntry> grid;
|
||||||
protected ListStore<ReplaceEntry> store;
|
protected ListStore<ReplaceEntry> store;
|
||||||
|
@ -159,6 +165,24 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
toolBarHead.add(comboShowOccurrencesType);
|
toolBarHead.add(comboShowOccurrencesType);
|
||||||
|
|
||||||
|
//Connect Codelist
|
||||||
|
btnConnect = new TextButton("Connect");
|
||||||
|
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink());
|
||||||
|
btnConnect.setIconAlign(IconAlign.RIGHT);
|
||||||
|
btnConnect.setTitle("Connect");
|
||||||
|
btnConnect.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Connect");
|
||||||
|
btnConnect.disable();
|
||||||
|
connectCodelist();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
toolBarHead.add(btnConnect, new BoxLayoutData(new Margins(10,0,0,0)));
|
||||||
|
|
||||||
// Create Grid
|
// Create Grid
|
||||||
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
||||||
|
@ -333,6 +357,9 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void retrieveColumn() {
|
protected void retrieveColumn() {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
|
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
|
||||||
new AsyncCallback<ColumnData>() {
|
new AsyncCallback<ColumnData>() {
|
||||||
|
@ -385,6 +412,11 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void addHandlersForShowOccurrencesType(
|
protected void addHandlersForShowOccurrencesType(
|
||||||
final LabelProvider<ShowOccurrencesTypeElement> labelProvider) {
|
final LabelProvider<ShowOccurrencesTypeElement> labelProvider) {
|
||||||
comboShowOccurrencesType
|
comboShowOccurrencesType
|
||||||
|
@ -529,6 +561,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void startReplaceBatch(
|
protected void startReplaceBatch(
|
||||||
ArrayList<ReplaceEntry> effectiveReplaceList) {
|
ArrayList<ReplaceEntry> effectiveReplaceList) {
|
||||||
ReplaceBatchColumnSession replaceBatchColumnSession = new ReplaceBatchColumnSession(
|
ReplaceBatchColumnSession replaceBatchColumnSession = new ReplaceBatchColumnSession(
|
||||||
|
@ -562,27 +595,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selected(String replaceValue) {
|
public void selectedDimensionRow(DimensionRow dimensionRow) {
|
||||||
Log.debug("Change Value: " + replaceValue);
|
|
||||||
currentReplaceEntry.setReplacementValue(replaceValue);
|
|
||||||
store.update(currentReplaceEntry);
|
|
||||||
updateInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void aborted() {
|
|
||||||
Log.debug("Change Value Aborted");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void failed(String reason, String detail) {
|
|
||||||
Log.error("Change Value Failed:" + reason + " " + detail);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selected(DimensionRow dimensionRow) {
|
|
||||||
Log.debug("Change Value: " + dimensionRow);
|
Log.debug("Change Value: " + dimensionRow);
|
||||||
currentReplaceEntry.setReplacementValue(dimensionRow.getValue());
|
currentReplaceEntry.setReplacementValue(dimensionRow.getValue());
|
||||||
currentReplaceEntry.setReplacementDimensionRow(dimensionRow);
|
currentReplaceEntry.setReplacementDimensionRow(dimensionRow);
|
||||||
|
@ -590,4 +603,69 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
updateInfo();
|
updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void abortedDimensionRowSelection() {
|
||||||
|
Log.debug("Change Value Aborted");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failedDimensionRowSelection(String reason, String detail) {
|
||||||
|
Log.error("Change Value Failed:" + reason + " " + detail);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectedSingleValueReplace(String replaceValue) {
|
||||||
|
Log.debug("Change Value: " + replaceValue);
|
||||||
|
currentReplaceEntry.setReplacementValue(replaceValue);
|
||||||
|
store.update(currentReplaceEntry);
|
||||||
|
updateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void abortedSingleValueReplace() {
|
||||||
|
Log.debug("Change Value Aborted");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failedSingleValueReplace(String reason, String detail) {
|
||||||
|
Log.error("Change Value Failed:" + reason + " " + detail);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void connectCodelist() {
|
||||||
|
Log.debug("callConnectCodelistDialog");
|
||||||
|
|
||||||
|
ConnectCodelistDialog connectCodelistDialog = new ConnectCodelistDialog(
|
||||||
|
eventBus);
|
||||||
|
connectCodelistDialog.addListener(this);
|
||||||
|
connectCodelistDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectedConnectCodelist(ColumnData connection) {
|
||||||
|
Log.debug("Selected connection: "+connection);
|
||||||
|
btnConnect.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void abortedConnectCodelist() {
|
||||||
|
Log.debug("Connection Aborted");
|
||||||
|
btnConnect.enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failedConnectCodelist(String reason, String detail) {
|
||||||
|
Log.debug("Connection Failed: "+reason+" "+detail);
|
||||||
|
UtilsGXT3.alert("Error on connect",
|
||||||
|
reason);
|
||||||
|
btnConnect.enable();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,19 +85,19 @@ public class SingleValueReplaceDialog extends Window {
|
||||||
|
|
||||||
public void fireCompleted(String replaceValue) {
|
public void fireCompleted(String replaceValue) {
|
||||||
for (SingleValueReplaceListener listener : listeners)
|
for (SingleValueReplaceListener listener : listeners)
|
||||||
listener.selected(replaceValue);
|
listener.selectedSingleValueReplace(replaceValue);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireAborted() {
|
public void fireAborted() {
|
||||||
for (SingleValueReplaceListener listener : listeners)
|
for (SingleValueReplaceListener listener : listeners)
|
||||||
listener.aborted();
|
listener.abortedSingleValueReplace();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireFailed(String reason, String details) {
|
public void fireFailed(String reason, String detail) {
|
||||||
for (SingleValueReplaceListener listener : listeners)
|
for (SingleValueReplaceListener listener : listeners)
|
||||||
listener.failed(reason, details);
|
listener.failedSingleValueReplace(reason, detail);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ public interface SingleValueReplaceListener {
|
||||||
/**
|
/**
|
||||||
* Called when selected replaceValue without errors
|
* Called when selected replaceValue without errors
|
||||||
*/
|
*/
|
||||||
public void selected(String replaceValue);
|
public void selectedSingleValueReplace(String replaceValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the select operation is aborted by the user.
|
* Called when the select operation is aborted by the user.
|
||||||
*/
|
*/
|
||||||
public void aborted();
|
public void abortedSingleValueReplace();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the something in the wizard is failed.
|
* Called when the something in the wizard is failed.
|
||||||
|
@ -24,6 +24,6 @@ public interface SingleValueReplaceListener {
|
||||||
* @param reason
|
* @param reason
|
||||||
* @param detail
|
* @param detail
|
||||||
*/
|
*/
|
||||||
public void failed(String reason, String detail);
|
public void failedSingleValueReplace(String reason, String detail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,333 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties;
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.properties.TabResourceProperties;
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||||
|
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.tr.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
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.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.Window;
|
||||||
|
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.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.event.TriggerClickEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
||||||
|
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.info.Info;
|
||||||
|
|
||||||
|
public class ConnectCodelistDialog extends Window implements
|
||||||
|
CodelistSelectionListener {
|
||||||
|
protected String WIDTH = "500px";
|
||||||
|
protected String HEIGHT = "150px";
|
||||||
|
protected ArrayList<ConnectCodelistListener> listeners;
|
||||||
|
|
||||||
|
protected ComboBox<TabResource> comboDimensionType = null;
|
||||||
|
protected FieldLabel comboDimensionTypeLabel;
|
||||||
|
protected ListStore<TabResource> storeComboDimensionType;
|
||||||
|
|
||||||
|
protected ComboBox<ColumnData> comboColumnReferenceType = null;
|
||||||
|
protected FieldLabel comboColumnReferenceTypeLabel;
|
||||||
|
protected ListStore<ColumnData> storeComboColumnReferenceType;
|
||||||
|
|
||||||
|
protected EventBus eventBus;
|
||||||
|
|
||||||
|
private TextButton btnApply;
|
||||||
|
private TextButton btnClose;
|
||||||
|
|
||||||
|
public ConnectCodelistDialog(EventBus eventBus) {
|
||||||
|
listeners = new ArrayList<ConnectCodelistListener>();
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
initWindow();
|
||||||
|
create();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void create() {
|
||||||
|
final FramedPanel panel = new FramedPanel();
|
||||||
|
panel.setHeaderVisible(false);
|
||||||
|
panel.setBodyBorder(false);
|
||||||
|
|
||||||
|
// Attach Codelist
|
||||||
|
// comboDimensionType
|
||||||
|
TabResourceProperties propsDimensionType = GWT
|
||||||
|
.create(TabResourceProperties.class);
|
||||||
|
storeComboDimensionType = new ListStore<TabResource>(
|
||||||
|
propsDimensionType.id());
|
||||||
|
|
||||||
|
comboDimensionType = new ComboBox<TabResource>(storeComboDimensionType,
|
||||||
|
propsDimensionType.label());
|
||||||
|
Log.trace("ComboDimensionType created");
|
||||||
|
|
||||||
|
addHandlersForComboDimensionType(propsDimensionType.label());
|
||||||
|
|
||||||
|
comboDimensionType.setEmptyText("Select a Codelist...");
|
||||||
|
comboDimensionType.setWidth(191);
|
||||||
|
comboDimensionType.setEditable(false);
|
||||||
|
comboDimensionType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
comboDimensionTypeLabel = new FieldLabel(comboDimensionType, "Codelist");
|
||||||
|
|
||||||
|
// ColumnReferenceType
|
||||||
|
ColumnDataProperties propsColumnReferenceType = GWT
|
||||||
|
.create(ColumnDataProperties.class);
|
||||||
|
storeComboColumnReferenceType = new ListStore<ColumnData>(
|
||||||
|
propsColumnReferenceType.id());
|
||||||
|
|
||||||
|
comboColumnReferenceType = new ComboBox<ColumnData>(
|
||||||
|
storeComboColumnReferenceType, propsColumnReferenceType.label());
|
||||||
|
Log.trace("ComboColumnReferenceType created");
|
||||||
|
|
||||||
|
addHandlersForComboColumnReferenceType(propsColumnReferenceType.label());
|
||||||
|
|
||||||
|
comboColumnReferenceType.setEmptyText("Select a Column Reference...");
|
||||||
|
comboColumnReferenceType.setWidth(191);
|
||||||
|
comboColumnReferenceType.setEditable(false);
|
||||||
|
comboColumnReferenceType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
comboColumnReferenceTypeLabel = new FieldLabel(
|
||||||
|
comboColumnReferenceType, "Column");
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
btnApply = new TextButton("Connect");
|
||||||
|
btnApply.setIcon(ResourceBundle.INSTANCE.codelistLink());
|
||||||
|
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||||
|
btnApply.setTitle("Connect");
|
||||||
|
btnApply.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Connect");
|
||||||
|
connectCodelist();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
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(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.add(comboDimensionTypeLabel, new VerticalLayoutData(1, -1));
|
||||||
|
v.add(comboColumnReferenceTypeLabel, new VerticalLayoutData(1, -1));
|
||||||
|
v.add(flowButton, new VerticalLayoutData(-1, 36,
|
||||||
|
new Margins(5, 2, 5, 2)));
|
||||||
|
|
||||||
|
panel.add(v);
|
||||||
|
|
||||||
|
add(panel);
|
||||||
|
|
||||||
|
comboColumnReferenceTypeLabel.setVisible(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addHandlersForComboDimensionType(
|
||||||
|
final LabelProvider<TabResource> labelProvider) {
|
||||||
|
|
||||||
|
comboDimensionType.addTriggerClickHandler(new TriggerClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTriggerClick(TriggerClickEvent event) {
|
||||||
|
Log.debug("ComboDimension TriggerClickEvent");
|
||||||
|
callDialogCodelistSelection();
|
||||||
|
comboDimensionType.collapse();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addHandlersForComboColumnReferenceType(
|
||||||
|
final LabelProvider<ColumnData> labelProvider) {
|
||||||
|
|
||||||
|
comboColumnReferenceType
|
||||||
|
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||||
|
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||||
|
Info.display(
|
||||||
|
"Column Reference Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: labelProvider.getLabel(event
|
||||||
|
.getSelectedItem())
|
||||||
|
+ "!"));
|
||||||
|
Log.debug("ComboColumnReferenceType selected: "
|
||||||
|
+ event.getSelectedItem());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void connectCodelist() {
|
||||||
|
TabResource codelist = comboDimensionType.getCurrentValue();
|
||||||
|
if (codelist == null) {
|
||||||
|
Log.debug("No codelist selected");
|
||||||
|
UtilsGXT3.alert("Attention", "Select a valid codelist");
|
||||||
|
} else {
|
||||||
|
ColumnData connection = comboColumnReferenceType.getCurrentValue();
|
||||||
|
if (connection == null) {
|
||||||
|
Log.debug("No connection selected");
|
||||||
|
UtilsGXT3.alert("Attention", "Select a valid column");
|
||||||
|
} else {
|
||||||
|
fireCompleted(connection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void callDialogCodelistSelection() {
|
||||||
|
CodelistSelectionDialog dialogCodelistSelection = new CodelistSelectionDialog(
|
||||||
|
eventBus);
|
||||||
|
dialogCodelistSelection.addListener(this);
|
||||||
|
dialogCodelistSelection.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selected(TabResource tabResource) {
|
||||||
|
Log.debug("Selected Codelist: " + tabResource);
|
||||||
|
storeComboDimensionType.clear();
|
||||||
|
storeComboDimensionType.add(tabResource);
|
||||||
|
storeComboDimensionType.commitChanges();
|
||||||
|
comboDimensionType.setValue(tabResource);
|
||||||
|
retrieveConnectedColumnData(tabResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void aborted() {
|
||||||
|
Log.debug("Select Codelist Aborted");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failed(String reason, String detail) {
|
||||||
|
Log.error("Select Codelist Failed[reason: " + reason + " , detail:"
|
||||||
|
+ detail + "]");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveConnectedColumnData(TabResource tabResource) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(
|
||||||
|
tabResource.getTrId(),
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Log.debug("Error retrieving columns: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error retrieving columns",
|
||||||
|
"Error retrieving columns on server!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
storeComboColumnReferenceType.clear();
|
||||||
|
storeComboColumnReferenceType.addAll(result);
|
||||||
|
storeComboColumnReferenceType.commitChanges();
|
||||||
|
comboColumnReferenceTypeLabel.setVisible(true);
|
||||||
|
comboColumnReferenceType.setMinListWidth(191);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initWindow() {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setResizable(false);
|
||||||
|
setHeadingText("Connect");
|
||||||
|
setModal(true);
|
||||||
|
setClosable(true);
|
||||||
|
getHeader().setIcon(ResourceBundle.INSTANCE.codelistLink());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initTools() {
|
||||||
|
super.initTools();
|
||||||
|
|
||||||
|
closeBtn.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void close() {
|
||||||
|
fireAborted();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(ConnectCodelistListener listener) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(ConnectCodelistListener listener) {
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireCompleted(ColumnData connection) {
|
||||||
|
for (ConnectCodelistListener listener : listeners)
|
||||||
|
listener.selectedConnectCodelist(connection);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireAborted() {
|
||||||
|
for (ConnectCodelistListener listener : listeners)
|
||||||
|
listener.abortedConnectCodelist();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireFailed(String reason, String details) {
|
||||||
|
for (ConnectCodelistListener listener : listeners)
|
||||||
|
listener.failedConnectCodelist(reason, details);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ConnectCodelistListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when selected codelist without errors
|
||||||
|
*/
|
||||||
|
public void selectedConnectCodelist(ColumnData connection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the select operation is aborted by the user.
|
||||||
|
*/
|
||||||
|
public void abortedConnectCodelist();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the something in the wizard is failed.
|
||||||
|
*
|
||||||
|
* @param reason
|
||||||
|
* @param detail
|
||||||
|
*/
|
||||||
|
public void failedConnectCodelist(String reason, String detail);
|
||||||
|
|
||||||
|
}
|
|
@ -186,19 +186,19 @@ public class DimensionRowSelectionDialog extends Window {
|
||||||
|
|
||||||
public void fireCompleted(DimensionRow dimensionRow) {
|
public void fireCompleted(DimensionRow dimensionRow) {
|
||||||
for (DimensionRowSelectionListener listener : listeners)
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
listener.selected(dimensionRow);
|
listener.selectedDimensionRow(dimensionRow);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireAborted() {
|
public void fireAborted() {
|
||||||
for (DimensionRowSelectionListener listener : listeners)
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
listener.aborted();
|
listener.abortedDimensionRowSelection();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fireFailed(String reason, String details) {
|
public void fireFailed(String reason, String details) {
|
||||||
for (DimensionRowSelectionListener listener : listeners)
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
listener.failed(reason, details);
|
listener.failedDimensionRowSelection(reason, details);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ public interface DimensionRowSelectionListener {
|
||||||
/**
|
/**
|
||||||
* Called when selected one row of dimension or time dimension without errors
|
* Called when selected one row of dimension or time dimension without errors
|
||||||
*/
|
*/
|
||||||
public void selected(DimensionRow dimensionRow);
|
public void selectedDimensionRow(DimensionRow dimensionRow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the select operation is aborted by the user.
|
* Called when the select operation is aborted by the user.
|
||||||
*/
|
*/
|
||||||
public void aborted();
|
public void abortedDimensionRowSelection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the something in the wizard is failed.
|
* Called when the something in the wizard is failed.
|
||||||
|
@ -28,6 +28,6 @@ public interface DimensionRowSelectionListener {
|
||||||
* @param reason
|
* @param reason
|
||||||
* @param detail
|
* @param detail
|
||||||
*/
|
*/
|
||||||
public void failed(String reason, String detail);
|
public void failedDimensionRowSelection(String reason, String detail);
|
||||||
|
|
||||||
}
|
}
|
|
@ -378,14 +378,14 @@ public class ReplacePanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selected(DimensionRow dimRow) {
|
public void selectedDimensionRow(DimensionRow dimRow) {
|
||||||
Log.debug("Selected dimension row: " + dimRow);
|
Log.debug("Selected dimension row: " + dimRow);
|
||||||
dimensionRow=dimRow;
|
dimensionRow=dimRow;
|
||||||
comboDimensionType.setValue(dimRow);
|
comboDimensionType.setValue(dimRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aborted() {
|
public void abortedDimensionRowSelection() {
|
||||||
Log.debug("Aborted");
|
Log.debug("Aborted");
|
||||||
comboDimensionType.setValue(null);
|
comboDimensionType.setValue(null);
|
||||||
dimensionRow=null;
|
dimensionRow=null;
|
||||||
|
@ -393,7 +393,7 @@ public class ReplacePanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(String reason, String detail) {
|
public void failedDimensionRowSelection(String reason, String detail) {
|
||||||
Log.debug("Failed: "+reason+" "+detail);
|
Log.debug("Failed: "+reason+" "+detail);
|
||||||
comboDimensionType.setValue(null);
|
comboDimensionType.setValue(null);
|
||||||
dimensionRow=null;
|
dimensionRow=null;
|
||||||
|
|
|
@ -64,6 +64,12 @@ public interface ResourceBundle extends ClientBundle {
|
||||||
@Source("disk_32.png")
|
@Source("disk_32.png")
|
||||||
ImageResource save32();
|
ImageResource save32();
|
||||||
|
|
||||||
|
@Source("codelist-link.png")
|
||||||
|
ImageResource codelistLink();
|
||||||
|
|
||||||
|
@Source("codelist-link_32.png")
|
||||||
|
ImageResource codelistLink32();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 856 B |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 856 B |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in New Issue