public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getSource() instanceof MainView) { MainView view = (MainView) e.getSource(); Rectangle bounds = ((ZoomableLabelUI) view.getUI()).getIconR(view); Point p = e.getPoint(); if (bounds.contains(p)) { if (view.getIcon() instanceof MultipleImage) { Rectangle iconR = ((MultipleImage) view.getIcon()) .getIconR(PdfUtilitiesController.REFRESH_MONITORING_ICON); if (iconR != null) { float zoom = Controller.getCurrentController().getViewController().getZoom(); iconR.setLocation((int) (iconR.x * zoom), iconR.y); iconR.setSize((int) (iconR.width * zoom), (int) (iconR.height * zoom)); iconR.translate(bounds.x, bounds.y); if (iconR.contains(p)) { UpdateMonitoringFolderAction.updateNodesAgainstMonitoringDir( getMonitorNodes( Controller.getCurrentController().getViewController().getMap().getRootNode()), false); return; } } } } // StringBuilder sb = new StringBuilder(); // pdfHeaderExtraction(e, sb); } boolean openOnPage = ResourceController.getResourceController() .getBooleanProperty(PdfUtilitiesController.OPEN_PDF_VIEWER_ON_PAGE_KEY); if (!openOnPage) { this.mouseListener.mouseClicked(e); return; } if ( /*wasFocused() && */ (e.getModifiers() & ~(InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) == InputEvent.BUTTON1_MASK) { final MainView component = (MainView) e.getComponent(); final ModeController modeController = Controller.getCurrentModeController(); NodeModel node = null; try { node = ((MainView) e.getSource()).getNodeView().getModel(); } catch (Exception ex) { } if (node == null) { node = modeController.getMapController().getSelectedNode(); } if (component.isInFollowLinkRegion(e.getX())) { writeToLog(node); } if (!component.isInFollowLinkRegion(e.getX()) || !MonitoringUtils.isPdfLinkedNode(node)) { this.mouseListener.mouseClicked(e); return; } URI uri = Tools.getAbsoluteUri(node); if (uri == null) { this.mouseListener.mouseClicked(e); return; } IAnnotation annotation = null; try { annotation = node.getExtension(AnnotationModel.class); } catch (Exception ex) { } LinkController.getController().onDeselect(node); if (!PdfUtilitiesController.getController().openPdfOnPage(uri, annotation)) { this.mouseListener.mouseClicked(e); return; } LinkController.getController().onSelect(node); } else { this.mouseListener.mouseClicked(e); } }
public static DocearNodeModifiedExtension getExtension(final NodeModel node) { DocearNodeModifiedExtension docearNodeModel = (DocearNodeModifiedExtension) node.getExtension(DocearNodeModifiedExtension.class); return docearNodeModel; }