예제 #1
0
  /**
   * Print the description for a workflow or a node.
   *
   * @param activeNode
   * @param wf
   * @param nodes
   * @param nodes_ID
   * @return table
   */
  private table printDescription(
      int activeNode, MWorkflow wf, MWFNode[] nodes, ArrayList nodes_ID) {
    // create new table
    table desTable = new table();

    String WFName = "";
    String WFDescription = "";

    // not started yet
    if (activeNode < 0) {
      WFName = wf.getName();
      WFDescription = wf.getHelp();
    }

    // started
    else {
      WFName = nodes[getIndex(activeNode, nodes_ID)].getName();
      WFDescription = nodes[getIndex(activeNode, nodes_ID)].getHelp();
    }

    // add info to the desciption table
    tr aRow = new tr();
    td aGrid = new td();
    aGrid.addElement(new h6(WFName));
    aGrid.addElement(new br());
    aGrid.addElement(WFDescription);
    desTable.addElement(aRow.addElement(aGrid));

    return desTable;
  } // printDescription
예제 #2
0
  /**
   * Print the control panel.
   *
   * @param activeNode
   * @param wf
   * @param nodes
   * @param nodes_ID
   * @return form
   */
  private form printControlPanel(
      int activeNode, MWorkflow wf, MWFNode[] nodes, ArrayList nodes_ID) {
    // create a new form
    form myForm = new form(FORM_ACTION, form.METHOD_POST, form.ENC_DEFAULT);
    myForm.addElement(new input("hidden", M_Command, ""));
    myForm.addElement(new input("hidden", J_Command, ""));
    myForm.setTarget(TARGET_WINDOW);
    myForm.setName(FORM_NAME);

    // test fist or last node

    boolean isFirst = wf.isFirst(activeNode, Env.getContextAsInt(ctx, "#AD_Client_ID"));
    boolean isLast = wf.isLast(activeNode, Env.getContextAsInt(ctx, "#AD_Client_ID"));

    // get AD_Window_ID for the first and last node
    int First_Window_ID = wf.getFirstNode().getAD_Window_ID();
    int Last_Window_ID = nodes[nodes.length - 1].getAD_Window_ID();

    int Back_Window_ID = 0;
    int Next_Window_ID = 0;
    int index = 0;

    // WUtil.debug(""+activeNode,"activeNode");
    if (!isFirst) {
      index = activeNode >= 0 ? getIndex(activeNode, nodes_ID) - 1 : 0;
      // WUtil.debug(""+index,"index");
      Back_Window_ID = nodes[index].getAD_Window_ID();
    }
    if (!isLast) {
      index = activeNode >= 0 ? getIndex(activeNode, nodes_ID) + 1 : 0;
      Next_Window_ID = nodes[index].getAD_Window_ID();
    }
    boolean enableFirst = true;
    boolean enableBack = true;
    boolean enableNext = true;
    boolean enableLast = true;

    if (isFirst) {
      enableBack = false;
      enableFirst = false;
    }
    if (isLast) {
      enableNext = false;
      enableLast = false;
    }

    td firstImage = new td();
    td backImage = new td();
    td nextImage = new td();
    td lastImage = new td();

    // first
    String url = "'WWindow?AD_Window_ID=" + First_Window_ID + "'";
    // String
    // url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+First_Window_ID+"&Target_Window=win_"+First_Window_ID+"'";
    String Target_Window = "'WWindow" + First_Window_ID + "'";
    String parameters = url + "," + Target_Window;
    String js_command = "popUp(" + parameters + ");submit()";
    firstImage.addElement(createControlButtonImage("Start", js_command, enableFirst));
    // back
    url = "'WWindow?AD_Window_ID=" + Back_Window_ID + "'";
    //
    // url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Back_Window_ID+"&Target_Window=win_"+Back_Window_ID+"'";
    Target_Window = "'WWindow" + Back_Window_ID + "'";
    parameters = url + "," + Target_Window;
    js_command = "popUp(" + parameters + ");submit()";
    backImage.addElement(createControlButtonImage("Back", js_command, enableBack));

    // next
    url = "'WWindow?AD_Window_ID=" + Next_Window_ID + "'";
    // url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Next_Window_ID+"&Target_Window=win_"+Next_Window_ID+"'";
    Target_Window = "'WWindow" + Next_Window_ID + "'";
    parameters = url + "," + Target_Window;
    js_command = "popUp(" + parameters + ");submit()";
    nextImage.addElement(createControlButtonImage("Next", js_command, enableNext));

    // last
    url = "'WWindow?AD_Window_ID=" + Last_Window_ID + "'";
    // url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Last_Window_ID+"&Target_Window=win_"+Last_Window_ID+"'";
    Target_Window = "'WWindow" + Last_Window_ID + "'";
    parameters = url + "," + Target_Window;
    js_command = "popUp(" + parameters + ");submit()";
    lastImage.addElement(createControlButtonImage("End", js_command, enableLast));

    tr aRow = new tr();
    aRow.addElement(firstImage);
    aRow.addElement(backImage);
    aRow.addElement(nextImage);
    aRow.addElement(lastImage);

    // add the table to the form
    myForm.addElement(new table().addElement(aRow));

    return myForm;
  } // printControlPanel
예제 #3
0
  /**
   * Print the workflow. - Use the image map array to create the visual layout of workflow
   *
   * @param activeNode
   * @param wf
   * @param nodes
   * @param nodes_ID
   * @param imageMap
   * @return table
   */
  private table printWorkflow(
      int activeNode, MWorkflow wf, MWFNode[] nodes, ArrayList nodes_ID, int[][] imageMap) {

    // create a new table
    table imageTable = new table();
    // find the dimension for the table
    final int ROW = imageMap.length;
    final int COL = imageMap[0].length;

    // process every row
    for (int i = 0; i < ROW; i++) {
      // create a new row
      tr aRow = new tr();

      for (int j = 0; j < COL; j++) {
        // create a new grid
        td grid = new td();
        grid.setAlign("center");
        // not node images
        img spaceImage = createWorkflowImage("Spacer", 0, null, true);
        img arrowForwardImage = createWorkflowImage("ArrowFW_", 0, null, true);
        img arrowBackwardImage = createWorkflowImage("ArrowBW_", 0, null, true);
        img arrowDownImage = createWorkflowImage("ArrowDown_", 0, null, true);
        // node images

        img normalNodeImage = null;
        img activeNodeImage = null;

        // not node images
        if (imageMap[i][j] <= 0) {

          if (imageMap[i][j] == ARROW_FORWARD) grid.addElement(arrowForwardImage);

          if (imageMap[i][j] == ARROW_BACKWARD) grid.addElement(arrowBackwardImage);

          if (imageMap[i][j] == ARROW_DOWN) grid.addElement(arrowDownImage);

          if (imageMap[i][j] == SPACE) grid.addElement(spaceImage);

        } // not node images
        else {

          // Initialize variable
          int AD_Window_ID = 0;
          String url = "";
          String Target_Window = "";
          String parameters = "";
          String js_command = "";

          if (imageMap[i][j] == activeNode) {
            // Create image

            AD_Window_ID = nodes[getIndex(imageMap[i][j], nodes_ID)].getAD_Window_ID();
            //  url = "'WWindow?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
            url = "'WWindow?AD_Window_ID=" + AD_Window_ID;
            Target_Window = "'WWindow" + AD_Window_ID + "'";
            /// url=WebEnv.getBaseDirectory("WWindow")+
            //	"?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
            //	Target_Window = "'win_"+AD_Window_ID+"'";
            System.out.println("WorkFlow if(true)======" + url);

            parameters = url + "'," + Target_Window;
            js_command = "popUp(" + parameters + ");submit()";
            activeNodeImage = createWorkflowImage("mWorkFlow_", imageMap[i][j], js_command, true);

            grid.addElement(activeNodeImage);
            grid.addElement(new br());
            grid.addElement("" + imageMap[i][j]);
            grid.addElement(new br());
            grid.addElement(
                "<font color=blue>"
                    + nodes[getIndex(imageMap[i][j], nodes_ID)].getName()
                    + "</font>");
          } // active node
          else {
            // Create image
            AD_Window_ID = nodes[getIndex(imageMap[i][j], nodes_ID)].getAD_Window_ID();
            // url = "'WWindow?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
            url = "'WWindow?AD_Window_ID=" + AD_Window_ID;

            // url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
            Target_Window = "'WWindow" + AD_Window_ID + "'";

            System.out.println("WorkFlow else======" + url);
            parameters = url + "'," + Target_Window;
            js_command = "popUp(" + parameters + ");submit()";
            normalNodeImage = createWorkflowImage("mWorkFlow_", imageMap[i][j], js_command, false);

            grid.addElement(normalNodeImage);
            grid.addElement(new br());
            grid.addElement("" + imageMap[i][j]);
            grid.addElement(new br());
            grid.addElement(nodes[getIndex(imageMap[i][j], nodes_ID)].getName());
          } // inactive node
        }
        aRow.addElement(grid);
      } // process every gird

      imageTable.addElement(aRow);
    } // every row

    return imageTable;
  } // printWorkflow