Updated ReplaceBatch
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@113709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a333b5825f
commit
f707692a40
|
@ -48,7 +48,7 @@ public class ReplaceBatchDialog extends Window implements MonitorDialogListener
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String WIDTH = "650px";
|
private static final String WIDTH = "650px";
|
||||||
private static final String HEIGHT = "530px";
|
private static final String HEIGHT = "560px";
|
||||||
private TRId trId;
|
private TRId trId;
|
||||||
|
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistD
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistListener;
|
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.ColumnDataPropertiesCombo;
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
|
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
|
||||||
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.store.ShowOccurrencesTypeElement;
|
import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement;
|
||||||
|
@ -41,18 +42,22 @@ import com.google.gwt.cell.client.Cell.Context;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.NodeList;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.safecss.shared.SafeStylesBuilder;
|
import com.google.gwt.safecss.shared.SafeStylesBuilder;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
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.IdentityValueProvider;
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||||
import com.sencha.gxt.core.client.util.Format;
|
import com.sencha.gxt.core.client.util.Format;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
@ -72,11 +77,14 @@ import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutD
|
||||||
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.HorizontalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
||||||
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
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.SelectEvent.SelectHandler;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
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.form.TextField;
|
||||||
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
@ -84,7 +92,6 @@ import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,10 +105,16 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
ConnectCodelistListener {
|
ConnectCodelistListener {
|
||||||
private static final String DON_T_REPLACE = "Don't replace";
|
private static final String DON_T_REPLACE = "Don't replace";
|
||||||
private static final String WIDTH = "560px";
|
private static final String WIDTH = "560px";
|
||||||
private static final String HEIGHT = "520px";
|
private static final String HEIGHT = "550px";
|
||||||
|
private static final String GRID_HEIGHT = "344px";
|
||||||
|
private static final String TOOLBAR_HEAD_HEIGHT = "102px";
|
||||||
|
private static final String CONNECTION_FIELD_WIDTH = "470px";
|
||||||
|
private static final int SHOW_OCCURENCE_TYPE_WIDTH = 100;
|
||||||
|
private static final String COMBOCOLS_WIDTH = "510px";
|
||||||
|
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private TRId trId;
|
private TRId trId;
|
||||||
|
private ArrayList<ColumnData> columns;
|
||||||
|
|
||||||
private RefColumn refColumn;
|
private RefColumn refColumn;
|
||||||
private String columnLocalId;
|
private String columnLocalId;
|
||||||
|
@ -138,6 +151,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
private boolean simpleReplace;
|
private boolean simpleReplace;
|
||||||
|
|
||||||
|
private ComboBox<ColumnData> comboCols;
|
||||||
|
|
||||||
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
|
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
|
||||||
RequestProperties requestProperties, EventBus eventBus) {
|
RequestProperties requestProperties, EventBus eventBus) {
|
||||||
this.curation = true;
|
this.curation = true;
|
||||||
|
@ -181,7 +196,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
|
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
|
||||||
+ " , columnLocalId:" + columnLocalId + "]");
|
+ " , columnLocalId:" + columnLocalId + "]");
|
||||||
init();
|
init();
|
||||||
retrieveColumnByColumnId();
|
retrieveColumnsWithViewColumnIncluded();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,8 +210,33 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
protected void create() {
|
protected void create() {
|
||||||
showOccurencesType = ShowOccurrencesType.ONLYERRORS;
|
showOccurencesType = ShowOccurrencesType.ONLYERRORS;
|
||||||
|
|
||||||
toolBarHead = new ToolBar();
|
FlexTable flexTable = new FlexTable();
|
||||||
toolBarHead.add(new LabelToolItem("Show: "));
|
flexTable.setCellSpacing(1);
|
||||||
|
|
||||||
|
// Combo Column
|
||||||
|
ColumnDataPropertiesCombo propsCols = GWT
|
||||||
|
.create(ColumnDataPropertiesCombo.class);
|
||||||
|
Log.debug("Props: " + propsCols);
|
||||||
|
final ListStore<ColumnData> storeCols = new ListStore<ColumnData>(
|
||||||
|
propsCols.id());
|
||||||
|
Log.debug("Store Col: " + storeCols);
|
||||||
|
storeCols.addAll(columns);
|
||||||
|
|
||||||
|
Log.debug("StoreCol created");
|
||||||
|
comboCols = new ComboBox<ColumnData>(storeCols, propsCols.label());
|
||||||
|
|
||||||
|
Log.debug("Combo Threshold created");
|
||||||
|
|
||||||
|
comboCols.addSelectionHandler(comboColsSelection());
|
||||||
|
|
||||||
|
comboCols.setEmptyText("Select a column...");
|
||||||
|
comboCols.setEditable(false);
|
||||||
|
comboCols.setTriggerAction(TriggerAction.ALL);
|
||||||
|
comboCols.setWidth(COMBOCOLS_WIDTH);
|
||||||
|
|
||||||
|
FieldLabel columnField = new FieldLabel(comboCols, "Column");
|
||||||
|
|
||||||
|
flexTable.setWidget(0, 0, columnField);
|
||||||
|
|
||||||
// Create Combo Show
|
// Create Combo Show
|
||||||
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
|
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
|
||||||
|
@ -211,18 +251,21 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
addHandlersForShowOccurrencesType(propsShowOccurrencesType.label());
|
addHandlersForShowOccurrencesType(propsShowOccurrencesType.label());
|
||||||
|
|
||||||
comboShowOccurrencesType.setEmptyText("Select a show type...");
|
comboShowOccurrencesType.setEmptyText("Select a show type...");
|
||||||
comboShowOccurrencesType.setWidth(100);
|
comboShowOccurrencesType.setWidth(SHOW_OCCURENCE_TYPE_WIDTH);
|
||||||
comboShowOccurrencesType.setTypeAhead(true);
|
comboShowOccurrencesType.setTypeAhead(true);
|
||||||
comboShowOccurrencesType.setEditable(false);
|
comboShowOccurrencesType.setEditable(false);
|
||||||
comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL);
|
comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
|
||||||
comboShowOccurrencesType
|
comboShowOccurrencesType
|
||||||
.setValue(ShowOccurrencesTypeStore.onlyErrorsElement);
|
.setValue(ShowOccurrencesTypeStore.onlyErrorsElement);
|
||||||
|
|
||||||
toolBarHead.add(comboShowOccurrencesType);
|
FieldLabel comboShowOccurrencesTypeField = new FieldLabel(
|
||||||
|
comboShowOccurrencesType, "Show");
|
||||||
|
flexTable.setWidget(1, 0, comboShowOccurrencesTypeField);
|
||||||
|
|
||||||
|
HorizontalLayoutContainer connectionLayout = new HorizontalLayoutContainer();
|
||||||
|
if (column == null || !column.isViewColumn()) {
|
||||||
|
|
||||||
if (!column.isViewColumn()) {
|
|
||||||
// Connect Codelist
|
// Connect Codelist
|
||||||
btnConnect = new TextButton();
|
btnConnect = new TextButton();
|
||||||
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
|
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
|
||||||
|
@ -239,7 +282,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toolBarHead.add(btnConnect);
|
connectionLayout.add(btnConnect, new HorizontalLayoutData(-1, 1,
|
||||||
|
new Margins(1)));
|
||||||
|
|
||||||
// Disconnect Codelist
|
// Disconnect Codelist
|
||||||
btnDisconnect = new TextButton();
|
btnDisconnect = new TextButton();
|
||||||
|
@ -257,16 +301,33 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
toolBarHead.add(btnDisconnect);
|
connectionLayout.add(btnDisconnect, new HorizontalLayoutData(-1, 1,
|
||||||
|
new Margins(1)));
|
||||||
|
|
||||||
connectionField = new TextField();
|
connectionField = new TextField();
|
||||||
toolBarHead.add(connectionField);
|
connectionField.setWidth(CONNECTION_FIELD_WIDTH);
|
||||||
|
connectionLayout.add(connectionField, new HorizontalLayoutData(-1,
|
||||||
|
1, new Margins(1)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
connectionField = new TextField();
|
connectionField = new TextField();
|
||||||
toolBarHead.add(connectionField);
|
connectionField.setWidth(CONNECTION_FIELD_WIDTH);
|
||||||
|
|
||||||
|
connectionLayout.add(connectionField, new HorizontalLayoutData(-1,
|
||||||
|
1, new Margins(1)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FieldLabel conField = new FieldLabel(connectionLayout, "Connection");
|
||||||
|
flexTable.setWidget(2, 0, conField);
|
||||||
|
|
||||||
|
cleanCells(flexTable.getElement());
|
||||||
|
|
||||||
|
toolBarHead = new ToolBar();
|
||||||
|
toolBarHead.setHeight(TOOLBAR_HEAD_HEIGHT);
|
||||||
|
// toolBarHead.setHeight("");
|
||||||
|
toolBarHead.add(flexTable, new BoxLayoutData(new Margins(0)));
|
||||||
|
|
||||||
// Create Grid
|
// Create Grid
|
||||||
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
||||||
CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>(
|
CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>(
|
||||||
|
@ -274,17 +335,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>(
|
RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>(
|
||||||
identity);
|
identity);
|
||||||
// number.setFixed(false);
|
|
||||||
// number.setResizable(false);
|
|
||||||
number.setWidth(50);
|
number.setWidth(50);
|
||||||
|
|
||||||
//From gxt 3.1.1
|
|
||||||
number.setCellClassName("");
|
number.setCellClassName("");
|
||||||
number.setCellPadding(true);
|
number.setCellPadding(true);
|
||||||
|
|
||||||
//GXT 3.0.1
|
|
||||||
//number.setColumnClassSuffix("");
|
|
||||||
|
|
||||||
number.setHeader("N.");
|
number.setHeader("N.");
|
||||||
SafeStylesBuilder styleBuilder = new SafeStylesBuilder();
|
SafeStylesBuilder styleBuilder = new SafeStylesBuilder();
|
||||||
styleBuilder.width(50, Unit.PX);
|
styleBuilder.width(50, Unit.PX);
|
||||||
|
@ -310,8 +364,11 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String style = "style='color: green;font-weight:normal'";
|
String style = "style='color: green;font-weight:normal'";
|
||||||
sb.appendHtmlConstant("<span " + style + ">" + new SafeHtmlBuilder().appendEscaped(value).toSafeHtml().asString()
|
sb.appendHtmlConstant("<span "
|
||||||
+ "</span>");
|
+ style
|
||||||
|
+ ">"
|
||||||
|
+ new SafeHtmlBuilder().appendEscaped(value)
|
||||||
|
.toSafeHtml().asString() + "</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -388,7 +445,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
grid.setLoader(loader);
|
grid.setLoader(loader);
|
||||||
grid.setSelectionModel(sm);
|
grid.setSelectionModel(sm);
|
||||||
number.initPlugin(grid);
|
number.initPlugin(grid);
|
||||||
grid.setHeight("376px");
|
grid.setHeight(GRID_HEIGHT);
|
||||||
grid.getView().setStripeRows(true);
|
grid.getView().setStripeRows(true);
|
||||||
grid.getView().setColumnLines(true);
|
grid.getView().setColumnLines(true);
|
||||||
grid.getView().setAutoFill(true);
|
grid.getView().setAutoFill(true);
|
||||||
|
@ -435,7 +492,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
|
||||||
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4));
|
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
|
||||||
flowButton.add(btnSave, boxLayoutData);
|
flowButton.add(btnSave, boxLayoutData);
|
||||||
flowButton.add(btnClose, boxLayoutData);
|
flowButton.add(btnClose, boxLayoutData);
|
||||||
|
|
||||||
|
@ -443,11 +500,55 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
|
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
||||||
v.add(flowButton, new VerticalLayoutData(1, 36,
|
v.add(flowButton,
|
||||||
new Margins(5, 2, 5, 2)));
|
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||||
add(v);
|
add(v);
|
||||||
|
|
||||||
|
setSelectedColumn();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void update(ColumnData column) {
|
||||||
|
this.column = column;
|
||||||
|
if (column == null) {
|
||||||
|
setSelectedColumn();
|
||||||
|
} else {
|
||||||
|
columnLocalId = column.getColumnId();
|
||||||
|
connection=null;
|
||||||
|
conditionCode=null;
|
||||||
|
refColumn = null;
|
||||||
|
validationColumnColumnId = null;
|
||||||
|
hasValidationColumns = false;
|
||||||
|
clear();
|
||||||
|
retrieveValidationColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSelectedColumn() {
|
||||||
|
if (column == null) {
|
||||||
|
columnLocalId=null;
|
||||||
|
connection = null;
|
||||||
|
conditionCode=null;
|
||||||
|
refColumn = null;
|
||||||
|
validationColumnColumnId = null;
|
||||||
|
hasValidationColumns = false;
|
||||||
|
comboCols.reset();
|
||||||
|
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||||
|
.getShowOccurrencesType());
|
||||||
|
Log.debug("Not Is View Column");
|
||||||
|
connectionField.setVisible(false);
|
||||||
|
btnDisconnect.setVisible(false);
|
||||||
|
btnConnect.setVisible(false);
|
||||||
|
if(curation){
|
||||||
|
comboCols.setReadOnly(true);
|
||||||
|
}
|
||||||
|
toolBarHead.forceLayout();
|
||||||
|
} else {
|
||||||
|
comboCols.setValue(column);
|
||||||
if (curation) {
|
if (curation) {
|
||||||
|
comboCols.setReadOnly(true);
|
||||||
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||||
.getShowOccurrencesType());
|
.getShowOccurrencesType());
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
|
@ -456,20 +557,15 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
connectionField.setVisible(true);
|
connectionField.setVisible(true);
|
||||||
btnDisconnect.setVisible(true);
|
btnDisconnect.setVisible(true);
|
||||||
btnConnect.setVisible(false);
|
btnConnect.setVisible(false);
|
||||||
btnConnect.enable();
|
btnConnect.disable();
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
toolBarHead.forceLayout();
|
toolBarHead.forceLayout();
|
||||||
} else {
|
} else {
|
||||||
if (column.isViewColumn()) {
|
if (column.isViewColumn()) {
|
||||||
Log.debug("Is View Column");
|
Log.debug("Is View Column");
|
||||||
//storeShowOccurrencesType
|
// storeShowOccurrencesType
|
||||||
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
|
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
|
||||||
storeShowOccurrencesType
|
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||||
.addAll(ShowOccurrencesTypeStore.getShowOccurrencesType());
|
.getShowOccurrencesType());
|
||||||
|
|
||||||
|
|
||||||
ColumnViewData cViewData = column.getColumnViewData();
|
ColumnViewData cViewData = column.getColumnViewData();
|
||||||
RefColumn refCol = new RefColumn(String.valueOf(cViewData
|
RefColumn refCol = new RefColumn(String.valueOf(cViewData
|
||||||
|
@ -482,20 +578,79 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
Log.debug("Not Is View Column");
|
Log.debug("Not Is View Column");
|
||||||
connectionField.setVisible(false);
|
connectionField.setVisible(false);
|
||||||
btnDisconnect.setVisible(false);
|
btnDisconnect.setVisible(false);
|
||||||
|
btnConnect.setVisible(true);
|
||||||
|
btnConnect.setEnabled(true);
|
||||||
|
toolBarHead.forceLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (column.isViewColumn()) {
|
||||||
|
Log.debug("Is View Column");
|
||||||
|
// storeShowOccurrencesType
|
||||||
|
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
|
||||||
|
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||||
|
.getShowOccurrencesType());
|
||||||
|
|
||||||
|
ColumnViewData cViewData = column.getColumnViewData();
|
||||||
|
RefColumn refCol = new RefColumn(String.valueOf(cViewData
|
||||||
|
.getTargetTableId()),
|
||||||
|
cViewData.getTargetTableColumnId());
|
||||||
|
retrieveConnectionForViewColumn(refCol);
|
||||||
|
} else {
|
||||||
|
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
|
||||||
|
.getShowOccurrencesType());
|
||||||
|
Log.debug("Not Is View Column");
|
||||||
|
connectionField.setVisible(false);
|
||||||
|
btnDisconnect.setVisible(false);
|
||||||
|
btnConnect.setVisible(true);
|
||||||
|
btnConnect.setEnabled(true);
|
||||||
toolBarHead.forceLayout();
|
toolBarHead.forceLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SelectionHandler<ColumnData> comboColsSelection() {
|
||||||
|
SelectionHandler<ColumnData> selectionHandler = new SelectionHandler<ColumnData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||||
|
if (event.getSelectedItem() != null) {
|
||||||
|
ColumnData col = event.getSelectedItem();
|
||||||
|
Log.debug("Col selected:" + col.toString());
|
||||||
|
column = col;
|
||||||
|
btnSave.enable();
|
||||||
|
update(col);
|
||||||
|
} else {
|
||||||
|
column = null;
|
||||||
|
btnSave.disable();
|
||||||
|
update(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
protected void retrieveColumnByColumnId() {
|
return selectionHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cleanCells(Element elem) {
|
||||||
|
NodeList<Element> tds = elem.<XElement> cast().select("td");
|
||||||
|
for (int i = 0; i < tds.getLength(); i++) {
|
||||||
|
Element td = tds.getItem(i);
|
||||||
|
|
||||||
|
if (!td.hasChildNodes() && td.getClassName().equals("")) {
|
||||||
|
td.removeFromParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveColumnsWithViewColumnIncluded() {
|
||||||
Log.debug("Retrieve Column by ColumnId: columnLocalId:" + columnLocalId
|
Log.debug("Retrieve Column by ColumnId: columnLocalId:" + columnLocalId
|
||||||
+ ", trId:" + trId);
|
+ ", trId:" + trId);
|
||||||
TDGWTServiceAsync.INSTANCE.getColumn(columnLocalId, trId,
|
TDGWTServiceAsync.INSTANCE.getColumnWithViewColumnIncluded(trId,
|
||||||
new AsyncCallback<ColumnData>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
@ -521,17 +676,35 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(ColumnData result) {
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
Log.debug("Column: " + result);
|
Log.debug("Column: " + result);
|
||||||
column = result;
|
columns = result;
|
||||||
retriveValidationColumn();
|
retrieveColumn();
|
||||||
|
if (column == null) {
|
||||||
|
hasValidationColumns = false;
|
||||||
|
create();
|
||||||
|
} else {
|
||||||
|
retrieveValidationColumn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retriveValidationColumn() {
|
protected void retrieveColumn() {
|
||||||
TDGWTServiceAsync.INSTANCE.getValidationColumns(columnLocalId,trId,
|
for (ColumnData c : columns) {
|
||||||
|
if (columnLocalId != null
|
||||||
|
&& c.getColumnId().compareTo(columnLocalId) == 0) {
|
||||||
|
column = c;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retrieveValidationColumn() {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getValidationColumns(columnLocalId, trId,
|
||||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -617,6 +790,14 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
protected void loadData(ListLoadConfig loadConfig,
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
|
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
|
||||||
|
|
||||||
|
if(column==null){
|
||||||
|
ListLoadResultBean<ReplaceEntry> loadedResult = new ListLoadResultBean<ReplaceEntry>(
|
||||||
|
getRecord(new ArrayList<Occurrences>()));
|
||||||
|
Log.debug("created " + loadedResult.toString());
|
||||||
|
callback.onSuccess(loadedResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession(
|
OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession(
|
||||||
column, showOccurencesType, hasValidationColumns,
|
column, showOccurencesType, hasValidationColumns,
|
||||||
conditionCode, validationColumnColumnId);
|
conditionCode, validationColumnColumnId);
|
||||||
|
@ -1064,7 +1245,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
public void onSuccess(ColumnData result) {
|
public void onSuccess(ColumnData result) {
|
||||||
Log.debug("Column: " + result);
|
Log.debug("Column: " + result);
|
||||||
connection = result;
|
connection = result;
|
||||||
retrieveColumnByColumnId();
|
retrieveColumnsWithViewColumnIncluded();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue