コード例 #1
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  /** Display. Fill Editors */
  public void display(int index) {
    log.fine("Index=" + index);
    //
    m_activity = resetDisplay(index);
    //	Nothing to show
    if (m_activity == null) {
      return;
    }
    //	Display Activity
    fNode.setText(m_activity.getNodeName());
    fDescription.setValue(m_activity.getNodeDescription());
    fHelp.setValue(m_activity.getNodeHelp());
    //
    fHistory.setContent(HISTORY_DIV_START_TAG + m_activity.getHistoryHTML() + "</div>");

    //	User Actions
    MWFNode node = m_activity.getNode();
    if (MWFNode.ACTION_UserChoice.equals(node.getAction())) {
      if (m_column == null) m_column = node.getColumn();
      if (m_column != null && m_column.get_ID() != 0) {
        fAnswerList.removeAllItems();
        int dt = m_column.getAD_Reference_ID();
        if (dt == DisplayType.YesNo) {
          ValueNamePair[] values = MRefList.getList(Env.getCtx(), 319, false); // 	_YesNo
          for (int i = 0; i < values.length; i++) {
            fAnswerList.appendItem(values[i].getName(), values[i].getValue());
          }
          fAnswerList.setVisible(true);
        } else if (dt == DisplayType.List) {
          ValueNamePair[] values =
              MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
          for (int i = 0; i < values.length; i++) {
            fAnswerList.appendItem(values[i].getName(), values[i].getValue());
          }
          fAnswerList.setVisible(true);
        } else //	other display types come here
        {
          fAnswerText.setText("");
          fAnswerText.setVisible(true);
        }
      }
    }
    //	--
    else if (MWFNode.ACTION_UserWindow.equals(node.getAction())
        || MWFNode.ACTION_UserForm.equals(node.getAction())) {
      fAnswerButton.setLabel(node.getName());
      fAnswerButton.setTooltiptext(node.getDescription());
      fAnswerButton.setVisible(true);
    } else log.log(Level.SEVERE, "Unknown Node Action: " + node.getAction());

    statusBar.setStatusDB((m_index + 1) + "/" + m_activities.length);
    statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFActivities"));
  } //	display
コード例 #2
0
ファイル: WFileImport.java プロジェクト: makezjdq/adempiere-1
  /** Reload/Load file */
  private void cmd_reloadFile() {
    if (m_file_istream == null) return;

    m_data.clear();
    rawData.setText("");

    try {
      //  see NaturalAccountMap

      ListItem listitem = fCharset.getSelectedItem();
      Charset charset = null;

      if (listitem == null) return;

      charset = (Charset) listitem.getValue();
      BufferedReader in = new BufferedReader(new InputStreamReader(m_file_istream, charset), 10240);

      //	not safe see p108 Network pgm
      String s = null;
      String concat = "";

      while ((s = in.readLine()) != null) {
        m_data.add(s);

        concat += s;
        concat += "\n";

        if (m_data.size() < MAX_LOADED_LINES) {
          rawData.setValue(concat);
        }
      }
      in.close();
    } catch (Exception e) {
      log.log(Level.SEVERE, "", e);
      bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
    }

    int index = 1; // 	second line as first may be heading

    if (m_data.size() == 1) index = 0;

    int length = 0;

    if (m_data.size() > 0) length = m_data.get(index).toString().length();

    info.setValue(
        Msg.getMsg(Env.getCtx(), "Records")
            + "="
            + m_data.size()
            + ", "
            + Msg.getMsg(Env.getCtx(), "Length")
            + "="
            + length
            + "   ");

    // setCursor (Cursor.getDefaultCursor());

    log.config("Records=" + m_data.size() + ", Length=" + length);
  } //	cmd_loadFile
コード例 #3
0
  /** Initialize component & values from m_mAssignment */
  private void setDisplay() {
    m_setting = true;

    //	Set Resource
    int S_Resource_ID = m_mAssignment.getS_Resource_ID();
    KeyNamePair[] resources = new KeyNamePair[m_lookup.size()];
    m_lookup.keySet().toArray(resources);
    for (int i = 0; i < resources.length; i++) {
      if (resources[i].getKey() == S_Resource_ID) {
        fResource.setSelectedIndex(i);
        break;
      }
    }
    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair check = new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel());
    if (check == null || check.getKey() != S_Resource_ID) {
      if (m_mAssignment.getS_ResourceAssignment_ID() == 0) // 	new record select first
      fResource.setSelectedItem(fResource.getSelectedItem()); // 	initiates UOM display
      else log.log(Level.SEVERE, "Resource not found ID=" + S_Resource_ID);
    }

    //	Set Date, Qty
    fDateFrom.setValue(m_mAssignment.getAssignDateFrom());
    fTimeFrom.setValue(m_mAssignment.getAssignDateFrom());
    fQty.setValue(m_mAssignment.getQty());

    //	Name, Description
    fName.setValue(m_mAssignment.getName());
    fDescription.setValue(m_mAssignment.getDescription());

    //	Set Editor to R/O if confirmed
    boolean readWrite = true;
    if (m_mAssignment.isConfirmed()) readWrite = false;
    confirmPanel.getButton("Cancel").setVisible(readWrite);
    fResource.setEnabled(readWrite);
    fDateFrom.setReadonly(!readWrite);
    fQty.setEnabled(readWrite);

    m_setting = false;
  } //	dynInit