Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
  public void refresh() {
    Iterable<Property> properties = Collections.emptyList();

    if (beanHelper != null) {
      Image icon = beanHelper.getIcon(BeanInfo.ICON_COLOR_32x32);
      if (icon == null) {
        remove(top);
      } else {
        JXImageView logo = new JXImageView();
        logo.setImage(icon);
        add(logo, BorderLayout.NORTH);
      }
      properties =
          filter(
              beanHelper.getProperties(),
              new Predicate<Property>() {
                @Override
                public boolean apply(Property input) {
                  return !input.isHidden();
                }
              });
    }

    table.setModel(new MyTableModel(properties));

    // should we expose minimum row/column sizes as a user property?
    table.setRowHeight(18); // essentially the minimum row height
    table.getColumnModel().getColumn(0).setMinWidth(1);
    table.getColumnModel().getColumn(0).setMaxWidth(1);
    table.getColumnModel().getColumn(1).setMinWidth(1);

    table.packAll();
    revalidate();
  }
Esempio n. 3
0
 private void updateForm() {
   if (logger.isDebugEnabled()) {
     logger.debug("Actualizando validaciones");
   }
   updateComponentTreeMandatoryAndSeverity(model.getValidationModel().getResult(), getControl());
   getOKAction().setEnabled(!model.getValidationModel().hasErrors());
   grid.packAll();
 }
Esempio n. 4
0
  /**
   * Laster import
   *
   * @param bunt
   */
  void loadImport(Bunt bunt) {
    deductImportList.clear();

    List<AvdelingAvregningBelop> belop = avdelingAvregningBelopManager.findByBunt(bunt);

    if (belop != null) {
      deductImportList.addAll(belop);
    }
    table.packAll();
  }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
  /**
   * Viser rapport
   *
   * @param window
   */
  void showReport(WindowInterface window) {
    GuiUtil.setWaitCursor(window);
    Batchable batch = (Batchable) batchSelectionList.getSelection();
    if (batch != null) {
      List<ReconcilVInterface> lines = reconcilVManager.findByBatchId(batch.getBatchId());

      if (lines != null) {
        reportList.clear();
        reportList.addAll(lines);
      }
    }
    table.packAll();
    GuiUtil.setDefaultCursor(window);
  }
Esempio n. 7
0
  /**
   * Lager tabell for avregningimport
   *
   * @return tabell
   */
  public JXTable getTableImport() {
    table = new JXTable();

    table.setModel(new DeductImportTableModel(deductImportSelectionList));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setSelectionModel(
        new SingleListSelectionAdapter(deductImportSelectionList.getSelectionIndexHolder()));
    table.setColumnControlVisible(true);
    deductImportSelectionList.clearSelection();

    table.packAll();
    table.setSortable(true);
    return table;
  }
Esempio n. 8
0
  /**
   * Lager tabell for rapport
   *
   * @return tabell
   */
  public JXTable getTableReport() {
    table = new JXTable();

    tableModel = new ReconcilTableModel(reportSelectionList);
    table.setModel(tableModel);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.setColumnControlVisible(true);
    table.setSearchable(null);

    table.setDragEnabled(false);

    table.setShowGrid(true);
    table.packAll();
    return table;
  }
Esempio n. 9
0
  public JXTable createConfigureMonthDetailsTable(LinkTableModel dateTableModel) {

    JXTable table = new JXTable();
    table.setCellSelectionEnabled(true);
    table.setVisibleRowCount(6);
    table.setFont(monthView.getFont());
    table.setShowGrid(false, false);

    configureDayOfWeeksHeader(table);
    table.setDefaultRenderer(
        Date.class,
        createDateRenderer(dateTableModel.selectAction, paddingBoxBorder, JLabel.TRAILING));

    table.setHighlighters(createCurrentDateHighlighters());
    table.setModel(dateTableModel);
    table.packAll();
    Component comp = table.prepareRenderer(table.getCellRenderer(1, 1), 1, 1);
    table.setRowHeight(comp.getPreferredSize().height);

    return table;
  }
Esempio n. 10
0
  protected JComponent buildGridPanel() {
    grid = ComponentUtils.getStandardTable();
    grid.setColumnControlVisible(false);
    source = new BasicEventList();
    final EventList<MatcherEditor> editors = new BasicEventList<MatcherEditor>();
    editors.add(
        new TextComponentMatcherEditor(
            inputField,
            GlazedLists.textFilterator(
                new String[] {"documento", "sucursal.nombre", "clave", "nombre"})));
    final MatcherEditor editor = new CompositeMatcherEditor(editors);
    final FilterList filterList = new FilterList(source, new ThreadedMatcherEditor(editor));
    SortedList sorted = new SortedList(filterList, null);
    final EventTableModel tm = new EventTableModel(sorted, getTableFormat());
    selectionModel = new EventSelectionModel(sorted);

    grid.setModel(tm);
    TableComparatorChooser.install(grid, sorted, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE);
    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();
          }
        });
    grid.packAll();

    JComponent c = ComponentUtils.createTablePanel(grid);
    c.setPreferredSize(new Dimension(750, 400));
    return c;
  }
Esempio n. 11
0
 /** LifeCycle * */
 public void iniciarPago() {
   grid.packAll();
   // model.validate();
   updateForm();
 }