コード例 #1
0
ファイル: VLocatorDialog.java プロジェクト: jdhuayta/libertya
  /** 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
コード例 #2
0
  private void refreshList() {
    if (getComponent().getItemCount() > 0) getComponent().removeAllItems();

    if (isReadWrite()) {
      if (lookup != null) {
        int size = lookup.getSize();

        boolean found = false;
        for (int i = 0; i < size; i++) {
          Object obj = lookup.getElementAt(i);
          if (obj instanceof KeyNamePair) {
            KeyNamePair lookupKNPair = (KeyNamePair) obj;
            getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getKey());
            if (!found
                && oldValue != null
                && oldValue instanceof Integer
                && lookupKNPair.getKey() == (Integer) oldValue) {
              found = true;
            }
          } else if (obj instanceof ValueNamePair) {
            ValueNamePair lookupKNPair = (ValueNamePair) obj;
            getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getValue());
            if (!found && oldValue != null && lookupKNPair.getValue().equals(oldValue.toString())) {
              found = true;
            }
          }
        }
        if (!found && oldValue != null) {
          NamePair pair = lookup.getDirect(oldValue, false, false);
          if (pair != null) {
            if (pair instanceof KeyNamePair) {
              int key = ((KeyNamePair) pair).getKey();
              getComponent().appendItem(pair.getName(), key);
            } else if (pair instanceof ValueNamePair) {
              ValueNamePair valueNamePair = (ValueNamePair) pair;
              getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
            }
          }
        }
      }
    } else {
      if (lookup != null) {
        NamePair pair = lookup.getDirect(oldValue, false, false);
        if (pair != null) {
          if (pair instanceof KeyNamePair) {
            int key = ((KeyNamePair) pair).getKey();
            getComponent().appendItem(pair.getName(), key);
          } else if (pair instanceof ValueNamePair) {
            ValueNamePair valueNamePair = (ValueNamePair) pair;
            getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
          }
        }
      }
    }
    getComponent().setValue(oldValue);
  }
コード例 #3
0
 /**
  * Check availability and insert record
  *
  * @return true if saved/updated
  */
 private boolean cmd_save() {
   log.config("");
   //	Set AssignDateTo
   Calendar date = new GregorianCalendar();
   getDateAndTimeFrom(date);
   Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
   BigDecimal qty = fQty.getValue();
   KeyNamePair uom = (KeyNamePair) m_lookup.get(fResource.getSelectedItem());
   int minutes = MUOMConversion.convertToMinutes(Env.getCtx(), uom.getKey(), qty);
   Timestamp assignDateTo = TimeUtil.addMinutess(assignDateFrom, minutes);
   m_mAssignment.setAssignDateTo(assignDateTo);
   //
   //	m_mAssignment.dump();
   return m_mAssignment.save();
 } //	cmdSave
コード例 #4
0
ファイル: Viewer.java プロジェクト: AtrumGeost/ati_ds
  /** Descripción de Método */
  private void cmd_report() {
    KeyNamePair pp = (KeyNamePair) comboReport.getSelectedItem();

    if (pp == null) {
      return;
    }

    //

    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    MPrintFormat pf = null;
    int AD_PrintFormat_ID = pp.getKey();

    // create new

    if (AD_PrintFormat_ID == -1) {
      int AD_ReportView_ID = m_reportEngine.getPrintFormat().getAD_ReportView_ID();

      if (AD_ReportView_ID != 0) {
        String name = m_reportEngine.getName();
        int index = name.lastIndexOf("_");

        if (index != -1) {
          name = name.substring(0, index);
        }

        pf = MPrintFormat.createFromReportView(m_ctx, AD_ReportView_ID, name);
      } else {
        int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID();

        pf = MPrintFormat.createFromTable(m_ctx, AD_Table_ID);
      }

      if (pf != null) {
        fillComboReport(pf.getID());
      } else {
        return;
      }
    } else {
      pf = MPrintFormat.get(Env.getCtx(), AD_PrintFormat_ID, true);
    }

    m_reportEngine.setPrintFormat(pf);
    revalidate();
    cmd_drill(); // setCursor
  } // cmd_report
コード例 #5
0
ファイル: VLocatorDialog.java プロジェクト: jdhuayta/libertya
  /** Descripción de Método */
  private void createValue() {

    // Get Warehouse Info

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

    if (pp == null) {
      return;
    }

    getWarehouseInfo(pp.getKey());

    //

    StringBuffer buf = new StringBuffer(m_M_WarehouseValue);

    buf.append(m_Separator).append(fX.getText());
    buf.append(m_Separator).append(fY.getText());
    buf.append(m_Separator).append(fZ.getText());
    fValue.setText(buf.toString());
  } // createValue
コード例 #6
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
コード例 #7
0
  public void onEvent(Event e) throws Exception {
    if (m_setting) return;
    //	Update Assignment
    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair resource =
        listItem != null
            ? new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel())
            : null;
    if (resource != null) {
      int S_Resource_ID = resource.getKey();
      m_mAssignment.setS_Resource_ID(S_Resource_ID);
    }

    Calendar date = new GregorianCalendar();
    getDateAndTimeFrom(date);

    Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
    if (assignDateFrom != null) m_mAssignment.setAssignDateFrom(assignDateFrom);
    if (fQty.getValue() != null) {
      BigDecimal qty = fQty.getValue();
      m_mAssignment.setQty(qty);
    }
    m_mAssignment.setName((String) fName.getValue());
    m_mAssignment.setDescription((String) fDescription.getValue());

    //	Resource - Look up UOM
    if (e.getTarget() == fResource) {
      Object o = m_lookup.get(fResource.getSelectedItem());
      if (o == null) lUOM.setValue(" ? ");
      else lUOM.setValue(o.toString());
    }

    //	Zoom - InfoResource
    else if (e.getTarget().getId().equals("Zoom")) {
      InfoSchedule is = new InfoSchedule(m_mAssignment, true);
      if (is.getMResourceAssignment() != null) {
        m_mAssignment = is.getMResourceAssignment();
        //	setDisplay();
        detach();
      }
      is = null;
    }

    //	cancel - return
    else if (e.getTarget().getId().equals("Cancel")) {
      m_cancel = true;
      detach();
    }

    //	delete - delete and return
    else if (e.getTarget().getId().equals("Delete")) {
      if (m_mAssignment.delete(true)) {
        m_mAssignment = null;
        detach();
      } else FDialog.error(0, this, "ResourceAssignmentNotDeleted");
    }

    //	OK - Save
    else if (e.getTarget().getId().equals("Ok")) {
      if (cmd_save()) detach();
    }
  }
コード例 #8
0
ファイル: VLocatorDialog.java プロジェクト: jdhuayta/libertya
  /** 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