use of javax.swing.event.TreeSelectionEvent in project keystore-explorer by kaikramer.
the class DViewCertificate method initComponents.
private void initComponents(X509Certificate[] certs) throws CryptoException {
jlHierarchy = new JLabel(res.getString("DViewCertificate.jlHierarchy.text"));
jtrHierarchy = new JTree(createCertificateNodes(certs));
jtrHierarchy.setRowHeight(Math.max(18, jtrHierarchy.getRowHeight()));
jtrHierarchy.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
ToolTipManager.sharedInstance().registerComponent(jtrHierarchy);
jtrHierarchy.setCellRenderer(new CertificateTreeCellRend());
jtrHierarchy.setRootVisible(false);
TreeNode topNode = (TreeNode) jtrHierarchy.getModel().getRoot();
expandTree(jtrHierarchy, new TreePath(topNode));
jtrHierarchy.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
populateDetails();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
jspHierarchy = PlatformUtil.createScrollPane(jtrHierarchy, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jspHierarchy.setPreferredSize(new Dimension(100, 75));
jpHierarchy = new JPanel(new BorderLayout(5, 5));
jpHierarchy.add(jlHierarchy, BorderLayout.NORTH);
jpHierarchy.add(jspHierarchy, BorderLayout.CENTER);
jpHierarchy.setBorder(new EmptyBorder(5, 5, 5, 5));
GridBagConstraints gbcLbl = new GridBagConstraints();
gbcLbl.gridx = 0;
gbcLbl.gridwidth = 1;
gbcLbl.gridheight = 1;
gbcLbl.insets = new Insets(5, 5, 5, 5);
gbcLbl.anchor = GridBagConstraints.EAST;
GridBagConstraints gbcCtrl = new GridBagConstraints();
gbcCtrl.gridx = 1;
gbcCtrl.gridwidth = 1;
gbcCtrl.gridheight = 1;
gbcCtrl.insets = new Insets(5, 5, 5, 5);
gbcCtrl.anchor = GridBagConstraints.WEST;
jlVersion = new JLabel(res.getString("DViewCertificate.jlVersion.text"));
GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLbl.clone();
gbc_jlVersion.gridy = 0;
jtfVersion = new JTextField(3);
jtfVersion.setEditable(false);
jtfVersion.setToolTipText(res.getString("DViewCertificate.jtfVersion.tooltip"));
GridBagConstraints gbc_jtfVersion = (GridBagConstraints) gbcCtrl.clone();
gbc_jtfVersion.gridy = 0;
jlSubject = new JLabel(res.getString("DViewCertificate.jlSubject.text"));
GridBagConstraints gbc_jlSubject = (GridBagConstraints) gbcLbl.clone();
gbc_jlSubject.gridy = 1;
jdnSubject = new JDistinguishedName(res.getString("DViewCertificate.Subject.Title"), 40, false);
jdnSubject.setToolTipText(res.getString("DViewCertificate.jdnSubject.tooltip"));
GridBagConstraints gbc_jdnSubject = (GridBagConstraints) gbcCtrl.clone();
gbc_jdnSubject.gridy = 1;
jlIssuer = new JLabel(res.getString("DViewCertificate.jlIssuer.text"));
GridBagConstraints gbc_jlIssuer = (GridBagConstraints) gbcLbl.clone();
gbc_jlIssuer.gridy = 2;
jdnIssuer = new JDistinguishedName(res.getString("DViewCertificate.Issuer.Title"), 40, false);
jdnIssuer.setToolTipText(res.getString("DViewCertificate.jdnIssuer.tooltip"));
GridBagConstraints gbc_jdnIssuer = (GridBagConstraints) gbcCtrl.clone();
gbc_jdnIssuer.gridy = 2;
jlSerialNumber = new JLabel(res.getString("DViewCertificate.jlSerialNumber.text"));
GridBagConstraints gbc_jlSerialNumber = (GridBagConstraints) gbcLbl.clone();
gbc_jlSerialNumber.gridy = 3;
jtfSerialNumber = new JTextField(30);
jtfSerialNumber.setEditable(false);
jtfSerialNumber.setToolTipText(res.getString("DViewCertificate.jtfSerialNumber.tooltip"));
GridBagConstraints gbc_jtfSerialNumber = (GridBagConstraints) gbcCtrl.clone();
gbc_jtfSerialNumber.gridy = 3;
jlValidFrom = new JLabel(res.getString("DViewCertificate.jlValidFrom.text"));
GridBagConstraints gbc_jlValidFrom = (GridBagConstraints) gbcLbl.clone();
gbc_jlValidFrom.gridy = 4;
jtfValidFrom = new JTextField(30);
jtfValidFrom.setEditable(false);
jtfValidFrom.setToolTipText(res.getString("DViewCertificate.jtfValidFrom.tooltip"));
GridBagConstraints gbc_jtfValidFrom = (GridBagConstraints) gbcCtrl.clone();
gbc_jtfValidFrom.gridy = 4;
jlValidUntil = new JLabel(res.getString("DViewCertificate.jlValidUntil.text"));
GridBagConstraints gbc_jlValidUntil = (GridBagConstraints) gbcLbl.clone();
gbc_jlValidUntil.gridy = 5;
jtfValidUntil = new JTextField(30);
jtfValidUntil.setEditable(false);
jtfValidUntil.setToolTipText(res.getString("DViewCertificate.jtfValidUntil.tooltip"));
GridBagConstraints gbc_jtfValidUntil = (GridBagConstraints) gbcCtrl.clone();
gbc_jtfValidUntil.gridy = 5;
jlPublicKey = new JLabel(res.getString("DViewCertificate.jlPublicKey.text"));
GridBagConstraints gbc_jlPublicKey = (GridBagConstraints) gbcLbl.clone();
gbc_jlPublicKey.gridy = 6;
jtfPublicKey = new JTextField(15);
jtfPublicKey.setEditable(false);
jtfPublicKey.setToolTipText(res.getString("DViewCertificate.jtfPublicKey.tooltip"));
jbViewPublicKeyDetails = new JButton();
jbViewPublicKeyDetails.setToolTipText(res.getString("DViewCertificate.jbViewPublicKeyDetails.tooltip"));
jbViewPublicKeyDetails.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("DViewCertificate.jbViewPublicKeyDetails.image")))));
jbViewPublicKeyDetails.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
pubKeyDetailsPressed();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
jpPublicKey = new JPanel(new GridBagLayout());
GridBagConstraints gbc_jpPublicKey = (GridBagConstraints) gbcCtrl.clone();
gbc_jpPublicKey.gridy = 6;
GridBagConstraints gbc_jtfPublicKey = new GridBagConstraints();
gbc_jtfPublicKey.gridwidth = 1;
gbc_jtfPublicKey.gridheight = 1;
gbc_jtfPublicKey.gridx = 0;
gbc_jtfPublicKey.gridy = 0;
gbc_jtfPublicKey.insets = new Insets(0, 0, 0, 5);
GridBagConstraints gbc_jbViewPublicKeyDetails = new GridBagConstraints();
gbc_jbViewPublicKeyDetails.gridwidth = 1;
gbc_jbViewPublicKeyDetails.gridheight = 1;
gbc_jbViewPublicKeyDetails.gridx = 1;
gbc_jbViewPublicKeyDetails.gridy = 0;
gbc_jbViewPublicKeyDetails.insets = new Insets(0, 5, 0, 0);
jpPublicKey.add(jtfPublicKey, gbc_jtfPublicKey);
jpPublicKey.add(jbViewPublicKeyDetails, gbc_jbViewPublicKeyDetails);
jlSignatureAlgorithm = new JLabel(res.getString("DViewCertificate.jlSignatureAlgorithm.text"));
GridBagConstraints gbc_jlSignatureAlgorithm = (GridBagConstraints) gbcLbl.clone();
gbc_jlSignatureAlgorithm.gridy = 7;
jtfSignatureAlgorithm = new JTextField(15);
jtfSignatureAlgorithm.setEditable(false);
jtfSignatureAlgorithm.setToolTipText(res.getString("DViewCertificate.jtfSignatureAlgorithm.tooltip"));
GridBagConstraints gbc_jtfSignatureAlgorithm = (GridBagConstraints) gbcCtrl.clone();
gbc_jtfSignatureAlgorithm.gridy = 7;
jlFingerprint = new JLabel(res.getString("DViewCertificate.jlFingerprint.text"));
GridBagConstraints gbc_jlFingerprint = (GridBagConstraints) gbcLbl.clone();
gbc_jlFingerprint.gridy = 8;
jcfFingerprint = new JCertificateFingerprint(30);
GridBagConstraints gbc_jcfFingerprint = (GridBagConstraints) gbcCtrl.clone();
gbc_jcfFingerprint.gridy = 8;
jbExtensions = new JButton(res.getString("DViewCertificate.jbExtensions.text"));
PlatformUtil.setMnemonic(jbExtensions, res.getString("DViewCertificate.jbExtensions.mnemonic").charAt(0));
jbExtensions.setToolTipText(res.getString("DViewCertificate.jbExtensions.tooltip"));
jbExtensions.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
extensionsPressed();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
jbPem = new JButton(res.getString("DViewCertificate.jbPem.text"));
PlatformUtil.setMnemonic(jbPem, res.getString("DViewCertificate.jbPem.mnemonic").charAt(0));
jbPem.setToolTipText(res.getString("DViewCertificate.jbPem.tooltip"));
jbPem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
pemEncodingPressed();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
jbAsn1 = new JButton(res.getString("DViewCertificate.jbAsn1.text"));
PlatformUtil.setMnemonic(jbAsn1, res.getString("DViewCertificate.jbAsn1.mnemonic").charAt(0));
jbAsn1.setToolTipText(res.getString("DViewCertificate.jbAsn1.tooltip"));
jbAsn1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
asn1DumpPressed();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
if (importExport == IMPORT) {
jbImportExport = new JButton(res.getString("DViewCertificate.jbImportExport.import.text"));
jbImportExport.setToolTipText(res.getString("DViewCertificate.jbImportExport.import.tooltip"));
} else {
jbImportExport = new JButton(res.getString("DViewCertificate.jbImportExport.export.text"));
jbImportExport.setToolTipText(res.getString("DViewCertificate.jbImportExport.export.tooltip"));
}
PlatformUtil.setMnemonic(jbImportExport, res.getString("DViewCertificate.jbImportExport.mnemonic").charAt(0));
jbImportExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DViewCertificate.this);
importExportPressed();
} finally {
CursorUtil.setCursorFree(DViewCertificate.this);
}
}
});
jpButtons = new JPanel();
if (importExport != NONE) {
jpButtons.add(jbImportExport);
}
jpButtons.add(jbExtensions);
jpButtons.add(jbPem);
jpButtons.add(jbAsn1);
GridBagConstraints gbc_jpButtons = new GridBagConstraints();
gbc_jpButtons.gridx = 0;
gbc_jpButtons.gridy = 9;
gbc_jpButtons.gridwidth = 2;
gbc_jpButtons.gridheight = 1;
gbc_jpButtons.anchor = GridBagConstraints.EAST;
jpDetail = new JPanel(new GridBagLayout());
jpDetail.setBorder(new EmptyBorder(5, 5, 5, 5));
jpDetail.add(jlVersion, gbc_jlVersion);
jpDetail.add(jtfVersion, gbc_jtfVersion);
jpDetail.add(jlSubject, gbc_jlSubject);
jpDetail.add(jdnSubject, gbc_jdnSubject);
jpDetail.add(jlIssuer, gbc_jlIssuer);
jpDetail.add(jdnIssuer, gbc_jdnIssuer);
jpDetail.add(jlSerialNumber, gbc_jlSerialNumber);
jpDetail.add(jtfSerialNumber, gbc_jtfSerialNumber);
jpDetail.add(jlValidFrom, gbc_jlValidFrom);
jpDetail.add(jtfValidFrom, gbc_jtfValidFrom);
jpDetail.add(jlValidUntil, gbc_jlValidUntil);
jpDetail.add(jtfValidUntil, gbc_jtfValidUntil);
jpDetail.add(jlPublicKey, gbc_jlPublicKey);
jpDetail.add(jpPublicKey, gbc_jpPublicKey);
jpDetail.add(jlSignatureAlgorithm, gbc_jlSignatureAlgorithm);
jpDetail.add(jtfSignatureAlgorithm, gbc_jtfSignatureAlgorithm);
jpDetail.add(jlFingerprint, gbc_jlFingerprint);
jpDetail.add(jcfFingerprint, gbc_jcfFingerprint);
jpDetail.add(jpButtons, gbc_jpButtons);
jpCertificates = new JPanel(new BorderLayout(0, 0));
jpCertificates.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
jpCertificates.add(jpHierarchy, BorderLayout.NORTH);
jpCertificates.add(jpDetail, BorderLayout.CENTER);
jbOK = new JButton(res.getString("DViewCertificate.jbOK.text"));
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);
getContentPane().add(jpCertificates, BorderLayout.CENTER);
getContentPane().add(jpOK, BorderLayout.SOUTH);
jtrHierarchy.setSelectionRow(0);
setResizable(false);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
getRootPane().setDefaultButton(jbOK);
pack();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
jbOK.requestFocus();
}
});
}
use of javax.swing.event.TreeSelectionEvent in project sonarqube by SonarSource.
the class ScannerReportViewerApp method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
splitPane = new JSplitPane();
frame.getContentPane().add(splitPane, BorderLayout.CENTER);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setPreferredSize(new Dimension(500, 7));
splitPane.setRightComponent(tabbedPane);
componentDetailsTab = new JScrollPane();
tabbedPane.addTab("Component details", null, componentDetailsTab, null);
componentEditor = new JEditorPane();
componentDetailsTab.setViewportView(componentEditor);
sourceTab = new JScrollPane();
tabbedPane.addTab("Source", null, sourceTab, null);
sourceEditor = createSourceEditor();
sourceEditor.setEditable(false);
sourceTab.setViewportView(sourceEditor);
textLineNumber = createTextLineNumber();
sourceTab.setRowHeaderView(textLineNumber);
highlightingTab = new JScrollPane();
tabbedPane.addTab("Highlighting", null, highlightingTab, null);
highlightingEditor = new JEditorPane();
highlightingTab.setViewportView(highlightingEditor);
symbolTab = new JScrollPane();
tabbedPane.addTab("Symbol references", null, symbolTab, null);
symbolEditor = new JEditorPane();
symbolTab.setViewportView(symbolEditor);
coverageTab = new JScrollPane();
tabbedPane.addTab("Coverage", null, coverageTab, null);
coverageEditor = new JEditorPane();
coverageTab.setViewportView(coverageEditor);
duplicationTab = new JScrollPane();
tabbedPane.addTab("Duplications", null, duplicationTab, null);
duplicationEditor = new JEditorPane();
duplicationTab.setViewportView(duplicationEditor);
testsTab = new JScrollPane();
tabbedPane.addTab("Tests", null, testsTab, null);
testsEditor = new JEditorPane();
testsTab.setViewportView(testsEditor);
issuesTab = new JScrollPane();
tabbedPane.addTab("Issues", null, issuesTab, null);
issuesEditor = new JEditorPane();
issuesTab.setViewportView(issuesEditor);
externalIssuesTab = new JScrollPane();
tabbedPane.addTab("External Issues", null, externalIssuesTab, null);
externalIssuesEditor = new JEditorPane();
externalIssuesTab.setViewportView(externalIssuesEditor);
measuresTab = new JScrollPane();
tabbedPane.addTab("Measures", null, measuresTab, null);
measuresEditor = new JEditorPane();
measuresTab.setViewportView(measuresEditor);
scmTab = new JScrollPane();
tabbedPane.addTab("SCM", null, scmTab, null);
scmEditor = new JEditorPane();
scmTab.setViewportView(scmEditor);
activeRuleTab = new JScrollPane();
tabbedPane.addTab("Active Rules", null, activeRuleTab, null);
activeRuleEditor = new JEditorPane();
activeRuleTab.setViewportView(activeRuleEditor);
adHocRuleTab = new JScrollPane();
tabbedPane.addTab("Add Hoc Rules", null, adHocRuleTab, null);
adHocRuleEditor = new JEditorPane();
adHocRuleTab.setViewportView(adHocRuleEditor);
qualityProfileTab = new JScrollPane();
tabbedPane.addTab("Quality Profiles", null, qualityProfileTab, null);
qualityProfileEditor = new JEditorPane();
qualityProfileTab.setViewportView(qualityProfileEditor);
pluginTab = new JScrollPane();
tabbedPane.addTab("Plugins", null, pluginTab, null);
pluginEditor = new JEditorPane();
pluginTab.setViewportView(pluginEditor);
cpdTextBlocksTab = new JScrollPane();
tabbedPane.addTab("CPD Text Blocks", null, cpdTextBlocksTab, null);
cpdTextBlocksEditor = new JEditorPane();
cpdTextBlocksTab.setViewportView(cpdTextBlocksEditor);
significantCodeTab = new JScrollPane();
tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
significantCodeEditor = new JEditorPane();
significantCodeTab.setViewportView(significantCodeEditor);
metadataTab = new JScrollPane();
tabbedPane.addTab("Metadata", null, metadataTab, null);
metadataEditor = new JEditorPane();
metadataTab.setViewportView(metadataEditor);
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);
componentTree = new JTree();
componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {
{
}
}));
treeScrollPane.setViewportView(componentTree);
componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
componentTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
if (node == null) {
// Nothing is selected.
return;
}
frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
updateDetails((Component) node.getUserObject());
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
});
frame.pack();
}
use of javax.swing.event.TreeSelectionEvent in project jPOS by jpos.
the class JTreeFactory method create.
public JComponent create(UI ui, Element e) {
final UI parentUI = ui;
final Map map = new HashMap();
final JTree tree = new JTree(getNode(e, map));
String font = e.getAttributeValue("font");
if (font != null)
tree.setFont(Font.decode(font));
tree.setRootVisible(e.getTextTrim().length() > 0);
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent evt) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node != null) {
String s = (String) map.get(node);
if (s != null) {
StringTokenizer st = new StringTokenizer(s);
String action = st.nextToken();
String command = null;
if (st.hasMoreTokens())
command = st.nextToken();
ActionListener al = (ActionListener) parentUI.get(action);
if (al != null) {
al.actionPerformed(new ActionEvent(node, 0, command));
}
// System.out.println ("ACTION: " + action);
// System.out.println ("COMMAND: " + command);
}
}
}
});
return tree;
}
use of javax.swing.event.TreeSelectionEvent in project vcell by virtualcell.
the class BioModelEditorPathwayCommonsPanel method initialize.
private void initialize() {
searchTextField = new TextFieldAutoCompletion();
searchTextField.addActionListener(eventHandler);
searchTextField.putClientProperty("JTextField.variant", "search");
filterTextField = new TextFieldAutoCompletion();
filterTextField.addActionListener(eventHandler);
filterTextField.addKeyListener(eventHandler);
filterTextField.putClientProperty("JTextField.variant", "filter");
searchButton = new JButton("Search");
searchButton.addActionListener(eventHandler);
sortButton = new JButton("Sort");
sortButton.addActionListener(eventHandler);
showPathwayButton = new JButton("Preview");
showPathwayButton.addActionListener(eventHandler);
showPathwayButton.setEnabled(false);
gotoPathwayButton = new JButton("Open Web Link");
gotoPathwayButton.addActionListener(eventHandler);
gotoPathwayButton.setEnabled(false);
responseTree = new JTree();
responseTreeModel = new ResponseTreeModel();
responseTree.setModel(responseTreeModel);
ToolTipManager.sharedInstance().registerComponent(responseTree);
CollapsiblePanel searchPanel = new CollapsiblePanel("Search", true);
searchPanel.getContentPanel().setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.LINE_START;
searchPanel.getContentPanel().add(searchTextField, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.insets = new Insets(0, 4, 0, 0);
searchPanel.getContentPanel().add(searchButton, gbc);
setPreferredSize(new Dimension(475, 300));
setLayout(new GridBagLayout());
int gridy = 0;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 4, 4, 4);
add(searchPanel, gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.insets = new Insets(4, 4, 4, 4);
gbc.fill = GridBagConstraints.BOTH;
add(new JScrollPane(responseTree), gbc);
gridy++;
CollapsiblePanel filterPanel = new CollapsiblePanel("Filter", true);
filterPanel.getContentPanel().setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.insets = new Insets(2, 2, 2, 2);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.LINE_START;
filterPanel.getContentPanel().add(filterTextField, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.insets = new Insets(0, 4, 0, 0);
filterPanel.getContentPanel().add(sortButton, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 4, 4, 4);
filterPanel.expand(true);
add(filterPanel, gbc);
// JPanel optionsField = new JPanel(new GridLayout());
// ButtonGroup buttonGroup = new ButtonGroup();
// JRadioButton o1, o2, o3;
// o1 = new JRadioButton(" Entity ");
// buttonGroup.add(o1);
// optionsField.add(o1);
// o2 = new JRadioButton(" Database ");
// buttonGroup.add(o2);
// optionsField.add(o2);
// o3 = new JRadioButton(" Organism ");
// buttonGroup.add(o3);
// optionsField.add(o3);
// o3.setSelected(true);
//
// gridy ++;
// CollapsiblePanel optionsPanel = new CollapsiblePanel("Group by... ", true);
// optionsPanel.getContentPanel().setLayout(new GridBagLayout());
// gbc = new GridBagConstraints();
// gbc.gridx = 0;
// gbc.gridy = gridy;
// gbc.weightx = 1.0;
// gbc.fill = GridBagConstraints.HORIZONTAL;
// gbc.anchor = GridBagConstraints.LINE_START;
// optionsPanel.getContentPanel().add(optionsField, gbc);
//
// gbc = new GridBagConstraints();
// gbc.gridx = 0;
// gbc.gridy = gridy;
// gbc.weightx = 1.0;
// gbc.gridwidth = GridBagConstraints.REMAINDER;
// gbc.fill = GridBagConstraints.HORIZONTAL;
// gbc.insets = new Insets(4,4,4,4);
// optionsPanel.expand(false);
// add(optionsPanel, gbc);
gridy++;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 4, 4, 1);
add(showPathwayButton, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(4, 1, 4, 4);
add(gotoPathwayButton, gbc);
sortButton.setIcon(bAscending ? VCellIcons.sortDownIcon : VCellIcons.sortUpIcon);
ResponseTreeCellRenderer renderer = new ResponseTreeCellRenderer();
// renderer.setLeafIcon(null);
// renderer.setClosedIcon(null);
// renderer.setOpenIcon(null);
renderer.setLeafIcon(VCellIcons.pathwayLeafIcon);
responseTree.setCellRenderer(renderer);
responseTree.setRootVisible(false);
responseTree.getSelectionModel().addTreeSelectionListener(eventHandler);
responseTree.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() <= 1) {
return;
}
showPathway();
}
});
responseTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object obj = responseTree.getLastSelectedPathComponent();
if (obj == null || !(obj instanceof BioModelNode)) {
return;
}
BioModelNode selectedNode = (BioModelNode) obj;
Object userObject = selectedNode.getUserObject();
setSelectedObjects(new Object[] { userObject });
}
});
}
use of javax.swing.event.TreeSelectionEvent in project vcell by virtualcell.
the class AnnotationsPanel method initialize.
private void initialize() {
try {
setLayout(new GridBagLayout());
setBackground(Color.white);
int gridy = 0;
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.insets = new Insets(4, 4, 4, 4);
gbc.fill = java.awt.GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.SOUTHWEST;
add(getBottomPanel(), gbc);
// used just to initialize emptyText once
JTextPane tenpTextPane = new JTextPane();
tenpTextPane.setContentType("text/html");
tenpTextPane.setText(null);
emptyHtmlText = tenpTextPane.getText();
initializeComboBoxQualifier();
getJTreeMIRIAM().addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
TreePath tp = ((JTree) e.getSource()).getSelectionPath();
if (tp == null) {
getJButtonDeleteRef().setEnabled(false);
} else {
Object lastPathComponent = tp.getLastPathComponent();
getJButtonDeleteRef().setEnabled(tp != null && lastPathComponent instanceof LinkNode);
}
}
});
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
Aggregations