コード例 #1
0
 /** Search Button Pressed */
 private void cmd_Search() {
   tableInit();
   totalCalculation();
   if (xTableACC.getRowCount() != 0 || xTableAAP.getRowCount() != 0) {
     statusBar.setStatusLine("Acuerdos Comerciales y Cartas Compromiso");
     statusBar.setStatusDB(xTableACC.getRowCount() + xTableAAP.getRowCount());
   } else {
     showCreditNotificationCondition();
   }
 }
コード例 #2
0
  /**
   * Action Find. - create where clause - query database
   *
   * @param includeAliasCombination include alias combination
   */
  private void action_Find(boolean includeAliasCombination) {
    log.info("");
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    //	Create where Clause
    MQuery query = null;
    if (m_query != null) query = m_query.deepCopy();
    else query = new MQuery();
    //	Alias
    if (includeAliasCombination && f_Alias != null && f_Alias.getValue().toString().length() > 0) {
      String value = f_Alias.getValue().toString().toUpperCase();
      if (!value.endsWith("%")) value += "%";
      query.addRestriction("UPPER(Alias)", MQuery.LIKE, value);
    }
    //	Combination (mandatory)
    if (includeAliasCombination && f_Combination.getValue().toString().length() > 0) {
      String value = f_Combination.getValue().toString().toUpperCase();
      if (!value.endsWith("%")) value += "%";
      query.addRestriction("UPPER(Combination)", MQuery.LIKE, value);
    }
    //	Org (mandatory)
    if (f_AD_Org_ID != null && f_AD_Org_ID.getValue() != null)
      query.addRestriction("AD_Org_ID", MQuery.EQUAL, f_AD_Org_ID.getValue());
    //	Account (mandatory)
    if (f_Account_ID != null && f_Account_ID.getValue() != null)
      query.addRestriction("Account_ID", MQuery.EQUAL, f_Account_ID.getValue());
    if (f_SubAcct_ID != null && f_SubAcct_ID.getValue() != null)
      query.addRestriction("C_SubAcct_ID", MQuery.EQUAL, f_SubAcct_ID.getValue());

    //	Product
    if (f_M_Product_ID != null && f_M_Product_ID.getValue() != null)
      query.addRestriction("M_Product_ID", MQuery.EQUAL, f_M_Product_ID.getValue());
    //	BPartner
    if (f_C_BPartner_ID != null && f_C_BPartner_ID.getValue() != null)
      query.addRestriction("C_BPartner_ID", MQuery.EQUAL, f_C_BPartner_ID.getValue());
    //	Campaign
    if (f_C_Campaign_ID != null && f_C_Campaign_ID.getValue() != null)
      query.addRestriction("C_Campaign_ID", MQuery.EQUAL, f_C_Campaign_ID.getValue());
    //	Loc From
    if (f_C_LocFrom_ID != null && f_C_LocFrom_ID.getValue() != null)
      query.addRestriction("C_LocFrom_ID", MQuery.EQUAL, f_C_LocFrom_ID.getValue());
    //	Loc To
    if (f_C_LocTo_ID != null && f_C_LocTo_ID.getValue() != null)
      query.addRestriction("C_LocTo_ID", MQuery.EQUAL, f_C_LocTo_ID.getValue());
    //	Project
    if (f_C_Project_ID != null && f_C_Project_ID.getValue() != null)
      query.addRestriction("C_Project_ID", MQuery.EQUAL, f_C_Project_ID.getValue());
    //	SRegion
    if (f_C_SalesRegion_ID != null && f_C_SalesRegion_ID.getValue() != null)
      query.addRestriction("C_SalesRegion_ID", MQuery.EQUAL, f_C_SalesRegion_ID.getValue());
    //	Org Trx
    if (f_AD_OrgTrx_ID != null && f_AD_OrgTrx_ID.getValue() != null)
      query.addRestriction("AD_OrgTrx_ID", MQuery.EQUAL, f_AD_OrgTrx_ID.getValue());
    //	Activity
    if (f_C_Activity_ID != null && f_C_Activity_ID.getValue() != null)
      query.addRestriction("C_Activity_ID", MQuery.EQUAL, f_C_Activity_ID.getValue());
    //	User 1
    if (f_User1_ID != null && f_User1_ID.getValue() != null)
      query.addRestriction("User1_ID", MQuery.EQUAL, f_User1_ID.getValue());
    //	User 2
    if (f_User2_ID != null && f_User2_ID.getValue() != null)
      query.addRestriction("User2_ID", MQuery.EQUAL, f_User2_ID.getValue());

    //	Query
    m_mTab.setQuery(query);
    m_mTab.query(false);
    statusBar.setStatusDB(String.valueOf(m_mTab.getRowCount()));
    setCursor(Cursor.getDefaultCursor());
  } //	action_Find
コード例 #3
0
  /**
   * Dyanmic Init. When a row is selected, the editor values are set (editors do not change grid)
   *
   * @return true if initialized
   */
  private boolean initAccount() {
    m_AD_Client_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "AD_Client_ID");
    //	Get AcctSchema Info
    if (s_AcctSchema == null || s_AcctSchema.getC_AcctSchema_ID() != m_C_AcctSchema_ID)
      s_AcctSchema = new MAcctSchema(Env.getCtx(), m_C_AcctSchema_ID, null);
    log.config(s_AcctSchema.toString() + ", #" + s_AcctSchema.getAcctSchemaElements().length);
    Env.setContext(Env.getCtx(), m_WindowNo, "C_AcctSchema_ID", m_C_AcctSchema_ID);

    //  Model
    int AD_Window_ID = 153; // 	Maintain Account Combinations
    GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0);
    if (wVO == null) return false;
    m_mWindow = new GridWindow(wVO);
    m_mTab = m_mWindow.getTab(0);
    // Make sure is the tab is loaded - teo_sarca [ 1659124 ]
    if (!m_mTab.isLoadComplete()) m_mWindow.initTab(0);

    //  ParameterPanel restrictions
    m_mTab.getField("Alias").setDisplayLength(15);
    m_mTab.getField("Combination").setDisplayLength(15);
    //  Grid restrictions
    m_mTab.getField("AD_Client_ID").setDisplayed(false);
    m_mTab.getField("C_AcctSchema_ID").setDisplayed(false);
    m_mTab.getField("IsActive").setDisplayed(false);
    m_mTab.getField("IsFullyQualified").setDisplayed(false);
    //  don't show fields not being displayed in this environment
    for (int i = 0; i < m_mTab.getFieldCount(); i++) {
      GridField field = m_mTab.getField(i);
      if (!field.isDisplayed(true)) //  check context
      field.setDisplayed(false);
    }

    //  GridController
    m_gridController = new GridController();
    m_gridController.initGrid(m_mTab, true, m_WindowNo, null, null);
    m_gridController.setPreferredSize(new Dimension(300, 100));
    panel.add(m_gridController, BorderLayout.CENTER);

    //  Prepare Parameter
    m_gbc.anchor = GridBagConstraints.NORTHWEST;
    m_gbc.gridy = 0; // 	line
    m_gbc.gridx = 0;
    m_gbc.gridwidth = 1;
    m_gbc.insets = m_fieldInsets;
    m_gbc.fill = GridBagConstraints.HORIZONTAL;
    m_gbc.weightx = 0;
    m_gbc.weighty = 0;

    int TabNo = 0;

    //	Alias
    if (s_AcctSchema.isHasAlias()) {
      GridField alias = m_mTab.getField("Alias");
      f_Alias = VEditorFactory.getEditor(m_mTab, alias, false);
      addLine(alias, f_Alias, false);
    } //	Alias

    //	Combination
    GridField combination = m_mTab.getField("Combination");
    f_Combination = VEditorFactory.getEditor(m_mTab, combination, false);
    addLine(combination, f_Combination, false);
    m_newRow = true;

    /** Create Fields in Element Order */
    MAcctSchemaElement[] elements = s_AcctSchema.getAcctSchemaElements();
    for (int i = 0; i < elements.length; i++) {
      MAcctSchemaElement ase = elements[i];
      String type = ase.getElementType();
      boolean isMandatory = ase.isMandatory();
      //
      if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Organization)) {
        GridField field = m_mTab.getField("AD_Org_ID");
        f_AD_Org_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_AD_Org_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Account)) {
        GridField field = m_mTab.getField("Account_ID");
        f_Account_ID = VEditorFactory.getEditor(m_mTab, field, false);
        //	((VLookup)f_Account_ID).setWidth(400);
        addLine(field, f_Account_ID, isMandatory);
        f_Account_ID.addVetoableChangeListener(this);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SubAccount)) {
        GridField field = m_mTab.getField("C_SubAcct_ID");
        f_SubAcct_ID = VEditorFactory.getEditor(m_mTab, field, false);
        //	((VLookup)f_SubAcct_ID).setWidth(400);
        addLine(field, f_SubAcct_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Product)) {
        GridField field = m_mTab.getField("M_Product_ID");
        f_M_Product_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_M_Product_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_BPartner)) {
        GridField field = m_mTab.getField("C_BPartner_ID");
        f_C_BPartner_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_BPartner_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Campaign)) {
        GridField field = m_mTab.getField("C_Campaign_ID");
        f_C_Campaign_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_Campaign_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationFrom)) {
        GridField field = m_mTab.getField("C_LocFrom_ID");
        f_C_LocFrom_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_LocFrom_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationTo)) {
        GridField field = m_mTab.getField("C_LocTo_ID");
        f_C_LocTo_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_LocTo_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Project)) {
        GridField field = m_mTab.getField("C_Project_ID");
        f_C_Project_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_Project_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SalesRegion)) {
        GridField field = m_mTab.getField("C_SalesRegion_ID");
        f_C_SalesRegion_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_SalesRegion_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_OrgTrx)) {
        GridField field = m_mTab.getField("AD_OrgTrx_ID");
        f_AD_OrgTrx_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_AD_OrgTrx_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Activity)) {
        GridField field = m_mTab.getField("C_Activity_ID");
        f_C_Activity_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_C_Activity_ID, isMandatory);
      }
      //	User1
      else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList1)) {
        GridField field = m_mTab.getField("User1_ID");
        f_User1_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_User1_ID, isMandatory);
      } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList2)) {
        GridField field = m_mTab.getField("User2_ID");
        f_User2_ID = VEditorFactory.getEditor(m_mTab, field, false);
        addLine(field, f_User2_ID, isMandatory);
      }
    } //	Create Fields in Element Order

    //	Add description
    m_newRow = true;
    m_gbc.gridy = m_line++;
    m_gbc.gridx = 0;
    m_gbc.gridwidth = 4;
    m_gbc.insets = new Insets(5, 15, 2, 0); // 	top,left,bottom,right
    m_gbc.fill = GridBagConstraints.HORIZONTAL;
    f_Description.setFont(f_Description.getFont().deriveFont(Font.ITALIC));
    parameterPanel.add(f_Description, m_gbc);

    //	Finish
    m_query = new MQuery();
    m_query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID);
    m_query.addRestriction("IsFullyQualified", MQuery.EQUAL, "Y");
    if (m_mAccount.C_ValidCombination_ID == 0) m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
    else {
      MQuery query = new MQuery();
      query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID);
      query.addRestriction("C_ValidCombination_ID", MQuery.EQUAL, m_mAccount.C_ValidCombination_ID);
      m_mTab.setQuery(query);
    }
    m_mTab.query(false);
    m_gridController.getTable().addMouseListener(new VAccountDialog_mouseAdapter(this));
    m_gridController.addDataStatusListener(this);

    statusBar.setStatusLine(s_AcctSchema.toString());
    statusBar.setStatusDB("?");

    //	Initial value
    if (m_mAccount.C_ValidCombination_ID != 0) m_mTab.navigate(0);

    log.config("fini");
    return true;
  } //	initAccount
コード例 #4
0
ファイル: StatusBar.java プロジェクト: makezjdq/adempiere-1
 /**
  * Click
  *
  * @param e event
  */
 public void mouseClicked(MouseEvent e) {
   adaptee.mouseClicked(e);
 }
コード例 #5
0
  private void dynInit() {
    // Llenar los filtros de busquedas
    llenarcombos();
    // generacion de las columnas para los avisos de Creditos
    ColumnInfo[] layoutACC =
        new ColumnInfo[] {

          // 0 Proveedor
          new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), ".", String.class),

          // 1 País
          new ColumnInfo(Msg.translate(Env.getCtx(), "CountryName"), ".", String.class),

          // 2 Departamento
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_VMR_Department_ID"), ".", String.class),

          // 3 Categoría
          new ColumnInfo(Msg.translate(Env.getCtx(), "Categoria"), ".", String.class),

          // 4 Mes
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_Month"), ".", Integer.class),

          // 5 Año
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_Year"), ".", Integer.class),

          // 6 Compras hechas
          new ColumnInfo(Msg.translate(Env.getCtx(), "PurchasesDone"), "total", float.class),

          // 7 Descuentos generados
          new ColumnInfo(Msg.translate(Env.getCtx(), "GeneratedDiscount"), ".", float.class),

          // 8 Avisos pendientes
          new ColumnInfo(Msg.translate(Env.getCtx(), "PendingAdvices"), ".", float.class),
        };

    xTableACC.prepareTable(layoutACC, "", "", true, "");

    //  Visual
    CompiereColor.setBackground(this);
    xTableACC.getSelectionModel().addListSelectionListener(this);
    xTableACC.getColumnModel().getColumn(0).setMinWidth(350);
    xTableACC.getColumnModel().getColumn(1).setMinWidth(150);
    xTableACC.getColumnModel().getColumn(2).setMinWidth(190);
    xTableACC.getColumnModel().getColumn(3).setMinWidth(110);
    xTableACC.getColumnModel().getColumn(4).setMinWidth(25);
    xTableACC.getColumnModel().getColumn(4).setMaxWidth(30);
    xTableACC.getColumnModel().getColumn(5).setMinWidth(30);
    xTableACC.getColumnModel().getColumn(5).setMaxWidth(35);
    xTableACC.getColumnModel().getColumn(6).setMinWidth(140);
    xTableACC.getColumnModel().getColumn(7).setMinWidth(150);
    xTableACC.getColumnModel().getColumn(8).setMinWidth(140);
    xTableACC.getSelectionModel().addListSelectionListener(this);

    ColumnInfo[] layoutAAP =
        new ColumnInfo[] {

          // 0 Proveedor
          new ColumnInfo(
              Msg.translate(Env.getCtx(), "C_BPartner_ID"), "vendorID", KeyNamePair.class),

          // 1 País
          new ColumnInfo(Msg.translate(Env.getCtx(), "CountryName"), ".", KeyNamePair.class),

          // 2 Mes
          new ColumnInfo(Msg.translate(Env.getCtx(), "Month"), ".", Integer.class),

          // 3 Año
          new ColumnInfo(Msg.translate(Env.getCtx(), "Year"), ".", Integer.class),

          // 4 Tipo
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_Notificationtype"), ".", String.class),

          // 5 Compras hechas
          new ColumnInfo(Msg.translate(Env.getCtx(), "PurchasesDone"), "total", float.class),

          // 6 Descuentos generados
          new ColumnInfo(Msg.translate(Env.getCtx(), "GeneratedDiscount"), ".", float.class),

          // 7 Avisos pendientes
          new ColumnInfo(Msg.translate(Env.getCtx(), "PendingAdvices"), ".", float.class),
        };

    xTableAAP.prepareTable(layoutAAP, "", "", true, "");

    //  Visual
    CompiereColor.setBackground(this);
    xTableAAP.getSelectionModel().addListSelectionListener(this);
    xTableAAP.getColumnModel().getColumn(0).setMinWidth(350);
    xTableAAP.getColumnModel().getColumn(1).setMinWidth(150);
    xTableAAP.getColumnModel().getColumn(2).setMinWidth(25);
    xTableAAP.getColumnModel().getColumn(2).setMaxWidth(30);
    xTableAAP.getColumnModel().getColumn(3).setMinWidth(30);
    xTableAAP.getColumnModel().getColumn(3).setMaxWidth(35);
    xTableAAP.getColumnModel().getColumn(4).setMinWidth(90);
    xTableAAP.getColumnModel().getColumn(5).setMinWidth(150);
    xTableAAP.getColumnModel().getColumn(6).setMinWidth(140);
    xTableAAP.getColumnModel().getColumn(7).setMinWidth(140);
    xTableAAP.getSelectionModel().addListSelectionListener(this);

    ColumnInfo[] layoutDetails =
        new ColumnInfo[] {

          // 0 Proveedor
          new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), ".", String.class),

          // 1 Mes
          new ColumnInfo(Msg.translate(Env.getCtx(), "Month"), ".", Integer.class),

          // 2 Año
          new ColumnInfo(Msg.translate(Env.getCtx(), "Year"), ".", Integer.class),

          // 3 Departamento
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_VMR_Department_ID"), ".", String.class),

          // 4 Categoría
          new ColumnInfo(Msg.translate(Env.getCtx(), "Categoria"), ".", String.class),

          // 5 Descuento
          new ColumnInfo(Msg.translate(Env.getCtx(), "XX_PubAmountDisc"), ".", float.class)
        };

    xTableDetails.prepareTable(layoutDetails, "", "", true, "");

    //  Visual
    CompiereColor.setBackground(this);
    xTableDetails.getSelectionModel().addListSelectionListener(this);
    xTableDetails.getColumnModel().getColumn(0).setMinWidth(350);
    xTableDetails.getColumnModel().getColumn(1).setMinWidth(25);
    xTableDetails.getColumnModel().getColumn(1).setMaxWidth(30);
    xTableDetails.getColumnModel().getColumn(2).setMinWidth(30);
    xTableDetails.getColumnModel().getColumn(2).setMaxWidth(35);
    xTableDetails.getColumnModel().getColumn(3).setMinWidth(190);
    xTableDetails.getColumnModel().getColumn(4).setMinWidth(150);
    xTableDetails.getColumnModel().getColumn(5).setMinWidth(120);
    xTableDetails.getSelectionModel().addListSelectionListener(this);

    bSearch.addActionListener(this);
    bReset.addActionListener(this);

    // Se cargan los acuerdos
    tableInit_option = 0;
    tableInit();
    tableDetailsInit();
    totalCalculation();

    xTableACC.getTableHeader().setReorderingAllowed(false);
    xTableAAP.getTableHeader().setReorderingAllowed(false);
    xTableDetails.getTableHeader().setReorderingAllowed(false);
    // xTable.setAutoResizeMode(3);
    // data();

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

    // estatus
    statusBar.setStatusLine("Acuerdos Comerciales y Cartas Compromiso");
    statusBar.setStatusDB(xTableACC.getRowCount() + xTableAAP.getRowCount());
  } //  dynInit
コード例 #6
0
  /** Dynamic Init. Table Layout, Visual, Listener */
  private void dynInit() {

    // Add the column definition for the table
    xProductTable.addColumn(" ");
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "ProductKey"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "VendorProductRef"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_Product"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_PriceConsecutive"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_ProductQty"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_LabelQty"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_Category"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_Department_I"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_Line_I"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "XX_Section_I"));
    xProductTable.addColumn(Msg.translate(Env.getCtx(), "AttributeSetInstance"));
    xProductTable.setMultiSelection(true);

    xProductTable.setColumnClass(0, IDColumn.class, false);
    xProductTable.setColumnClass(1, String.class, true);
    xProductTable.setColumnClass(2, KeyNamePair.class, true);
    xProductTable.setColumnClass(3, KeyNamePair.class, true);
    xProductTable.setColumnClass(4, String.class, true);
    xProductTable.setColumnClass(5, Integer.class, true);
    xProductTable.setColumnClass(6, Integer.class, false);
    xProductTable.setColumnClass(7, KeyNamePair.class, true);
    xProductTable.setColumnClass(8, KeyNamePair.class, true);
    xProductTable.setColumnClass(9, KeyNamePair.class, true);
    xProductTable.setColumnClass(10, KeyNamePair.class, true);
    xProductTable.setColumnClass(11, KeyNamePair.class, true);

    CompiereColor.setBackground(this);
    xProductTable.setRowHeight(xProductTable.getRowHeight() + 2);
    generate.addActionListener(this);
    markall.addActionListener(this);

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

    xProductTable.addKeyListener(
        new KeyListener() {

          @Override
          public void keyTyped(KeyEvent e) {}

          @Override
          public void keyReleased(KeyEvent e) {

            int row = xProductTable.getSelectedColumn();
            int column = xProductTable.getSelectedRow();
            xProductTable.editCellAt(column, row);
          }

          @Override
          public void keyPressed(KeyEvent e) {}
        });
    xProductTable.getTableHeader().setReorderingAllowed(false);
    xProductTable.getModel().addTableModelListener(this);
    xProductTable.autoSize(true);
    xProductTable.repaint();
  } //  dynInit
コード例 #7
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