From 06941aa60bcfa7eb028c92731028b6618d17d032 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 4 Apr 2014 08:21:28 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94286 82a268e6-3cf1-43bd-a215-b396298e98cf --- .gwt/.gwt-log | 32 +++ .../client/batch/BatchReplaceDialog.java | 68 ------- .../client/batch/ReplaceBatchDialog.java | 108 +++++++++++ ...placePanel.java => ReplaceBatchPanel.java} | 29 +-- .../ReplaceBatchColumnProgressBarUpdater.java | 74 +++++++ .../ReplaceBatchColumnProgressDialog.java | 129 +++++++++++++ .../ReplaceBatchColumnProgressListener.java | 53 +++++ .../ReplaceBatchColumnProgressUpdater.java | 182 ++++++++++++++++++ 8 files changed, 583 insertions(+), 92 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java rename src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/{BatchReplacePanel.java => ReplaceBatchPanel.java} (95%) create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressBarUpdater.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressDialog.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressListener.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressUpdater.java diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index efd2255..3291ff2 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -2440,3 +2440,35 @@ Compiling... Compilation completed in 0.00 seconds Removing invalidated units Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 5 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 13.16 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java deleted file mode 100644 index 23e1d3e..0000000 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.gcube.portlets.user.td.columnwidget.client.batch; - -import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; -import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; - -import com.google.web.bindery.event.shared.EventBus; -import com.sencha.gxt.widget.core.client.Window; -import com.sencha.gxt.widget.core.client.event.SelectEvent; -import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class BatchReplaceDialog extends Window { - protected String WIDTH = "650px"; - protected String HEIGHT = "530px"; - protected TRId trId; - protected String columnName=null; - - - public BatchReplaceDialog(TRId trId, String columnName, EventBus eventBus) { - this.trId=trId; - this.columnName=columnName; - initWindow(); - BatchReplacePanel batchRepalcePanel= new BatchReplacePanel(this, trId,columnName,eventBus); - add(batchRepalcePanel); - } - - protected void initWindow() { - setWidth(WIDTH); - setHeight(HEIGHT); - setBodyBorder(false); - setResizable(false); - setHeadingText("Replace Batch"); - setClosable(true); - setModal(true); - forceLayoutOnResize = true; - getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch()); - - } - - /** - * {@inheritDoc} - */ - @Override - protected void initTools() { - super.initTools(); - - closeBtn.addSelectHandler(new SelectHandler() { - - - public void onSelect(SelectEvent event) { - close(); - } - }); - - } - - protected void close (){ - hide(); - - } - -} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java new file mode 100644 index 0000000..db1dd0d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchDialog.java @@ -0,0 +1,108 @@ +package org.gcube.portlets.user.td.columnwidget.client.batch; + +import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceBatchColumnProgressDialog; +import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceColumnProgressDialog; +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.tr.batch.ReplaceBatchColumnSession; +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.Window; +import com.sencha.gxt.widget.core.client.event.SelectEvent; +import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ReplaceBatchDialog extends Window { + protected String WIDTH = "650px"; + protected String HEIGHT = "530px"; + protected TRId trId; + protected String columnName=null; + protected EventBus eventBus; + + + public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) { + this.trId=trId; + this.columnName=columnName; + this.eventBus=eventBus; + initWindow(); + ReplaceBatchPanel batchRepalcePanel= new ReplaceBatchPanel(this, trId,columnName,eventBus); + add(batchRepalcePanel); + } + + protected void initWindow() { + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(false); + setHeadingText("Replace Batch"); + setClosable(true); + setModal(true); + forceLayoutOnResize = true; + getHeader().setIcon(ResourceBundle.INSTANCE.replaceBatch()); + + } + + /** + * {@inheritDoc} + */ + @Override + protected void initTools() { + super.initTools(); + + closeBtn.addSelectHandler(new SelectHandler() { + + + public void onSelect(SelectEvent event) { + close(); + } + }); + + } + + protected void close (){ + hide(); + + } + + + protected void startBatchReplace(ReplaceBatchColumnSession rbcSession){ + TDGWTServiceAsync.INSTANCE.startReplaceBatchColumn(rbcSession, + new AsyncCallback() { + + public void onFailure(Throwable caught) { + Log.error("Start Replace Batch failed:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error on batch replace", + "Error on batch replace"); + + } + + public void onSuccess(Void v) { + Log.trace("Started batch replace "); + + + } + + }); + + } + + protected void callReplaceBatchColumnProgressDialog() { + ReplaceBatchColumnProgressDialog dialog = new ReplaceBatchColumnProgressDialog( + this, eventBus); + dialog.show(); + + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java similarity index 95% rename from src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java rename to src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java index c8a463c..eefe943 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java @@ -12,6 +12,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurences; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceEntry; import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; @@ -67,7 +68,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar; * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it * */ -public class BatchReplacePanel extends FramedPanel implements +public class ReplaceBatchPanel extends FramedPanel implements SingleValueReplaceListener, DimensionRowSelectionListener { protected String WIDTH = "560px"; protected String HEIGHT = "520px"; @@ -76,7 +77,7 @@ public class BatchReplacePanel extends FramedPanel implements protected TRId trId; protected String columnName; protected ColumnData column; - protected BatchReplaceDialog parent; + protected ReplaceBatchDialog parent; private ReplaceEntry currentReplaceEntry; private int currentRowIndex; @@ -90,7 +91,7 @@ public class BatchReplacePanel extends FramedPanel implements protected ListStore store; protected HTML info; - public BatchReplacePanel(BatchReplaceDialog parent, TRId trId, + public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, String columnName, EventBus eventBus) { this.parent = parent; this.trId = trId; @@ -419,28 +420,8 @@ public class BatchReplacePanel extends FramedPanel implements } protected void startReplaceBatch(ArrayList effectiveReplaceList){ - /* + ReplaceBatchColumnSession rbcSession=new ReplaceBatchColumnSession(trId, column, effectiveReplaceList, column.isViewColumn()); - TDGWTServiceAsync.INSTANCE.startReplaceBatch(column, - new AsyncCallback>() { - - public void onFailure(Throwable caught) { - Log.error("load columns failure:" - + caught.getLocalizedMessage()); - UtilsGXT3.alert("Error retrieving columns", - "Error retrieving columns"); - callback.onFailure(caught); - } - - public void onSuccess(ArrayList result) { - Log.trace("loaded " + result.size() + " Occurences"); - callback.onSuccess(new ListLoadResultBean( - getRecord(result))); - - } - - }); - */ } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressBarUpdater.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressBarUpdater.java new file mode 100644 index 0000000..a8d062c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressBarUpdater.java @@ -0,0 +1,74 @@ +/** + * + */ +package org.gcube.portlets.user.td.columnwidget.client.progress; + + + + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.sencha.gxt.widget.core.client.ProgressBar; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ReplaceBatchColumnProgressBarUpdater implements ReplaceBatchColumnProgressListener { + + protected ProgressBar progressBar; + + /** + * Creates a new {@link ProgressBar} updater. + * @param progressBar the {@link ProgressBar} to update. + */ + public ReplaceBatchColumnProgressBarUpdater(ProgressBar progressBar) { + this.progressBar = progressBar; + } + + + /** + * {@inheritDoc} + */ + public void operationComplete(TRId trId) { + Log.info("Completed"); + progressBar.updateProgress(1, "Completed"); + + } + + /** + * {@inheritDoc} + */ + public void operationFailed(Throwable caught, String reason, String failureDetails) { + Log.info("Failed"); + progressBar.updateText("Failed"); + } + + public void operationInitializing() { + Log.info("Inizializing"); + progressBar.updateProgress(0, "Initializing..."); + } + + public void operationUpdate(float elaborated) { + Log.info("Import elaborated: "+elaborated); + if (elaborated == 0) progressBar.updateProgress(0, "Initializing..."); + if (elaborated>0 && elaborated<1) { + Log.trace("progress "+elaborated); + int elab=new Float(elaborated*100).intValue(); + progressBar.updateProgress(elaborated,elab+"% Progress..."); + } + if (elaborated == 1) progressBar.updateProgress(1, "Completing..."); + + } + + @Override + public void operationStopped(TRId trId,String reason, String details) { + Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + progressBar.updateText("Stopped"); + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressDialog.java new file mode 100644 index 0000000..4972247 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressDialog.java @@ -0,0 +1,129 @@ +package org.gcube.portlets.user.td.columnwidget.client.progress; + +import org.gcube.portlets.user.td.columnwidget.client.batch.ReplaceBatchDialog; +import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.web.bindery.event.shared.EventBus; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.widget.core.client.FramedPanel; +import com.sencha.gxt.widget.core.client.ProgressBar; +import com.sencha.gxt.widget.core.client.Window; +import com.sencha.gxt.widget.core.client.button.TextButton; +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.event.SelectEvent; +import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; + + + +/** + * ReplaceBatchColumnProgressDialog is a Dialog that show progress of replace batch the column value + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ReplaceBatchColumnProgressDialog extends Window implements ReplaceBatchColumnProgressListener { + public static final int STATUS_POLLING_DELAY = 1000; + protected String WIDTH = "400px"; + protected String HEIGHT = "120px"; + protected ReplaceBatchDialog parent; + protected EventBus eventBus; + protected ReplaceBatchColumnProgressUpdater progressUpdater; + protected TextButton ok; + protected TRId trId; + + public ReplaceBatchColumnProgressDialog(ReplaceBatchDialog parent, EventBus eventBus) { + this.parent=parent; + this.eventBus=eventBus; + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(true); + setModal(true); + setHeadingText("Replace Batch Progress"); + + trId=null; + + FramedPanel panel=new FramedPanel(); + panel.setHeaderVisible(false); + panel.setBodyBorder(false); + + VerticalLayoutContainer v = new VerticalLayoutContainer(); + + + ProgressBar progressBar = new ProgressBar(); + + ok=new TextButton("OK"); + ok.addSelectHandler(new SelectHandler() { + + public void onSelect(SelectEvent event) { + updateInvocation(); + + } + }); + + v.add(progressBar, new VerticalLayoutData(1, + 1, new Margins(5, 5, 5, 5))); + + panel.add(v); + panel.addButton(ok); + add(panel); + + + progressUpdater = new ReplaceBatchColumnProgressUpdater(); + progressUpdater.addListener(new ReplaceBatchColumnProgressBarUpdater(progressBar)); + + progressUpdater.addListener(this); + progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); + show(); + ok.setVisible(false); + + } + + public void operationInitializing() { + // TODO Auto-generated method stub + + } + + public void operationUpdate(float elaborated) { + // TODO Auto-generated method stub + + } + + public void operationComplete(TRId trId) { + Log.debug("Operation Complete return: "+trId.toString()); + this.trId=trId; + updateInvocation(); + } + + public void operationFailed(Throwable caught, String reason, + String failureDetails) { + ok.setVisible(true); + this.trId=null; + UtilsGXT3.alert("Error Replacing The Column Value", reason); + + } + + public void updateInvocation(){ + if(trId!=null){ + ChangeTableRequestEvent changeTableRequestEvent= + new ChangeTableRequestEvent(ChangeTableRequestType.COLUMNREPLACE, trId); + eventBus.fireEvent(changeTableRequestEvent); + } + parent.hide(); + hide(); + + } + + @Override + public void operationStopped(TRId trId,String reason, String details) { + Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); + ok.setVisible(true); + this.trId=trId; + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressListener.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressListener.java new file mode 100644 index 0000000..0dbbb18 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressListener.java @@ -0,0 +1,53 @@ +/** + * + */ +package org.gcube.portlets.user.td.columnwidget.client.progress; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + + + +/** + * Defines a listener for operation progress. + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface ReplaceBatchColumnProgressListener { + + /** + * Called when the operation is starting. + */ + public void operationInitializing(); + + /** + * Called when there is a progress for the operation. + * @param elaborated the elaborated part. + */ + public void operationUpdate(float elaborated); + + + /** + * Called when the operation is complete. + */ + public void operationComplete(TRId trId); + + /** + * Called when the operation is failed. + * @param caught the failure exception. + * @param reason the failure reason. + */ + public void operationFailed(Throwable caught, String reason, String failureDetails); + + + + /** + * Called when the operation is stopped + * + * @param trId + * @param reason + * @param details + */ + public void operationStopped(TRId trId, String reason, String details); +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressUpdater.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressUpdater.java new file mode 100644 index 0000000..44d0dd7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/progress/ReplaceBatchColumnProgressUpdater.java @@ -0,0 +1,182 @@ +/** + * + */ +package org.gcube.portlets.user.td.columnwidget.client.progress; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnMonitor; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.rpc.AsyncCallback; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class ReplaceBatchColumnProgressUpdater extends Timer { + + protected ArrayList listeners = new ArrayList(); + + /** + * {@inheritDoc} + */ + @Override + public void run() { + Log.debug("requesting operation progress"); + TDGWTServiceAsync.INSTANCE + .getReplaceBatchColumnMonitor(new AsyncCallback() { + + + public void onFailure(Throwable caught) { + cancel(); + Log.error("Error retrieving the operation state", + caught); + String message = getStack(caught); + fireOperationFailed(caught, + "Failed getting operation updates", message); + } + + public void onSuccess(ReplaceBatchColumnMonitor result) { + Log.info("retrieved ReplaceBatchColumnMonitor: " + + result.getStatus()); + switch (result.getStatus()) { + case INITIALIZING: + Log.info("Replace Batch Initializing..."); + fireOperationInitializing(); + break; + case ABORTED: + cancel(); + Log.info("Replace Batch Aborted"); + break; + case IN_PROGRESS: + fireOperationUpdate(result.getProgress()); + break; + case VALIDATING_RULES: + fireOperationUpdate(result.getProgress()); + break; + case STOPPED: + cancel(); + stopMessage(result); + break; + case FAILED: + cancel(); + errorMessage(result); + break; + case SUCCEDED: + cancel(); + Log.info("Replace Batch fisnish:" + + result.getTrId()); + fireOperationComplete(result.getTrId()); + break; + default: + Log.info("Unknow State"); + break; + } + + } + + + + }); + + } + + protected void errorMessage(ReplaceBatchColumnMonitor result) { + Log.info("Batch Replace Failed"); + Throwable th = null; + String failure = null; + String details = null; + if (result.getError() != null) { + th = result.getError(); + failure = "Failed Client Library"; + details = result.getError().getLocalizedMessage(); + } else { + th = new Throwable("Failed"); + failure = "Failed Client Library"; + details = "Batch replace failed"; + } + + + fireOperationFailed(th, failure, details); + } + + protected void stopMessage(ReplaceBatchColumnMonitor result) { + Log.info("Batch Replace Stopped"); + String failure = null; + String details = null; + if (result.getError() != null) { + failure = "Stopped"; + details = result.getError().getLocalizedMessage(); + } else { + failure = "Stopped"; + details = "Stopped batch replace"; + } + + fireOperationStopped(result.getTrId(),failure, details); + } + + + protected String getStack(Throwable e) { + String message = e.getLocalizedMessage() + " ->
"; + Throwable c = e.getCause(); + if (c != null) + message += getStack(c); + return message; + } + + protected void fireOperationInitializing() { + for (ReplaceBatchColumnProgressListener listener : listeners) + listener.operationInitializing(); + } + + protected void fireOperationUpdate(float elaborated) { + for (ReplaceBatchColumnProgressListener listener : listeners) + listener.operationUpdate(elaborated); + } + + protected void fireOperationComplete(TRId trId) { + for (ReplaceBatchColumnProgressListener listener : listeners) + listener.operationComplete(trId); + } + + protected void fireOperationFailed(Throwable caught, String failure, + String failureDetails) { + for (ReplaceBatchColumnProgressListener listener : listeners) + listener.operationFailed(caught, failure, failureDetails); + } + + protected void fireOperationStopped(TRId trId, String reason, String details) { + for (ReplaceBatchColumnProgressListener listener : listeners) + listener.operationStopped(trId,reason, details); + } + + + /** + * Add a new {@link } to this + * {@link ReplaceBatchColumnProgressUpdater}. + * + * @param listener + * the listener to add. + */ + public void addListener(ReplaceBatchColumnProgressListener listener) { + listeners.add(listener); + } + + /** + * Removes the specified {@link } from this + * {@link ReplaceBatchColumnProgressUpdater}. + * + * @param listener + * the listener to remove. + */ + public void removeListener(ReplaceColumnProgressListener listener) { + listeners.remove(listener); + } +}