Exemplo n.º 1
0
  /** Descripción de Método */
  private void displayLocator() {
    MLocator l = (MLocator) fLocator.getSelectedItem();

    if (l == null) {
      return;
    }

    //

    m_M_Locator_ID = l.getM_Locator_ID();
    fWarehouseInfo.setText(l.getWarehouseName());
    fX.setText(l.getX());
    fY.setText(l.getY());
    fZ.setText(l.getZ());
    fValue.setText(l.getValue());
    getWarehouseInfo(l.getM_Warehouse_ID());

    // Set Warehouse

    int size = fWarehouse.getItemCount();

    for (int i = 0; i < size; i++) {
      KeyNamePair pp = (KeyNamePair) fWarehouse.getItemAt(i);

      if (pp.getKey() == l.getM_Warehouse_ID()) {
        fWarehouse.setSelectedIndex(i);

        continue;
      }
    }
  } // displayLocator
Exemplo n.º 2
0
  /**
   * Descripción de Método
   *
   * @param e
   */
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    //

    if (e.getActionCommand().equals(ConfirmPanel.A_OK)) {
      actionOK();
      m_change = true;
      dispose();
    } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) {
      fLocator.setValue(m_OriginalLocatorID);
      m_change = false;
      dispose();
    }

    // Locator Change

    else if (e.getSource() == fLocator) {
      displayLocator();

      // New Value Change

    } else if (source == fCreateNew) {
      enableNew();

      // Entered/Changed data for Value

    } else if (fCreateNew.isSelected() && (source == fWarehouse)) {
      createValue();
    }
  } // actionPerformed
Exemplo n.º 3
0
  /**
   * Descripción de Método
   *
   * @return
   */
  public Integer getValue() {
    MLocator l = (MLocator) fLocator.getSelectedItem();

    if ((l != null) && (l.getM_Locator_ID() != 0)) {
      return new Integer(l.getM_Locator_ID());
    }

    return null;
  } // getValue
Exemplo n.º 4
0
  /**
   * Descripción de Método
   *
   * @return
   */
  public boolean isChanged() {
    if (m_change) {
      MLocator l = (MLocator) fLocator.getSelectedItem();

      if (l != null) {
        return l.getM_Locator_ID() == m_M_Locator_ID;
      }
    }

    return m_change;
  } // getChange
Exemplo n.º 5
0
  /** Descripción de Método */
  private void actionOK() {
    if (fCreateNew.isSelected()) {

      // Get Warehouse Info

      KeyNamePair pp = (KeyNamePair) fWarehouse.getSelectedItem();

      if (pp != null) {
        getWarehouseInfo(pp.getKey());
      }

      // Check mandatory values

      String mandatoryFields = "";

      if (m_M_Warehouse_ID == 0) {
        mandatoryFields += lWarehouse.getText() + " - ";
      }

      if (fValue.getText().length() == 0) {
        mandatoryFields += lValue.getText() + " - ";
      }

      if (fX.getText().length() == 0) {
        mandatoryFields += lX.getText() + " - ";
      }

      if (fY.getText().length() == 0) {
        mandatoryFields += lY.getText() + " - ";
      }

      if (fZ.getText().length() == 0) {
        mandatoryFields += lZ.getText() + " - ";
      }

      if (mandatoryFields.length() != 0) {
        ADialog.error(
            m_WindowNo,
            this,
            "FillMandatory",
            mandatoryFields.substring(0, mandatoryFields.length() - 3));

        return;
      }

      MLocator loc =
          MLocator.get(
              Env.getCtx(),
              m_M_Warehouse_ID,
              fValue.getText(),
              fX.getText(),
              fY.getText(),
              fZ.getText());

      m_M_Locator_ID = loc.getM_Locator_ID();
      fLocator.addItem(loc);
      fLocator.setSelectedItem(loc);
    } // createNew

    //

    log.config("M_Locator_ID=" + m_M_Locator_ID);
  } // actionOK
Exemplo n.º 6
0
  /** Descripción de Método */
  private void initLocator() {
    log.fine("");

    // Load Warehouse

    String sql = "SELECT M_Warehouse_ID, Name FROM M_Warehouse";

    if (m_only_Warehouse_ID != 0) {
      sql += " WHERE M_Warehouse_ID=" + m_only_Warehouse_ID;
    }

    String SQL =
        MRole.getDefault().addAccessSQL(sql, "M_Warehouse", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO)
            + " ORDER BY 2";

    try {
      PreparedStatement pstmt = DB.prepareStatement(SQL);
      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {
        fWarehouse.addItem(new KeyNamePair(rs.getInt(1), rs.getString(2)));
      }

      rs.close();
      pstmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, "warehouse", e);
    }

    log.fine("Warehouses=" + fWarehouse.getItemCount());

    // Load existing Locators

    m_mLocator.fillComboBox(m_mandatory, true, true, false);
    log.fine(m_mLocator.toString());
    fLocator.setModel(m_mLocator);
    fLocator.setValue(m_M_Locator_ID);
    fLocator.addActionListener(this);
    displayLocator();

    //

    fCreateNew.setSelected(false);
    fCreateNew.addActionListener(this);
    enableNew();

    //

    fWarehouse.addActionListener(this);
    fX.addKeyListener(this);
    fY.addKeyListener(this);
    fZ.addKeyListener(this);

    // Guarda el ID de la ubicación con la cual se invocó el constructor
    // de este diálogo. Este ID se utiliza en caso de cancelar el diálogo
    // para recuperar el valor que tenía previamente el ID de ubicación.
    m_OriginalLocatorID = m_M_Locator_ID;

    // Update UI

    pack();
  } // initLocator