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();
|
||||
panel.add(content);
|
||||
|
||||
columnsGridPanel = new ColumnDataGridPanel();
|
||||
columnsGridPanel = new ColumnDataGridPanel(this);
|
||||
|
||||
columnsGridPanel
|
||||
.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.utils.UtilsGXT3;
|
||||
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.extract.ExtractCodelistTargetColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
|
@ -229,7 +230,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
|
||||
@Override
|
||||
public void completedDefColumnCreation(DefNewColumn defNewColumn) {
|
||||
comboDefColumn.setValue(defNewColumn,true);
|
||||
comboDefColumn.setValue(defNewColumn, true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -239,7 +240,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
||||
|
||||
|
@ -278,7 +278,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
final ComboBox<DefNewColumn> comboDefColumn = new ComboBox<DefNewColumn>(
|
||||
storeComboDefColumn, props.label());
|
||||
comboDefColumn.setItemId(COMBO_DEF_COLUMN);
|
||||
|
||||
|
||||
Log.debug("ComboDefColumn created");
|
||||
|
||||
final CreateDefColumnListener createDefColumnListener = new CreateDefColumnListener() {
|
||||
|
@ -291,7 +291,7 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
|
||||
@Override
|
||||
public void completedDefColumnCreation(DefNewColumn defNewColumn) {
|
||||
comboDefColumn.setValue(defNewColumn,true);
|
||||
comboDefColumn.setValue(defNewColumn, true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
||||
|
||||
|
@ -324,8 +323,6 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
comboDefColumn.setEditable(false);
|
||||
comboDefColumn.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
|
||||
|
||||
// comboColumn
|
||||
ColumnDataPropertiesCombo propsCod = GWT
|
||||
.create(ColumnDataPropertiesCombo.class);
|
||||
|
@ -343,16 +340,16 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
comboColumn.setWidth(COMBOWIDTH);
|
||||
comboColumn.setEditable(false);
|
||||
comboColumn.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
|
||||
CheckBox checkNew = new CheckBox();
|
||||
checkNew.setItemId(CHECK_NEW);
|
||||
checkNew.setEnabled(true);
|
||||
checkNew.setBoxLabel("New");
|
||||
checkNew.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
checkNew.setEnabled(true);
|
||||
checkNew.setBoxLabel("New");
|
||||
checkNew.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
if(event.getValue()){
|
||||
if (event.getValue()) {
|
||||
comboColumn.setVisible(false);
|
||||
comboDefColumn.setVisible(true);
|
||||
forceLayout();
|
||||
|
@ -361,18 +358,19 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
comboDefColumn.setVisible(false);
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.START);
|
||||
|
||||
flowButton.add(checkNew, 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);
|
||||
columnLabel.setId(col.getColumnId());
|
||||
comboDefColumn.setVisible(false);
|
||||
|
@ -434,10 +432,16 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug("Error retrieving columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving columns",
|
||||
"Error retrieving columns on server!");
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error Locked",
|
||||
caught.getLocalizedMessage(), caught);
|
||||
} else {
|
||||
Log.debug("Error retrieving columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving columns",
|
||||
"Error retrieving columns on server!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,20 +484,20 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
|
||||
public boolean updateExtractCodelistSession() {
|
||||
targetColumns = new ArrayList<ExtractCodelistTargetColumn>();
|
||||
|
||||
|
||||
int i = 0;
|
||||
int lenght = formLayout.getWidgetCount();
|
||||
|
||||
for (; i < lenght; i++) {
|
||||
FieldLabel fieldLabel = (FieldLabel) formLayout.getWidget(i);
|
||||
String columnId = fieldLabel.getId();
|
||||
Log.debug("Field id:"+columnId);
|
||||
Log.debug("Field id:" + columnId);
|
||||
ColumnData colCurrent = null;
|
||||
for (ColumnData col : parent.extractCodelistSession
|
||||
.getSourceColumns()) {
|
||||
if (col.getColumnId().compareTo(columnId) == 0) {
|
||||
colCurrent = col;
|
||||
Log.debug("Column Match:"+colCurrent);
|
||||
Log.debug("Column Match:" + colCurrent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -501,53 +505,59 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
|||
UtilsGXT3.alert("Error creating form", "Error creating form!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(connection==null){
|
||||
|
||||
if (connection == null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<DefNewColumn> comboDefColumn = ((ComboBox<DefNewColumn>) fieldLabel
|
||||
.getWidget());
|
||||
ComboBox<DefNewColumn> comboDefColumn = ((ComboBox<DefNewColumn>) fieldLabel
|
||||
.getWidget());
|
||||
DefNewColumn defNewColumn = comboDefColumn.getValue();
|
||||
Log.debug("Retrieved: "+defNewColumn.toString());
|
||||
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
||||
Log.debug("New TargetColumn: "+extractCodelistTargetColumn);
|
||||
Log.debug("Retrieved: " + defNewColumn.toString());
|
||||
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(
|
||||
colCurrent, defNewColumn);
|
||||
Log.debug("New TargetColumn: " + extractCodelistTargetColumn);
|
||||
targetColumns.add(extractCodelistTargetColumn);
|
||||
} else {
|
||||
|
||||
HBoxLayoutContainer flowButton=(HBoxLayoutContainer) fieldLabel
|
||||
|
||||
HBoxLayoutContainer flowButton = (HBoxLayoutContainer) fieldLabel
|
||||
.getWidget();
|
||||
CheckBox checkNew=(CheckBox)flowButton.getItemByItemId(CHECK_NEW);
|
||||
if(checkNew==null){
|
||||
UtilsGXT3.alert("Error creating form", "Error creating form for check radio!");
|
||||
CheckBox checkNew = (CheckBox) flowButton
|
||||
.getItemByItemId(CHECK_NEW);
|
||||
if (checkNew == null) {
|
||||
UtilsGXT3.alert("Error creating form",
|
||||
"Error creating form for check radio!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(checkNew.getValue()){
|
||||
}
|
||||
|
||||
if (checkNew.getValue()) {
|
||||
@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();
|
||||
Log.debug("Retrieved: "+defNewColumn.toString());
|
||||
ExtractCodelistTargetColumn extractCodelistTargetCol = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
||||
Log.debug("New TargetColumn:"+extractCodelistTargetCol);
|
||||
Log.debug("Retrieved: " + defNewColumn.toString());
|
||||
ExtractCodelistTargetColumn extractCodelistTargetCol = new ExtractCodelistTargetColumn(
|
||||
colCurrent, defNewColumn);
|
||||
Log.debug("New TargetColumn:" + extractCodelistTargetCol);
|
||||
targetColumns.add(extractCodelistTargetCol);
|
||||
} else {
|
||||
@SuppressWarnings("unchecked")
|
||||
ComboBox<ColumnData> comboColumn=(ComboBox<ColumnData>)flowButton.getItemByItemId(COMBO_COLUMN);
|
||||
ColumnData columnData=comboColumn.getCurrentValue();
|
||||
if(columnData==null){
|
||||
ComboBox<ColumnData> comboColumn = (ComboBox<ColumnData>) flowButton
|
||||
.getItemByItemId(COMBO_COLUMN);
|
||||
ColumnData columnData = comboColumn.getCurrentValue();
|
||||
if (columnData == null) {
|
||||
UtilsGXT3.alert("Attention", "Fill all column!");
|
||||
return false;
|
||||
} else {
|
||||
ExtractCodelistTargetColumn extractCodelistTargetC = new ExtractCodelistTargetColumn(
|
||||
colCurrent, columnData, connection.getTrId());
|
||||
Log.debug("New TargetColumn:"+extractCodelistTargetC);
|
||||
colCurrent, columnData, connection.getTrId());
|
||||
Log.debug("New TargetColumn:" + extractCodelistTargetC);
|
||||
targetColumns.add(extractCodelistTargetC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Log.debug("UpdateExtractCodelistSession:"+targetColumns);
|
||||
|
||||
Log.debug("UpdateExtractCodelistSession:" + targetColumns);
|
||||
parent.extractCodelistSession.setTargetColumns(targetColumns);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,13 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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.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.google.gwt.core.client.GWT;
|
||||
|
@ -35,35 +41,34 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
|
||||
public class ColumnDataGridPanel extends ContentPanel implements
|
||||
HasSelectionHandlers<ColumnData> {
|
||||
protected static final int GRIDHEIGHT=360;
|
||||
|
||||
protected static final int GRIDHEIGHT = 360;
|
||||
|
||||
protected static final ColumnDataProperties props = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
|
||||
|
||||
protected final CheckBoxSelectionModel<ColumnData> sm;
|
||||
|
||||
protected final Grid<ColumnData> grid;
|
||||
|
||||
public ColumnDataGridPanel() {
|
||||
private WizardCard parent;
|
||||
|
||||
public ColumnDataGridPanel(WizardCard parent) {
|
||||
this.parent = parent;
|
||||
Log.debug("ColumnDataGridPanel");
|
||||
setHeadingText("Columns");
|
||||
|
||||
|
||||
|
||||
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
||||
props.label());
|
||||
|
||||
|
||||
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
||||
|
||||
sm = new CheckBoxSelectionModel<ColumnData>(
|
||||
identity);
|
||||
|
||||
|
||||
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
||||
|
||||
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
||||
l.add(sm.getColumn());
|
||||
l.add(labelCol);
|
||||
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
||||
|
||||
|
||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||
|
@ -86,7 +91,7 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
|
@ -94,21 +99,18 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight(GRIDHEIGHT);
|
||||
//grid.getView().setAutoExpandColumn(labelCol);
|
||||
// grid.getView().setAutoExpandColumn(labelCol);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
|
||||
|
||||
|
||||
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.setScrollMode(ScrollMode.AUTO);
|
||||
con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
|
@ -125,10 +127,25 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
TDGWTServiceAsync.INSTANCE
|
||||
.getColumns(new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("No load columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
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());
|
||||
UtilsGXT3.alert("Error",
|
||||
"No columns loaded: "+caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
|
@ -143,11 +160,10 @@ public class ColumnDataGridPanel extends ContentPanel implements
|
|||
}
|
||||
|
||||
public ArrayList<ColumnData> getSelectedItems() {
|
||||
return new ArrayList<ColumnData>(grid
|
||||
.getSelectionModel().getSelectedItems());
|
||||
|
||||
}
|
||||
return new ArrayList<ColumnData>(grid.getSelectionModel()
|
||||
.getSelectedItems());
|
||||
|
||||
}
|
||||
|
||||
public HandlerRegistration addSelectionHandler(
|
||||
SelectionHandler<ColumnData> handler) {
|
||||
|
|
Loading…
Reference in New Issue