Search in sources :

Example 6 with IUiThreadAccess

use of org.jowidgets.api.threads.IUiThreadAccess in project jo-client-platform by jo-source.

the class PasteLinkCommand method linkBeans.

private void linkBeans(final IExecutionContext executionContext, final List<IBeanProxy<SOURCE_BEAN_TYPE>> selection) {
    final IExecutionTask executionTask = CapUiToolkit.executionTaskFactory().create(executionContext);
    final IUiThreadAccess uiThreadAccess = Toolkit.getUiThreadAccess();
    executionTask.addExecutionCallbackListener(new IExecutionCallbackListener() {

        @Override
        public void canceled() {
            uiThreadAccess.invokeLater(new Runnable() {

                @Override
                public void run() {
                    for (final IBeanProxy<SOURCE_BEAN_TYPE> bean : selection) {
                        bean.setExecutionTask(null);
                    }
                    executionObservable.fireAfterExecutionCanceled(executionContext);
                }
            });
        }
    });
    final Collection<ILinkCreation> linkCreations = linkProvider.get();
    executionObservable.fireAfterExecutionPrepared(executionContext);
    linkCreatorService.create(createResultCallback(selection, executionContext), linkCreations, executionTask);
}
Also used : IExecutionCallbackListener(org.jowidgets.cap.common.api.execution.IExecutionCallbackListener) IExecutionTask(org.jowidgets.cap.ui.api.execution.IExecutionTask) IUiThreadAccess(org.jowidgets.api.threads.IUiThreadAccess) ILinkCreation(org.jowidgets.cap.common.api.link.ILinkCreation)

Aggregations

IUiThreadAccess (org.jowidgets.api.threads.IUiThreadAccess)6 IExecutionCallbackListener (org.jowidgets.cap.common.api.execution.IExecutionCallbackListener)4 IExecutionTask (org.jowidgets.cap.ui.api.execution.IExecutionTask)4 ILinkCreation (org.jowidgets.cap.common.api.link.ILinkCreation)2 AbstractUiResultCallback (org.jowidgets.cap.ui.tools.execution.AbstractUiResultCallback)2 LinkedList (java.util.LinkedList)1 ILoginCancelListener (org.jowidgets.api.login.ILoginCancelListener)1 ILoginInterceptor (org.jowidgets.api.login.ILoginInterceptor)1 ILoginResultCallback (org.jowidgets.api.login.ILoginResultCallback)1 IBeanData (org.jowidgets.cap.common.api.bean.IBeanData)1 IBeanKey (org.jowidgets.cap.common.api.bean.IBeanKey)1 ILinkCreationBuilder (org.jowidgets.cap.common.api.link.ILinkCreationBuilder)1 RemotingBasicAuthenticationLoginInterceptor (org.jowidgets.cap.tools.starter.client.remoting.RemotingBasicAuthenticationLoginInterceptor)1 IBeanKeyFactory (org.jowidgets.cap.ui.api.bean.IBeanKeyFactory)1 IBeanProxy (org.jowidgets.cap.ui.api.bean.IBeanProxy)1