示例#1
0
  /**
   * ************************************************************************ Action Listener
   *
   * @param e event
   */
  public void actionPerformed(ActionEvent e) {
    //  don't requery if fieldValue and fieldName are empty
    if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
        && (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0)) return;

    //	Product Attribute Search
    if (e.getSource().equals(m_InfoPAttributeButton)) {
      cmd_InfoPAttribute();
      return;
    }
    m_pAttributeWhere = null;

    //	Query Product Attribute Instance
    int row = p_table.getSelectedRow();
    if (e.getSource().equals(m_PAttributeButton) && row != -1) {
      Integer productInteger = getSelectedRowKey();
      String productName = (String) p_table.getValueAt(row, INDEX_NAME);
      KeyNamePair warehouse = (KeyNamePair) pickWarehouse.getSelectedItem();
      if (productInteger == null || productInteger.intValue() == 0 || warehouse == null) return;
      String title = warehouse.getName() + " - " + productName;
      IPAttributeInstance pai =
          PAttributeInstance.get(
              this, title, warehouse.getKey(), 0, productInteger.intValue(), m_C_BPartner_ID);
      m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
      m_M_Locator_ID = pai.getM_Locator_ID();
      if (m_M_AttributeSetInstance_ID != -1) dispose(true);
      return;
    }
    //
    super.actionPerformed(e);
  } //  actionPerformed
  private final void actionPerformed0(ActionEvent e) throws Exception {
    // Select Instance
    if (e.getSource() == bSelectExistingASI) {
      cmd_select();
      return;
    }
    // New/Edit
    else if (e.getSource() == cbNewEdit) {
      cmd_newEdit();
    }
    // Select Lot from existing
    else if (e.getSource() == fieldLot) {
      final KeyNamePair pp = fieldLot.getSelectedItem();
      if (pp != null && pp.getKey() != -1) {
        fieldLotString.setText(pp.getName());
        fieldLotString.setEditable(false);
        asiTemplate.setM_Lot_ID(pp.getKey());
      } else {
        fieldLotString.setEditable(true);
        asiTemplate.setM_Lot_ID(0);
      }
    }
    // Create New Lot
    else if (e.getSource() == bLot) {
      KeyNamePair pp = asiTemplate.createLot(m_M_Product_ID);
      if (pp != null) {
        fieldLot.addItem(pp);
        fieldLot.setSelectedItem(pp);
      }
    }
    // Create New SerNo
    else if (e.getSource() == bSerNo) {
      fieldSerNo.setText(asiTemplate.getSerNo(true));
    }

    // OK
    else if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
      final MAttributeSetInstance asi = saveSelection();
      final int M_Locator_ID = -1; // N/A
      setResultAndDispose(asi, M_Locator_ID);
      return;
    }
    // Cancel
    else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) {
      final int M_Locator_ID = -1; // N/A
      setResultAndDispose(null, M_Locator_ID);
    }
    // Zoom M_Lot
    else if (e.getSource() == mZoom) {
      cmd_zoom();
    } else {
      log.log(Level.SEVERE, "Unknown event: {0}", e);
    }
  } // actionPerformed
示例#3
0
  /** Dynamic Init. - Load Bank Info - Load BPartner - Init Table */
  private void dynInit() {
    ArrayList<BankInfo> bankAccountData = getBankAccountData();
    for (BankInfo bi : bankAccountData) fieldBankAccount.appendItem(bi.toString(), bi);

    if (fieldBankAccount.getItemCount() == 0) FDialog.error(m_WindowNo, form, "VPaySelectNoBank");
    else fieldBankAccount.setSelectedIndex(0);

    ArrayList<KeyNamePair> bpartnerData = getBPartnerData();
    for (KeyNamePair pp : bpartnerData) fieldBPartner.appendItem(pp.getName(), pp);
    fieldBPartner.setSelectedIndex(0);

    ArrayList<KeyNamePair> docTypeData = getDocTypeData();
    for (KeyNamePair pp : docTypeData) fieldDtype.appendItem(pp.getName(), pp);

    prepareTable(miniTable);

    miniTable.getModel().addTableModelListener(this);
    //
    fieldPayDate.setMandatory(true);
    fieldPayDate.setValue(new Timestamp(System.currentTimeMillis()));
  } //  dynInit
示例#4
0
 /**
  * Parent Constructor
  *
  * @param client client
  * @param currency currency
  */
 public MAcctSchema(MClient client, KeyNamePair currency) {
   this(client.getCtx(), 0, client.get_TrxName());
   setClientOrg(client);
   setC_Currency_ID(currency.getKey());
   StringBuilder msgset =
       new StringBuilder()
           .append(client.getName())
           .append(" ")
           .append(getGAAP())
           .append("/")
           .append(get_ColumnCount())
           .append(" ")
           .append(currency.getName());
   setName(msgset.toString());
 } //	MAcctSchema
 @Override
 public int getContextVariableAsInt(final String name) {
   final Object value = getContextVariable(name);
   if (value == null) {
     return -1;
   } else if (value instanceof Number) {
     return ((Number) value).intValue();
   } else if (value instanceof KeyNamePair) {
     final KeyNamePair knp = (KeyNamePair) value;
     if (knp.getKey() <= 0 && Check.isEmpty(knp.getName())) {
       return -1;
     } else {
       return knp.getKey();
     }
   } else {
     try {
       return Integer.parseInt(value.toString());
     } catch (final Exception e) {
       log.log(Level.WARNING, "Cannot convert " + value + " to integer", e);
     }
   }
   return -1;
 }