Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94786 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-11 15:45:20 +00:00
parent 523ce0c4ba
commit dc7462c918
1 changed files with 64 additions and 36 deletions

View File

@ -83,7 +83,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
* *
*/ */
public class ReplaceBatchPanel extends FramedPanel implements public class ReplaceBatchPanel extends FramedPanel implements
SingleValueReplaceListener, DimensionRowSelectionListener, ConnectCodelistListener { 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;
@ -102,17 +103,19 @@ public class ReplaceBatchPanel extends FramedPanel implements
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
private TextButton btnConnect;
private ToolBar toolBarHead;
private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null; private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null;
private TextButton btnConnect;
private TextField connectionField;
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;
protected HTML info; protected HTML info;
private TextButton btnDisconnect;
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
String columnName, EventBus eventBus) { String columnName, EventBus eventBus) {
@ -138,9 +141,9 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected void create() { protected void create() {
showOccurencesType = ShowOccurrencesType.ONLYERRORS; showOccurencesType = ShowOccurrencesType.ONLYERRORS;
ToolBar toolBarHead = new ToolBar(); toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Show: ")); toolBarHead.add(new LabelToolItem("Show: "));
// Create Combo Show // Create Combo Show
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
.create(ShowOccurrencesTypeProperties.class); .create(ShowOccurrencesTypeProperties.class);
@ -165,10 +168,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
toolBarHead.add(comboShowOccurrencesType); toolBarHead.add(comboShowOccurrencesType);
//Connect Codelist // Connect Codelist
btnConnect = new TextButton("Connect"); btnConnect = new TextButton();
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink()); btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
btnConnect.setIconAlign(IconAlign.RIGHT); btnConnect.setIconAlign(IconAlign.TOP);
btnConnect.setTitle("Connect"); btnConnect.setTitle("Connect");
btnConnect.addSelectHandler(new SelectHandler() { btnConnect.addSelectHandler(new SelectHandler() {
@ -179,10 +182,30 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
}); });
toolBarHead.add(btnConnect);
toolBarHead.add(btnConnect, new BoxLayoutData(new Margins(10,0,0,0))); // Disconnect Codelist
btnDisconnect = new TextButton();
btnDisconnect.setIcon(ResourceBundle.INSTANCE.codelistLinkBreak24());
btnDisconnect.setIconAlign(IconAlign.TOP);
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(connectionField);
// Create Grid // Create Grid
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>(); IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
@ -355,10 +378,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);
btnDisconnect.setVisible(false);
} }
protected void retrieveColumn() { protected void retrieveColumn() {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName, TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
@ -412,11 +435,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
}); });
} }
protected void addHandlersForShowOccurrencesType( protected void addHandlersForShowOccurrencesType(
final LabelProvider<ShowOccurrencesTypeElement> labelProvider) { final LabelProvider<ShowOccurrencesTypeElement> labelProvider) {
comboShowOccurrencesType comboShowOccurrencesType
@ -449,7 +467,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) { final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession( OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession(
column, showOccurencesType,hasValidationColumns); column, showOccurencesType, hasValidationColumns);
TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace( TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace(
occurrencesSession, occurrencesSession,
@ -561,7 +579,6 @@ 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(
@ -615,7 +632,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
@Override @Override
public void selectedSingleValueReplace(String replaceValue) { public void selectedSingleValueReplace(String replaceValue) {
Log.debug("Change Value: " + replaceValue); Log.debug("Change Value: " + replaceValue);
@ -623,34 +639,47 @@ public class ReplaceBatchPanel extends FramedPanel implements
store.update(currentReplaceEntry); store.update(currentReplaceEntry);
updateInfo(); updateInfo();
} }
@Override @Override
public void abortedSingleValueReplace() { public void abortedSingleValueReplace() {
Log.debug("Change Value Aborted"); Log.debug("Change Value Aborted");
} }
@Override @Override
public void failedSingleValueReplace(String reason, String detail) { public void failedSingleValueReplace(String reason, String detail) {
Log.error("Change Value Failed:" + reason + " " + detail); Log.error("Change Value Failed:" + reason + " " + detail);
} }
private void connectCodelist() { protected void connectCodelist() {
Log.debug("callConnectCodelistDialog"); Log.debug("callConnectCodelistDialog");
ConnectCodelistDialog connectCodelistDialog = new ConnectCodelistDialog( ConnectCodelistDialog connectCodelistDialog = new ConnectCodelistDialog(
eventBus); eventBus);
connectCodelistDialog.addListener(this); connectCodelistDialog.addListener(this);
connectCodelistDialog.show(); connectCodelistDialog.show();
}
protected void disconnectCodelist() {
Log.debug("Disconnect codelist");
connectionField.setValue("");
connectionField.setVisible(false);
btnDisconnect.setVisible(false);
btnConnect.setVisible(true);
btnConnect.enable();
toolBarHead.forceLayout();
} }
@Override @Override
public void selectedConnectCodelist(ColumnData connection) { public void selectedConnectCodelist(ColumnData connection) {
Log.debug("Selected connection: "+connection); Log.debug("Selected connection: " + connection);
connectionField.setValue(connection.getLabel());
connectionField.setVisible(true);
btnDisconnect.setVisible(true);
btnConnect.setVisible(false);
btnConnect.enable(); btnConnect.enable();
toolBarHead.forceLayout();
} }
@Override @Override
@ -661,11 +690,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
@Override @Override
public void failedConnectCodelist(String reason, String detail) { public void failedConnectCodelist(String reason, String detail) {
Log.debug("Connection Failed: "+reason+" "+detail); Log.debug("Connection Failed: " + reason + " " + detail);
UtilsGXT3.alert("Error on connect", UtilsGXT3.alert("Error on connect", reason);
reason);
btnConnect.enable(); btnConnect.enable();
} }
} }