Added Clone
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@92822 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c09a54c8bc
commit
a3415a197a
|
@ -0,0 +1,76 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession;
|
||||
import org.gcube.portlets.user.td.tablewidget.client.util.InfoMessageBox;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
public class CloneTabularResource {
|
||||
protected TRId trId;
|
||||
protected EventBus eventBus;
|
||||
|
||||
protected CloneTabularResourceSession cloneTabularResourceSession;
|
||||
|
||||
public CloneTabularResource(TRId trId, EventBus eventBus) {
|
||||
this.trId = trId;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
public void cloneTR() {
|
||||
cloneTabularResourceSession = new CloneTabularResourceSession(trId);
|
||||
onCloneTR();
|
||||
|
||||
}
|
||||
|
||||
protected void onCloneTR() {
|
||||
TDGWTServiceAsync.INSTANCE.startCloneTabularResource(
|
||||
cloneTabularResourceSession, new AsyncCallback<TRId>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.debug("Clone Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
alert("Error Cloning Tabular Resource",
|
||||
"Error in clone operation!");
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(TRId result) {
|
||||
info("Clone", "Clone Tabular Resource Succed");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void alert(String title, String message) {
|
||||
final AlertMessageBox d = new AlertMessageBox(title, message);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
private void info(String title, String message) {
|
||||
final InfoMessageBox d = new InfoMessageBox(title, message);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ import com.sencha.gxt.widget.core.client.ProgressBar;
|
|||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DeleteRowsProgressBarUpdater implements ChangeTableTypeProgressListener {
|
||||
public class DeleteRowsProgressBarUpdater implements DeleteRowsProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DeleteRowsProgressDialog extends Window implements ChangeTableTypeProgressListener {
|
||||
public class DeleteRowsProgressDialog extends Window implements DeleteRowsProgressListener {
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected String WIDTH = "400px";
|
||||
protected String HEIGHT = "120px";
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
*/
|
||||
public class DeleteRowsProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<ChangeTableTypeProgressListener> listeners = new ArrayList<ChangeTableTypeProgressListener>();
|
||||
protected ArrayList<DeleteRowsProgressListener> listeners = new ArrayList<DeleteRowsProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -131,51 +131,51 @@ public class DeleteRowsProgressUpdater extends Timer {
|
|||
}
|
||||
|
||||
protected void fireOperationInitializing() {
|
||||
for (ChangeTableTypeProgressListener listener : listeners)
|
||||
for (DeleteRowsProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (ChangeTableTypeProgressListener listener : listeners)
|
||||
for (DeleteRowsProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (ChangeTableTypeProgressListener listener : listeners)
|
||||
for (DeleteRowsProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (ChangeTableTypeProgressListener listener : listeners)
|
||||
for (DeleteRowsProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (ChangeTableTypeProgressListener listener : listeners)
|
||||
for (DeleteRowsProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new {@link ChangeTableTypeProgressListener} to this
|
||||
* Add a new {@link DeleteRowsProgressListener} to this
|
||||
* {@link DeleteRowsProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(ChangeTableTypeProgressListener listener) {
|
||||
public void addListener(DeleteRowsProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link ChangeTableTypeProgressListener} from this
|
||||
* Removes the specified {@link DeleteRowsProgressListener} from this
|
||||
* {@link DeleteRowsProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(ChangeTableTypeProgressListener listener) {
|
||||
public void removeListener(DeleteRowsProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class DuplicateRowsDeletePanel extends FramedPanel {
|
|||
grid.getView().setAutoExpandColumn(labelCol);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
//grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
|
@ -131,10 +131,11 @@ public class DuplicateRowsDeletePanel extends FramedPanel {
|
|||
};
|
||||
deleteButton.addSelectHandler(changeHandler);
|
||||
|
||||
//FieldLabel columnsLabel = new FieldLabel(null, "Columns");
|
||||
FieldLabel columnsLabel = new FieldLabel(null, "Columns");
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(1)));
|
||||
v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
v.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
v.add(deleteButton, new VerticalLayoutData(-1, -1, new Margins(10, 0,
|
||||
10, 0)));
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.td.tablewidget.client.util;
|
||||
|
||||
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
||||
|
||||
public class InfoMessageBox extends MessageBox {
|
||||
|
||||
/**
|
||||
* Creates a message box with an info icon and the specified title and
|
||||
* message.
|
||||
*
|
||||
* @param title
|
||||
* the message box title
|
||||
* @param message
|
||||
* the message displayed in the message box
|
||||
*/
|
||||
public InfoMessageBox(String title, String message) {
|
||||
super(title, message);
|
||||
|
||||
setIcon(ICONS.info());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue