Example #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
Example #2
0
  void buildTableFooterRows(table table, ReportBuilderArgs args) {

    tfoot footer = new tfoot();
    footer.setPrettyPrint(true);
    table.addElement(footer);

    for (GridRow row : getFooterRows()) {
      row.build(footer, args);
    }
  }
Example #3
0
  void buildTableHeaderRows(table table, ReportBuilderArgs args) {

    thead header = new thead();
    header.setPrettyPrint(true);
    table.addElement(header);

    for (GridRow row : getHeaderRows()) {
      row.build(header, args);
    }
  }
Example #4
0
  void buildTableWithoutGroups(table table, ReportBuilderArgs args) {

    tbody tbody = new tbody();
    tbody.setPrettyPrint(true);
    table.addElement(tbody);

    for (Object[] dataRow : args.getCurrentDataSet().getRows()) {
      // build rows (<tr>)
      for (GridRow row : getRows()) {
        args.setCurrentDataRow(dataRow);
        row.build(tbody, args);
      }
    }
  }
Example #5
0
  void buildTableWithGroups(table table, ReportBuilderArgs args) {

    // 1) Need to sort groups (desc?)
    // 2) Need to sort data based on groups?? do we?? i don't know!
    // 3) Render header rows
    // 4) Render body rows
    // 5) Render footer rows

    tbody tbody = new tbody();
    tbody.setPrettyPrint(true);
    table.addElement(tbody);

    for (Object[] dataRow : args.getCurrentDataSet().getRows()) {
      // build rows (<tr>)
      for (GridRow row : getRows()) {
        args.setCurrentDataRow(dataRow);
        row.build(tbody, args);
      }
    }
  }
Example #6
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;
  }
Example #7
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