Example usage for java.awt.event MouseEvent getButton

List of usage examples for java.awt.event MouseEvent getButton

Introduction

In this page you can find the example usage for java.awt.event MouseEvent getButton.

Prototype

public int getButton() 

Source Link

Document

Returns which, if any, of the mouse buttons has changed state.

Usage

From source file:com.haulmont.cuba.desktop.gui.components.DesktopTree.java

@Override
public void setItemClickAction(Action action) {
    if (this.doubleClickAction != action) {
        if (action != null) {
            if (itemClickListener == null) {
                itemClickListener = new MouseAdapter() {
                    @Override// w  ww.j  a v  a2 s .c  om
                    public void mouseClicked(MouseEvent e) {
                        if (isEditable()) {
                            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2
                                    && doubleClickAction != null) {

                                int rowForLocation = impl.getRowForLocation(e.getX(), e.getY());
                                TreePath pathForLocation = impl.getPathForRow(rowForLocation);

                                if (pathForLocation != null) {
                                    impl.setSelectionPath(pathForLocation);

                                    doubleClickAction.actionPerform(DesktopTree.this);
                                }
                            }
                        }
                    }
                };
                impl.addMouseListener(itemClickListener);
                impl.setToggleClickCount(0);
            }
        } else {
            impl.removeMouseListener(itemClickListener);
            impl.setToggleClickCount(2);
            itemClickListener = null;
        }
        this.doubleClickAction = action;
    }
}

From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java

/**
 * Creates the master view containing the chart.
 * /*from  w  w  w  .  j av  a  2s . c om*/
 * @param parent
 *            the parent composite
 * @return the chart composite
 */
public Composite createMasterView(Composite parent) {

    // create the date set for the chart
    mPieDataset = new GraphPieDataset();
    mPieDataset.setShowAllCategories(mShowAllCategoriesAction.isChecked());
    mGraph = createChart(mPieDataset);

    // creates the chart component
    // Composite embeddedComposite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
    // embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // experimental usage of JFreeChart SWT
    // the composite to harbor the Swing chart control
    ChartComposite embeddedComposite = new ChartComposite(parent, SWT.NONE, mGraph, true);
    embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    embeddedComposite.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseClicked(final ChartMouseEvent event) {

            MouseEvent trigger = event.getTrigger();
            if (trigger.getButton() == MouseEvent.BUTTON1 && event.getEntity() instanceof PieSectionEntity) {

                // && trigger.getClickCount() == 2 //doubleclick not correctly detected with the SWT composite

                mMasterComposite.getDisplay().syncExec(new Runnable() {

                    public void run() {
                        mIsDrilledDown = true;
                        mCurrentDetailCategory = (String) ((PieSectionEntity) event.getEntity())
                                .getSectionKey();
                        mStackLayout.topControl = mDetailViewer.getTable();
                        mMainSection.layout();
                        mDetailViewer.setInput(mDetailViewer.getInput());

                        updateActions();
                        updateLabel();
                    }
                });
            } else {
                event.getTrigger().consume();
            }
        }

        public void chartMouseMoved(ChartMouseEvent event) {
            // NOOP
        }
    });

    return embeddedComposite;
}

From source file:canreg.client.gui.analysis.FrequenciesByYearInternalFrame.java

private void rowTableMousePressed(java.awt.event.MouseEvent evt) {
    if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {
        showPopUpMenu(0, evt);//w  w  w .j  a va 2  s . c o m
    }

}

From source file:canreg.client.gui.analysis.FrequenciesByYearInternalFrame.java

private void columnTableMousePressed(java.awt.event.MouseEvent evt) {
    if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {
        JTable target = (JTable) evt.getSource();
        int columnNumber = target.getSelectedColumn();

        JPopupMenu jpm = new JPopupMenu("" + columnNumber);
        jpm.add(java.util.ResourceBundle
                .getBundle("canreg/client/gui/analysis/resources/FrequenciesByYearInternalFrame")
                .getString("COLUMN ")
                + tableColumnModel.getColumn(tableColumnModel.getColumnIndexAtX(evt.getX())).getHeaderValue());
        jpm.show(target, evt.getX(), evt.getY());
    }//from ww  w  .  j a v  a 2s  .  com
}

From source file:it.unibas.spicygui.vista.listener.MyMouseEventListener.java

private void dispacciaEvento(Component com, MouseEvent e, Point point, boolean draggedEvent) {
    if (com == null) {
        com = SwingUtilities.getDeepestComponentAt(pannelloPrincipale, point.x, point.y);
    }//w  ww .j  a v  a2 s.c om
    Point componentPoint = SwingUtilities.convertPoint(component, e.getPoint(), com);
    if (com != null) {
        if (com instanceof JTree) {
            TreePath treePath = ((JTree) com).getPathForLocation(componentPoint.x, componentPoint.y);
            if (treePath == null || draggedEvent) {
                jLayeredPane.moveToFront(component);
                component.updateUI();
                if (e.getButton() == MouseEvent.BUTTON3) {
                    return;
                }
            }
        }
        com.dispatchEvent(new MouseEvent(com, e.getID(), e.getWhen(), e.getModifiers(), componentPoint.x,
                componentPoint.y, e.getClickCount(), e.isPopupTrigger()));

        jLayeredPane.moveToFront(component);
        component.updateUI();

    }
    jLayeredPane.moveToFront(component);
    component.updateUI();

}

From source file:org.exist.launcher.Launcher.java

private boolean initSystemTray() {
    final Dimension iconDim = tray.getTrayIconSize();
    BufferedImage image = null;/*  w w  w . j  ava 2s .c o m*/
    try {
        image = ImageIO.read(getClass().getResource("icon32.png"));
    } catch (final IOException e) {
        showMessageAndExit("Launcher failed", "Failed to read system tray icon.", false);
    }
    trayIcon = new TrayIcon(image.getScaledInstance(iconDim.width, iconDim.height, Image.SCALE_SMOOTH),
            "eXist-db Launcher");

    final JDialog hiddenFrame = new JDialog();
    hiddenFrame.setUndecorated(true);
    hiddenFrame.setIconImage(image);

    final PopupMenu popup = createMenu();
    trayIcon.setPopupMenu(popup);
    trayIcon.addActionListener(actionEvent -> {
        trayIcon.displayMessage(null, "Right click for menu", TrayIcon.MessageType.INFO);
        setServiceState();
    });

    // add listener for left click on system tray icon. doesn't work well on linux though.
    if (!SystemUtils.IS_OS_LINUX) {
        trayIcon.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent mouseEvent) {
                if (mouseEvent.getButton() == MouseEvent.BUTTON1) {
                    setServiceState();
                    hiddenFrame.add(popup);
                    popup.show(hiddenFrame, mouseEvent.getXOnScreen(), mouseEvent.getYOnScreen());
                }
            }
        });
    }

    try {
        hiddenFrame.setResizable(false);
        hiddenFrame.pack();
        hiddenFrame.setVisible(true);
        tray.add(trayIcon);
    } catch (final AWTException e) {
        return false;
    }

    return true;
}

From source file:fi.todoordelay.gui.GuiMainFrame.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.// w w w  .j a v a 2  s  .  c o m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    menuBar = new javax.swing.JMenuBar();
    projectMenu = new javax.swing.JMenu();
    addprojectMenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    saveAsMenuItem = new javax.swing.JMenuItem();
    exitMenuItem = new javax.swing.JMenuItem();
    taskMenu = new javax.swing.JMenu();
    addtaskMenuItem = new javax.swing.JMenuItem();
    copyMenuItem = new javax.swing.JMenuItem();
    pasteMenuItem = new javax.swing.JMenuItem();
    deleteMenuItem = new javax.swing.JMenuItem();
    ownlistMenu = new javax.swing.JMenu();
    addownlistMenuItem = new javax.swing.JMenuItem();
    aboutMenuItem = new javax.swing.JMenuItem();

    projectListModel = new javax.swing.DefaultListModel();
    projectsList = new javax.swing.JList(projectListModel);
    projectsPane = new javax.swing.JScrollPane(projectsList);

    taskListModel = new javax.swing.DefaultListModel();
    tasksList = new javax.swing.JList(taskListModel);
    tasksPane = new javax.swing.JScrollPane(tasksList);

    informationTextArea = new javax.swing.JTextArea();
    informationPane = new javax.swing.JScrollPane(informationTextArea);

    addItemDialog = new javax.swing.JOptionPane();
    editItemDialog = new javax.swing.JOptionPane();

    mainLogic = new fi.todoordelay.logic.LogicMain();

    projectsListMouseListener = new MouseListener() {
        public void mouseClicked(MouseEvent evt) {
            int index = projectsList.locationToIndex(evt.getPoint());
            selectedProject = index;
            selectionGroup = 0;

            if (evt.getButton() == 3) {
                int d = editItemDialog.showConfirmDialog(null,
                        "ARE YOU SURE YOU WANT TO DELETE CHOSEN PROJECT?", "Delete project dialog",
                        editItemDialog.YES_NO_OPTION, editItemDialog.WARNING_MESSAGE);
                if (d == 0) {
                    mainLogic.removeProject(mainLogic.getProjects().get(selectedProject));
                }
                selectedProject = -1;
                updateProjectListModel();
            }

            if (evt.getClickCount() == 2 && selectedProject > -1) {
                List pl = mainLogic.getProjects();
                Project p = (Project) pl.get(index);

                editItemDialog.setWantsInput(true);
                String name = editItemDialog.showInputDialog(null, "New project name (required):",
                        "Edit project dialog", editItemDialog.INFORMATION_MESSAGE);
                String description = editItemDialog.showInputDialog(null, "New project description:",
                        "Edit project dialog", editItemDialog.INFORMATION_MESSAGE);
                String dueString = editItemDialog.showInputDialog(null, "New due date in x day(s):",
                        "Edit project dialog", editItemDialog.INFORMATION_MESSAGE);

                try {
                    if (name.equals("")) {
                        JOptionPane.showMessageDialog(editItemDialog,
                                "Project name cannot be empty (exiting without changes)");
                    } else if (Long.parseLong(dueString) < 0) {
                        JOptionPane.showMessageDialog(editItemDialog, "Due date must be zero or higher");
                    } else {
                        p.setName(name);
                        p.setDescription(description);
                        p.setDuedate(LocalDateTime.now().plusDays(Long.parseLong(dueString)));
                    }
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(editItemDialog, "Due date must be valid number");
                }

            }

            updateProjectListModel();
            mouseClickedOnProjectActionPerformed(evt);

        }

        public void mouseEntered(MouseEvent evt) {
        }

        public void mouseExited(MouseEvent evt) {
        }

        public void mouseReleased(MouseEvent evt) {
        }

        public void mousePressed(MouseEvent evt) {
        }

    };
    projectsList.addMouseListener(projectsListMouseListener);

    tasksListMouseListener = new MouseListener() {
        public void mouseClicked(MouseEvent evt) {
            int index = tasksList.locationToIndex(evt.getPoint());
            selectedTask = index;
            selectionGroup = 1;

            if (evt.getButton() == 3) {
                int d = editItemDialog.showConfirmDialog(null, "ARE YOU SURE YOU WANT TO DELETE CHOSEN TASK?",
                        "Delete task dialog", editItemDialog.YES_NO_OPTION, editItemDialog.WARNING_MESSAGE);
                if (d == 0) {
                    mainLogic.getProjects().get(selectedProject).removeTask(
                            mainLogic.getProjects().get(selectedProject).getTasks().get(selectedTask));
                }
                updateProjectListModel();
            }

            if (evt.getClickCount() == 2 && selectedTask > -1) {
                List tl = mainLogic.getProjects().get(selectedProject).getTasks();
                Task t = (Task) tl.get(index);

                editItemDialog.setWantsInput(true);
                String name = editItemDialog.showInputDialog(null, "New task name (required):",
                        "Edit task dialog", editItemDialog.INFORMATION_MESSAGE);
                String description = editItemDialog.showInputDialog(null, "New task description:",
                        "Edit task dialog", editItemDialog.INFORMATION_MESSAGE);
                String dueString = editItemDialog.showInputDialog(null, "New due date in x day(s):",
                        "Edit task dialog", editItemDialog.INFORMATION_MESSAGE);

                try {
                    if (name.equals("")) {
                        JOptionPane.showMessageDialog(editItemDialog,
                                "Task name cannot be empty (exiting without changes)");
                    } else if (Long.parseLong(dueString) < 0) {
                        JOptionPane.showMessageDialog(editItemDialog, "Due date must be zero or higher");
                    } else {
                        t.setName(name);
                        t.setDescription(description);
                        t.setDuedate(LocalDateTime.now().plusDays(Long.parseLong(dueString)));
                    }
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(editItemDialog, "Due date must be valid number");
                }

            }

            updateProjectListModel();
            mouseClickedOnProjectActionPerformed(evt);

        }

        public void mouseEntered(MouseEvent evt) {
        }

        public void mouseExited(MouseEvent evt) {
        }

        public void mouseReleased(MouseEvent evt) {
        }

        public void mousePressed(MouseEvent evt) {
        }

    };
    tasksList.addMouseListener(tasksListMouseListener);

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    projectsPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Projects"));
    projectsPane.setViewportBorder(null);

    tasksPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Tasks"));
    tasksPane.setViewportBorder(null);

    informationPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Description"));
    projectsPane.setViewportBorder(null);

    projectMenu.setText("Project");
    addprojectMenuItem.setMnemonic('p');
    addprojectMenuItem.setText("Add Project");
    projectMenu.add(addprojectMenuItem);
    addprojectMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addItemDialog.setWantsInput(true);
            String name = addItemDialog.showInputDialog(null, "Project name (required):", "Add project dialog",
                    addItemDialog.INFORMATION_MESSAGE);
            String description = addItemDialog.showInputDialog(null, "Project description:",
                    "Add project dialog", addItemDialog.INFORMATION_MESSAGE);
            String due_at = addItemDialog.showInputDialog(null, "Due in x day(s):", "Add project dialog",
                    addItemDialog.INFORMATION_MESSAGE);
            Project newProject = new Project(name, description, Long.parseLong(due_at));
            mainLogic.addProject(newProject);
            projectListModel.addElement(name);

            updateProjectListModel();
            addprojectMenuItemActionPerformed(evt);
        }
    });
    menuBar.add(projectMenu);

    taskMenu.setText("Task");
    addtaskMenuItem.setMnemonic('t');
    addtaskMenuItem.setText("Add Task");
    taskMenu.add(addtaskMenuItem);
    addtaskMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addItemDialog.setWantsInput(true);
            String name = addItemDialog.showInputDialog(null, "Task name (required):", "Add task dialog",
                    addItemDialog.INFORMATION_MESSAGE);
            String description = addItemDialog.showInputDialog(null, "Task description:", "Add task dialog",
                    addItemDialog.INFORMATION_MESSAGE);
            String due_at = addItemDialog.showInputDialog(null, "Due in x day(s):", "Add task dialog",
                    addItemDialog.INFORMATION_MESSAGE);
            Task newTask = new Task(name, description, Long.parseLong(due_at));

            Project s = mainLogic.getProjects().get(selectedProject);

            s.addTask(newTask);
            taskListModel.addElement(name);

            updateProjectListModel();
            addprojectMenuItemActionPerformed(evt);
        }
    });
    menuBar.add(taskMenu);

    setJMenuBar(menuBar);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(
                                    projectsPane, javax.swing.GroupLayout.PREFERRED_SIZE, 300,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                    layout.createSequentialGroup().addGap(312, 312, 312).addComponent(tasksPane,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 300,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup().addGap(624, 624, 624).addComponent(
                                    informationPane, javax.swing.GroupLayout.PREFERRED_SIZE, 300,
                                    Short.MAX_VALUE)))

                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
            javax.swing.GroupLayout.Alignment.TRAILING,
            layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(informationPane, javax.swing.GroupLayout.DEFAULT_SIZE, 860,
                                    Short.MAX_VALUE)
                            .addComponent(tasksPane, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(projectsPane, javax.swing.GroupLayout.Alignment.LEADING))

                    .addContainerGap()));

    pack();
}

From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java

/**
 * Creates the master view containing the chart.
 * // w ww . jav  a  2s.c om
 * @param parent
 *            the parent composite
 * @return the chart composite
 */
public Composite createMasterView(final Composite parent) {

    // create the date set for the chart
    this.mPieDataset = new GraphPieDataset();
    // this.mPieDataset.setShowAllCategories(this.mShowAllCategoriesAction.isChecked());
    this.mPieDataset.setShowAllCategories(true);
    this.mGraph = createChart(this.mPieDataset);

    // creates the chart component
    // final Composite embeddedComposite = new Composite(parent, SWT.EMBEDDED);
    // embeddedComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));

    // experimental usage of JFreeChart SWT
    // the composite to harbor the Swing chart control
    ChartComposite embeddedComposite = new ChartComposite(parent, SWT.NONE, mGraph, true);
    embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    embeddedComposite.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseClicked(final ChartMouseEvent event) {

            final MouseEvent trigger = event.getTrigger();
            if (trigger.getButton() == MouseEvent.BUTTON1 && event.getEntity() instanceof PieSectionEntity) {

                // && trigger.getClickCount() == 2 //doubleclick not correctly detected with the SWT composite

                GraphStatsView.this.mMasterComposite.getDisplay().syncExec(new Runnable() {

                    public void run() {

                        GraphStatsView.this.mIsDrilledDown = true;
                        GraphStatsView.this.mCurrentDetailCategory = (String) ((PieSectionEntity) event
                                .getEntity()).getSectionKey();
                        GraphStatsView.this.mStackLayout.topControl = GraphStatsView.this.mDetailViewer
                                .getTable();
                        GraphStatsView.this.mMainSection.layout();
                        GraphStatsView.this.mDetailViewer
                                .setInput(GraphStatsView.this.mDetailViewer.getInput());

                        GraphStatsView.this.updateActions();
                        GraphStatsView.this.updateLabel();
                    }
                });
            } else {
                event.getTrigger().consume();
            }
        }

        public void chartMouseMoved(final ChartMouseEvent event) {

            // NOOP
        }
    });

    return embeddedComposite;
}

From source file:net.sf.mzmine.chartbasics.gui.swing.ChartGestureMouseAdapter.java

@Override
public void mouseClicked(MouseEvent e) {
    if (gestureHandlers == null || gestureHandlers.isEmpty()
            || !(listensFor(Event.CLICK) || listensFor(Event.DOUBLE_CLICK)))
        return;//from   w w  w . ja  va2 s .  c  o m

    if (e.getComponent() instanceof ChartPanel) {
        ChartPanel chartPanel = (ChartPanel) e.getComponent();
        ChartEntity entity = findChartEntity(chartPanel, e);
        ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity);
        Button button = Button.getButton(e.getButton());

        if (!e.isConsumed()) {
            // double clicked
            if (e.getClickCount() == 2) {
                // reset click count to handle double clicks quickly
                e.consume();
                // handle event
                handleEvent(new ChartGestureEvent(chartPanel, e, entity,
                        new ChartGesture(gestureEntity, Event.DOUBLE_CLICK, button)));
            } else if (e.getClickCount() == 1) {
                // handle event
                handleEvent(new ChartGestureEvent(chartPanel, e, entity,
                        new ChartGesture(gestureEntity, Event.CLICK, button)));
            }
        }
    }
}

From source file:pt.lsts.neptus.plugins.sunfish.awareness.SituationAwareness.java

@Override
public void mouseClicked(MouseEvent event, final StateRenderer2D source) {

    if (event.getButton() == MouseEvent.BUTTON3) {
        final LinkedHashMap<String, Vector<AssetPosition>> positions = positionsByType();
        JPopupMenu popup = new JPopupMenu();
        for (String type : positions.keySet()) {
            JMenu menu = new JMenu(type + "s");
            for (final AssetPosition p : positions.get(type)) {

                if (p.getTimestamp() < oldestTimestampSelection || p.getTimestamp() > newestTimestampSelection)
                    continue;

                Color c = cmap.getColor(1 - (p.getAge() / (7200000.0)));
                String htmlColor = String.format("#%02X%02X%02X", c.getRed(), c.getGreen(), c.getBlue());
                menu.add("<html><b>" + p.getAssetName() + "</b> <font color=" + htmlColor + ">" + getAge(p)
                        + "</font>").addActionListener(new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                source.focusLocation(p.getLoc());
                            }/*from   w  w w  .  jav  a  2 s.  c o m*/
                        });
            }
            popup.add(menu);
        }

        popup.addSeparator();
        popup.add("Settings").addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                PluginUtils.editPluginProperties(SituationAwareness.this, true);
            }
        });

        popup.add("Fetch asset properties").addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                //                    for (AssetTrack track : assets.values()) {
                //                        track.setColor(new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255)));
                //                    }
                fetchAssetProperties();
            }
        });

        popup.add("Select location sources").addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                JPanel p = new JPanel();
                p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));

                for (ILocationProvider l : localizers) {
                    JCheckBox check = new JCheckBox(l.getName());
                    check.setSelected(true);
                    p.add(check);
                    check.setSelected(updateMethodNames.contains(l.getName()));
                }

                int op = JOptionPane.showConfirmDialog(getConsole(), p, "Location update sources",
                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                if (op == JOptionPane.CANCEL_OPTION)
                    return;

                Vector<String> methods = new Vector<String>();
                for (int i = 0; i < p.getComponentCount(); i++) {

                    if (p.getComponent(i) instanceof JCheckBox) {
                        JCheckBox sel = (JCheckBox) p.getComponent(i);
                        if (sel.isSelected())
                            methods.add(sel.getText());
                    }
                }
                updateMethods = StringUtils.join(methods, ", ");
                propertiesChanged();
            }
        });

        popup.add("Select hidden positions types").addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

                JPanel p = new JPanel();
                p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));

                for (String type : positions.keySet()) {
                    JCheckBox check = new JCheckBox(type);
                    check.setSelected(true);
                    p.add(check);
                    check.setSelected(hiddenPosTypes.contains(type));
                }

                int op = JOptionPane.showConfirmDialog(getConsole(), p, "Position types to be hidden",
                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
                if (op == JOptionPane.CANCEL_OPTION)
                    return;

                Vector<String> types = new Vector<String>();
                for (int i = 0; i < p.getComponentCount(); i++) {

                    if (p.getComponent(i) instanceof JCheckBox) {
                        JCheckBox sel = (JCheckBox) p.getComponent(i);
                        if (sel.isSelected())
                            types.add(sel.getText());
                    }
                }
                hiddenTypes = StringUtils.join(types, ", ");
                propertiesChanged();
            }
        });

        popup.addSeparator();
        popup.add("Decision Support").addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (dialogDecisionSupport == null) {
                    dialogDecisionSupport = new JDialog(getConsole());
                    dialogDecisionSupport.setModal(false);
                    dialogDecisionSupport.setAlwaysOnTop(true);
                    dialogDecisionSupport.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
                }
                ArrayList<AssetPosition> tags = new ArrayList<AssetPosition>();
                LinkedHashMap<String, Vector<AssetPosition>> positions = positionsByType();
                Vector<AssetPosition> spots = positions.get("SPOT Tag");
                Vector<AssetPosition> argos = positions.get("Argos Tag");
                if (spots != null)
                    tags.addAll(spots);
                if (argos != null)
                    tags.addAll(argos);
                if (!assets.containsKey(getConsole().getMainSystem())) {
                    GuiUtils.errorMessage(getConsole(), "Decision Support", "UUV asset position is unknown");
                    return;
                }
                supportTable.setAssets(assets.get(getConsole().getMainSystem()).getLatest(), tags);
                JXTable table = new JXTable(supportTable);
                dialogDecisionSupport.setContentPane(new JScrollPane(table));
                dialogDecisionSupport.invalidate();
                dialogDecisionSupport.validate();
                dialogDecisionSupport.setSize(600, 300);
                dialogDecisionSupport.setTitle("Decision Support Table");
                dialogDecisionSupport.setVisible(true);
                dialogDecisionSupport.toFront();
                GuiUtils.centerOnScreen(dialogDecisionSupport);
            }
        });
        popup.show(source, event.getX(), event.getY());
    }
    super.mouseClicked(event, source);
}