示例#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
  /**
   * Create Left Top aligned TD
   *
   * @param element element
   * @return td table data
   */
  private WebDoc CreateChatPage(WWindowStatus ws, WebSessionCtx wsc, WebDoc doc, int CM_Chat_ID) {

    doc = WebDoc.createPopup("Chat ");

    td center = doc.addWindowCenter(false);
    int record_ID = ws.curTab.getRecord_ID();
    log.info("Record_ID=" + record_ID);
    if (record_ID == -1) // 	No Key
    {
      log.info("Record does not exist");
      return doc;
    }
    //	Find display
    String infoName = null;
    String infoDisplay = null;
    for (int i = 0; i < ws.curTab.getFieldCount(); i++) {
      GridField field = ws.curTab.getField(i);
      if (field.isKey()) infoName = field.getHeader();
      if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo"))
          && field.getValue() != null) infoDisplay = field.getValue().toString();
      if (infoName != null && infoDisplay != null) break;
    }
    String description = infoName + ": " + infoDisplay;
    //

    if (ws.curTab.getCM_ChatID() > 0) m_chat = new MChat(wsc.ctx, ws.curTab.getCM_ChatID(), null);
    else if (CM_Chat_ID > 0) m_chat = new MChat(wsc.ctx, CM_Chat_ID, null);
    else m_chat = new MChat(wsc.ctx, ws.curTab.getAD_Table_ID(), record_ID, description, null);

    String text = m_chat.getHistory(MChat.CONFIDENTIALTYPE_Internal).toString();

    form myForm = new form("WChat").setName("chat");
    myForm.setOnSubmit("this.Submit.disabled=true;return true;");
    if (CM_Chat_ID == 0)
      myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", ws.curTab.getCM_ChatID()));
    else myForm.addElement(new input(input.TYPE_HIDDEN, "CM_ChatID", CM_Chat_ID));
    myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", ws.curTab.getAD_Table_ID()));
    myForm.addElement(new input(input.TYPE_HIDDEN, "record_ID", record_ID));
    myForm.addElement(new input(input.TYPE_HIDDEN, "description", description));

    table myTable = new table("0", "0", "5", "100%", null);
    myTable.setID("WChatParameter");
    m_displayLength = 80;

    // history field
    myTable.addElement(new tr().addElement(new td("History")));
    m_readOnly = true;
    table HistoryTable = new table("1", "0", "5", "100%", null);
    HistoryTable.addElement(
        new tr()
            .addElement(
                new td(text)
                    .setRowSpan(10)
                    .setAlign(AlignType.LEFT)
                    .setVAlign(AlignType.TOP)
                    .setColSpan(4)));
    myTable.addElement(HistoryTable);

    // input field
    myTable.addElement(new tr().addElement(new td("Input")));
    m_readOnly = false;
    m_columnName = "chatinput";
    myTable.addElement(new tr().addElement(getTextField("", 10)));

    //	 Reset
    String textbtn = "Reset";
    if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Reset");
    input restbtn = new input(input.TYPE_RESET, textbtn, "  " + text);
    restbtn.setID(text);
    restbtn.setClass("resetbtn");

    //	Submit
    textbtn = "Submit";
    if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Submit");
    input submitbtn = new input(input.TYPE_SUBMIT, textbtn, "  " + text);
    submitbtn.setID(text);
    submitbtn.setClass("submitbtn");

    //	Close
    textbtn = "Close";
    if (wsc.ctx != null) text = Msg.getMsg(wsc.ctx, "Close");
    input closebtn = new input(input.TYPE_SUBMIT, textbtn, "  " + text);
    closebtn.setID(text);
    closebtn.setClass("closebtn");
    closebtn.setOnClick("self.close();return false;");

    myTable.addElement(
        new tr()
            .addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false, restbtn))
            .addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false, submitbtn))
            .addElement(new td(null, AlignType.LEFT, AlignType.MIDDLE, false, closebtn)));
    myForm.addElement(myTable);
    center.addElement(myForm);

    return doc;
  }
示例#3
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
示例#4
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