Fixed Final and Lock error
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@100243 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c6b9ea6739
commit
7af37b02df
|
@ -53,7 +53,7 @@ public class SourceColumnsSelectionCard extends WizardCard {
|
||||||
VerticalLayoutContainer content = new VerticalLayoutContainer();
|
VerticalLayoutContainer content = new VerticalLayoutContainer();
|
||||||
panel.add(content);
|
panel.add(content);
|
||||||
|
|
||||||
columnsGridPanel = new ColumnDataGridPanel();
|
columnsGridPanel = new ColumnDataGridPanel(this);
|
||||||
|
|
||||||
columnsGridPanel
|
columnsGridPanel
|
||||||
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.user.td.columnwidget.client.properties.ExtractCodelist
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
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.columnwidget.client.utils.UtilsGXT3;
|
||||||
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.TDGWTIsLockedException;
|
||||||
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.extract.ExtractCodelistTargetColumn;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistTargetColumn;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
@ -240,7 +241,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -302,7 +302,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -324,8 +323,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
comboDefColumn.setEditable(false);
|
comboDefColumn.setEditable(false);
|
||||||
comboDefColumn.setTriggerAction(TriggerAction.ALL);
|
comboDefColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// comboColumn
|
// comboColumn
|
||||||
ColumnDataPropertiesCombo propsCod = GWT
|
ColumnDataPropertiesCombo propsCod = GWT
|
||||||
.create(ColumnDataPropertiesCombo.class);
|
.create(ColumnDataPropertiesCombo.class);
|
||||||
|
@ -371,7 +368,8 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
|
|
||||||
flowButton.add(checkNew, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(checkNew, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
flowButton.add(comboColumn, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(comboColumn, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
flowButton.add(comboDefColumn, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(comboDefColumn, new BoxLayoutData(
|
||||||
|
new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
FieldLabel columnLabel = new FieldLabel(flowButton, label);
|
FieldLabel columnLabel = new FieldLabel(flowButton, label);
|
||||||
columnLabel.setId(col.getColumnId());
|
columnLabel.setId(col.getColumnId());
|
||||||
|
@ -433,6 +431,11 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
.fireEvent(
|
.fireEvent(
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
parent.showErrorAndHide("Error Locked",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Error retrieving columns: "
|
Log.debug("Error retrieving columns: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
|
@ -440,6 +443,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
"Error retrieving columns on server!");
|
"Error retrieving columns on server!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ArrayList<ColumnData> result) {
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
@ -508,30 +512,36 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
.getWidget());
|
.getWidget());
|
||||||
DefNewColumn defNewColumn = comboDefColumn.getValue();
|
DefNewColumn defNewColumn = comboDefColumn.getValue();
|
||||||
Log.debug("Retrieved: " + defNewColumn.toString());
|
Log.debug("Retrieved: " + defNewColumn.toString());
|
||||||
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(
|
||||||
|
colCurrent, defNewColumn);
|
||||||
Log.debug("New TargetColumn: " + extractCodelistTargetColumn);
|
Log.debug("New TargetColumn: " + extractCodelistTargetColumn);
|
||||||
targetColumns.add(extractCodelistTargetColumn);
|
targetColumns.add(extractCodelistTargetColumn);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
HBoxLayoutContainer flowButton = (HBoxLayoutContainer) fieldLabel
|
HBoxLayoutContainer flowButton = (HBoxLayoutContainer) fieldLabel
|
||||||
.getWidget();
|
.getWidget();
|
||||||
CheckBox checkNew=(CheckBox)flowButton.getItemByItemId(CHECK_NEW);
|
CheckBox checkNew = (CheckBox) flowButton
|
||||||
|
.getItemByItemId(CHECK_NEW);
|
||||||
if (checkNew == null) {
|
if (checkNew == null) {
|
||||||
UtilsGXT3.alert("Error creating form", "Error creating form for check radio!");
|
UtilsGXT3.alert("Error creating form",
|
||||||
|
"Error creating form for check radio!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkNew.getValue()) {
|
if (checkNew.getValue()) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ComboBox<DefNewColumn> comboDefColumn = (ComboBox<DefNewColumn>)flowButton.getItemByItemId(COMBO_DEF_COLUMN);
|
ComboBox<DefNewColumn> comboDefColumn = (ComboBox<DefNewColumn>) flowButton
|
||||||
|
.getItemByItemId(COMBO_DEF_COLUMN);
|
||||||
DefNewColumn defNewColumn = comboDefColumn.getValue();
|
DefNewColumn defNewColumn = comboDefColumn.getValue();
|
||||||
Log.debug("Retrieved: " + defNewColumn.toString());
|
Log.debug("Retrieved: " + defNewColumn.toString());
|
||||||
ExtractCodelistTargetColumn extractCodelistTargetCol = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
ExtractCodelistTargetColumn extractCodelistTargetCol = new ExtractCodelistTargetColumn(
|
||||||
|
colCurrent, defNewColumn);
|
||||||
Log.debug("New TargetColumn:" + extractCodelistTargetCol);
|
Log.debug("New TargetColumn:" + extractCodelistTargetCol);
|
||||||
targetColumns.add(extractCodelistTargetCol);
|
targetColumns.add(extractCodelistTargetCol);
|
||||||
} else {
|
} else {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ComboBox<ColumnData> comboColumn=(ComboBox<ColumnData>)flowButton.getItemByItemId(COMBO_COLUMN);
|
ComboBox<ColumnData> comboColumn = (ComboBox<ColumnData>) flowButton
|
||||||
|
.getItemByItemId(COMBO_COLUMN);
|
||||||
ColumnData columnData = comboColumn.getCurrentValue();
|
ColumnData columnData = comboColumn.getCurrentValue();
|
||||||
if (columnData == null) {
|
if (columnData == null) {
|
||||||
UtilsGXT3.alert("Attention", "Fill all column!");
|
UtilsGXT3.alert("Attention", "Fill all column!");
|
||||||
|
|
|
@ -4,7 +4,13 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
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.TDGWTIsLockedException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
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.wizardwidget.client.WizardCard;
|
||||||
|
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -44,26 +50,25 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
|
|
||||||
protected final Grid<ColumnData> grid;
|
protected final Grid<ColumnData> grid;
|
||||||
|
|
||||||
public ColumnDataGridPanel() {
|
private WizardCard parent;
|
||||||
|
|
||||||
|
public ColumnDataGridPanel(WizardCard parent) {
|
||||||
|
this.parent = parent;
|
||||||
Log.debug("ColumnDataGridPanel");
|
Log.debug("ColumnDataGridPanel");
|
||||||
setHeadingText("Columns");
|
setHeadingText("Columns");
|
||||||
|
|
||||||
|
|
||||||
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
||||||
props.label());
|
props.label());
|
||||||
|
|
||||||
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
||||||
|
|
||||||
sm = new CheckBoxSelectionModel<ColumnData>(
|
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
||||||
identity);
|
|
||||||
|
|
||||||
|
|
||||||
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
||||||
l.add(sm.getColumn());
|
l.add(sm.getColumn());
|
||||||
l.add(labelCol);
|
l.add(labelCol);
|
||||||
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
||||||
|
|
||||||
|
|
||||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||||
|
@ -94,7 +99,6 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
sm.setSelectionMode(SelectionMode.MULTI);
|
sm.setSelectionMode(SelectionMode.MULTI);
|
||||||
grid.setLoader(loader);
|
grid.setLoader(loader);
|
||||||
grid.setSelectionModel(sm);
|
grid.setSelectionModel(sm);
|
||||||
|
@ -107,8 +111,6 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
grid.setLoadMask(true);
|
grid.setLoadMask(true);
|
||||||
grid.setColumnReordering(true);
|
grid.setColumnReordering(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||||
con.setScrollMode(ScrollMode.AUTO);
|
con.setScrollMode(ScrollMode.AUTO);
|
||||||
con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||||
|
@ -125,10 +127,25 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
TDGWTServiceAsync.INSTANCE
|
TDGWTServiceAsync.INSTANCE
|
||||||
.getColumns(new AsyncCallback<ArrayList<ColumnData>>() {
|
.getColumns(new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Log.error("No load columns: "
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
parent.getEventBus()
|
||||||
|
.fireEvent(
|
||||||
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Locked",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
} else {
|
||||||
|
Log.error("No columns loaded: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
"No columns loaded: "+caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,12 +160,11 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<ColumnData> getSelectedItems() {
|
public ArrayList<ColumnData> getSelectedItems() {
|
||||||
return new ArrayList<ColumnData>(grid
|
return new ArrayList<ColumnData>(grid.getSelectionModel()
|
||||||
.getSelectionModel().getSelectedItems());
|
.getSelectedItems());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public HandlerRegistration addSelectionHandler(
|
public HandlerRegistration addSelectionHandler(
|
||||||
SelectionHandler<ColumnData> handler) {
|
SelectionHandler<ColumnData> handler) {
|
||||||
return grid.getSelectionModel().addSelectionHandler(handler);
|
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||||
|
|
Loading…
Reference in New Issue