List of usage examples for javax.swing.tree DefaultMutableTreeNode getParent
public TreeNode getParent()
From source file:seleniumAutomation.flowControls.java
public static void parseNodes(javax.swing.tree.DefaultMutableTreeNode nodes) { for (int i = 0; i < nodes.getChildCount(); i++) { parseNodes((javax.swing.tree.DefaultMutableTreeNode) nodes.getChildAt(i)); }//from www .j av a 2 s.c o m if (nodes.getChildCount() == 0) { if (!testStep.isEmpty()) { if (!((javax.swing.tree.DefaultMutableTreeNode) nodes.getParent()).getLastChild().equals(nodes)) { testStep.add(nodes.getUserObject().toString()); } else { testStep.add(nodes.getUserObject().toString()); testSuite.put(testStep.get(0), testStep); testStep = new ArrayList<String>(); } } else { testStep = new ArrayList(); testStep.add(nodes.getUserObject().toString()); testSuite.put(testStep.get(0), testStep); } } }
From source file:streamme.visuals.Main.java
public void playNodes() { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree_files.getLastSelectedPathComponent(); if (node != null && node.isLeaf()) { DataNode dn = (DataNode) node.getUserObject(); if (!dn.isFolder()) { PlaylistManager pm = PlaylistManager.get(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); pm.clearPlaylist(-1);/* w w w .j a v a 2 s . c o m*/ // Get Path: javax.swing.tree.TreeNode[] tree = parent.getPath(); String path = StreamMe.OPTIONS.getOutputPath(); for (int i = 1; i < tree.length; i++) { path += "\\" + ((DataNode) ((DefaultMutableTreeNode) tree[i]).getUserObject()).getName(); } Enumeration ch = parent.children(); DefaultMutableTreeNode child = null; while (ch.hasMoreElements()) { child = (DefaultMutableTreeNode) ch.nextElement(); if (child.isLeaf()) break; } int songIdx = 0, i = 0; while (child != null) { DataNode childnode = (DataNode) child.getUserObject(); if (child == node) { songIdx = i; } pm.addToPlaylist(-1, childnode.toFileLink(path + "\\" + childnode.getName())); child = child.getNextSibling(); i++; } playSong(pm.getDefaultModelIdx(), songIdx); } } }
From source file:view.MultipleValidationDialog.java
private void jtValidationValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jtValidationValueChanged if (jtValidation.getSelectionRows().length == 0) { showSignatureValidationDetails(null); } else if (jtValidation.getSelectionRows().length == 1) { DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;/*from w ww.j av a 2 s . c o m*/ if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); jtValidation.expandRow(jtValidation.getSelectionRows()[0]); } showSignatureValidationDetails(sv); } else { jtValidation.setSelectionPath(evt.getOldLeadSelectionPath()); } }
From source file:view.MultipleValidationDialog.java
private void btnShowCertificateDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShowCertificateDetailsActionPerformed DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;/* w w w . j av a 2 s.co m*/ if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); } CertificatePropertiesDialog cpd = new CertificatePropertiesDialog((MainWindow) this.getParent(), true, sv.getSignature().getSignCertificateChain()); cpd.setLocationRelativeTo(null); cpd.setVisible(true); }
From source file:view.MultipleValidationDialog.java
private void lblRevisionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblRevisionMouseClicked if (SwingUtilities.isLeftMouseButton(evt)) { DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;//www. j a v a 2 s . c om if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); } try { File f = CCInstance.getInstance().extractRevision(sv.getFilename(), sv.getName()); openPdfReaderFromFile(f); } catch (IOException | RevisionExtractionException ex) { Logger.getLogger(WorkspacePanel.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:view.WorkspacePanel.java
private void btnCheckCertificateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckCertificateActionPerformed DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;/*from w w w . j a va2 s . c om*/ if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); } CertificatePropertiesDialog cpd = new CertificatePropertiesDialog(mainWindow, true, sv.getSignature().getSignCertificateChain()); cpd.setLocationRelativeTo(null); cpd.setVisible(true); }
From source file:view.WorkspacePanel.java
private void jtValidationValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jtValidationValueChanged if (jtValidation.getSelectionRows().length == 0) { showSignatureValidationDetails(null); imagePanel.setSelectedSignature(null); } else if (jtValidation.getSelectionRows().length == 1) { DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;//from w w w.ja v a 2 s.com if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); jtValidation.expandRow(jtValidation.getSelectionRows()[0]); } showSignatureValidationDetails(sv); imagePanel.setSelectedSignature(sv); int pageNumber = sv.getPosList().get(0).page - 1; if (imagePanel.getPageNumber() != pageNumber) { imagePanel.setPageNumber(pageNumber); jsPageNumber.setValue(pageNumber + 1); } } }
From source file:view.WorkspacePanel.java
private void lblRevisionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblRevisionMouseClicked if (SwingUtilities.isLeftMouseButton(evt)) { DefaultMutableTreeNode dtn = (DefaultMutableTreeNode) jtValidation.getLastSelectedPathComponent(); SignatureValidation sv = null;/* w w w. java 2 s.c o m*/ if (dtn.isLeaf()) { DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) dtn.getParent(); sv = (SignatureValidation) dmtn.getUserObject(); } else { sv = (SignatureValidation) dtn.getUserObject(); } try { File f = CCInstance.getInstance().extractRevision(document.getDocumentLocation(), sv.getName()); openPdfReaderFromFile(f); } catch (RevisionExtractionException | IOException ex) { Logger.getLogger(WorkspacePanel.class.getName()).log(Level.SEVERE, null, ex); } } }