コード例 #1
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