/* * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { TableModel old = (TableModel) evt.getOldValue(); TableModel knew = (TableModel) evt.getNewValue(); if (old != null) old.removeTableModelListener(autoTailTracker_); if (knew != null) knew.addTableModelListener(autoTailTracker_); }
// // Implement the PropertyChangeListener // public void propertyChange(PropertyChangeEvent e) { // When the TableModel changes we need to update the listeners // and column widths if ("model".equals(e.getPropertyName())) { TableModel model = (TableModel) e.getOldValue(); model.removeTableModelListener(this); model = (TableModel) e.getNewValue(); model.addTableModelListener(this); adjustColumns(); } }
/** Assing an UjoTableModel only. */ @Override public void setModel(TableModel dataModel) { if (dataModel instanceof UjoTableModel) { super.setModel(dataModel); // Add A Model Change Listener. dataModel.addTableModelListener( new TableModelListener() { public void tableChanged(TableModelEvent e) { if (e.getColumn() == TableModelEvent.ALL_COLUMNS) { submitEditMode(e.getType() != TableModelEvent.DELETE); } } }); } }
private void setupInfoColumnControllerBindings() { for (int i = 0; i < p_layout.length; i++) { final int columnIndexModel = i; final Info_Column infoColumn = p_layout[columnIndexModel]; final IInfoColumnController columnController = infoColumn.getColumnController(); final List<Info_Column> dependentColumns = infoColumn.getDependentColumns(); if (columnController == null && (dependentColumns == null || dependentColumns.isEmpty())) { // if there is no controller on this column and there are no dependent columns // then there is no point for adding a binder continue; } final TableModel tableModel = getTableModel(); final InfoColumnControllerBinder binder = new InfoColumnControllerBinder(this, infoColumn, columnIndexModel); tableModel.addTableModelListener(binder); } }
/** * Overriden to register a listener on the model. This listener ensures editing is cancelled when * editing row is being changed. * * @throws IllegalArgumentException if dataModel is not a {@link PropertySheetTableModel} * @see javax.swing.JTable#setModel(javax.swing.table.TableModel) */ public void setModel(TableModel newModel) { if (!(newModel instanceof PropertySheetTableModel)) { throw new IllegalArgumentException( "dataModel must be of type " + PropertySheetTableModel.class.getName()); } if (cancelEditing == null) { cancelEditing = new CancelEditing(); } TableModel oldModel = getModel(); if (oldModel != null) { oldModel.removeTableModelListener(cancelEditing); } super.setModel(newModel); newModel.addTableModelListener(cancelEditing); // ensure the "value" column can not be resized getColumnModel().getColumn(1).setResizable(false); }
public void addTableModelListener(TableModelListener l) { original.addTableModelListener(l); }
/** Create the main JFrame */ public Driver() { frame = (JFrame) this; setTitle("RIDVentory v2.1.2"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Creates connection to controller control = Controller.getInstance(); setBounds(100, 100, 593, 370); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {577, 0}; gridBagLayout.rowHeights = new int[] {332, 0}; gridBagLayout.columnWeights = new double[] {0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[] {0.0, Double.MIN_VALUE}; getContentPane().setLayout(gridBagLayout); // Create Menu TopMenuBar topMenu = new TopMenuBar(); this.setJMenuBar(topMenu.createMenuBar()); // Popup Menus // Category Menu final JPopupMenu popupCat = new JPopupMenu(); final JMenuItem addCat = new JMenuItem("Add Category"); final JMenuItem editCat = new JMenuItem("Edit Category"); final JMenuItem deleteCat = new JMenuItem("Delete Category"); popupCat.add(addCat); popupCat.add(editCat); popupCat.add(deleteCat); // Brand Menu final JPopupMenu popupBrand = new JPopupMenu(); final JMenuItem addBrand = new JMenuItem("Add Brand"); final JMenuItem editBrand = new JMenuItem("Edit Brand"); final JMenuItem deleteBrand = new JMenuItem("Delete Brand"); popupBrand.add(addBrand); popupBrand.add(editBrand); popupBrand.add(deleteBrand); GridBagConstraints gbc_table = new GridBagConstraints(); gbc_table.gridwidth = 3; gbc_table.fill = GridBagConstraints.BOTH; gbc_table.insets = new Insets(0, 0, 5, 0); gbc_table.gridx = 0; gbc_table.gridy = 0; gbc_table.weightx = 1; gbc_table.weighty = 1; GridBagConstraints gbc_buttonPanel = new GridBagConstraints(); gbc_buttonPanel.insets = new Insets(0, 0, 5, 5); gbc_buttonPanel.fill = GridBagConstraints.BOTH; gbc_buttonPanel.gridx = 0; gbc_buttonPanel.gridy = 0; gbc_buttonPanel.weightx = 1; gbc_buttonPanel.weighty = 1; GridBagConstraints gbc_list = new GridBagConstraints(); gbc_list.insets = new Insets(0, 0, 5, 0); gbc_list.anchor = GridBagConstraints.NORTHWEST; gbc_list.gridx = 1; gbc_list.gridy = 0; gbc_list.weightx = 1; gbc_list.weighty = 1; GridBagConstraints gbc_topMenu = new GridBagConstraints(); gbc_topMenu.insets = new Insets(0, 0, 5, 0); gbc_topMenu.anchor = GridBagConstraints.NORTHWEST; gbc_topMenu.gridx = 1; gbc_topMenu.gridy = 0; gbc_topMenu.weightx = 1; gbc_topMenu.weighty = 1; JSplitPane splitPane = new JSplitPane(); splitPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); GridBagConstraints gbc_splitPane = new GridBagConstraints(); gbc_splitPane.weighty = 1.0; gbc_splitPane.weightx = 1.0; gbc_splitPane.fill = GridBagConstraints.BOTH; gbc_splitPane.gridx = 0; gbc_splitPane.gridy = 0; getContentPane().add(splitPane, gbc_splitPane); JPanel rightPanel = new JPanel(); splitPane.setRightComponent(rightPanel); GridBagLayout gbl_rightPanel = new GridBagLayout(); gbl_rightPanel.columnWidths = new int[] {499, 0}; gbl_rightPanel.rowHeights = new int[] {281, 0}; gbl_rightPanel.columnWeights = new double[] {0.0, Double.MIN_VALUE}; gbl_rightPanel.rowWeights = new double[] {0.0, Double.MIN_VALUE}; rightPanel.setLayout(gbl_rightPanel); table = new JTable() { /** */ private static final long serialVersionUID = 1L; public boolean isCellEditable(int rowIndex, int vColIndex) { if (vColIndex > 0) // ID is not editable return true; else return false; } }; table.setFillsViewportHeight(true); table.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.setAlignmentY(Component.BOTTOM_ALIGNMENT); // Load table data tableData = control.loadTableData(); final TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<DefaultTableModel>((DefaultTableModel) tableData); table.setModel(tableData); table.setRowSorter(sorter); // Change it so load is only called once (Store results of load call and use it for list) catCellEditor = new JComboBox<String>(control.loadCategories()); brandCellEditor = new JComboBox<String>(control.loadBrands()); // Make model editor a dropdown (Make dynamic in the future) categoryColumn = table.getColumnModel().getColumn(3); brandColumn = table.getColumnModel().getColumn(4); categoryColumn.setCellEditor(new DefaultCellEditor(catCellEditor)); brandColumn.setCellEditor(new DefaultCellEditor(brandCellEditor)); // Right main pane JSplitPane splitPaneMain = new JSplitPane(); splitPaneMain.setBorder(null); splitPaneMain.setDividerSize(-1); splitPaneMain.setResizeWeight(1.0); splitPaneMain.setPreferredSize(new Dimension(187, 25)); splitPaneMain.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); GridBagConstraints gbc_splitPaneMain = new GridBagConstraints(); gbc_splitPaneMain.weighty = 1.0; gbc_splitPaneMain.weightx = 1.0; gbc_splitPaneMain.fill = GridBagConstraints.BOTH; gbc_splitPaneMain.gridx = 0; gbc_splitPaneMain.gridy = 0; // Add split pane to main Right split pane rightPanel.add(splitPaneMain, gbc_splitPaneMain); // Right main pane, buttons row JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 2, 0, 0)); final JButton btnInsert = new JButton("Insert"); final JButton btnDelete = new JButton("Delete"); buttonPanel.add(btnInsert); buttonPanel.add(btnDelete); // Set components splitPaneMain.setTopComponent(new JScrollPane(table)); splitPaneMain.setBottomComponent(buttonPanel); JPanel leftPanel = new JPanel(); splitPane.setLeftComponent(leftPanel); GridBagLayout gbl_leftPanel = new GridBagLayout(); gbl_leftPanel.columnWidths = new int[] {71, 0}; gbl_leftPanel.rowHeights = new int[] {34, 0}; gbl_leftPanel.columnWeights = new double[] {0.0, Double.MIN_VALUE}; gbl_leftPanel.rowWeights = new double[] {0.0, Double.MIN_VALUE}; leftPanel.setLayout(gbl_leftPanel); // Left Split panel JSplitPane splitPaneLists = new JSplitPane(); splitPaneLists.setResizeWeight(0.5); splitPaneLists.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); GridBagConstraints gbc_splitPaneLists = new GridBagConstraints(); gbc_splitPaneLists.anchor = GridBagConstraints.NORTHWEST; gbc_splitPaneLists.gridx = 0; gbc_splitPaneLists.gridy = 0; gbc_splitPaneLists.weightx = 1; gbc_splitPaneLists.weighty = 1; gbc_splitPaneLists.fill = GridBagConstraints.BOTH; leftPanel.add(splitPaneLists, gbc_splitPaneLists); // Right list final JList<String> brandList = new JList<String>(); brandList.setLayoutOrientation(JList.VERTICAL_WRAP); brandList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); brandList.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); brandList.setAlignmentX(Component.RIGHT_ALIGNMENT); brandList.setAlignmentY(Component.TOP_ALIGNMENT); brandList.setModel(control.loadListBrands()); brandList.setSelectedIndex(0); final ListSelectionModel brandListSelectionModel = (ListSelectionModel) brandList.getSelectionModel(); splitPaneLists.setRightComponent(brandList); // Left List final JList<String> categoryList = new JList<String>(); categoryList.setLayoutOrientation(JList.VERTICAL_WRAP); categoryList.setVisible(true); categoryList.setAlignmentY(Component.TOP_ALIGNMENT); categoryList.setAlignmentX(Component.LEFT_ALIGNMENT); categoryList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ListSelectionModel catListSelectionModel = categoryList.getSelectionModel(); // Created to add listener categoryList.setModel(control.loadListCategories()); categoryList.setSelectedIndex(0); splitPaneLists.setLeftComponent(categoryList); table.addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { Point p = e.getPoint(); int rowNumber = table.rowAtPoint(p); if (Debug.LEVEL > 1) System.out.println("Row " + rowNumber + " selected"); } } }); btnDelete.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { int selectedRow = table.getSelectedRow(); String name = (String) table.getModel().getValueAt(selectedRow, 1); if (selectedRow != -1) { int answer = JOptionPane.showConfirmDialog( frame, "Are you sure you want to erase product " + name + "?\n", "Are you sure?", JOptionPane.YES_NO_OPTION); if (answer == JOptionPane.YES_OPTION) { if (Debug.LEVEL > 1) System.out.println("Row " + selectedRow + " Deleted"); DefaultTableModel model = (DefaultTableModel) table.getModel(); // Call Delete in controller int id = (int) model.getValueAt(selectedRow, 0); if (control.deleteItem(id) == -1) { JOptionPane.showMessageDialog( frame, "Error: Item could not be erased", "Error", JOptionPane.ERROR_MESSAGE); } if (Debug.LEVEL > 2) System.out.println("Product ID " + id); // Delete it from table model model.removeRow(selectedRow); } } } }); btnInsert.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { InsertItem dialog = new InsertItem(table.getModel()); dialog.setVisible(true); btnInsert.setEnabled(false); // Disable insert button so no multiple inserts btnDelete.setEnabled(false); // Put a listener on the window to determine when it closes dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { // Notify table that data has changed to rerun filter // fireTableCellUpdated ((DefaultTableModel) tableData).fireTableDataChanged(); btnInsert.setEnabled(true); // Re-Enable insert button btnDelete.setEnabled(true); if (Debug.LEVEL > 3) System.out.println("Insert item window closed"); } }); } }); categoryList.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { Point p = e.getPoint(); int itemChosen = categoryList.locationToIndex(p); // Make sure an item is chosen if (itemChosen > 0) // Greater than 0 to skip All { // Mark item as selected categoryList.setSelectedIndex(itemChosen); // Check if Delete Menu Item is on if (!popupDeleteOnCat) { popupCat.add(editCat); popupCat.add(deleteCat); // If not on, add it popupDeleteOnCat = true; } } else { // Check if Delete is on if (popupDeleteOnCat) { popupCat.remove(1); // Delete edit if turned on popupCat.remove(1); // Delete delete if turned on popupDeleteOnCat = false; } } popupCat.show(frame, e.getX(), e.getY()); if (Debug.LEVEL > 0) System.out.println("Category List Item Chosen: " + itemChosen); } } }); brandList.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { Point p = e.getPoint(); int itemChosen = brandList.locationToIndex(p); // Make sure an item has been chosen if (itemChosen > 0) // Greater than 0 because 0 is All { // Mark item as selected brandList.setSelectedIndex(itemChosen); // Check if Delete Menu Item is not on the menu if (!popupDeleteOnBrand) { popupBrand.add(editBrand); popupBrand.add(deleteBrand); // If not on, add it popupDeleteOnBrand = true; } } else { // Check if Delete is on the menu if (popupDeleteOnBrand) { popupBrand.remove(1); // Delete edit popupBrand.remove(1); // Delete delete if turned on popupDeleteOnBrand = false; } } popupBrand.show(frame, e.getX(), e.getY()); if (Debug.LEVEL > 0) System.out.println("Brand List Item Chosen: " + itemChosen); } } }); // Selected index listeners catListSelectionModel.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) // Proceed if values aren't being changed { int index = categoryList.getSelectedIndex(); if (index >= 0) // Make sure you're actually working on an item { String category = (String) categoryList.getModel().getElementAt(index); index = brandList.getSelectedIndex(); String brand = (String) brandList.getModel().getElementAt(index); // Call filter update sorter.setRowFilter(control.createFilter(category, brand)); // debug if (Debug.LEVEL > 0) System.out.println("Category List Index Chosen: " + index); } } } }); // Selected index listeners brandListSelectionModel.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) // Proceed if values aren't being changed { int indexCat = categoryList.getSelectedIndex(); int indexBrand = brandList.getSelectedIndex(); if (indexCat >= 0 && indexBrand >= 0) // Make sure you're actually working on an item { String category = (String) categoryList.getModel().getElementAt(indexCat); String brand = (String) brandList.getModel().getElementAt(indexBrand); // Call filter update sorter.setRowFilter(control.createFilter(category, brand)); } } } }); addCat.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { String newCat = (String) JOptionPane.showInputDialog( frame, "Enter the name of the new Category:", "Add New Category", JOptionPane.PLAIN_MESSAGE, null, null, null); if (newCat == null) { return; // Don't do anything } if (newCat.isEmpty() || newCat == "") { JOptionPane.showMessageDialog( frame, "No input encountered", "New category was not created", JOptionPane.ERROR_MESSAGE); return; // Don't do anything } String result = control.addCategory(newCat); // Input checking needs to be added before beta 2 if (result != null) { JOptionPane.showMessageDialog( frame, result, "SQL Error Encountered", JOptionPane.ERROR_MESSAGE); return; } // Add category to list DefaultListModel<String> model = (DefaultListModel<String>) categoryList.getModel(); model.addElement(newCat); catCellEditor.addItem(newCat); } }); deleteCat.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int catChosenIndex = categoryList.getSelectedIndex(); String catName = (String) categoryList.getSelectedValue(); // System.out.println(catChosen); int answer = JOptionPane.showConfirmDialog( frame, "Are you sure you want to delete category " + catName + "?\n", "Are you sure?", JOptionPane.YES_NO_OPTION); if (answer == JOptionPane.YES_OPTION) { if (control.deleteCategory(catName) != 0) { JOptionPane.showMessageDialog( frame, "Unable to erase category (category must not be used by any items)", "SQL Error Encountered", JOptionPane.ERROR_MESSAGE); return; } DefaultListModel<String> model = (DefaultListModel<String>) categoryList.getModel(); categoryList.clearSelection(); model.removeElementAt(catChosenIndex); catCellEditor.removeItem(catName); categoryList.setSelectedIndex(0); } } }); addBrand.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { String newBrand = (String) JOptionPane.showInputDialog( frame, "Enter the name of the new Brand:", "Add New Category", JOptionPane.PLAIN_MESSAGE, null, null, null); if (newBrand == null) { return; // Don't do anything } if (newBrand.isEmpty() || newBrand == "") { JOptionPane.showMessageDialog( frame, "No input encountered", "New category was not created", JOptionPane.ERROR_MESSAGE); return; // Don't do anything } String result = control.addBrand(newBrand); // Input checking needs to be added before beta 2 if (result != null) { JOptionPane.showMessageDialog( frame, result, "SQL Error Encountered", JOptionPane.ERROR_MESSAGE); return; } // Add category to list DefaultListModel<String> model = (DefaultListModel<String>) brandList.getModel(); model.addElement(newBrand); brandCellEditor.addItem(newBrand); } }); deleteBrand.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int brandChosenIndex = brandList.getSelectedIndex(); String brandName = (String) brandList.getSelectedValue(); System.out.println(brandChosenIndex); int answer = JOptionPane.showConfirmDialog( frame, "Are you sure you want to delete category " + brandName + "?\n", "Are you sure?", JOptionPane.YES_NO_OPTION); if (answer == JOptionPane.YES_OPTION) { if (control.deleteBrand(brandName) != 0) { JOptionPane.showMessageDialog( frame, "Unable to erase category (category must not be used by any items)", "SQL Error Encountered", JOptionPane.ERROR_MESSAGE); return; } DefaultListModel<String> model = (DefaultListModel<String>) brandList.getModel(); // brandList.clearSelection(); model.removeElementAt(brandChosenIndex); brandCellEditor.removeItem(brandName); // Use name to allow flexibility in future brandList.setSelectedIndex(0); // Reset to all } } }); // Data change listener tableData.addTableModelListener( new TableModelListener() { public void tableChanged(TableModelEvent e) { try { int row = e.getFirstRow(); int column = e.getColumn(); String columnName = tableData.getColumnName(column); int itemID = (int) tableData.getValueAt(row, 0); Object data = tableData.getValueAt(row, column); if (Debug.LEVEL > 0) { System.out.println( "Cell Edited at " + row + " " + column + ": " + columnName + " " + data + " ID: " + itemID); } int rowsUpdated = control.updateItem(itemID, columnName, data); if (rowsUpdated == 0) { System.out.println("Failed to update, changes reverted"); JOptionPane.showMessageDialog( frame, "Edit was invalid, please verify value is correct", "SQL Error Encountered", JOptionPane.ERROR_MESSAGE); // ((RidvTableModel)tableData).undoChange(); } } catch (ArrayIndexOutOfBoundsException exception) { // Temp fix for data insertion bypass } } }); }
/** * Sets the model. * * @param model The model that will be set as the model of this class. */ public void setModel(TableModel model) { this.model = model; model.addTableModelListener(this); }
/** Creates a new instance of FixedTableModel */ public FixedTableModel(TableModel link) { link.addTableModelListener(this); sourceModel = link; setRowCount(1); }
/** * Create a table for quantitative protein data with a given table model * * @param tableModel quant protein table model * @return JTable quant protein table */ public static JTable createQuantProteinTable( DataAccessController controller, TableModel tableModel) { DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt(); DefaultPrideTable quantProteinTable = new DefaultPrideTable(tableModel, columnModel); quantProteinTable.setAutoCreateColumnsFromModel(false); // add table model change listener tableModel.addTableModelListener(new BarChartColumnListener(quantProteinTable)); // in case the compare doesn't exist List<TableColumn> columns = columnModel.getColumns(true); for (TableColumn column : columns) { if (column.getHeaderValue().equals(QuantProteinTableModel.TableHeader.COMPARE.getHeader())) { column.setMaxWidth(25); } } // hide mapped protein accession String mappedProtAccHeader = QuantProteinTableModel.TableHeader.MAPPED_PROTEIN_ACCESSION_COLUMN.getHeader(); TableColumnExt mappedProtAccColumn = (TableColumnExt) quantProteinTable.getColumn(mappedProtAccHeader); mappedProtAccColumn.setCellRenderer(new HyperLinkCellRenderer()); // add hyper link click listener quantProteinTable.addMouseMotionListener( new TableCellMouseMotionListener(quantProteinTable, mappedProtAccHeader)); quantProteinTable.addMouseListener( new HyperLinkCellMouseClickListener( quantProteinTable, mappedProtAccHeader, new ProteinAccHyperLinkGenerator())); TableColumnExt proteinIdColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.IDENTIFICATION_ID.getHeader()); proteinIdColumn.setVisible(false); // hide the protein name column TableColumnExt proteinNameColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.PROTEIN_NAME.getHeader()); proteinNameColumn.setVisible(false); // protein status column TableColumnExt proteinStatusColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.PROTEIN_STATUS.getHeader()); proteinStatusColumn.setVisible(false); // sequence coverage column TableColumnExt seqCoverageColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.PROTEIN_SEQUENCE_COVERAGE.getHeader()); seqCoverageColumn.setCellRenderer(new SequenceCoverageRenderer()); seqCoverageColumn.setVisible(false); // isoelectric point column TableColumnExt isoelectricColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.THEORITICAL_ISOELECTRIC_POINT_COLUMN .getHeader()); isoelectricColumn.setVisible(false); // score TableColumnExt proteinScoreColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.IDENTIFICATION_SCORE_COLUMN.getHeader()); proteinScoreColumn.setVisible(false); // threshold TableColumnExt proteinThresholdColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.IDENTIFICATION_THRESHOLD_COLUMN.getHeader()); proteinThresholdColumn.setVisible(false); // number of peptides TableColumnExt numOfPeptideColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.NUMBER_OF_PEPTIDES.getHeader()); numOfPeptideColumn.setVisible(false); // number of unique peptides TableColumnExt numOfUniquePeptideColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.NUMBER_OF_UNIQUE_PEPTIDES.getHeader()); numOfUniquePeptideColumn.setVisible(false); // number of ptms TableColumnExt numOfPtmColumn = (TableColumnExt) quantProteinTable.getColumn( QuantProteinTableModel.TableHeader.NUMBER_OF_PTMS.getHeader()); numOfPtmColumn.setVisible(false); // additional column String additionalColHeader = ProteinTableModel.TableHeader.ADDITIONAL.getHeader(); TableColumnExt additionalCol = (TableColumnExt) quantProteinTable.getColumn(additionalColHeader); Icon icon = GUIUtilities.loadIcon( Desktop.getInstance().getDesktopContext().getProperty("view.detail.small.icon")); additionalCol.setCellRenderer(new IconRenderer(icon)); additionalCol.setMaxWidth(50); additionalCol.setVisible(false); // add mouse motion listener quantProteinTable.addMouseMotionListener( new TableCellMouseMotionListener(quantProteinTable, additionalColHeader)); quantProteinTable.addMouseListener( new ShowParamsMouseListener(controller, quantProteinTable, additionalColHeader)); return quantProteinTable; }
public void addTableModelListener(final TableModelListener l) { model.addTableModelListener(l); }