List of usage examples for javax.swing.event TreeSelectionEvent getOldLeadSelectionPath
public TreePath getOldLeadSelectionPath()
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;// w ww . j a va 2s .c om 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 jtFilesValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jtFilesValueChanged jtValidation.setModel(null);/* w w w .j av a 2s . c om*/ ArrayList<SignatureValidation> svList = null; if (jtFiles.getSelectionRows().length > 1) { jtFiles.setSelectionPath(evt.getOldLeadSelectionPath()); return; } if (evt.getNewLeadSelectionPath() == null) { panelSignatureDetails.setVisible(false); return; } for (Map.Entry<ValidationFileListEntry, ArrayList<SignatureValidation>> entry : hmValidation.entrySet()) { int numSigs = CCInstance.getInstance().getNumberOfSignatures(entry.getKey().getFilename()); if (String.valueOf(evt.getPath().getLastPathComponent()) .equals("(" + numSigs + ") " + entry.getKey().getFilename())) { svList = entry.getValue(); break; } } final DefaultMutableTreeNode top = new DefaultMutableTreeNode(null); if (svList == null) { return; } if (svList.isEmpty()) { panelSignatureDetails.setVisible(false); DefaultMutableTreeNode noSignatures = new TreeNodeWithState(Bundle.getBundle().getString("notSigned"), TreeNodeWithState.State.NOT_SIGNED); top.add(noSignatures); TreeModel tm = new DefaultTreeModel(top); jtValidation.setModel(tm); return; } for (SignatureValidation sv : svList) { DefaultMutableTreeNode sig = new DefaultMutableTreeNode(sv); TreeNodeWithState childChanged = null; if (sv.isCertification()) { if (sv.isValid()) { if (sv.isChanged() || !sv.isCoversEntireDocument()) { childChanged = new TreeNodeWithState( "<html>" + Bundle.getBundle().getString("tn.1") + "<br>" + Bundle.getBundle().getString("tn.2") + "</html>", TreeNodeWithState.State.CERTIFIED_WARNING); } else { childChanged = new TreeNodeWithState(Bundle.getBundle().getString("certifiedOk"), TreeNodeWithState.State.CERTIFIED); } } else { childChanged = new TreeNodeWithState(Bundle.getBundle().getString("changedAfterCertified"), TreeNodeWithState.State.INVALID); } } else if (sv.isValid()) { if (sv.isChanged()) { childChanged = new TreeNodeWithState( "<html>" + Bundle.getBundle().getString("tn.3") + "<br>" + Bundle.getBundle().getString("tn.4") + "</html>", TreeNodeWithState.State.VALID_WARNING); } else { childChanged = new TreeNodeWithState(Bundle.getBundle().getString("signedOk"), TreeNodeWithState.State.VALID); } } else { childChanged = new TreeNodeWithState(Bundle.getBundle().getString("signedChangedOrCorrupted"), TreeNodeWithState.State.INVALID); } TreeNodeWithState childVerified = null; if (sv.getOcspCertificateStatus().equals(CertificateStatus.OK) || sv.getCrlCertificateStatus().equals(CertificateStatus.OK)) { childVerified = new TreeNodeWithState(Bundle.getBundle().getString("certOK"), TreeNodeWithState.State.VALID); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.REVOKED) || sv.getCrlCertificateStatus().equals(CertificateStatus.REVOKED)) { childVerified = new TreeNodeWithState(Bundle.getBundle().getString("certRevoked"), TreeNodeWithState.State.INVALID); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.UNCHECKED) && sv.getCrlCertificateStatus().equals(CertificateStatus.UNCHECKED)) { childVerified = new TreeNodeWithState(Bundle.getBundle().getString("certNotVerified"), TreeNodeWithState.State.WARNING); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.UNCHAINED)) { childVerified = new TreeNodeWithState(Bundle.getBundle().getString("certNotChained"), TreeNodeWithState.State.WARNING); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.EXPIRED)) { childVerified = new TreeNodeWithState(Bundle.getBundle().getString("certExpired"), TreeNodeWithState.State.WARNING); } else if (sv.getOcspCertificateStatus().equals(CertificateStatus.CHAINED_LOCALLY)) { childVerified = new TreeNodeWithState( "<html>" + Bundle.getBundle().getString("tn.5") + "<br>" + Bundle.getBundle().getString("tn.6") + "</html>", TreeNodeWithState.State.VALID_WARNING); } TreeNodeWithState childTimestamp = null; if (sv.isValidTimeStamp()) { childTimestamp = new TreeNodeWithState(Bundle.getBundle().getString("validTimestamp"), TreeNodeWithState.State.VALID); } else { childTimestamp = new TreeNodeWithState(Bundle.getBundle().getString("signerDateTime"), TreeNodeWithState.State.WARNING); } sig.add(childChanged); sig.add(childVerified); sig.add(childTimestamp); top.add(sig); } TreeModel tm = new DefaultTreeModel(top); jtValidation.setModel(tm); if (jtValidation.getRowCount() > 0) { jtValidation.setSelectionRow(jtValidation.getRowCount() - 1); } }