コード例 #1
0
ファイル: AbstractSelector.java プロジェクト: rcancino/sw2
 /**
  * Metodo para construir el grid. Subclaseses recomendable que ejecuten super.buildGrid antes de
  * iniciar una personalizacion de este metodo
  *
  * @return
  */
 protected JXTable buildGrid() {
   final EventTableModel<T> tm = new EventTableModel<T>(sortedSource, getTableFormat());
   selectionModel = new EventSelectionModel(sortedSource);
   selectionModel.setSelectionMode(getSelectionMode());
   final JXTable grid = ComponentUtils.getStandardTable();
   grid.setModel(tm);
   grid.setSelectionModel(selectionModel);
   final Action select =
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           doSelect();
         }
       };
   ComponentUtils.addEnterAction(grid, select);
   grid.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() == 2) doSelect();
         }
       });
   // new TableComparatorChooser(grid,sortedSource,true);
   TableComparatorChooser.install(
       grid, sortedSource, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE);
   grid.packAll();
   return grid;
 }
コード例 #2
0
ファイル: NCDescuentoForm.java プロジェクト: ArtChl/siipapwin
 private JComponent buildGridPanel() {
   final String[] props = {
     "clave",
     "factura.numero",
     "factura.fecha",
     "factura.tipo",
     "factura.total",
     "factura.pagos",
     "factura.devolucionesCred",
     "factura.saldo",
     "factura.descuentoPactado",
     "factura.cargo",
     "importe"
   };
   final String[] cols = {
     "Cliente",
     "Factura",
     "Fecha",
     "T",
     "Total",
     "Pagos",
     "Devoluciones",
     "Saldo",
     "Desc",
     "Cargo",
     "Importe"
   };
   final TableFormat<NotasDeCreditoDet> tf =
       GlazedLists.tableFormat(NotasDeCreditoDet.class, props, cols);
   final SortedList<NotasDeCreditoDet> sortedList =
       new SortedList<NotasDeCreditoDet>(model.getPartidas(), null);
   final EventTableModel<NotasDeCreditoDet> tm =
       new EventTableModel<NotasDeCreditoDet>(sortedList, tf);
   final EventSelectionModel<NotasDeCreditoDet> selectionModel =
       new EventSelectionModel<NotasDeCreditoDet>(sortedList);
   selectionModel.setSelectionMode(ListSelection.SINGLE_SELECTION);
   final Action deleteAction =
       new AbstractAction() {
         public void actionPerformed(ActionEvent e) {
           if (!selectionModel.getSelected().isEmpty()) {
             selectionModel.getSelected().remove(0);
             if (sortedList.isEmpty()) getOKAction().setEnabled(false);
           }
         }
       };
   grid = ComponentUtils.getStandardTable();
   grid.setModel(tm);
   grid.packAll();
   grid.setSelectionModel(selectionModel);
   ComponentUtils.addDeleteAction(grid, deleteAction);
   JScrollPane sp = new JScrollPane(grid);
   return sp;
 }