Example usage for java.awt.event MouseEvent getComponent

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

Introduction

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

Prototype

public Component getComponent() 

Source Link

Document

Returns the originator of the event.

Usage

From source file:corelyzer.ui.CorelyzerGLCanvas.java

void handleRightMouseClick(final MouseEvent e) {
    Point p = e.getPoint();//  www.java2s. c om

    // save a keep of click position
    // so some menu actions can make use of it
    this.rightClickPos = p;

    // float sp[] = {0.0f, 0.0f};
    this.convertMousePointToSceneSpace(p, scenePos);

    // System.out.println("---- Mouse Right Click at " +
    // p.x + ", " + p.y);
    // System.out.println("---- Which is Scene Space: " +
    // scenePos[0] + ", " + scenePos[1]);

    determineSelectedSceneComponents(scenePos, e);

    this.scenePopupMenu.show(e.getComponent(), p.x, p.y);

    selectedMarker = SceneGraph.accessPickedMarker();

    // System.out.println("MarkerId: " + selectedMarker + " is selected");

    if (selectedMarker < 0) {
        return;
    } else {
        // JMenuItem title =
        // (JMenuItem) this.scenePopupMenu.getComponent(4);
        // title.setText("Edit Annotation");
        // this.annotationEditMenu.setEnabled(true);
        // this.annotationAddMenu.setEnabled(false);
    }

    this.scenePopupMenu.repaint();
}

From source file:display.containers.FileManager.java

public Container getPane() {
    //if (gui==null) {

    fileSystemView = FileSystemView.getFileSystemView();
    desktop = Desktop.getDesktop();

    JPanel detailView = new JPanel(new BorderLayout(3, 3));
    //fileTableModel = new FileTableModel();

    table = new JTable();
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setAutoCreateRowSorter(true);//from  ww  w.  j a va  2 s.c om
    table.setShowVerticalLines(false);
    table.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                Point p = e.getPoint();
                int row = table.convertRowIndexToModel(table.rowAtPoint(p));
                int column = table.convertColumnIndexToModel(table.columnAtPoint(p));
                if (row >= 0 && column >= 0) {
                    mouseDblClicked(row, column);
                }
            }
        }
    });
    table.addKeyListener(new KeyListener() {

        @Override
        public void keyTyped(KeyEvent arg0) {

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            if (KeyEvent.VK_DELETE == arg0.getKeyCode()) {
                if (mode != 2) {
                    parentFrame.setLock(true);
                    parentFrame.getProgressBarPanel().setVisible(true);
                    Thread t = new Thread(new Runnable() {

                        @Override
                        public void run() {
                            try {
                                deleteSelectedFiles();
                            } catch (IOException e) {
                                JOptionPane.showMessageDialog(parentFrame, "Error during the deletion.",
                                        "Deletion error", JOptionPane.ERROR_MESSAGE);
                                WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.", e);
                            } finally {
                                parentFrame.setLock(false);
                                refresh();
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        }
                    });
                    t.start();

                } else {
                    if (UserProfile.CURRENT_USER.getLevel() == 3) {
                        parentFrame.setLock(true);
                        parentFrame.getProgressBarPanel().setVisible(true);
                        Thread delThread = new Thread(new Runnable() {

                            @Override
                            public void run() {
                                int[] rows = table.getSelectedRows();
                                int[] columns = table.getSelectedColumns();
                                for (int i = 0; i < rows.length; i++) {
                                    if (!continueAction) {
                                        continueAction = true;
                                        return;
                                    }
                                    int row = table.convertRowIndexToModel(rows[i]);
                                    try {
                                        deleteServerFile(row);
                                    } catch (Exception e) {
                                        WindowManager.mwLogger.log(Level.SEVERE, "Error during the deletion.",
                                                e);
                                    }
                                }
                                refresh();
                                parentFrame.setLock(false);
                                parentFrame.getProgressBarPanel().setVisible(false);
                            }
                        });
                        delThread.start();

                    }
                }
            }
        }

        @Override
        public void keyPressed(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }
    });
    table.getSelectionModel().addListSelectionListener(listSelectionListener);
    JScrollPane tableScroll = new JScrollPane(table);
    Dimension d = tableScroll.getPreferredSize();
    tableScroll.setPreferredSize(new Dimension((int) d.getWidth(), (int) d.getHeight() / 2));
    detailView.add(tableScroll, BorderLayout.CENTER);

    // the File tree
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    treeModel = new DefaultTreeModel(root);
    table.getRowSorter().addRowSorterListener(new RowSorterListener() {

        @Override
        public void sorterChanged(RowSorterEvent e) {
            ((FileTableModel) table.getModel()).fireTableDataChanged();
        }
    });

    // show the file system roots.
    File[] roots = fileSystemView.getRoots();
    for (File fileSystemRoot : roots) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(fileSystemRoot);
        root.add(node);
        //showChildren(node);
        //
        File[] files = fileSystemView.getFiles(fileSystemRoot, true);
        for (File file : files) {
            if (file.isDirectory()) {
                node.add(new DefaultMutableTreeNode(file));
            }
        }
        //
    }
    JScrollPane treeScroll = new JScrollPane();

    Dimension preferredSize = treeScroll.getPreferredSize();
    Dimension widePreferred = new Dimension(200, (int) preferredSize.getHeight());
    treeScroll.setPreferredSize(widePreferred);

    JPanel fileView = new JPanel(new BorderLayout(3, 3));

    detailView.add(fileView, BorderLayout.SOUTH);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScroll, detailView);

    JPanel simpleOutput = new JPanel(new BorderLayout(3, 3));
    progressBar = new JProgressBar();
    simpleOutput.add(progressBar, BorderLayout.EAST);
    progressBar.setVisible(false);
    showChildren(getCurrentDir().toPath());
    //table.setDragEnabled(true);
    table.setColumnSelectionAllowed(false);

    // Menu popup
    Pmenu = new JPopupMenu();
    changeProjectitem = new JMenuItem("Reassign");
    renameProjectitem = new JMenuItem("Rename");
    twitem = new JMenuItem("To workspace");
    tlitem = new JMenuItem("To local");
    processitem = new JMenuItem("Select for process");
    switch (mode) {
    case 0:
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnlocalTowork().doClick();
            }
        });
        break;
    case 1:
        Pmenu.add(tlitem);
        Pmenu.add(processitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtnWorkTolocal().doClick();
            }
        });
        processitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        // Recupere les lignes selectionnees
                        int[] indices = table.getSelectedRows();
                        // On recupere les fichiers correspondants
                        ArrayList<File> files = new ArrayList<File>();
                        for (int i = 0; i < indices.length; i++) {
                            int row = table.convertRowIndexToModel(indices[i]);
                            File fi = ((FileTableModel) table.getModel()).getFile(row);
                            if (fi.isDirectory())
                                files.add(fi);
                        }
                        ImageProcessingFrame imf = new ImageProcessingFrame(files);
                    }
                });

            }
        });
        break;
    case 2:
        if (UserProfile.CURRENT_USER.getLevel() == 3) {
            Pmenu.add(changeProjectitem);
            Pmenu.add(renameProjectitem);
        }
        Pmenu.add(twitem);
        twitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToWorkspace().doClick();
            }
        });
        Pmenu.add(tlitem);
        tlitem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                parentFrame.getBtndistToLocal().doClick();
            }
        });
        break;
    }
    changeProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));

            ReassignProjectPanel reas = new ReassignProjectPanel(from.toPath()); // mode creation de liens
            Popup popup = PopupFactory.getSharedInstance().getPopup(WindowManager.MAINWINDOW, reas,
                    (int) WindowManager.MAINWINDOW.getX() + 200, (int) WindowManager.MAINWINDOW.getY() + 150);
            reas.setPopupWindow(popup);
            popup.show();
            table.setEnabled(true);
        }
    });
    renameProjectitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            table.setEnabled(false);
            final File from = ((FileTableModel) table.getModel())
                    .getFile(table.convertRowIndexToModel(table.getSelectedRows()[0]));
            JDialog.setDefaultLookAndFeelDecorated(true);
            String s = (String) JOptionPane.showInputDialog(WindowManager.MAINWINDOW, "New project name ?",
                    "Rename project", JOptionPane.PLAIN_MESSAGE, null, null, from.getName());

            //If a string was returned, say so.
            if ((s != null) && (s.length() > 0)) {
                ProjectDAO pdao = new MySQLProjectDAO();
                if (new File(from.getParent() + File.separator + s).exists()) {
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            JDialog.setDefaultLookAndFeelDecorated(true);
                            JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                    "Couldn't rename " + from.getName()
                                            + " (A file with this filename already exists)",
                                    "Renaming error", JOptionPane.ERROR_MESSAGE);
                        }
                    });
                    WindowManager.mwLogger.log(Level.SEVERE,
                            "Error during file project renaming (" + from.getName() + "). [Duplication error]");
                } else {
                    try {
                        boolean succeed = pdao.renameProject(from.getName(), s);
                        if (!succeed) {
                            SwingUtilities.invokeLater(new Runnable() {

                                @Override
                                public void run() {
                                    JDialog.setDefaultLookAndFeelDecorated(true);
                                    JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                            "Couldn't rename " + from.getName()
                                                    + " (no project with this name)",
                                            "Renaming error", JOptionPane.ERROR_MESSAGE);
                                }
                            });
                        } else {
                            from.renameTo(new File(from.getParent() + File.separator + s));
                            // on renomme le repertoire nifti ou dicom correspondant si il existe
                            switch (from.getParentFile().getName()) {
                            case ServerInfo.NRI_ANALYSE_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_ANALYSE_NAME,
                                        ServerInfo.NRI_DICOM_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)),
                                                Paths.get(from.getParent().replaceAll(
                                                        ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)
                                                        + File.separator + s));
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_ANALYSE_NAME, ServerInfo.NRI_DICOM_NAME)+File.separator+s));
                                break;
                            case ServerInfo.NRI_DICOM_NAME:
                                if (new File(from.getAbsolutePath().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                        ServerInfo.NRI_ANALYSE_NAME)).exists())
                                    try {
                                        Files.move(Paths.get(from.getAbsolutePath().replaceAll(
                                                ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)),
                                                Paths.get(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME,
                                                        ServerInfo.NRI_ANALYSE_NAME) + File.separator + s));
                                    } catch (IOException e) {
                                        SwingUtilities.invokeLater(new Runnable() {

                                            @Override
                                            public void run() {
                                                JDialog.setDefaultLookAndFeelDecorated(true);
                                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                                        "Couldn't rename " + from.getName()
                                                                + " (error with file system)",
                                                        "Renaming error", JOptionPane.ERROR_MESSAGE);
                                            }
                                        });
                                        e.printStackTrace();
                                        WindowManager.mwLogger.log(Level.SEVERE,
                                                "Error during file project renaming (" + from.getName() + ")",
                                                e);
                                    } //from.renameTo(new File(from.getParent().replaceAll(ServerInfo.NRI_DICOM_NAME, ServerInfo.NRI_ANALYSE_NAME)+File.separator+s));
                                break;
                            }
                            refresh();
                        }
                    } catch (final SQLException e) {
                        WindowManager.mwLogger.log(Level.SEVERE, "Error during SQL project renaming", e);
                        SwingUtilities.invokeLater(new Runnable() {

                            @Override
                            public void run() {
                                JDialog.setDefaultLookAndFeelDecorated(true);
                                JOptionPane.showMessageDialog(WindowManager.MAINWINDOW,
                                        "Exception : " + e.toString(), "Openning error",
                                        JOptionPane.ERROR_MESSAGE);
                            }
                        });
                    }
                }
            }
            table.setEnabled(true);
        }
    });
    table.addMouseListener(new MouseListener() {

        public void mouseClicked(MouseEvent me) {

        }

        public void mouseEntered(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent me) {
            if (me.getButton() == 3 && table.getSelectedRowCount() > 0) {
                int row = table.convertRowIndexToModel(table.rowAtPoint(me.getPoint()));
                changeProjectitem.setVisible(isPatient(((FileTableModel) table.getModel()).getFile(row)));
                renameProjectitem.setVisible(isProject(((FileTableModel) table.getModel()).getFile(row)));
                Pmenu.show(me.getComponent(), me.getX(), me.getY());
            }
        }
    });
    //

    //}
    return tableScroll;
}

From source file:org.orbisgis.view.geocatalog.Catalog.java

/**
 * The user click on the source list control
 *
 * @param e The mouse event fired by the LI
 *//*from   www  .j av  a 2 s .c  o  m*/
public void onMouseActionOnSourceList(MouseEvent e) {
    //Manage selection of items before popping up the menu
    if (e.isPopupTrigger()) { //Right mouse button under linux and windows
        int itemUnderMouse = -1; //Item under the position of the mouse event
        //Find the Item under the position of the mouse cursor
        for (int i = 0; i < sourceListContent.getSize(); i++) {
            //If the coordinate of the cursor cover the cell bouding box
            if (sourceList.getCellBounds(i, i).contains(e.getPoint())) {
                itemUnderMouse = i;
                break;
            }
        }
        //Retrieve all selected items index
        int[] selectedItems = sourceList.getSelectedIndices();
        //If there are a list item under the mouse
        if ((selectedItems != null) && (itemUnderMouse != -1)) {
            //If the item under the mouse was not previously selected
            if (!CollectionUtils.contains(selectedItems, itemUnderMouse)) {
                //Control must be pushed to add the list item to the selection
                if (e.isControlDown()) {
                    sourceList.addSelectionInterval(itemUnderMouse, itemUnderMouse);
                } else {
                    //Unselect the other items and select only the item under the mouse
                    sourceList.setSelectionInterval(itemUnderMouse, itemUnderMouse);
                }
            }
        } else if (itemUnderMouse == -1) {
            //Unselect all items
            sourceList.clearSelection();
        }
        //Selection are ready, now create the popup menu
        JPopupMenu popup = new JPopupMenu();
        popupActions.copyEnabledActions(popup);
        if (popup.getComponentCount() > 0) {
            popup.show(e.getComponent(), e.getX(), e.getY());
        }

    }
}

From source file:org.nuclos.client.relation.EntityRelationshipModelEditPanel.java

private void createMouseListener() {
    graphComponent.getGraphControl().addMouseListener(new MouseAdapter() {

        @Override// w  ww .j ava2 s  .c  o  m
        public void mousePressed(MouseEvent e) {
            if (isPopupShown) {
                isPopupShown = false;
                mxCell cell = (mxCell) graphComponent.getGraph().getSelectionModel().getCell();
                getGraphModel().remove(cell);
                return;
            }
            if (SwingUtilities.isRightMouseButton(e)) {
                xPos = e.getX();
                yPos = e.getY();
                Object obj = graphComponent.getCellAt(e.getX(), e.getY());

                if (obj instanceof mxCell) {
                    mxCell cell = (mxCell) obj;
                    if (cell.getStyle() != null && cell.getStyle().indexOf(ENTITYSTYLE) >= 0
                            && cell.getValue() instanceof EntityMetaDataVO) {
                        JPopupMenu pop = createPopupMenuEntity(cell, false);
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    } else if (cell.getStyle() != null && cell.getStyle().indexOf(ENTITYSTYLE) >= 0) {
                        JPopupMenu pop = createPopupMenuEntity(cell, true);
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    } else {
                        if (cell.getStyle() != null && cell.getStyle().indexOf("oval") >= 0) {
                            JPopupMenu pop = createRelationPopupMenu(cell, true, true);
                            pop.show(e.getComponent(), e.getX(), e.getY());
                        } else {
                            JPopupMenu pop = createRelationPopupMenu(cell, true, false);
                            pop.show(e.getComponent(), e.getX(), e.getY());
                        }
                    }
                } else {
                    JPopupMenu pop = createPopupMenu();
                    pop.show(e.getComponent(), e.getX(), e.getY());
                }
            } else if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
                mxCell cell = (mxCell) graphComponent.getGraph().getSelectionModel().getCell();
                if (cell == null)
                    return;
                if (cell.getValue() != null && cell.getValue() instanceof EntityMetaDataVO) {
                    EntityMetaDataVO voMeta = (EntityMetaDataVO) cell.getValue();
                    EntityMetaDataVO vo = MetaDataClientProvider.getInstance().getEntity(voMeta.getEntity());
                    new ShowNuclosWizard.NuclosWizardEditRunnable(false, mf.getHomePane(), vo).run();
                } else if (cell.getValue() != null && cell.getValue() instanceof EntityFieldMetaDataVO) {
                    if (cell.getStyle() != null && cell.getStyle().indexOf(OPENARROW) >= 0)
                        editMasterdataRelation(cell);
                    else if (cell.getStyle() != null && cell.getStyle().indexOf(DIAMONDARROW) >= 0) {
                        editSubformRelation(cell);
                    }

                } else if (cell.getValue() != null) {
                    if (cell.getStyle() != null && cell.getStyle().indexOf(OVALARROW) >= 0) {
                        try {

                            mxCell cellSource = (mxCell) cell.getSource();
                            mxCell cellTarget = (mxCell) cell.getTarget();

                            EntityMetaDataVO sourceModule = (EntityMetaDataVO) cellSource.getValue();
                            EntityMetaDataVO targetModule = (EntityMetaDataVO) cellTarget.getValue();

                            String sSourceModule = sourceModule.getEntity();
                            String sTargetModule = targetModule.getEntity();

                            boolean blnFound = false;

                            for (MasterDataVO voGeneration : MasterDataCache.getInstance()
                                    .get(NuclosEntity.GENERATION.getEntityName())) {
                                String sSource = (String) voGeneration.getField("sourceModule");
                                String sTarget = (String) voGeneration.getField("targetModule");

                                if (org.apache.commons.lang.StringUtils.equals(sSource, sSourceModule)
                                        && org.apache.commons.lang.StringUtils.equals(sTarget, sTargetModule)) {
                                    GenerationCollectController gcc = (GenerationCollectController) NuclosCollectControllerFactory
                                            .getInstance().newMasterDataCollectController(
                                                    NuclosEntity.GENERATION.getEntityName(), null, null);
                                    gcc.runViewSingleCollectableWithId(voGeneration.getId());
                                    blnFound = true;
                                    break;
                                }

                            }
                            if (!blnFound) {
                                GenerationCollectController gcc = (GenerationCollectController) NuclosCollectControllerFactory
                                        .getInstance().newMasterDataCollectController(
                                                NuclosEntity.GENERATION.getEntityName(), null, null);
                                Map<String, Object> mp = new HashMap<String, Object>();
                                mp.put("sourceModule", sSourceModule);
                                mp.put("sourceModuleId", new Integer(MetaDataClientProvider.getInstance()
                                        .getEntity(sSourceModule).getId().intValue()));
                                mp.put("targetModule", sTargetModule);
                                mp.put("targetModuleId", new Integer(MetaDataClientProvider.getInstance()
                                        .getEntity(sTargetModule).getId().intValue()));
                                MasterDataVO vo = new MasterDataVO(NuclosEntity.GENERATION.getEntityName(),
                                        null, null, null, null, null, null, mp);
                                gcc.runWithNewCollectableWithSomeFields(vo);
                            }
                        } catch (NuclosBusinessException e1) {
                            LOG.warn("mousePressed failed: " + e1, e1);
                        } catch (CommonPermissionException e1) {
                            LOG.warn("mousePressed failed: " + e1, e1);
                        } catch (CommonFatalException e1) {
                            LOG.warn("mousePressed failed: " + e1, e1);
                        } catch (CommonBusinessException e1) {
                            LOG.warn("mousePressed failed: " + e1, e1);
                        }
                    }
                }
            }
        }

    });
}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Set up the AnalysisResults GUI//from   ww  w .  ja  v a2s .c  o  m
 */
private void initGUI() {

    setLayout(new BorderLayout(0, 0));
    if (Platform.isOSX())
        setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    ImageIcon iconMultipleTables = Builder.getImageIcon("multipletables16.png");
    ImageIcon iconTable = Builder.getImageIcon("table16.png");

    // ImageIcon iconChart = Builder.getImageIcon("chart16.png");

    // Categories
    rootNode = new FHAESCategoryTreeNode("FHAES analysis results");
    categoryGeneral = new FHAESCategoryTreeNode("Descriptive summaries",
            Builder.getImageIcon("interval16.png"));
    categoryInterval = new FHAESCategoryTreeNode("Interval analysis", Builder.getImageIcon("interval16.png"));
    categorySeasonality = new FHAESCategoryTreeNode("Seasonality", Builder.getImageIcon("seasonality16.png"));
    categoryBinarySummaryMatrices = new FHAESCategoryTreeNode("Binary summary matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryBinaryMatrices = new FHAESCategoryTreeNode("Binary comparison matrices",
            Builder.getImageIcon("matrix16.png"));
    categorySimMatrices = new FHAESCategoryTreeNode("Similarity matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryDisSimMatrices = new FHAESCategoryTreeNode("Dissimilarity matrices",
            Builder.getImageIcon("matrix16.png"));

    // Menu actions

    // Results

    itemJaccard = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX, iconMultipleTables);
    itemJaccard.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SJACFile, new CSVFileFilter());
        }
    });

    itemCohen = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX, iconMultipleTables);
    itemCohen.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SCOHFile, new CSVFileFilter());
        }
    });

    itemJaccardD = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX_D, iconMultipleTables);
    itemJaccardD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSJACFile, new CSVFileFilter());
        }
    });

    itemCohenD = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX_D, iconMultipleTables);
    itemCohenD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSCOHFile, new CSVFileFilter());
        }
    });

    itemIntervalSummary = new FHAESResultTreeNode(FHAESResult.INTERVAL_SUMMARY, iconMultipleTables);
    itemIntervalSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsSummaryFile, new CSVFileFilter());
        }
    });

    itemExceedence = new FHAESResultTreeNode(FHAESResult.INTERVAL_EXCEEDENCE_TABLE, iconMultipleTables);
    itemExceedence.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsExceedenceFile, new CSVFileFilter());
        }
    });

    itemSeasonalitySummary = new FHAESResultTreeNode(FHAESResult.SEASONALITY_SUMMARY, iconMultipleTables);
    itemSeasonalitySummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(seasonalitySummaryFile, new CSVFileFilter());
        }
    });

    itemBin00 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_00, iconMultipleTables);
    itemBin00.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin00File, new CSVFileFilter());
        }
    });

    itemBin01 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_01, iconMultipleTables);
    itemBin01.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin01File, new CSVFileFilter());
        }
    });

    itemBin10 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_10, iconMultipleTables);
    itemBin10.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin10File, new CSVFileFilter());
        }
    });

    itemBin11 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_11, iconMultipleTables);
    itemBin11.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin11File, new CSVFileFilter());
        }
    });

    itemBinSum = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SUM, iconMultipleTables);
    itemBinSum.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(binSumFile, new CSVFileFilter());
        }

    });
    itemBinSiteSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SITE, iconMultipleTables);
    itemBinSiteSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(siteSummaryFile, new CSVFileFilter());
        }
    });
    itemBinSiteSummary.addAction(new FHAESAction("Export to shapefile", "formatshp.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            new ShapeFileDialog(App.mainFrame, fhm);

        }
    });

    itemBinTreeSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_TREE, iconMultipleTables);
    itemBinTreeSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(treeSummaryFile, new CSVFileFilter());
        }
    });

    itemNTP = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_NTP, iconMultipleTables);
    itemNTP.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(NTPFile, new CSVFileFilter());
        }
    });

    this.itemGeneralSummary = new FHAESResultTreeNode(FHAESResult.GENERAL_SUMMARY, iconMultipleTables);
    itemGeneralSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(generalSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleFileSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_FILE_SUMMARY, iconTable);
    itemSingleFileSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleFileSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleEventSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_EVENT_SUMMARY, iconTable);
    itemSingleEventSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleEventSummaryFile, new CSVFileFilter());
        }

    });

    // Add results to categories
    categoryGeneral.add(itemGeneralSummary);
    categoryGeneral.add(itemSingleFileSummary);
    categoryGeneral.add(itemSingleEventSummary);
    categorySimMatrices.add(itemJaccard);
    categorySimMatrices.add(itemCohen);
    categoryDisSimMatrices.add(itemJaccardD);
    categoryDisSimMatrices.add(itemCohenD);
    categoryInterval.add(itemIntervalSummary);
    categoryInterval.add(itemExceedence);
    categorySeasonality.add(itemSeasonalitySummary);
    categoryBinaryMatrices.add(itemBin11);
    categoryBinaryMatrices.add(itemBin01);
    categoryBinaryMatrices.add(itemBin10);
    categoryBinaryMatrices.add(itemBin00);
    categoryBinaryMatrices.add(itemBinSum);
    categoryBinarySummaryMatrices.add(itemBinSiteSummary);
    categoryBinarySummaryMatrices.add(itemBinTreeSummary);
    categoryBinarySummaryMatrices.add(itemNTP);

    // Add categories to root of tree
    rootNode.add(categoryGeneral);
    rootNode.add(categoryInterval);
    rootNode.add(categorySeasonality);
    rootNode.add(categoryBinarySummaryMatrices);
    rootNode.add(categoryBinaryMatrices);
    rootNode.add(categorySimMatrices);
    rootNode.add(categoryDisSimMatrices);

    treeModel = new DefaultTreeModel(rootNode);

    splitPane = new JSplitPane();
    if (Platform.isOSX())
        splitPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    splitPane.setResizeWeight(0.9);
    add(splitPane, BorderLayout.CENTER);

    JPanel panelTree = new JPanel();
    splitPane.setRightComponent(panelTree);
    panelTree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelTree.setLayout(new BorderLayout(0, 0));

    // Build tree
    treeResults = new JTree();
    panelTree.add(treeResults);
    treeResults.setModel(treeModel);

    treeResults.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    treeResults.setCellRenderer(new FHAESResultTreeRenderer());

    pickResultPanel = new PickResultPanel();
    runAnalysisPanel = new RunAnalysisPanel();

    cards = new JPanel();
    cl = new CardLayout();
    cards.setLayout(cl);
    cards.add(pickResultPanel, PICKRESULTPANEL);
    cards.add(runAnalysisPanel, RUNANALYSIS);
    cards.add(emptyPanel, EMPTYPANEL);

    splitPane.setLeftComponent(cards);

    cl.show(cards, RUNANALYSIS);

    splitPaneResult = new JSplitPane();
    splitPaneResult.setOneTouchExpandable(true);
    splitPaneResult.setOrientation(JSplitPane.VERTICAL_SPLIT);
    cards.add(splitPaneResult, RESULTSPANEL);

    panelResult = new JPanel();

    panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelResult.setLayout(new BorderLayout(0, 0));

    goldFishPanel = new GoldFishPanel();
    splitPaneResult.setRightComponent(goldFishPanel);

    // Build table
    scrollPane = new JScrollPane();

    panelResult.add(scrollPane);
    table = new JXTable();
    adapter = new JTableSpreadsheetByRowAdapter(table);

    table.setModel(new DefaultTableModel());
    table.setHorizontalScrollEnabled(true);
    scrollPane.setViewportView(table);
    splitPaneResult.setLeftComponent(panelResult);

    // OSX Style hack
    if (Platform.isOSX())
        panelResult.setBackground(MainWindow.MAC_BACKGROUND_COLOR);
    if (Platform.isOSX())
        scrollPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    // Expand all nodes
    for (int i = 0; i < treeResults.getRowCount(); i++) {
        treeResults.expandRow(i);
    }

    treeResults.addTreeSelectionListener(this);

    treeResults.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                int x = e.getX();
                int y = e.getY();
                JTree tree = (JTree) e.getSource();
                TreePath path = tree.getPathForLocation(x, y);
                if (path == null)
                    return;
                if (!tree.isEnabled())
                    return;

                tree.setSelectionPath(path);
                Component mc = e.getComponent();

                if (path != null && path.getLastPathComponent() instanceof FHAESResultTreeNode) {
                    FHAESResultTreeNode node = (FHAESResultTreeNode) path.getLastPathComponent();

                    if (!node.isEnabled())
                        return;

                    FHAESResultPopupMenu popupMenu = new FHAESResultPopupMenu(node.getArrayOfActions());
                    popupMenu.show(mc, e.getX(), e.getY());
                }
            }
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {

        }

        @Override
        public void mouseExited(MouseEvent arg0) {

        }

        @Override
        public void mousePressed(MouseEvent arg0) {

        }

        @Override
        public void mouseReleased(MouseEvent arg0) {

        }

    });

    this.splitPaneResult.setDividerLocation(10000);
    this.splitPaneResult.setDividerSize(3);
    this.splitPaneResult.setResizeWeight(1);
}

From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java

/**
 * Creates a new {@link AttributeStatisticsPanel} instance. Before displaying the panel, an
 * {@link AbstractAttributeStatisticsModel} should be set via
 * {@link #setModel(AbstractAttributeStatisticsModel, boolean)}.
 *
 *//*from w  w  w .j  a v  a 2 s . c o  m*/
public AttributeStatisticsPanel() {
    listOfChartPanels = new LinkedList<>();

    // create listener which listens for hovering/enlarge mouse events on this panel
    enlargeAndHoverAndPopupMouseAdapter = new MouseAdapter() {

        @Override
        public void mousePressed(final MouseEvent e) {
            // only popup trigger for popup menu
            if (e.isPopupTrigger()) {
                handlePopup(e);
            }

            // only left mouse button to enlarge
            if (!SwingUtilities.isLeftMouseButton(e)) {
                return;
            }

            // little hack so hovering over the details button does not remove the hover effect
            // (because MouseExited is called)
            // but clicking the button is still possible and does not enlarge the panel
            if (e.getSource() instanceof JButton) {
                ((JButton) e.getSource()).doClick();
                return;
            }

            // change enlarged status
            if (getModel() != null) {
                getModel().setEnlarged(!getModel().isEnlarged());
            }
        }

        @Override
        public void mouseExited(final MouseEvent e) {
            if (SwingTools.isMouseEventExitedToChildComponents(AttributeStatisticsPanel.this, e)) {
                // we are still hovering over the ASP, just a child component
                return;
            }
            hovered = false;
            repaint();
        }

        @Override
        public void mouseEntered(final MouseEvent e) {
            hovered = true;
            repaint();
        }

        @Override
        public void mouseReleased(final MouseEvent e) {
            if (e.isPopupTrigger()) {
                handlePopup(e);
            }
        }

        /**
         * Handles the popup click event.
         *
         * @param e
         */
        private void handlePopup(final MouseEvent e) {
            if (model.getAttribute().isNumerical()) {
                popupAttributeNumericalStatPanel.show(e.getComponent(), e.getX(), e.getY());
            } else if (model.getAttribute().isNominal()) {
                popupAttributeNominalStatPanel.show(e.getComponent(), e.getX(), e.getY());
            } else if (model.getAttribute().isDateTime()) {
                popupAttributeDateTimeStatPanel.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    };

    // create listener which listens for AttributeStatisticsEvents on the model
    listener = new AttributeStatisticsEventListener() {

        @Override
        public void modelChanged(final AttributeStatisticsEvent e) {
            switch (e.getEventType()) {
            case ALTERNATING_CHANGED:
                repaint();
                break;
            case ENLARGED_CHANGED:
                updateCharts();
                updateVisibilityOfChartPanels();
                if (AttributeStatisticsPanel.this.model.getAttribute().isNominal()) {
                    displayNominalValues();
                }
                break;
            case SHOW_CONSTRUCTION_CHANGED:
                panelStatsConstruction.setVisible(model.isShowConstruction());
                break;
            case STATISTICS_CHANGED:
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        AbstractAttributeStatisticsModel model = AttributeStatisticsPanel.this.model;
                        if (model.getAttribute().isNumerical()) {
                            updateNumericalElements(model);
                        } else if (model.getAttribute().isNominal()) {
                            updateNominalElements(model);
                        } else {
                            updateDateTimeElements(model);
                        }
                    }

                });
                break;
            default:
            }
        }
    };

    initGUI();
}

From source file:gdt.jgui.entity.webset.JWeblinkEditor.java

private void showPasswordMenu(MouseEvent e) {
    try {/*from   w w  w. j  av  a  2 s.c o  m*/
        JPopupMenu passwordMenu = new JPopupMenu();
        JMenuItem copyItem = new JMenuItem("Copy");
        passwordMenu.add(copyItem);
        copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        copyItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    StringSelection stringSelection = new StringSelection(passwordField.getText());
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(stringSelection, JWeblinkEditor.this);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        JMenuItem encodeItem = new JMenuItem("Encrypt/decrypt");
        passwordMenu.add(encodeItem);
        encodeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
        encodeItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    save();
                    JTextEncrypter te = new JTextEncrypter();
                    String teLocator$ = te.getLocator();
                    teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, passwordField.getText());
                    teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT_TITLE, nameField.getText());
                    String weLocator$ = JWeblinkEditor.this.getLocator();
                    weLocator$ = Locator.append(weLocator$, BaseHandler.HANDLER_METHOD, "response");
                    weLocator$ = Locator.append(weLocator$, JRequester.REQUESTER_ACTION,
                            ACTION_ENCODE_PASSWORD);
                    teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(weLocator$));
                    JConsoleHandler.execute(console, teLocator$);
                } catch (Exception ee) {
                    Logger.getLogger(getClass().getName()).info(ee.toString());
                }
            }
        });
        passwordMenu.show(e.getComponent(), e.getX(), e.getY());
    } catch (Exception ee) {
        Logger.getLogger(getClass().getName()).severe(ee.toString());
    }
}

From source file:com.haulmont.cuba.desktop.sys.DesktopWindowManager.java

protected void initTabContextMenu(JComponent tabComponent) {
    tabComponent.addMouseListener(new MouseAdapter() {
        @Override//from   w  w  w.j a va  2s . com
        public void mousePressed(MouseEvent e) {
            dispatchToParent(e);
            if (e.isPopupTrigger()) {
                showTabPopup(e);
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            dispatchToParent(e);
            if (e.isPopupTrigger()) {
                showTabPopup(e);
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            dispatchToParent(e);
        }

        @Override
        public void mouseMoved(MouseEvent e) {
            dispatchToParent(e);
        }

        @Override
        public void mouseDragged(MouseEvent e) {
            dispatchToParent(e);
        }

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            dispatchToParent(e);
        }

        @Override
        public void mouseExited(MouseEvent e) {
            dispatchToParent(e);
        }

        @Override
        public void mouseClicked(MouseEvent e) {
            dispatchToParent(e);
        }

        public void dispatchToParent(MouseEvent e) {
            tabsPane.dispatchEvent(SwingUtilities.convertMouseEvent(e.getComponent(), e, tabsPane));
        }
    });
}

From source file:corelyzer.ui.CorelyzerApp.java

public void mousePressed(final MouseEvent e) {
    // From JDK Doc
    // Note: Popup menus are triggered differently on different systems.
    // Therefore, isPopupTrigger should be checked in both mousePressed and
    // mouseReleased for proper cross-platform functionality.

    Point p = e.getPoint();/*w ww . ja v a  2s  . c  om*/
    Object actionSource = e.getSource();

    if (actionSource instanceof JList) {
        // find the index of the clicked item in the JList
        int index = ((JList) e.getSource()).locationToIndex(e.getPoint());
        if (index < 0) {
            return;
        }

        // show our popup menu if it was a right/ctrl-click
        if (e.isPopupTrigger()) {
            if (actionSource.equals(sessionList)) {
                Session s = (Session) sessionList.getSelectedValue();
                JMenuItem t;

                // Show label switching
                if (s == null) {
                    return;
                }

                String l = s.isShow() ? "Hide" : "Show";
                t = (JMenuItem) sessionPopupMenu.getComponent(0);
                t.setText(l);

                sessionPopupMenu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(trackList)) {
                ((JList) e.getSource()).setSelectedIndex(index);

                // Update context-aware show/hide
                TrackSceneNode t = (TrackSceneNode) trackList.getSelectedValue();
                if ((t != null) && (t.getId() >= 0)) {
                    boolean isShown = SceneGraph.getTrackShow(t.getId());
                    String label = isShown ? "Hide" : "Show";
                    ((JMenuItem) trackPopupMenu.getComponent(0)).setText(label);
                }

                trackPopupMenu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(sectionList)) {
                int[] rows = getSectionList().getSelectedIndices();

                JPopupMenu menu = sectionListPopupMenu(rows);
                menu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(dataFileList)) {
                ((JList) e.getSource()).setSelectedIndex(index);
                dataPopupMenu.show(e.getComponent(), p.x, p.y);
            }
        }
    }
}

From source file:corelyzer.ui.CorelyzerApp.java

public void mouseReleased(final MouseEvent e) {
    // From JDK Doc
    // Note: Popup menus are triggered differently on different systems.
    // Therefore, isPopupTrigger should be checked in both mousePressed and
    // mouseReleased for proper cross-platform functionality.

    Point p = e.getPoint();//from w  ww  .  ja v  a 2  s  .c  om
    Object actionSource = e.getSource();

    if (actionSource instanceof JList) {
        // find the index of the clicked item in the JList
        int index = ((JList) e.getSource()).locationToIndex(e.getPoint());
        if (index < 0) {
            return;
        }

        // show our popup menu if it was a right/ctrl-click
        if (e.isPopupTrigger()) {
            if (actionSource.equals(sessionList)) {
                Session s = (Session) sessionList.getSelectedValue();
                JMenuItem t;

                // Show label switching
                if (s == null) {
                    return;
                }

                String l = s.isShow() ? "Hide" : "Show";
                t = (JMenuItem) sessionPopupMenu.getComponent(0);
                t.setText(l);

                sessionPopupMenu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(trackList)) {
                ((JList) e.getSource()).setSelectedIndex(index);

                // Update context-aware show/hide
                TrackSceneNode t = (TrackSceneNode) trackList.getSelectedValue();
                if ((t != null) && (t.getId() >= 0)) {
                    boolean isShown = SceneGraph.getTrackShow(t.getId());
                    String label = isShown ? "Hide" : "Show";
                    ((JMenuItem) trackPopupMenu.getComponent(0)).setText(label);
                }

                trackPopupMenu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(sectionList)) {
                int[] rows = getSectionList().getSelectedIndices();

                JPopupMenu menu = sectionListPopupMenu(rows);
                menu.show(e.getComponent(), p.x, p.y);
            } else if (actionSource.equals(dataFileList)) {
                ((JList) e.getSource()).setSelectedIndex(index);
                dataPopupMenu.show(e.getComponent(), p.x, p.y);
            }
        }
    }
}