List of usage examples for java.awt.event MouseEvent getLocationOnScreen
public Point getLocationOnScreen()
From source file:edu.ku.brc.specify.ui.containers.ContainerTreePanel.java
/** * @param e/*from w w w . ja va2 s. c om*/ */ private void mousePressedOnTree(final MouseEvent e) { Point pnt = e.getLocationOnScreen(); int i = 0; for (Rectangle r : treeRenderer.getHitRects()) { //System.out.println(pnt+" "+r+" "+r.contains(pnt)); if (r.contains(pnt)) { DefaultMutableTreeNode node = getSelectedTreeNode(); if (node != null) { if (node.getUserObject() instanceof Container) { Container cn = (Container) node.getUserObject(); if (cn != null) { if (!isViewMode) // Edit Mode { if (cn.getCollectionObject() != null) { if (i == 0) { editColObj(cn.getCollectionObject()); } else { delColObj(); } } else { if (i == 0) { addColObjToContainer(true, true); } else { addColObjToContainer(false, true); } } } else if (cn.getCollectionObject() != null && i == 0) { viewColObj(); } } } else if (node.getUserObject() instanceof CollectionObject) { if (isViewMode) { if (i == 0) { viewColObj(); } } else { if (i == 0) { editColObj(); } } } } break; } i++; } }
From source file:uk.ac.lkl.cram.ui.ModuleFrame.java
private JXTaskPane createLearningExperienceChartPane() { JXTaskPane experienceChartPane = new JXTaskPane(); experienceChartPane.setScrollOnExpand(true); experienceChartPane.setTitle("Learning Experiences"); final LearningExperienceChartMaker maker = new LearningExperienceChartMaker(module); final ChartPanel chartPanel = maker.getChartPanel(); //Add a mouselistener, listening for a double click on a bar of the stacked bar chartPanel.addChartMouseListener(new ChartMouseListener() { @Override/*from w ww . j a v a2 s. com*/ public void chartMouseClicked(ChartMouseEvent cme) { //Get the mouse event MouseEvent trigger = cme.getTrigger(); //Test if the mouse event is a left-button if (trigger.getButton() == MouseEvent.BUTTON1 && trigger.getClickCount() == 2) { //Get the selected segment of the pie CategoryItemEntity bar = (CategoryItemEntity) cme.getEntity(); //Get the row key that corresponds to that segment--this is a learning experience String key = bar.getRowKey().toString(); //Get the set of tlalineitems whose activity contains that learning type Set<TLALineItem> relevantTLAs = maker.getLearningExperienceMap().get(key); //Create a pop up dialog containing that set of tlalineitems LearningExperiencePopupDialog popup = new LearningExperiencePopupDialog( (Frame) SwingUtilities.getWindowAncestor(chartPanel), true, relevantTLAs); //Set the title of the popup to indicate which learning type was selected popup.setTitle("Activities with \'" + key + "\'"); //Centre the popup at the location of the mouse click Point location = trigger.getLocationOnScreen(); int w = popup.getWidth(); int h = popup.getHeight(); popup.setLocation(location.x - w / 2, location.y - h / 2); popup.setVisible(true); int returnStatus = popup.getReturnStatus(); if (returnStatus == LearningTypePopupDialog.RET_OK) { modifyTLALineItem(popup.getSelectedTLALineItem(), 0); } } } @Override public void chartMouseMoved(ChartMouseEvent cme) { //Set the cursor shape according to the location of the cursor if (cme.getEntity() instanceof CategoryItemEntity) { chartPanel.setCursor(HAND); } else { chartPanel.setCursor(Cursor.getDefaultCursor()); } } }); chartPanel.setPreferredSize(new Dimension(125, 75)); chartPanel.setMinimumDrawHeight(75); experienceChartPane.add(chartPanel); return experienceChartPane; }
From source file:savant.view.swing.GraphPane.java
/** * {@inheritDoc}/*from ww w. j a v a 2 s . c o m*/ */ @Override public void mouseDragged(MouseEvent event) { setMouseModifier(event); GraphPaneController gpc = GraphPaneController.getInstance(); int x2 = getConstrainedX(event); isDragging = true; if (gpc.isPanning()) { setCursor(new Cursor(Cursor.HAND_CURSOR)); } else if (gpc.isZooming() || gpc.isSelecting()) { setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); } // Check if scrollbar is present (only vertical pan if present) JScrollBar scroller = getVerticalScrollBar(); boolean scroll = scroller.isVisible(); if (scroll) { //get new points Point l = event.getLocationOnScreen(); int currX = l.x; int currY = l.y; //magnitude int magX = Math.abs(currX - startX); int magY = Math.abs(currY - startY); if (magX >= magY) { //pan horizontally, reset vertical pan panVert = false; gpc.setMouseReleasePosition(transformXPixel(x2)); scroller.setValue(initialScroll); } else { //pan vertically, reset horizontal pan panVert = true; gpc.setMouseReleasePosition(baseX); scroller.setValue(initialScroll - (currY - startY)); } } else { //pan horizontally panVert = false; gpc.setMouseReleasePosition(transformXPixel(x2)); } }
From source file:uk.ac.lkl.cram.ui.ModuleFrame.java
private JXTaskPane createLearningTypeChartPane() { JXTaskPane typeChartPane = new JXTaskPane(); typeChartPane.setTitle("Learning Types"); typeChartPane.setScrollOnExpand(true); final LearningTypeChartMaker maker = new LearningTypeChartMaker(module); final ChartPanel chartPanel = maker.getChartPanel(); //Add a mouse listener to the chart chartPanel.addChartMouseListener(new ChartMouseListener() { @Override//from w w w.j av a2 s .c o m public void chartMouseClicked(ChartMouseEvent cme) { //Get the mouse event MouseEvent trigger = cme.getTrigger(); //Test if the mouse event is a left-button if (trigger.getButton() == MouseEvent.BUTTON1 && trigger.getClickCount() == 2) { //Check that the mouse click is on a segment of the pie if (cme.getEntity() instanceof PieSectionEntity) { //Get the selected segment of the pie PieSectionEntity pieSection = (PieSectionEntity) cme.getEntity(); //Get the key that corresponds to that segment--this is a learning type String key = pieSection.getSectionKey().toString(); //Get the set of tlalineitems whose activity contains that learning type Set<TLALineItem> relevantTLAs = maker.getLearningTypeMap().get(key); //Create a pop up dialog containing that set of tlalineitems LearningTypePopupDialog popup = new LearningTypePopupDialog( (Frame) SwingUtilities.getWindowAncestor(chartPanel), true, relevantTLAs, key); //Set the title of the popup to indicate which learning type was selected popup.setTitle("Activities with \'" + key + "\'"); //Centre the popup at the location of the mouse click Point location = trigger.getLocationOnScreen(); int w = popup.getWidth(); int h = popup.getHeight(); popup.setLocation(location.x - w / 2, location.y - h / 2); popup.setVisible(true); int returnStatus = popup.getReturnStatus(); if (returnStatus == LearningTypePopupDialog.RET_OK) { modifyTLALineItem(popup.getSelectedTLALineItem(), 0); } } } } @Override public void chartMouseMoved(ChartMouseEvent cme) { //Set the cursor shape according to the location of the cursor if (cme.getEntity() instanceof PieSectionEntity) { chartPanel.setCursor(HAND); } else { chartPanel.setCursor(Cursor.getDefaultCursor()); } } }); chartPanel.setPreferredSize(new Dimension(150, 200)); typeChartPane.add(chartPanel); return typeChartPane; }
From source file:erigo.ctstream.CTstream.java
/** * /* ww w . j a v a 2s .co m*/ * mouseDragged * * Implement the mouseDragged method defined by interface MouseMotionListener. * * This method implements the "guts" of our homemade window manager; this method * handles moving and resizing the frame. * * Why have we implemented our own window manager? Since translucent panels * can only be contained within undecorated Frames (see comments in the top * header above) and since undecorated Frames don't support moving/resizing, * we implement our own basic "window manager" by catching mouse move and drag * events. * * @author John P. Wilson * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent) */ @Override public void mouseDragged(MouseEvent mouseEventI) { // System.err.println("mouseDragged: " + mouseEventI.getX() + "," + mouseEventI.getY()); // Keep the screen capture area to at least a minimum width and height boolean bDontMakeThinner = false; boolean bDontMakeShorter = false; if (capturePanel.getHeight() < 20) { bDontMakeShorter = true; } if (capturePanel.getWidth() < 20) { bDontMakeThinner = true; } Point currentPoint = mouseEventI.getLocationOnScreen(); int currentPosX = currentPoint.x; int currentPosY = currentPoint.y; int deltaX = 0; int deltaY = 0; if ((mouseCommandMode != NO_COMMAND) && (mouseStartingPoint != null)) { deltaX = currentPosX - mouseStartingPoint.x; deltaY = currentPosY - mouseStartingPoint.y; } int oldFrameWidth = guiFrame.getBounds().width; int oldFrameHeight = guiFrame.getBounds().height; if (mouseCommandMode == MOVE_FRAME) { Point updatedGUIFrameLoc = new Point(frameStartingBounds.x + deltaX, frameStartingBounds.y + deltaY); guiFrame.setLocation(updatedGUIFrameLoc); } else if (mouseCommandMode == RESIZE_FRAME_NW) { int newFrameWidth = frameStartingBounds.width - deltaX; int newFrameHeight = frameStartingBounds.height - deltaY; if ((bDontMakeThinner && (newFrameWidth < oldFrameWidth)) || (bDontMakeShorter && (newFrameHeight < oldFrameHeight))) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x + deltaX, frameStartingBounds.y + deltaY, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_N) { int newFrameWidth = frameStartingBounds.width; int newFrameHeight = frameStartingBounds.height - deltaY; if (bDontMakeShorter && (newFrameHeight < oldFrameHeight)) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x, frameStartingBounds.y + deltaY, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_NE) { int newFrameWidth = frameStartingBounds.width + deltaX; int newFrameHeight = frameStartingBounds.height - deltaY; if ((bDontMakeThinner && (newFrameWidth < oldFrameWidth)) || (bDontMakeShorter && (newFrameHeight < oldFrameHeight))) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x, frameStartingBounds.y + deltaY, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_E) { int newFrameWidth = frameStartingBounds.width + deltaX; int newFrameHeight = frameStartingBounds.height; if (bDontMakeThinner && (newFrameWidth < oldFrameWidth)) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x, frameStartingBounds.y, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_SE) { int newFrameWidth = frameStartingBounds.width + deltaX; int newFrameHeight = frameStartingBounds.height + deltaY; if ((bDontMakeThinner && (newFrameWidth < oldFrameWidth)) || (bDontMakeShorter && (newFrameHeight < oldFrameHeight))) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x, frameStartingBounds.y, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_S) { int newFrameWidth = frameStartingBounds.width; int newFrameHeight = frameStartingBounds.height + deltaY; if (bDontMakeShorter && (newFrameHeight < oldFrameHeight)) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x, frameStartingBounds.y, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_SW) { int newFrameWidth = frameStartingBounds.width - deltaX; int newFrameHeight = frameStartingBounds.height + deltaY; if ((bDontMakeThinner && (newFrameWidth < oldFrameWidth)) || (bDontMakeShorter && (newFrameHeight < oldFrameHeight))) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x + deltaX, frameStartingBounds.y, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else if (mouseCommandMode == RESIZE_FRAME_W) { int newFrameWidth = frameStartingBounds.width - deltaX; int newFrameHeight = frameStartingBounds.height; if (bDontMakeThinner && (newFrameWidth < oldFrameWidth)) { return; } Rectangle updatedGUIFrameBounds = new Rectangle(frameStartingBounds.x + deltaX, frameStartingBounds.y, newFrameWidth, newFrameHeight); guiFrame.setBounds(updatedGUIFrameBounds); } else { // See if we need to go into a particular command mode mouseStartingPoint = null; frameStartingBounds = null; mouseCommandMode = getGUIFrameCommandMode(mouseEventI.getPoint()); if (mouseCommandMode != NO_COMMAND) { mouseStartingPoint = mouseEventI.getLocationOnScreen(); frameStartingBounds = guiFrame.getBounds(); } } }
From source file:org.gtdfree.GTDFree.java
protected TrayIcon getTrayIcon() { if (trayIcon == null) { if (ApplicationHelper.isGTKLaF()) { trayIcon = new TrayIcon(ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_tray_splash)); } else {/* ww w .ja va 2 s . c om*/ trayIcon = new TrayIcon(ApplicationHelper.loadImage(ApplicationHelper.icon_name_small_tray_splash)); } trayIcon.setImageAutoSize(true); trayIcon.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { trayIconPopup.setVisible(false); if (getJFrame().isVisible()) { getJFrame().setVisible(false); } else { pushVisible(); } } else { if (trayIconPopup.isVisible()) { trayIconPopup.setVisible(false); } else { Point p = new Point(e.getPoint()); /* * Disabled, because we are anyway doing things like rollover, * which are probably done by Frame. if (getJFrame().isShowing()) { SwingUtilities.convertPointFromScreen(p, getJFrame()); trayIconPopup.show(getJFrame(), p.x, p.y); } else { }*/ trayIconPopup.show(null, p.x, p.y); } } } }); trayIcon.setToolTip("GTD-Free - " + Messages.getString("GTDFree.Tray.desc")); //$NON-NLS-1$ //$NON-NLS-2$ /* * Necessary only when popup is showing with null window. Hides popup. */ MouseListener hideMe = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { if (e.getComponent() instanceof JMenuItem) { JMenuItem jm = (JMenuItem) e.getComponent(); jm.getModel().setRollover(false); jm.getModel().setArmed(false); jm.repaint(); } Point p = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), trayIconPopup); //System.out.println(p.x+" "+p.y+" "+trayIconPopup.getWidth()+" "+trayIconPopup.getHeight()); if (p.x < 0 || p.x >= trayIconPopup.getWidth() || p.y < 0 || p.y >= trayIconPopup.getHeight()) { trayIconPopup.setVisible(false); } } @Override public void mouseEntered(MouseEvent e) { if (e.getComponent() instanceof JMenuItem) { JMenuItem jm = (JMenuItem) e.getComponent(); jm.getModel().setRollover(true); jm.getModel().setArmed(true); jm.repaint(); } } }; trayIconPopup = new JPopupMenu(); trayIconPopup.addMouseListener(hideMe); JMenuItem mi = new JMenuItem(Messages.getString("GTDFree.Tray.Drop")); //$NON-NLS-1$ mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_small_collecting)); mi.setToolTipText(Messages.getString("GTDFree.Tray.Drop.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); /* * Workaround for tray, if JFrame is showing, then mouse click is not fired */ mi.addMouseListener(new MouseAdapter() { private boolean click = false; @Override public void mousePressed(MouseEvent e) { click = true; } @Override public void mouseReleased(MouseEvent e) { if (click) { click = false; doMouseClicked(e); } } @Override public void mouseExited(MouseEvent e) { click = false; } private void doMouseClicked(MouseEvent e) { trayIconPopup.setVisible(false); Clipboard c = null; if (e.getButton() == MouseEvent.BUTTON1) { c = Toolkit.getDefaultToolkit().getSystemClipboard(); } else if (e.getButton() == MouseEvent.BUTTON2) { c = Toolkit.getDefaultToolkit().getSystemSelection(); } else { return; } try { Object o = c.getData(DataFlavor.stringFlavor); if (o != null) { getEngine().getGTDModel().collectAction(o.toString()); } flashMessage(Messages.getString("GTDFree.Tray.Collect.ok"), e.getLocationOnScreen()); //$NON-NLS-1$ } catch (Exception e1) { Logger.getLogger(this.getClass()).debug("Internal error.", e1); //$NON-NLS-1$ flashMessage(Messages.getString("GTDFree.Tray.Collect.fail") + e1.getMessage(), //$NON-NLS-1$ e.getLocationOnScreen()); } } }); TransferHandler th = new TransferHandler() { private static final long serialVersionUID = 1L; @Override public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { return DataFlavor.selectBestTextFlavor(transferFlavors) != null; } @Override public boolean importData(JComponent comp, Transferable t) { try { DataFlavor f = DataFlavor.selectBestTextFlavor(t.getTransferDataFlavors()); Object o = t.getTransferData(f); if (o != null) { getEngine().getGTDModel().collectAction(o.toString()); } return true; } catch (UnsupportedFlavorException e) { Logger.getLogger(this.getClass()).debug("Internal error.", e); //$NON-NLS-1$ } catch (IOException e) { Logger.getLogger(this.getClass()).debug("Internal error.", e); //$NON-NLS-1$ } return false; } }; mi.setTransferHandler(th); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_delete)); mi.setText(Messages.getString("GTDFree.Tray.Hide")); //$NON-NLS-1$ mi.setToolTipText(Messages.getString("GTDFree.Tray.Hide.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); if (getJFrame().isVisible()) { getJFrame().setVisible(false); } } }); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_small_splash)); mi.setText(Messages.getString("GTDFree.Tray.Show")); //$NON-NLS-1$ mi.setToolTipText(Messages.getString("GTDFree.Tray.Show.desc")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); pushVisible(); } }); trayIconPopup.add(mi); mi = new JMenuItem(); mi.setIcon(ApplicationHelper.getIcon(ApplicationHelper.icon_name_large_exit)); mi.setText(Messages.getString("GTDFree.Tray.Exit")); //$NON-NLS-1$ mi.addMouseListener(hideMe); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { trayIconPopup.setVisible(false); close(false); } }); trayIconPopup.add(mi); } return trayIcon; }
From source file:org.forester.archaeopteryx.TreePanel.java
final private void showBranchDataPopup(final MouseEvent e, final PhylogenyNode node) { try {/* w ww. j av a2s . c o m*/ String[] histdata = null; short lines = 10; // show inserted species on branch if (!(((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc() .length() < 10)) { // as long as there are no branch names longer than 9 characters, this is going to work lines++; _popup_buffer.delete(0, _popup_buffer.length()); histdata = ((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc() .split(","); _popup_buffer .append("RAxml Weights Histogram " + node.getNodeData().getSequence(0).getName() + "\n"); String branch_data = ""; // parse the histogram Pattern p = Pattern.compile("\\s*\\d\\.\\d\\s-\\s\\d\\.\\d:\\s[\\|\\.]*\\s*\\d+"); for (int i = 0; i < histdata.length; i++) { //################################## // Parse Node Description a[i] here! Matcher m = p.matcher(histdata[i]); if (m.matches()) { branch_data = branch_data + histdata[i] + "\n"; // System.out.println(a[i]); } } _popup_buffer.append(branch_data); //_popup_buffer.append(((Annotation)node.getNodeData().getSequence().getAnnotation(0)).getDesc()); } else if (node.getNodeData().isHasSequence()) { _popup_buffer.delete(0, _popup_buffer.length()); _popup_buffer.append(node.getNodeData().getSequence(0).getName()); } if (_popup_buffer.length() > 0) { if (!getConfiguration().isUseNativeUI()) { _rollover_popup.setBorder(BorderFactory.createLineBorder(getTreeColorSet().getBranchColor())); _rollover_popup.setBackground(getTreeColorSet().getBackgroundColor()); if (isInFoundNodes(node)) { _rollover_popup.setForeground(getTreeColorSet().getFoundColor()); } else if (getControlPanel().isColorAccordingToTaxonomy()) { _rollover_popup.setForeground(getTaxonomyBasedColor(node)); } else { _rollover_popup.setForeground(getTreeColorSet().getSequenceColor()); } } else { _rollover_popup.setBorder(BorderFactory.createLineBorder(Color.BLACK)); } CategoryDataset data = createDataset(histdata); JFreeChart histogram = createChart(data, node.getNodeData().getSequence(0).getName()); _chart_panel = new ChartPanel(histogram, 300, 200, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_BUFFER_USED, false, false, false, false, true); _rollover_popup.setText(_popup_buffer.toString());//_popup_buffer.toString() ); _node_desc_popup = PopupFactory.getSharedInstance().getPopup(null, _chart_panel, e.getLocationOnScreen().x + 10, e.getLocationOnScreen().y - (10)); _node_desc_popup.show(); } } catch (final Exception ex) { // Do nothing. } }
From source file:org.forester.archaeopteryx.TreePanel.java
final private void showNodeDataPopup(final MouseEvent e, final PhylogenyNode node) { try {// ww w .j av a 2s .c o m if ((node.getNodeName().length() > 0) || (node.getNodeData().isHasTaxonomy() && !isTaxonomyEmpty(node.getNodeData().getTaxonomy())) || (node.getNodeData().isHasSequence() && !isSequenceEmpty(node.getNodeData().getSequence())) || (node.getNodeData().isHasDate()) || (node.getNodeData().isHasDistribution()) || node.getBranchData().isHasConfidences()) { _popup_buffer.setLength(0); short lines = 0; if (node.getNodeName().length() > 0) { lines++; _popup_buffer.append(node.getNodeName()); } if (node.getNodeData().isHasTaxonomy() && !isTaxonomyEmpty(node.getNodeData().getTaxonomy())) { lines++; boolean enc_data = false; final Taxonomy tax = node.getNodeData().getTaxonomy(); if (_popup_buffer.length() > 0) { _popup_buffer.append("\n"); } if (!ForesterUtil.isEmpty(tax.getTaxonomyCode())) { _popup_buffer.append("["); _popup_buffer.append(tax.getTaxonomyCode()); _popup_buffer.append("]"); enc_data = true; } if (!ForesterUtil.isEmpty(tax.getScientificName())) { if (enc_data) { _popup_buffer.append(" "); } _popup_buffer.append(tax.getScientificName()); enc_data = true; } if (!ForesterUtil.isEmpty(tax.getCommonName())) { if (enc_data) { _popup_buffer.append(" ("); } else { _popup_buffer.append("("); } _popup_buffer.append(tax.getCommonName()); _popup_buffer.append(")"); enc_data = true; } if (!ForesterUtil.isEmpty(tax.getAuthority())) { if (enc_data) { _popup_buffer.append(" ("); } else { _popup_buffer.append("("); } _popup_buffer.append(tax.getAuthority()); _popup_buffer.append(")"); enc_data = true; } if (!ForesterUtil.isEmpty(tax.getRank())) { if (enc_data) { _popup_buffer.append(" ["); } else { _popup_buffer.append("["); } _popup_buffer.append(tax.getRank()); _popup_buffer.append("]"); enc_data = true; } if (tax.getSynonyms().size() > 0) { if (enc_data) { _popup_buffer.append(" "); } _popup_buffer.append("["); int counter = 1; for (final String syn : tax.getSynonyms()) { if (!ForesterUtil.isEmpty(syn)) { _popup_buffer.append(syn); if (counter < tax.getSynonyms().size()) { _popup_buffer.append(", "); } } counter++; } _popup_buffer.append("]"); } } if (node.getNodeData().isHasSequence() && !isSequenceEmpty(node.getNodeData().getSequence())) { lines++; boolean enc_data = false; if (_popup_buffer.length() > 0) { _popup_buffer.append("\n"); } final Sequence seq = node.getNodeData().getSequence(); if (seq.getAccession() != null) { _popup_buffer.append("["); if (!ForesterUtil.isEmpty(seq.getAccession().getSource())) { _popup_buffer.append(seq.getAccession().getSource()); _popup_buffer.append("="); } _popup_buffer.append(seq.getAccession().getValue()); _popup_buffer.append("]"); enc_data = true; } if (!ForesterUtil.isEmpty(seq.getSymbol())) { if (enc_data) { _popup_buffer.append(" ["); } else { _popup_buffer.append("["); } _popup_buffer.append(seq.getSymbol()); _popup_buffer.append("]"); enc_data = true; } if (!ForesterUtil.isEmpty(seq.getName())) { if (enc_data) { _popup_buffer.append(" "); } _popup_buffer.append(seq.getName()); } } if (node.getNodeData().isHasDate()) { lines++; if (_popup_buffer.length() > 0) { _popup_buffer.append("\n"); } _popup_buffer.append(node.getNodeData().getDate().asSimpleText()); } if (node.getNodeData().isHasDistribution()) { lines++; if (_popup_buffer.length() > 0) { _popup_buffer.append("\n"); } _popup_buffer.append(node.getNodeData().getDistribution().asSimpleText()); } if (node.getBranchData().isHasConfidences()) { final List<Confidence> confs = node.getBranchData().getConfidences(); for (final Confidence confidence : confs) { lines++; if (_popup_buffer.length() > 0) { _popup_buffer.append("\n"); } if (!ForesterUtil.isEmpty(confidence.getType())) { _popup_buffer.append("["); _popup_buffer.append(confidence.getType()); _popup_buffer.append("] "); } else { _popup_buffer.append("[?] "); } _popup_buffer.append(FORMATTER_CONFIDENCE.format(ForesterUtil.round(confidence.getValue(), getOptions().getNumberOfDigitsAfterCommaForConfidenceValues()))); } } if (_popup_buffer.length() > 0) { if (!getConfiguration().isUseNativeUI()) { _rollover_popup .setBorder(BorderFactory.createLineBorder(getTreeColorSet().getBranchColor())); _rollover_popup.setBackground(getTreeColorSet().getBackgroundColor()); if (isInFoundNodes(node)) { _rollover_popup.setForeground(getTreeColorSet().getFoundColor()); } else if (getControlPanel().isColorAccordingToTaxonomy()) { _rollover_popup.setForeground(getTaxonomyBasedColor(node)); } else { _rollover_popup.setForeground(getTreeColorSet().getSequenceColor()); } } else { _rollover_popup.setBorder(BorderFactory.createLineBorder(Color.BLACK)); } _rollover_popup.setText(_popup_buffer.toString()); //_rollover_popup.setText("Hallo"); _node_desc_popup = PopupFactory.getSharedInstance().getPopup(null, _rollover_popup, e.getLocationOnScreen().x + 10, e.getLocationOnScreen().y - (lines * 20)); _node_desc_popup.show(); } } } catch (final Exception ex) { // Do nothing. } }