Package org.jboss.mbui.gui.reification

Examples of org.jboss.mbui.gui.reification.Context


                    dialog, globalContext, this
            );
            coordinators.put(name, coordinator);

            // top level interaction unit & context
            final Context context = new Context();

            // build reification pipeline
            Function<Context> prepareContext = new Function<Context>() {
                @Override
                public void execute(Control<Context> control) {
                    context.set(ContextKey.EVENTBUS, coordinator.getLocalBus());
                    context.set(ContextKey.COORDINATOR, coordinator);

                    control.proceed();
                }
            };

            Function<Context> statementShim = new Function<Context>() {
                @Override
                public void execute(Control<Context> control) {
                    new StatementContextStep().execute(dialog,context);
                    control.proceed();
                }
            };

            Function<Context> readOperationMetaData = new Function<Context>() {
                @Override
                public void execute(final Control<Context> control) {
                    ReadOperationDescriptions operationMetaData = new ReadOperationDescriptions(framework.getDispatcher());
                    operationMetaData.prepareAsync(dialog, context, new ReificationPreperation.Callback()
                    {
                        @Override
                        public void onError(Throwable caught) {
                            Log.error("Reification failed: " + caught.getMessage());
                            control.abort();
                        }

                        @Override
                        public void onSuccess() {
                            Log.info("Successfully retrieved operation meta data");
                            control.proceed();
                        }
                    });
                }
            };

            Function<Context> readResourceMetaData = new Function<Context>() {
                @Override
                public void execute(final Control<Context> control) {
                    ReificationPreperation readResourceDescription = new ReadResourceDescription(framework.getDispatcher());
                    readResourceDescription.prepareAsync(dialog, context, new ReificationPreperation.Callback()
                    {
                        @Override
                        public void onSuccess()
                        {
                            Log.info("Successfully retrieved resource meta data");

                            // setup & start the reification pipeline
                            ReificationPipeline pipeline = new ReificationPipeline(
                                    new UniqueIdCheckStep(),
                                    new BuildUserInterfaceStep(),
                                    new ImplicitBehaviourStep(framework.getDispatcher()),
                                    new IntegrityStep());

                            pipeline.execute(dialog, context);

                            control.proceed();
                        }

                        @Override
                        public void onError(final Throwable caught)
                        {
                            Log.error("Reification failed: " + caught.getMessage());
                            control.abort();
                        }
                    });
                }
            };

            Outcome<Context> outcome = new Outcome<Context>() {
                @Override
                public void onFailure(final Context context) {
                    Window.alert("Reification failed");
                }

                @Override
                public void onSuccess(final Context context) {
                    // show result
                    ReificationWidget widget = context.get(ContextKey.WIDGET);
                    assert widget !=null;

                    cachedWidgets.put(name, widget);
                    callback.onSuccess(widget.asWidget());
                }
View Full Code Here


                    .start(new Container(namespace, "tab2", "Bar", Concurrency))
                    .end()
                .end()
                .build();
        Dialog dialog = new Dialog(QName.valueOf(namespace + ":sample"), root);
        pipeline.execute(dialog, new Context());
    }
View Full Code Here

                .build();
        Dialog dialog = new Dialog(QName.valueOf(namespace + ":sample"), root);

        try
        {
            pipeline.execute(dialog, new Context());
            fail("ReificationException expected");
        }
        catch (ReificationException e)
        {
            String message = e.getMessage();
View Full Code Here

TOP

Related Classes of org.jboss.mbui.gui.reification.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.