コード例 #1
0
  /** Hacer el insert en la tabla REFERENCEMATRIX */
  public void doInsert(int Product, int option) {

    // Asocio producto
    X_XX_VMR_ReferenceMatrix matrix = new X_XX_VMR_ReferenceMatrix(Env.getCtx(), 0, null);

    matrix.setXX_VALUE1(0);
    matrix.setXX_VALUE2(0);
    matrix.setXX_COLUMN(0);
    matrix.setXX_ROW(0);
    matrix.setXX_QUANTITYC(LineRefProv.getQty());
    matrix.setXX_QUANTITYV(LineRefProv.getSaleQty());
    matrix.setXX_QUANTITYO(LineRefProv.getXX_GiftsQty());
    matrix.setXX_VMR_PO_LineRefProv_ID((Integer) LineRefProv.get_Value("XX_VMR_PO_LineRefProv_ID"));
    matrix.setM_Product(Product);

    matrix.save();

    if (option == 1) {

      tableInit_option = 1;
      tableInit();
      tableLoad(xAssociateTable);

      bDisassociate.setEnabled(true);
      bNewProduct.setEnabled(false);
    }
  }
コード例 #2
0
  /** Associate Button Pressed */
  private void cmd_associate() {
    int productRow = xProductTable.getSelectedRow();
    log.config("Row=" + productRow);

    KeyNamePair product = (KeyNamePair) xProductTable.getValueAt(productRow, 0);

    doInsert(product.getKey(), 0);

    //  ** Load Table **
    tableInit_option = 1;
    tableInit();
    tableLoad(xAssociateTable);

    //  ** Load Table **
    tableInit_option = 2;
    tableInit();
    tableLoad(xProductTable);

    bDisassociate.setEnabled(true);
    bNewProduct.setEnabled(false);

    // Coloco la referencia como asociada
    // MVMRVendorProdRef vendorProdRef = new MVMRVendorProdRef(Env.getCtx(),
    // LineRefProv.getXX_VMR_VendorProdRef_ID(), null);
    // vendorProdRef.setXX_IsAssociated(true);
    // vendorProdRef.save();

  } //  cmd_associate
コード例 #3
0
  /** Disassociate Button Pressed */
  private void cmd_disassociate() {
    if (verify()) {
      // desasocio el producto
      X_XX_VMR_ReferenceMatrix matrix =
          new X_XX_VMR_ReferenceMatrix(Env.getCtx(), associatedReference_ID, null);
      matrix.delete(true);

      tableInit_option = 0;
      tableInit();
      tableLoad(xProductTable);

      tableInit_option = 1;
      tableInit();
      tableLoad(xAssociateTable);

      bDisassociate.setEnabled(false);
      bNewProduct.setEnabled(true);
    }
  } //  cmd_disassociate
コード例 #4
0
  /** Dynamic Init. Table Layout, Visual, Listener */
  private void dynInit() {

    ColumnInfo[] layout =
        new ColumnInfo[] {
          new ColumnInfo(Msg.translate(Env.getCtx(), "M_Product_ID"), ".", KeyNamePair.class), //  1
          new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), ".", String.class) //  2
        };

    xProductTable.prepareTable(layout, "", "", false, "");
    xAssociateTable.prepareTable(layout, "", "", true, "");

    xAssociateTable.setAutoResizeMode(3);
    xProductTable.setAutoResizeMode(3);

    //  Visual
    CompiereColor.setBackground(this);

    //  Listener
    xProductTable.getSelectionModel().addListSelectionListener(this);
    xAssociateTable.getModel().addTableModelListener(this);
    bDisassociate.addActionListener(this);
    bNewProduct.addActionListener(this);

    // pregunto si hay productos asociados para ver si cargo las tablas
    boolean ready = verify();

    if (ready == false) {

      tableInit_option = 0;
      tableInit();
      tableLoad(xProductTable);

    } else {
      tableInit_option = 1;
      tableInit();
      tableLoad(xAssociateTable);

      bNewProduct.setEnabled(false);
      bDisassociate.setEnabled(true);
    }

    xProductTable.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {

              int rowP = xProductTable.getSelectedRow();

              if (!(rowP == -1)) {
                cmd_associate();
              }
            }
          }
        });

    //  Init
    statusBar.setStatusLine("");
    statusBar.setStatusDB(0);

    MOrder order = new MOrder(Env.getCtx(), LineRefProv.getC_Order_ID(), null);

    boolean block = false;
    String oS = order.getXX_OrderStatus();
    String compS = order.getDocStatus();
    if (oS.equals("AN") || compS.equals("CO")) {
      block = true;
    }

    if (order.isXX_OrderReadyStatus() && order.getXX_OrderType().equalsIgnoreCase("Nacional"))
      block = true;

    if (order.getXX_OrderType().equalsIgnoreCase("Importada")
        && order.get_ValueAsInt("XX_ImportingCompany_ID") != 0) {

      if (order.get_ValueAsInt("XX_ImportingCompany_ID")
          != Env.getCtx().getContextAsInt("#XX_L_VSI_CLIENTCENTROBECO_ID")) {
        block = true;
      }
    }

    if (order.getXX_StoreDistribution().equals("Y") || block) {
      xProductTable.setEnabled(false);
      xAssociateTable.setEnabled(false);
      bNewProduct.setEnabled(false);
      bDisassociate.setEnabled(false);
    }
  } //  dynInit
コード例 #5
0
  /**
   * Static Init.
   *
   * <pre>
   *  mainPanel
   *      northPanel
   *      centerPanel
   *          xMatched
   *          xPanel
   *          xMathedTo
   *      southPanel
   *  </pre>
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    mainPanel.setLayout(mainLayout);
    northPanel.setLayout(northLayout);

    // LineRefProv_Label.setText(Msg.getMsg(Env.getCtx(), "RecordNo",new String[]
    // {""+LineRefProv.getXX_VMR_PO_LineRefProv_ID()}));
    LineRefProv_Label.setText("");
    southPanel.setLayout(southLayout);
    bNewProduct.setText(Msg.translate(Env.getCtx(), "NewProduct"));
    bNewProduct.setEnabled(true);
    bDisassociate.setText(Msg.translate(Env.getCtx(), "Disassociate"));
    bDisassociate.setEnabled(false);
    centerPanel.setLayout(centerLayout);
    xProductScrollPane.setBorder(xProductBorder);
    xProductScrollPane.setPreferredSize(new Dimension(450, 150));
    xAssociateScrollPane.setBorder(xAssociateBorder);
    xAssociateScrollPane.setPreferredSize(new Dimension(450, 58));

    xPanel.setLayout(xLayout);
    mainPanel.add(northPanel, BorderLayout.NORTH);
    northPanel.add(
        LineRefProv_Label,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(12, 12, 5, 5),
            0,
            0));

    mainPanel.add(southPanel, BorderLayout.SOUTH);

    mainPanel.add(centerPanel, BorderLayout.CENTER);
    centerPanel.add(xProductScrollPane, BorderLayout.NORTH);
    xProductScrollPane.getViewport().add(xProductTable, null);
    centerPanel.add(xAssociateScrollPane, BorderLayout.SOUTH);
    centerPanel.add(xPanel, BorderLayout.CENTER);
    xAssociateScrollPane.getViewport().add(xAssociateTable, null);

    southPanel.add(
        bDisassociate,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(5, 12, 5, 12),
            0,
            0));
    southPanel.add(
        bNewProduct,
        new GridBagConstraints(
            8,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 12, 5, 12),
            0,
            0));
  } //  jbInit