Updated Batch Replace
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94789 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
dc7462c918
commit
a35d49537c
|
@ -94,8 +94,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
protected ColumnData column;
|
protected ColumnData column;
|
||||||
protected boolean hasValidationColumns;
|
protected boolean hasValidationColumns;
|
||||||
protected ShowOccurrencesType showOccurencesType;
|
protected ShowOccurrencesType showOccurencesType;
|
||||||
|
protected ColumnData connection;
|
||||||
|
|
||||||
protected ReplaceBatchDialog parent;
|
protected ReplaceBatchDialog parent;
|
||||||
|
|
||||||
private ReplaceEntry currentReplaceEntry;
|
private ReplaceEntry currentReplaceEntry;
|
||||||
private int currentRowIndex;
|
private int currentRowIndex;
|
||||||
|
|
||||||
|
@ -115,7 +117,9 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
protected Grid<ReplaceEntry> grid;
|
protected Grid<ReplaceEntry> grid;
|
||||||
protected ListStore<ReplaceEntry> store;
|
protected ListStore<ReplaceEntry> store;
|
||||||
protected HTML info;
|
protected HTML info;
|
||||||
private TextButton btnDisconnect;
|
protected TextButton btnDisconnect;
|
||||||
|
|
||||||
|
private boolean simpleReplace;
|
||||||
|
|
||||||
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
|
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
|
||||||
String columnName, EventBus eventBus) {
|
String columnName, EventBus eventBus) {
|
||||||
|
@ -123,6 +127,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
connection = null;
|
||||||
hasValidationColumns = false;
|
hasValidationColumns = false;
|
||||||
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
|
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
|
||||||
+ " , columnName:" + columnName + "]");
|
+ " , columnName:" + columnName + "]");
|
||||||
|
@ -168,44 +173,47 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
toolBarHead.add(comboShowOccurrencesType);
|
toolBarHead.add(comboShowOccurrencesType);
|
||||||
|
|
||||||
// Connect Codelist
|
if (!column.isViewColumn()) {
|
||||||
btnConnect = new TextButton();
|
// Connect Codelist
|
||||||
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
|
btnConnect = new TextButton();
|
||||||
btnConnect.setIconAlign(IconAlign.TOP);
|
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
|
||||||
btnConnect.setTitle("Connect");
|
btnConnect.setIconAlign(IconAlign.TOP);
|
||||||
btnConnect.addSelectHandler(new SelectHandler() {
|
btnConnect.setTitle("Connect");
|
||||||
|
btnConnect.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
Log.debug("Pressed Connect");
|
Log.debug("Pressed Connect");
|
||||||
btnConnect.disable();
|
btnConnect.disable();
|
||||||
connectCodelist();
|
connectCodelist();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toolBarHead.add(btnConnect);
|
toolBarHead.add(btnConnect);
|
||||||
|
|
||||||
|
// Disconnect Codelist
|
||||||
|
btnDisconnect = new TextButton();
|
||||||
|
btnDisconnect
|
||||||
|
.setIcon(ResourceBundle.INSTANCE.codelistLinkBreak24());
|
||||||
|
btnDisconnect.setIconAlign(IconAlign.TOP);
|
||||||
|
btnDisconnect.setTitle("Disconnect");
|
||||||
|
btnDisconnect.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
// Disconnect Codelist
|
public void onSelect(SelectEvent event) {
|
||||||
btnDisconnect = new TextButton();
|
Log.debug("Pressed Disconnect");
|
||||||
btnDisconnect.setIcon(ResourceBundle.INSTANCE.codelistLinkBreak24());
|
btnDisconnect.disable();
|
||||||
btnDisconnect.setIconAlign(IconAlign.TOP);
|
disconnectCodelist();
|
||||||
btnDisconnect.setTitle("Disconnect");
|
|
||||||
btnDisconnect.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
}
|
||||||
Log.debug("Pressed Disconnect");
|
|
||||||
btnDisconnect.disable();
|
|
||||||
disconnectCodelist();
|
|
||||||
|
|
||||||
}
|
});
|
||||||
|
toolBarHead.add(btnDisconnect);
|
||||||
|
|
||||||
});
|
connectionField = new TextField();
|
||||||
toolBarHead.add(btnDisconnect);
|
toolBarHead.add(connectionField);
|
||||||
|
|
||||||
connectionField = new TextField();
|
}
|
||||||
toolBarHead.add(connectionField);
|
|
||||||
|
|
||||||
// Create Grid
|
// Create Grid
|
||||||
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
|
||||||
|
@ -320,7 +328,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("388px");
|
grid.setHeight("376px");
|
||||||
grid.getView().setStripeRows(true);
|
grid.getView().setStripeRows(true);
|
||||||
grid.getView().setColumnLines(true);
|
grid.getView().setColumnLines(true);
|
||||||
grid.getView().setAutoFill(true);
|
grid.getView().setAutoFill(true);
|
||||||
|
@ -378,9 +386,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
new Margins(5, 2, 5, 2)));
|
new Margins(5, 2, 5, 2)));
|
||||||
add(v);
|
add(v);
|
||||||
|
|
||||||
connectionField.setVisible(false);
|
if (!column.isViewColumn()) {
|
||||||
btnDisconnect.setVisible(false);
|
connectionField.setVisible(false);
|
||||||
|
btnDisconnect.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retrieveColumn() {
|
protected void retrieveColumn() {
|
||||||
|
@ -592,14 +601,28 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
protected void callSingleValueReplaceDialog() {
|
protected void callSingleValueReplaceDialog() {
|
||||||
Log.debug("callSingleValueReplaceDialog");
|
Log.debug("callSingleValueReplaceDialog");
|
||||||
SingleValueReplaceDialog dialogSingleValueReplace = new SingleValueReplaceDialog(
|
simpleReplace = true;
|
||||||
currentReplaceEntry.getValue(),
|
if (connection == null) {
|
||||||
currentReplaceEntry.getReplacementValue(), column, eventBus);
|
SingleValueReplaceDialog dialogSingleValueReplace = new SingleValueReplaceDialog(
|
||||||
dialogSingleValueReplace.addListener(this);
|
currentReplaceEntry.getValue(),
|
||||||
dialogSingleValueReplace.show();
|
currentReplaceEntry.getReplacementValue(), column, eventBus);
|
||||||
|
dialogSingleValueReplace.addListener(this);
|
||||||
|
dialogSingleValueReplace.show();
|
||||||
|
} else {
|
||||||
|
Log.debug("callDimensionRowSelectionDialog");
|
||||||
|
CellData cellData = new CellData(currentReplaceEntry.getValue(),
|
||||||
|
connection.getName(), connection.getColumnId(),
|
||||||
|
connection.getLabel(), currentReplaceEntry.getRowId(), 0, 0);
|
||||||
|
DimensionRowSelectionDialog dialogDimensionRowSelection = new DimensionRowSelectionDialog(
|
||||||
|
connection, cellData, eventBus);
|
||||||
|
dialogDimensionRowSelection.addListener(this);
|
||||||
|
dialogDimensionRowSelection.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callDimensionRowSelectionDialog() {
|
protected void callDimensionRowSelectionDialog() {
|
||||||
|
simpleReplace = false;
|
||||||
Log.debug("callDimensionRowSelectionDialog");
|
Log.debug("callDimensionRowSelectionDialog");
|
||||||
CellData cellData = new CellData(currentReplaceEntry.getValue(),
|
CellData cellData = new CellData(currentReplaceEntry.getValue(),
|
||||||
column.getName(), column.getColumnId(), column.getLabel(),
|
column.getName(), column.getColumnId(), column.getLabel(),
|
||||||
|
@ -614,10 +637,16 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
@Override
|
@Override
|
||||||
public void selectedDimensionRow(DimensionRow dimensionRow) {
|
public void selectedDimensionRow(DimensionRow dimensionRow) {
|
||||||
Log.debug("Change Value: " + dimensionRow);
|
Log.debug("Change Value: " + dimensionRow);
|
||||||
currentReplaceEntry.setReplacementValue(dimensionRow.getValue());
|
if (simpleReplace) {
|
||||||
currentReplaceEntry.setReplacementDimensionRow(dimensionRow);
|
currentReplaceEntry.setReplacementValue(dimensionRow.getValue());
|
||||||
store.update(currentReplaceEntry);
|
store.update(currentReplaceEntry);
|
||||||
updateInfo();
|
updateInfo();
|
||||||
|
} else {
|
||||||
|
currentReplaceEntry.setReplacementValue(dimensionRow.getValue());
|
||||||
|
currentReplaceEntry.setReplacementDimensionRow(dimensionRow);
|
||||||
|
store.update(currentReplaceEntry);
|
||||||
|
updateInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -663,6 +692,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
|
|
||||||
protected void disconnectCodelist() {
|
protected void disconnectCodelist() {
|
||||||
Log.debug("Disconnect codelist");
|
Log.debug("Disconnect codelist");
|
||||||
|
this.connection = null;
|
||||||
connectionField.setValue("");
|
connectionField.setValue("");
|
||||||
connectionField.setVisible(false);
|
connectionField.setVisible(false);
|
||||||
btnDisconnect.setVisible(false);
|
btnDisconnect.setVisible(false);
|
||||||
|
@ -674,6 +704,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
|
||||||
@Override
|
@Override
|
||||||
public void selectedConnectCodelist(ColumnData connection) {
|
public void selectedConnectCodelist(ColumnData connection) {
|
||||||
Log.debug("Selected connection: " + connection);
|
Log.debug("Selected connection: " + connection);
|
||||||
|
this.connection = connection;
|
||||||
connectionField.setValue(connection.getLabel());
|
connectionField.setValue(connection.getLabel());
|
||||||
connectionField.setVisible(true);
|
connectionField.setVisible(true);
|
||||||
btnDisconnect.setVisible(true);
|
btnDisconnect.setVisible(true);
|
||||||
|
|
|
@ -12,8 +12,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SingleValueReplaceDialog extends Window {
|
public class SingleValueReplaceDialog extends Window {
|
||||||
|
@ -26,12 +26,12 @@ public class SingleValueReplaceDialog extends Window {
|
||||||
protected ColumnData column;
|
protected ColumnData column;
|
||||||
protected ArrayList<SingleValueReplaceListener> listeners;
|
protected ArrayList<SingleValueReplaceListener> listeners;
|
||||||
|
|
||||||
|
public SingleValueReplaceDialog(String value, String replaceValue,
|
||||||
public SingleValueReplaceDialog(String value, String replaceValue, ColumnData column, EventBus eventBus) {
|
ColumnData column, EventBus eventBus) {
|
||||||
listeners=new ArrayList<SingleValueReplaceListener>();
|
listeners = new ArrayList<SingleValueReplaceListener>();
|
||||||
this.value=value;
|
this.value = value;
|
||||||
this.replaceValue=replaceValue;
|
this.replaceValue = replaceValue;
|
||||||
this.column=column;
|
this.column = column;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
initWindow();
|
initWindow();
|
||||||
create();
|
create();
|
||||||
|
@ -66,8 +66,8 @@ public class SingleValueReplaceDialog extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create() {
|
protected void create() {
|
||||||
SingleValueReplacePanel replacePanel = new SingleValueReplacePanel(this, value, replaceValue,column,
|
SingleValueReplacePanel replacePanel = new SingleValueReplacePanel(
|
||||||
eventBus);
|
this, value, replaceValue, column, eventBus);
|
||||||
add(replacePanel);
|
add(replacePanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ public class SingleValueReplacePanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void initPanel() {
|
protected void initPanel() {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
|
|
Loading…
Reference in New Issue