/** @author braisted */ public class AnalysisFileView extends javax.swing.filechooser.FileView { private Icon analysisIcon = GUIFactory.getIcon("analysis16.gif"); /** Creates a new instance of AnalysisFileView */ public AnalysisFileView() {} public String getName(File f) { return null; // let the L&F FileView figure this out } public String getDescription(File f) { return null; // let the L&F FileView figure this out } public Boolean isTraversable(File f) { return null; // let the L&F FileView figure this out } public String getTypeDescription(File f) { String extension = getExtension(f); String type = null; if (extension != null) { if (extension.equals("anl")) { type = "MeV Analysis File"; } } return type; } public Icon getIcon(File f) { String extension = getExtension(f); Icon icon = null; if (extension != null) { if (extension.equals("anl")) { icon = analysisIcon; } } return icon; } /** Get the extension of a file. */ private String getExtension(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i + 1).toLowerCase(); } return ext; } }
/** Adds viewer specific menu items. */ protected void addMenuItems(JPopupMenu menu, ActionListener listener) { JMenuItem menuItem; menuItem = new JMenuItem("Zoom In", GUIFactory.getIcon("zoom_in.gif")); menuItem.setActionCommand(ZOOM_IN); menuItem.addActionListener(listener); menu.add(menuItem); menuItem = new JMenuItem("Zoom Out", GUIFactory.getIcon("zoom_out.gif")); menuItem.setActionCommand(ZOOM_OUT); menuItem.addActionListener(listener); menu.add(menuItem); menuItem = new JMenuItem("Save Data", GUIFactory.getIcon("save16.gif")); menuItem.setActionCommand(SAVE_DATA_CMD); menuItem.addActionListener(listener); menu.add(menuItem); menuItem = new JMenuItem("Toggle Gridlines", GUIFactory.getIcon("empty16.gif")); menuItem.setActionCommand(TOGGLE_GRIDLINES_CMD); menuItem.addActionListener(listener); menu.add(menuItem); menuItemAuto = new JMenuItem("Autoscale Y-Axis", GUIFactory.getIcon("Y_range_expand.gif")); menuItemAuto.setActionCommand(AUTOSCALE_CMD); menuItemAuto.addActionListener(listener); menuItemAuto.setEnabled(false); menu.add(menuItemAuto); menuItemSetScale = new JMenuItem("Set Y-Axis", GUIFactory.getIcon("Y_range_expand.gif")); menuItemSetScale.setActionCommand(SET_SCALE_CMD); menuItemSetScale.addActionListener(listener); menu.add(menuItemSetScale); menuItemFixScale = new JMenuItem("Fix Y-Axis to Global Range", GUIFactory.getIcon("Y_range_expand.gif")); menuItemFixScale.setActionCommand(FIX_SCALE_CMD); menuItemFixScale.addActionListener(listener); menu.add(menuItemFixScale); aggGenClusterMenuItem = new JMenuItem("Aggregate Gene Cluster", GUIFactory.getIcon("empty16.gif")); aggGenClusterMenuItem.setActionCommand(AGG_GENE_CLUSTER_CMD); aggGenClusterMenuItem.setEnabled(false); aggGenClusterMenuItem.addActionListener(listener); menu.add(aggGenClusterMenuItem); }
/** * Creates new form KNNCSearchDialog * * @param parent parent frame * @param table parent table * @param modal modal selection */ public KNNCSearchDialog(javax.swing.JDialog parent, JTable table, int numClasses, boolean modal) { super(parent, modal); this.table = table; this.numClasses = numClasses; numRows = table.getRowCount(); numCols = table.getColumnCount(); numSearchCols = numCols - (numClasses + 2); foundRowIndices = new Vector(); initComponents(); this.geneBarContainerLabel.setIcon(GUIFactory.getIcon("dialog_banner2.gif")); searchButtonGroup = new ButtonGroup(); searchButtonGroup.add(this.selectAllButton); searchButtonGroup.add(this.selectIncrButton); this.setSize(250, 200); this.pack(); this.jComboBox1.setMaximumRowCount(10); searchStr = null; this.jComboBox1.setEditable(true); this.jComboBox1.insertItemAt(new String(""), 0); this.findButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { findNextButton.setEnabled(false); runSearch(); if (foundRowIndices.size() > 0 && selectIncrButton.isSelected()) findNextButton.setEnabled(true); else findNextButton.setEnabled(false); } }); this.findNextButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { findNext(); } }); this.closeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { foundRowIndices.removeAllElements(); findNextButton.setEnabled(false); selectAllButton.setSelected(true); matchCaseChkBox.setSelected(true); setVisible(false); } }); this.jComboBox1.addFocusListener( new FocusListener() { public void focusGained(FocusEvent fe) { findNextButton.setEnabled(false); findNextButton.repaint(); foundRowIndices.removeAllElements(); } public void focusLost(FocusEvent fe) {} }); }
/** This method is called from within the constructor to initialize the dialog. */ private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jComboBox1 = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); matchCaseChkBox = new javax.swing.JCheckBox(); selectAllButton = new javax.swing.JRadioButton(); selectIncrButton = new javax.swing.JRadioButton(); buttonPanel = new javax.swing.JPanel(); findButton = new javax.swing.JButton(); findNextButton = new javax.swing.JButton(); closeButton = new javax.swing.JButton(); geneBarPanel = new javax.swing.JPanel(); geneBarContainerLabel = new javax.swing.JLabel(); getContentPane().setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints1; setTitle("Search"); setName("Search"); setResizable(false); addWindowListener( new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jComboBox1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 1; gridBagConstraints1.gridy = 1; gridBagConstraints1.gridwidth = 2; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets(10, 10, 10, 10); getContentPane().add(jComboBox1, gridBagConstraints1); jLabel2.setText("Find what:"); jLabel2.setForeground(java.awt.Color.black); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.gridy = 1; gridBagConstraints1.insets = new java.awt.Insets(10, 10, 10, 10); gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST; getContentPane().add(jLabel2, gridBagConstraints1); matchCaseChkBox.setText("Match Case"); matchCaseChkBox.setFocusPainted(false); matchCaseChkBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { matchCaseChkBoxActionPerformed(evt); } }); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 1; gridBagConstraints1.gridy = 3; gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 10); getContentPane().add(matchCaseChkBox, gridBagConstraints1); selectAllButton.setToolTipText("Select all finds at once."); selectAllButton.setSelected(true); selectAllButton.setText("Select All Rows Found"); selectAllButton.setFocusPainted(false); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 2; gridBagConstraints1.gridy = 2; gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; getContentPane().add(selectAllButton, gridBagConstraints1); selectIncrButton.setToolTipText("Move throgh finds sequentially."); selectIncrButton.setText("Select Incrementally"); selectIncrButton.setFocusPainted(false); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 2; gridBagConstraints1.gridy = 3; gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; getContentPane().add(selectIncrButton, gridBagConstraints1); findButton.setText("Find"); buttonPanel.add(findButton); findNextButton.setText("Find Next"); findNextButton.setEnabled(false); buttonPanel.add(findNextButton); closeButton.setText("Close"); buttonPanel.add(closeButton); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 1; gridBagConstraints1.gridy = 4; gridBagConstraints1.gridwidth = 2; gridBagConstraints1.insets = new java.awt.Insets(10, 0, 0, 0); getContentPane().add(buttonPanel, gridBagConstraints1); geneBarContainerLabel.setToolTipText("The Institute for Genomic Research"); geneBarContainerLabel.setIconTextGap(0); this.geneBarContainerLabel.setIcon(GUIFactory.getIcon("genebar2.gif")); geneBarPanel.add(geneBarContainerLabel); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.gridy = 0; gridBagConstraints1.gridwidth = 3; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints1.weightx = 1.0; getContentPane().add(geneBarPanel, gridBagConstraints1); pack(); }