Package org.jboss.bpm.console.client.model

Examples of org.jboss.bpm.console.client.model.ProcessInstanceRef


  }

  public void handleSuccessfulResponse(
      final Controller controller, final Object event, Response response)
  {
    ProcessInstanceRef inst = (ProcessInstanceRef)event;

    ConsoleLog.debug("Parse: " + response.getText());

    //TODO: move to DTO Parser
    JSONValue root = JSONParser.parse(response.getText());
    //int diagramWidth = JSONWalk.on(root).next("diagramWidth").asInt();
    //int diagramHeight = JSONWalk.on(root).next("diagramHeight").asInt();

    if (root instanceof JSONArray) {
      JSONArray array = (JSONArray) root;
      List<ActiveNodeInfo> activeNodeInfos = new ArrayList<ActiveNodeInfo>();
      for (int i = 0; i < array.size(); i++) {
        JSONWalk walk = JSONWalk.on(array.get(i));
        JSONWrapper wrapper = walk.next("activeNode");
        JSONObject activeNode = wrapper.asObject();
   
        int x = JSONWalk.on(activeNode).next("x").asInt();
        int y = JSONWalk.on(activeNode).next("y").asInt();
   
        int width = JSONWalk.on(activeNode).next("width").asInt();
        int height = JSONWalk.on(activeNode).next("height").asInt();
        String name = JSONWalk.on(activeNode).next("name").asString();
           
        activeNodeInfos.add(
            new ActiveNodeInfo(
                -1, -1,
                new DiagramNodeInfo(name, x, y, width, height)
            )
          );
        wrapper = walk.next("activeNode");
      }
 
      // update view
      ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID);
      view.update(
          new ActivityDiagramResultEvent(
              URLBuilder.getInstance().getProcessImageURL(inst.getDefinitionId()),
              activeNodeInfos
          )
      );
    }
  }
View Full Code Here


    return ID;
  }

  public String getUrl(Object event)
  {
    final ProcessInstanceRef inst = (ProcessInstanceRef)event;
    if(ProcessInstanceRef.STATE.ENDED == inst.getState())
      return URLBuilder.getInstance().getInstanceEndURL(inst.getId(), inst.getEndResult());
    else
      return URLBuilder.getInstance().getStateChangeURL(inst.getId(), inst.getState());
  }
View Full Code Here

    return ID;
  }

  public String getUrl(Object event)
  {
    ProcessInstanceRef instance = (ProcessInstanceRef)event;
    return URLBuilder.getInstance().getInstanceDeleteURL(instance.getId());
  }
View Full Code Here

        public void onChange(Widget widget)
        {
          int index = listBox.getSelectedIndex();
          if(index!=-1)
          {
            ProcessInstanceRef item = listBox.getItem(index);

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

      // toolbar
      final LayoutPanel toolBox = new LayoutPanel();
      toolBox.setPadding(0);
      toolBox.setWidgetSpacing(5);

      final ToolBar toolBar = new ToolBar();
      toolBar.add(
          new ToolButton("Refresh", new ClickListener() {
            public void onClick(Widget sender) {
              controller.handleEvent(
                  new Event(
                      UpdateInstancesAction.ID,
                      getCurrentDefinition()
                  )
              );
            }
          }
          )
      );

      toolBar.addSeparator();

      toolBar.add(
          new ToolButton("Start", new ClickListener()
          {
            public void onClick(Widget sender)
            {
              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)
                        {
                          createProcessFormWindow(getCurrentDefinition());
                        }
                        else
                        {
                          controller.handleEvent(
                              new Event(
                                  StartNewInstanceAction.ID,
                                  getCurrentDefinition()
                              )
                          );
                        }
                      }

                    }
                  });

            }
          }
          )
      );

      toolBar.addSeparator();

      toolBar.add(
          new ToolButton("Terminate", new ClickListener()
          {
            public void onClick(Widget sender)
            {

              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");
              }
            }
          }
          )
      );

      toolBar.addSeparator();

      toolBar.add(
          new ToolButton("Delete", new ClickListener()
          {
            public void onClick(Widget sender)
            {

              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
View Full Code Here

  }


  public ProcessInstanceRef getSelection()
  {
    ProcessInstanceRef selection = null;
    if(listBox.getSelectedIndex()!=-1)
      selection = listBox.getItem( listBox.getSelectedIndex());
    return selection;
  }
View Full Code Here

  public Response newInstance(
      @PathParam("id")
      String definitionId)
  {

    ProcessInstanceRef instance = null;
    try
    {
      instance = getProcessManagement().newInstance(definitionId);
      return createJsonResponse(instance);
    }
View Full Code Here

TOP

Related Classes of org.jboss.bpm.console.client.model.ProcessInstanceRef

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.