/** * 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; }
/** * 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; }
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; }
/** Initialize the GUI */ private void init() { setLayout(new BorderLayout(0, 0)); JPanel panelMain = new JPanel(); add(panelMain, BorderLayout.CENTER); panelMain.setLayout(new MigLayout("", "[grow]", "[grow]")); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); panelMain.add(scrollPane, "cell 0 0,grow"); table = new JXTable() { private static final long serialVersionUID = 1L; public void changeSelection( final int row, final int column, boolean toggle, boolean extend) { super.changeSelection(row, column, toggle, extend); if (table.isCellEditable(row, column)) { editCellAt(row, column); } } }; table.setHorizontalScrollEnabled(true); table.setColumnControlVisible(true); model = new SeriesIdentityTableModel(containerFrame); SeriesIdentityTableCellRenderer renderer = new SeriesIdentityTableCellRenderer(); table.setModel(model); table.getColumn(3).setCellRenderer(renderer); table.getColumn(4).setCellRenderer(renderer); table.getColumn(5).setCellRenderer(renderer); table.getColumn(6).setCellRenderer(renderer); table.getColumn(7).setCellRenderer(renderer); table.getColumn(8).setCellRenderer(renderer); table.getColumnExt(4).setIdentifier("SubObjectColumn"); table.getColumnExt("SubObjectColumn").setVisible(false); table .getColumnModel() .addColumnModelListener( new TableColumnModelListener() { @Override public void columnAdded(TableColumnModelEvent arg0) { chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible()); } @Override public void columnMarginChanged(ChangeEvent arg0) { // TODO Auto-generated method stub } @Override public void columnMoved(TableColumnModelEvent arg0) { // TODO Auto-generated method stub } @Override public void columnRemoved(TableColumnModelEvent arg0) { chkIncludeSubobjects.setSelected(table.getColumnExt("SubObjectColumn").isVisible()); } @Override public void columnSelectionChanged(ListSelectionEvent arg0) { // TODO Auto-generated method stub } }); scrollPane.setViewportView(table); JPanel panelButton = new JPanel(); add(panelButton, BorderLayout.SOUTH); panelButton.setLayout(new MigLayout("", "[grow][][]", "[grow][grow][][][]")); model.addTableModelListener(this); JPanel panel = new JPanel(); panelButton.add(panel, "cell 0 1 1 2,grow"); panel.setLayout(new MigLayout("", "[31px][162px]", "[16px][][]")); JLabel lblKey = new JLabel("Key:"); panel.add(lblKey, "cell 0 0,alignx left,aligny top"); JLabel lblPresentIn = new JLabel("= Present in database"); lblPresentIn.setFont(new Font("Dialog", Font.PLAIN, 12)); lblPresentIn.setIcon(Builder.getIcon("found.png", 16)); panel.add(lblPresentIn, "flowy,cell 1 0,alignx left,aligny top"); JLabel lblAbsentFrom = new JLabel("= Absent from database"); lblAbsentFrom.setFont(new Font("Dialog", Font.PLAIN, 12)); lblAbsentFrom.setIcon(Builder.getIcon("missing.png", 16)); panel.add(lblAbsentFrom, "cell 1 1,alignx left,aligny top"); JLabel lblNotYet = new JLabel("= Not yet searched"); lblNotYet.setFont(new Font("Dialog", Font.PLAIN, 12)); lblNotYet.setIcon(Builder.getIcon("wait.png", 16)); panel.add(lblNotYet, "cell 1 2,alignx left,aligny top"); JPanel panel_1 = new JPanel(); panelButton.add(panel_1, "cell 1 1 2 2,alignx right,growy"); panel_1.setLayout(new MigLayout("", "[116px,fill]", "[22px][][][]")); JButton btnSearchDB = new JButton("Search Database"); btnSearchDB.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnSearchDB, "cell 0 0,alignx left,aligny top"); btnSearchDB.setActionCommand("SearchDB"); JButton btnDefineByPattern = new JButton("Define names by pattern"); btnDefineByPattern.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnDefineByPattern, "cell 0 1,alignx left,aligny top"); btnDefineByPattern.setActionCommand("DefineByPattern"); JButton btnGenerateMissing = new JButton("Generate missing entities"); btnGenerateMissing.setActionCommand("GenerateMissing"); btnGenerateMissing.addActionListener(this); JButton btnSetDefaults = new JButton("Set default parameters"); btnSetDefaults.setActionCommand("SetDefaults"); btnSetDefaults.addActionListener(this); btnSetDefaults.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnSetDefaults, "cell 0 2"); btnGenerateMissing.setFont(new Font("Dialog", Font.BOLD, 9)); panel_1.add(btnGenerateMissing, "flowy,cell 0 3"); btnDefineByPattern.addActionListener(this); btnSearchDB.addActionListener(this); chkIncludeSubobjects = new JCheckBox("Include sub-objects in import"); chkIncludeSubobjects.addActionListener(this); chkIncludeSubobjects.setActionCommand("IncludeExcludeSubObjects"); panelButton.add(chkIncludeSubobjects, "cell 0 3"); chckbxOpenSeriesIn = new JCheckBox("Open series in editor when finished"); chckbxOpenSeriesIn.setSelected(true); panelButton.add(chckbxOpenSeriesIn, "cell 0 4"); }
public DownloadsMDIWindow(final UISubsystem ui) throws Exception { super(ui.getMainWindow().getMDIManager(), "downloads", ui); table = new JXTable(); table.setModel(model = new DownloadsTableModel()); table.setAutoCreateColumnsFromModel(false); table.getColumnModel().getColumn(1).setCellRenderer(new ProgressBarCellRenderer()); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(80); status = (JLabel) xui.getComponent("status"); downloadingFromText = (JLabel) xui.getComponent("downloadingfromtext"); uploadingToText = (JLabel) xui.getComponent("uploadingtotext"); setFixedColumnSize(table.getColumnModel().getColumn(2), 60); setFixedColumnSize(table.getColumnModel().getColumn(3), 60); setFixedColumnSize(table.getColumnModel().getColumn(4), 60); setFixedColumnSize(table.getColumnModel().getColumn(5), 10); table.setColumnControlVisible(true); downloadGrid = (JDownloadGrid) xui.getComponent("downloadgrid"); table .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getFirstIndex() < 0 || e.getFirstIndex() >= rows.size()) { downloadGrid.setDownload(null); updateDownloadingFromAndUploadingToText(); return; } selectDownloadToShowOnDownloadGrid(); updateDownloadingFromAndUploadingToText(); } }); table.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } @Override public void mouseClicked(MouseEvent e) {} private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { int row = table.rowAtPoint(e.getPoint()); boolean b = false; for (int r : table.getSelectedRows()) { if (r == row) { b = true; break; } } if (!b) { table.getSelectionModel().setSelectionInterval(row, row); } popup.show(e.getComponent(), e.getX(), e.getY()); } } }); // table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setColumnSelectionAllowed(false); ((JScrollPane) xui.getComponent("scroll")).setViewportView(table); popup = (JPopupMenu) xui.getComponent("popup"); update(); setTitle("Downloads"); listenExternalLinks(); postInit(); }