Package org.gwt.mosaic.ui.client.layout

Examples of org.gwt.mosaic.ui.client.layout.MosaicPanel


    public void initialize()
    {
        if(!isInitialized)
        {
            instanceList = new MosaicPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
            instanceList.setPadding(0);
            instanceList.setWidgetSpacing(0);

            listBox =
                    new ListBox<ProcessInstanceRef>(
                            new String[] {
                                    "<b>Instance</b>", "State", "Start Date"}
                    );

            listBox.setCellRenderer(new ListBox.CellRenderer<ProcessInstanceRef>() {
                public void renderCell(ListBox<ProcessInstanceRef> listBox, int row, int column,
                                       ProcessInstanceRef item) {
                    switch (column) {
                        case 0:
                            listBox.setText(row, column, item.getId());
                            break;
                        case 1:
                            listBox.setText(row, column, item.getState().toString());
                            break;
                        case 2:
                            String d = item.getStartDate() != null ? dateFormat.format(item.getStartDate()) : "";
                            listBox.setText(row, column, d);
                            break;
                        default:
                            throw new RuntimeException("Unexpected column size");
                    }
                }
            });

            listBox.addRowSelectionHandler(
                    new RowSelectionHandler()
                    {
                        public void onRowSelection(RowSelectionEvent rowSelectionEvent)
                        {
                            int index = listBox.getSelectedIndex();
                            if(index!=-1)
                            {
                                ProcessInstanceRef item = listBox.getItem(index);

                                // enable or disable signal button depending on current activity
                                if (isSignalable(item)) {
                                    signalBtn.setEnabled(true);
                                } else {
                                    signalBtn.setEnabled(false);
                                }

                                terminateBtn.setEnabled(true);

                                // update details
                                controller.handleEvent(
                                        new Event(UpdateInstanceDetailAction.ID,
                                                new InstanceEvent(currentDefinition, item)
                                        )
                                );
                            }
                        }
                    }
            );

            // toolbar
            final MosaicPanel toolBox = new MosaicPanel();

            toolBox.setPadding(0);
            toolBox.setWidgetSpacing(5);

            final ToolBar toolBar = new ToolBar();
            refreshBtn = new Button("Refresh", new ClickHandler() {

                public void onClick(ClickEvent clickEvent) {
                    controller.handleEvent(
                            new Event(
                                    UpdateInstancesAction.ID,
                                    getCurrentDefinition()
                            )
                    );
                }
            }
            );
            toolBar.add(refreshBtn);
            refreshBtn.setEnabled(false);
            toolBar.addSeparator();

            startBtn = new Button("Start", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    MessageBox.confirm("Start new execution",
                            "Do you want to start a new execution of this process?",
                            new MessageBox.ConfirmationCallback()
                            {
                                public void onResult(boolean doIt)
                                {
                                    if (doIt)
                                    {
                                        String url = getCurrentDefinition().getFormUrl();
                                        boolean hasForm = (url != null && !url.equals(""));
                                        if (hasForm)
                                        {
                                            ProcessDefinitionRef definition = getCurrentDefinition();
                                            iframeWindow = new IFrameWindowPanel(
                                                    definition.getFormUrl(), "New Process Instance: " + definition.getId()
                                            );

                                            iframeWindow.setCallback(
                                                    new IFrameWindowCallback()
                                                    {
                                                        public void onWindowClosed()
                                                        {
                                                            controller.handleEvent(
                                                                    new Event(UpdateInstancesAction.ID, getCurrentDefinition())
                                                            );
                                                        }
                                                    }
                                            );

                                            iframeWindow.show();
                                        }
                                        else
                                        {
                                            controller.handleEvent(
                                                    new Event(
                                                            StartNewInstanceAction.ID,
                                                            getCurrentDefinition()
                                                    )
                                            );
                                        }
                                    }

                                }
                            });

                }
            }
            );


            terminateBtn = new Button("Terminate", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    if (getSelection() != null)
                    {

                        MessageBox.confirm("Terminate instance",
                                "Terminating this instance will stop further execution.",
                                new MessageBox.ConfirmationCallback()
                                {
                                    public void onResult(boolean doIt)
                                    {
                                        if (doIt)
                                        {
                                            ProcessInstanceRef selection = getSelection();
                                            selection.setState(ProcessInstanceRef.STATE.ENDED);
                                            selection.setEndResult(ProcessInstanceRef.RESULT.OBSOLETE);
                                            controller.handleEvent(
                                                    new Event(
                                                            StateChangeAction.ID,
                                                            selection
                                                    )
                                            );
                                        }
                                    }
                                });
                    }
                    else
                    {
                        MessageBox.alert("Missing selection", "Please select an instance");
                    }
                }
            }
            );           


            deleteBtn = new Button("Delete", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    if (getSelection() != null)
                    {
                        MessageBox.confirm("Delete instance",
                                "Deleting this instance will remove any history information and associated tasks as well.",
                                new MessageBox.ConfirmationCallback()
                                {
                                    public void onResult(boolean doIt)
                                    {

                                        if (doIt)
                                        {
                                            ProcessInstanceRef selection = getSelection();
                                            selection.setState(ProcessInstanceRef.STATE.ENDED);

                                            controller.handleEvent(
                                                    new Event(
                                                            DeleteInstanceAction.ID,
                                                            selection
                                                    )
                                            );
                                        }
                                    }
                                });

                    }
                    else
                    {
                        MessageBox.alert("Missing selection", "Please select an instance");
                    }
                }
            }
            );

            signalBtn = new Button("Signal", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    createSignalWindow();
                }
            }
            );

            if(!isRiftsawInstance// riftsaw doesn't support instance operations
            {
                toolBar.add(startBtn);
                toolBar.add(signalBtn);
                toolBar.add(deleteBtn);

                startBtn.setEnabled(false);
                deleteBtn.setEnabled(false);
                signalBtn.setEnabled(false);
            }

            // terminate works on any BPM Engine
            toolBar.add(terminateBtn);
            terminateBtn.setEnabled(false);

            toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));


            instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
            instanceList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));

            /*pagingPanel = new PagingPanel(
              new PagingCallback()
              {
                public void rev()
                {
                  renderUpdate();
                }

                public void ffw()
                {
                  renderUpdate();
                }
              }
          );
          instanceList.add(pagingPanel, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));*/

            // cached data?
            if(this.cachedInstances!=null)
                bindData(this.cachedInstances);

            // layout
            MosaicPanel layout = new MosaicPanel(new BorderLayout());
            layout.setPadding(0);
            layout.add(instanceList, new BorderLayoutData(BorderLayout.Region.CENTER));

            // details
            InstanceDetailView detailsView = new InstanceDetailView();
            controller.addView(InstanceDetailView.ID, detailsView);
            controller.addAction(UpdateInstanceDetailAction.ID, new UpdateInstanceDetailAction());
            controller.addAction(ClearInstancesAction.ID, new ClearInstancesAction());
            controller.addAction(SignalExecutionAction.ID, new SignalExecutionAction());
            layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH,10,200));

            panel.add(layout);

            isInitialized = true;

View Full Code Here


    private void createSignalWindow()
    {
        signalTextBoxes = new ArrayList<TextBox>();

        MosaicPanel layout = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
        layout.setStyleName("bpm-window-layout");
        layout.setPadding(5);
        // toolbar
        final MosaicPanel toolBox = new MosaicPanel();

        toolBox.setPadding(0);
        toolBox.setWidgetSpacing(5);
        toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));

        final ToolBar toolBar = new ToolBar();
        toolBar.add(
                new Button("Signal", new ClickHandler() {

                    public void onClick(ClickEvent clickEvent)
                    {
                        int selectedToken = listBoxTokens.getSelectedIndex();
                        int selectedSignal = listBoxTokenSignals.getSelectedIndex();
                        if (selectedToken != -1 && selectedSignal != -1) {

                            controller.handleEvent(
                                    new Event(SignalExecutionAction.ID,
                                            new SignalInstanceEvent(getCurrentDefinition(), getSelection(), listBoxTokens.getItem(selectedToken), listBoxTokenSignals.getItem(selectedSignal), selectedToken)));

                        } else {
                            MessageBox.alert("Incomplete selection", "Please select both token and signal name");
                        }


                    }
                }
                )
        );

        toolBar.add(
                new Button("Cancel", new ClickHandler() {

                    public void onClick(ClickEvent clickEvent)
                    {

                        signalWindowPanel.close();
                    }
                }
                )
        );

        Label header = new Label("Available tokens to signal: ");
        header.setStyleName("bpm-label-header");
        layout.add(header, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

        toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

        layout.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

        listBoxTokens = new ListBox<TokenReference>(new String[] { "Id", "Name" });
View Full Code Here

  public void provideWidget(ProvisioningCallback callback)
  {
    Controller controller = Registry.get(Controller.class);
   
    panel = new MosaicPanel();
    panel.setPadding(0);   
   
    definitionView = new DefinitionHistoryListView();
    instanceView = new HistoryInstanceListView();

    final MosaicPanel splitPanel = new MosaicPanel(new ColumnLayout());
    splitPanel.setPadding(0);

    definitionView.provideWidget(new ProvisioningCallback()
    {
      public void onSuccess(Widget instance)
      {
        splitPanel.add(instance, new ColumnLayoutData("250 px"));
      }

      public void onUnavailable()
      {
        ConsoleLog.error("Failed to load DefinitionListView.class");
      }
    });

    instanceView.provideWidget(
        new ProvisioningCallback()
        {
          public void onSuccess(Widget instance)
          {
            splitPanel.add(instance);
          }

          public void onUnavailable()
          {
            ConsoleLog.error("Failed to load DefinitionListView.class");
View Full Code Here

  private MosaicPanel panel;

  public void provideWidget(ProvisioningCallback callback)
  {

    panel = new MosaicPanel();
    panel.setWidgetSpacing(0);
    panel.setPadding(0);
   
    listBox = createListBox();
    final Controller controller = Registry.get(Controller.class);
View Full Code Here

  public void initialize()
  {
    if(!isInitialized)
    {

      definitionList = new MosaicPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
      definitionList.setPadding(0);
      definitionList.setWidgetSpacing(0);

      // toolbar

      final MosaicPanel toolBox = new MosaicPanel();
      toolBox.setPadding(0);
      toolBox.setWidgetSpacing(0);
      toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));

      // toolbar
      final ToolBar toolBar = new ToolBar();     
      ClickHandler clickHandler = new ClickHandler()
      {
        public void onClick(ClickEvent clickEvent)
        {
          reload();
        }
      };
     
      toolBar.add(
          new Button("Refresh", clickHandler
          )
      );

      toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

      // filter
      MosaicPanel filterPanel = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));
      filterPanel.setStyleName("mosaic-ToolBar");
      final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
      dropBox.setStyleName("bpm-operation-ui");
      dropBox.addItem("All");
      dropBox.addItem("Active");
      dropBox.addItem("Retired");

      dropBox.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent changeEvent)
        {         
          switch (dropBox.getSelectedIndex())
          {
            case 0:
              currentFilter = FILTER_NONE;
              break;
            case 1:
              currentFilter = FILTER_ACTIVE;
              break;
            case 2:
              currentFilter = FILTER_SUSPENDED;
              break;
            default:
              throw new IllegalArgumentException("No such index");
          }

          renderFiltered();
        }
      });
      filterPanel.add(dropBox);

      toolBox.add(filterPanel, new BoxLayoutData(BoxLayoutData.FillStyle.VERTICAL));

      definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
      definitionList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
View Full Code Here

  private MosaicPanel panel;
 
  public void provideWidget(ProvisioningCallback callback)
  {

    panel = new MosaicPanel();
    panel.setWidgetSpacing(0);
    panel.setPadding(0);
   
    listBox = createListBox();
    final Controller controller = Registry.get(Controller.class);
View Full Code Here

  public void initialize()
  {
    if(!isInitialized)
    {

      definitionList = new MosaicPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
      definitionList.setPadding(0);
      definitionList.setWidgetSpacing(0);

      // toolbar

      final MosaicPanel toolBox = new MosaicPanel();
      toolBox.setPadding(0);
      toolBox.setWidgetSpacing(0);
      toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));

      // toolbar
      final ToolBar toolBar = new ToolBar();     
      ClickHandler clickHandler = new ClickHandler()
      {
        public void onClick(ClickEvent clickEvent)
        {
          reload();
        }
      };
     
      toolBar.add(
          new Button("Refresh", clickHandler
          )
      );

      toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

      definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
   
      definitionList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
      pagingPanel = new PagingPanel(
View Full Code Here

    this.controller = controller;
  }
 
  public void provideWidget(ProvisioningCallback callback)
  {
    panel = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));

    this.appContext = Registry.get(ApplicationContext.class);
    panel.add(new HeaderLabel("User Preferences"), new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

    MosaicPanel layout = new MosaicPanel(new GridLayout(2,1));
    layout.add(
        new HTML("<b>Default Tool</b><br>" +
            "Select the tool that should be loaded upon login.")
    );

    final List<ToolSet> toolsets =
        org.jboss.errai.workspaces.client.Workspace.getInstance().getToolsets();
    final ListBox multiBox = new ListBox();
    multiBox.setVisibleItemCount(5);
    layout.add(multiBox);

    // init
    final Preferences prefs = GWT.create(Preferences.class);
    String prefEditor = prefs.get(Preferences.DEFAULT_TOOL);
    for(ToolSet ts : toolsets)
View Full Code Here

        Widget closeBtn = window.getHeader().getWidget(0, Caption.CaptionRegion.RIGHT);
        closeBtn.setVisible(false);
        window.setAnimationEnabled(false);


        MosaicPanel panel = new MosaicPanel();
        panel.addStyleName("bpm-login");

        createLayoutContent(panel);
        window.setWidget(panel);
       
        if (!config.requiresLogin()) {
View Full Code Here


        HTML html = new HTML("Version: " + Version.VERSION);
        html.setStyleName("bpm-login-info");

        MosaicPanel btnPanel = new MosaicPanel(new BoxLayout());
        btnPanel.add(html, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
        btnPanel.add(submit);

        layoutPanel.add(messagePanel, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
        layoutPanel.add(form, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
        layoutPanel.add(btnPanel, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
View Full Code Here

TOP

Related Classes of org.gwt.mosaic.ui.client.layout.MosaicPanel

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.