protected boolean mouseOverComponent() { if (comp.isShowing()) { if (comp instanceof MainView) { final MainView view = (MainView) comp; Rectangle bounds = ((ZoomableLabelUI) view.getUI()).getIconR(view); final Point mousePosition = comp.getMousePosition(true); if (mousePosition == null) { return false; } if (bounds.contains(mousePosition)) { 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(mousePosition)) { return true; } } } } } } return false; }
public void mouseMoved(MouseEvent e) { if (e.getSource() instanceof MainView) { final MainView view = (MainView) e.getSource(); Rectangle bounds = ((ZoomableLabelUI) view.getUI()).getIconR(view); Point p = e.getPoint(); view.setCursor(Cursor.getDefaultCursor()); if (bounds.contains(p)) { if (view.getIcon() instanceof MultipleImage) { Rectangle iconR = ((MultipleImage) view.getIcon()) .getIconR(PdfUtilitiesController.REFRESH_MONITORING_ICON); if (iconR != null) { view.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 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)) { if (!showTimer.isRunning() && !hideTimer.isRunning()) { resetTimer(); showTimer.addActionListener(new ShowToolTipAction(view)); showTimer.start(); } return; } } else { resetTimer(); } } else { resetTimer(); } } } this.mouseListener.mouseMoved(e); }
public void mousePressed(MouseEvent e) { final MainView component = (MainView) e.getComponent(); wasFocused = component.hasFocus(); this.mouseListener.mousePressed(e); }
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); } }