Example usage for java.awt.event MouseEvent getSource

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

Introduction

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

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:androhashcheck.MainFrame.java

/**
 * Creates new form MainFrame/*from   w w  w .  j a  va2 s  . co  m*/
 * @param logInFrame
 */
public MainFrame(JFrame logInFrame) {
    initComponents();
    this.logInFrame = logInFrame;
    jList5.setModel(listModel);
    dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    displayApkFolder();
    //mouse listner - when clicked on uploaded package to show details
    jList3.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            JList list = (JList) evt.getSource();
            if (evt.getClickCount() == 2) {
                int index = list.locationToIndex(evt.getPoint());
                final TaskObject taskObject = taskList.get(index);
                java.awt.EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        new TaskFrame(taskObject).setVisible(true);
                    }
                });
            }
        }
    });
    shouldCheckTasks = true;
    startThreadForTaskUpdatesChecking();
}

From source file:com.endlessloopsoftware.ego.client.graph.GraphRenderer.java

public String getToolTipText(MouseEvent event) {
    return ((JComponent) event.getSource()).getToolTipText();
}

From source file:com.ssn.event.controller.SSNShareController.java

@Override
public void mouseClicked(MouseEvent e) {
    Object mouseEventObj = e.getSource();
    if (mouseEventObj != null && mouseEventObj instanceof JLabel) {
        JLabel label = (JLabel) mouseEventObj;
        getShareForm().setCursor(new Cursor(Cursor.WAIT_CURSOR));
        // Tracking this sharing event in Google Analytics
        GoogleAnalyticsUtil.track(SSNConstants.SSN_APP_EVENT_SHARING);
        Thread thread = null;//from w  w w  . j a v  a  2 s .c o m
        switch (label.getName()) {
        case "FacebookSharing":
            thread = new Thread() {
                boolean isAlreadyLoggedIn = false;

                @Override
                public void run() {

                    Set<String> sharedFileList = getFiles();
                    AccessGrant facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant();
                    if (facebookAccessGrant == null) {
                        try {
                            LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null);
                            loginWithFacebook.setHomeForm(getHomeModel().getHomeForm());
                            loginWithFacebook.login();

                            boolean processFurther = false;
                            while (!processFurther) {
                                facebookAccessGrant = getHomeModel().getHomeForm().getFacebookAccessGrant();
                                if (facebookAccessGrant == null) {
                                    Thread.sleep(10000);
                                } else {
                                    processFurther = true;
                                    isAlreadyLoggedIn = true;
                                }
                            }
                        } catch (InterruptedException ex) {
                            logger.error(ex);
                        }
                    }

                    FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory(
                            SSNConstants.SSN_FACEBOOK_API_KEY, SSNConstants.SSN_FACEBOOK_SECRET_KEY);
                    Connection<Facebook> connection = connectionFactory.createConnection(facebookAccessGrant);
                    Facebook facebook = connection.getApi();
                    MediaOperations mediaOperations = facebook.mediaOperations();

                    if (!isAlreadyLoggedIn) {
                        // SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox();
                        SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox();
                        FacebookProfile userProfile = facebook.userOperations().getUserProfile();
                        String userName = "";
                        if (userProfile != null) {
                            userName = userProfile.getName() != null ? userProfile.getName()
                                    : userProfile.getFirstName();
                        }
                        confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(),
                                "Confirmation", "",
                                "You are already logged in with " + userName + ", Click OK to continue.");
                        int result = confirmeDialog.getResult();
                        if (result == JOptionPane.YES_OPTION) {
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox();
                                    messageDialogBox.initDialogBoxUI(
                                            SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "",
                                            "Successfully uploaded.");
                                    messageDialogBox.setFocusable(true);

                                }
                            });
                        } else if (result == JOptionPane.NO_OPTION) {

                            AccessGrant facebookAccessGrant1 = null;
                            if (facebookAccessGrant1 == null) {
                                try {
                                    LoginWithFacebook loginWithFacebook = new LoginWithFacebook(null);
                                    loginWithFacebook.setHomeForm(getHomeModel().getHomeForm());
                                    loginWithFacebook.login();

                                    boolean processFurther = false;
                                    while (!processFurther) {
                                        facebookAccessGrant1 = getHomeModel().getHomeForm()
                                                .getFacebookAccessGrant();
                                        if (facebookAccessGrant1 == null) {
                                            Thread.sleep(10000);
                                        } else {
                                            processFurther = true;
                                            //isAlreadyLoggedIn = true;
                                        }
                                    }
                                    connectionFactory = new FacebookConnectionFactory(
                                            SSNConstants.SSN_FACEBOOK_API_KEY,
                                            SSNConstants.SSN_FACEBOOK_SECRET_KEY);
                                    connection = connectionFactory.createConnection(facebookAccessGrant);
                                    facebook = connection.getApi();
                                    mediaOperations = facebook.mediaOperations();
                                } catch (InterruptedException ex) {
                                    logger.error(ex);
                                }
                            }
                        }
                    }

                    String[] videoSupported = SSNConstants.SSN_VIDEO_FORMAT_SUPPORTED;
                    final List<String> videoSupportedList = Arrays.asList(videoSupported);

                    for (String file : sharedFileList) {
                        String fileExtension = file.substring(file.lastIndexOf(".") + 1, file.length());
                        Resource resource = new FileSystemResource(file);

                        if (!videoSupportedList.contains(fileExtension.toUpperCase())) {
                            String output = mediaOperations.postPhoto(resource);
                        } else {
                            String output = mediaOperations.postVideo(resource);
                        }

                    }

                    getShareForm().dispose();
                }
            };
            thread.start();
            break;
        case "TwitterSharing":
            LoginWithTwitter.deniedPermission = false;
            thread = new Thread() {
                boolean isAlreadyLoggedIn = false;

                @Override
                public void run() {
                    Set<String> sharedFileList = getFiles();
                    OAuthToken twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken();
                    if (twitterOAuthToken == null) {
                        try {
                            LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null);
                            loginWithTwitter.setHomeForm(getHomeModel().getHomeForm());
                            loginWithTwitter.login();

                            boolean processFurther = false;
                            while (!processFurther) {
                                if (LoginWithTwitter.deniedPermission)
                                    break;

                                twitterOAuthToken = getHomeModel().getHomeForm().getTwitterOAuthToken();
                                if (twitterOAuthToken == null) {
                                    Thread.sleep(10000);
                                } else {
                                    processFurther = true;
                                    isAlreadyLoggedIn = true;
                                }
                            }
                        } catch (IOException | InterruptedException ex) {
                            logger.error(ex);
                        }
                    }
                    if (!LoginWithTwitter.deniedPermission) {
                        Twitter twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY,
                                SSNConstants.SSN_TWITTER_SECRET_KEY, twitterOAuthToken.getValue(),
                                twitterOAuthToken.getSecret());
                        TimelineOperations timelineOperations = twitter.timelineOperations();
                        if (!isAlreadyLoggedIn) {
                            SSNConfirmationDialogBox confirmeDialog = new SSNConfirmationDialogBox();
                            TwitterProfile userProfile = twitter.userOperations().getUserProfile();

                            String userName = "";
                            if (userProfile != null) {
                                userName = twitter.userOperations().getScreenName() != null
                                        ? twitter.userOperations().getScreenName()
                                        : userProfile.getName();
                            }
                            confirmeDialog.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(),
                                    "Confirmation", "",
                                    "You are already logged in with " + userName + ", Click OK to continue.");
                            int result = confirmeDialog.getResult();
                            if (result == JOptionPane.YES_OPTION) {
                                SwingUtilities.invokeLater(new Runnable() {
                                    public void run() {
                                        SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox();
                                        messageDialogBox.initDialogBoxUI(
                                                SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Message", "",
                                                "Successfully uploaded.");
                                        messageDialogBox.setFocusable(true);

                                    }
                                });
                            } else if (result == JOptionPane.NO_OPTION) {

                                twitterOAuthToken = null;
                                if (twitterOAuthToken == null) {
                                    try {
                                        LoginWithTwitter loginWithTwitter = new LoginWithTwitter(null);
                                        loginWithTwitter.setHomeForm(getHomeModel().getHomeForm());
                                        loginWithTwitter.login();

                                        boolean processFurther = false;
                                        while (!processFurther) {
                                            twitterOAuthToken = getHomeModel().getHomeForm()
                                                    .getTwitterOAuthToken();
                                            if (twitterOAuthToken == null) {
                                                Thread.sleep(10000);
                                            } else {
                                                processFurther = true;

                                            }
                                        }
                                        twitter = new TwitterTemplate(SSNConstants.SSN_TWITTER_API_KEY,
                                                SSNConstants.SSN_TWITTER_SECRET_KEY,
                                                twitterOAuthToken.getValue(), twitterOAuthToken.getSecret());
                                        timelineOperations = twitter.timelineOperations();
                                    } catch (IOException | InterruptedException ex) {
                                        logger.error(ex);
                                    }
                                }
                            }
                        }

                        for (String file : sharedFileList) {
                            Resource image = new FileSystemResource(file);

                            TweetData tweetData = new TweetData("At " + new Date());
                            tweetData.withMedia(image);
                            timelineOperations.updateStatus(tweetData);
                        }
                    } else {
                        SSNMessageDialogBox messageDialogBox = new SSNMessageDialogBox();
                        messageDialogBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Alert",
                                "", "User denied for OurHive App permission on twitter.");
                        messageDialogBox.setFocusable(true);
                    }
                    getShareForm().dispose();
                }

            };
            thread.start();
            break;
        case "InstagramSharing":
            break;
        case "MailSharing":
            try {
                String OS = System.getProperty("os.name").toLowerCase();

                Set<String> sharedFileList = getFiles();
                Set<String> voiceNoteList = new HashSet<String>();
                for (String sharedFile : sharedFileList) {
                    String voiceNote = SSNDao.getVoiceCommandPath(new File(sharedFile).getAbsolutePath());
                    if (voiceNote != null && !voiceNote.isEmpty()) {
                        voiceNoteList.add(voiceNote);
                    }
                }
                sharedFileList.addAll(voiceNoteList);

                String fileFullPath = "";
                String caption = "";
                if (sharedFileList.size() == 1) {
                    fileFullPath = sharedFileList.toArray(new String[0])[0];

                    caption = SSMMediaGalleryPanel.readMetaDataForTitle(new File(fileFullPath));

                } else if (sharedFileList.size() > 1) {
                    fileFullPath = SSNHelper.createZipFileFromMultipleFiles(sharedFileList);
                }

                if (OS.contains("win")) {

                    // String subject = "SSN Subject";
                    String subject = caption.equals("") ? SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT : caption;
                    String body = "";
                    String m = "&subject=%s&body=%s";

                    String outLookExeDir = "C:\\Program Files\\Microsoft Office\\Office14\\Outlook.exe";
                    String mailCompose = "/c";
                    String note = "ipm.note";
                    String mailBodyContent = "/m";

                    m = String.format(m, subject, body);
                    String slashA = "/a";

                    String mailClientConfigParams[] = null;
                    Process startMailProcess = null;

                    mailClientConfigParams = new String[] { outLookExeDir, mailCompose, note, mailBodyContent,
                            m, slashA, fileFullPath };
                    startMailProcess = Runtime.getRuntime().exec(mailClientConfigParams);
                    OutputStream out = startMailProcess.getOutputStream();
                    File zipFile = new File(fileFullPath);
                    zipFile.deleteOnExit();
                } else if (OS.indexOf("mac") >= 0) {
                    //Process p = Runtime.getRuntime().exec(new String[]{String.format("open -a mail ", fileFullPath)});
                    Desktop desktop = Desktop.getDesktop();
                    String mailTo = caption.equals("") ? "?SUBJECT=" + SSNConstants.SSN_SHARE_WITH_MAIL_SUBJECT
                            : caption;
                    URI uriMailTo = null;
                    uriMailTo = new URI("mailto", mailTo, null);
                    desktop.mail(uriMailTo);
                }

                this.getShareForm().dispose();
            } catch (Exception ex) {
                logger.error(ex);
            }
            break;
        case "moveCopy":
            getShareForm().dispose();
            File album = new File(SSNHelper.getSsnHiveDirPath());
            File[] albumPaths = album.listFiles();
            Vector albumNames = new Vector();
            for (int i = 0; i < albumPaths.length; i++) {
                if (!(albumPaths[i].getName().equals("OurHive")) && SSNHelper.lastAlbum != null
                        && !(albumPaths[i].getName().equals(SSNHelper.lastAlbum)))
                    albumNames.add(albumPaths[i].getName());
            }
            if (SSNHelper.lastAlbum != null && !SSNHelper.lastAlbum.equals("OurHive"))
                albumNames.insertElementAt("OurHive", 0);

            SSNInputDialogBox inputBox = new SSNInputDialogBox(true, albumNames);
            inputBox.initDialogBoxUI(SSNDialogChoice.NOTIFICATION_DIALOG.getType(), "Copy Media",
                    "Please Select Album Name");
            String destAlbumName = inputBox.getTextValue();
            if (StringUtils.isNotBlank(destAlbumName)) {
                homeModel.moveAlbum(destAlbumName, getFiles());
            }

        }
        getShareForm().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:org.openconcerto.task.TodoListPanel.java

void initPopUp() {
    TablePopupMouseListener.add(this.t, new ITransformer<MouseEvent, JPopupMenu>() {

        @Override// ww  w.  ja v a 2 s.c  o  m
        public JPopupMenu transformChecked(MouseEvent evt) {
            final JTable table = (JTable) evt.getSource();
            final int modelIndex = TodoListPanel.this.sorter.modelIndex(table.getSelectedRow());
            final JPopupMenu res = new JPopupMenu();

            // Avancer d'un jour
            Action act = new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    final TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex);
                    if (element != null) {
                        final Date ts = element.getExpectedDate();
                        final Calendar cal = Calendar.getInstance();
                        cal.setTimeInMillis(ts.getTime());
                        cal.add(Calendar.DAY_OF_YEAR, 1);
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                ts.setTime(cal.getTimeInMillis());
                                element.setExpectedDate(ts);
                                element.commitChangesAndWait();
                                table.repaint();
                            }
                        });
                    }
                }
            };
            act.putValue(Action.NAME, TM.tr("moveOneDay"));
            res.add(act);

            // Marquer comme ralis
            act = new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex);
                    if (element != null) {
                        element.setDone(true);
                        element.commitChangesAndWait();
                        table.repaint();
                    }
                }
            };
            act.putValue(Action.NAME, TM.tr("markDone"));
            res.add(act);

            // Suppression
            act = new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    TodoListPanel.this.model.deleteTaskAtIndex(modelIndex);
                    table.repaint();
                }
            };
            act.putValue(Action.NAME, TM.tr("delete"));
            res.add(act);

            final TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex);
            SQLRowValues rowTache = element.getRowValues();

            List<AbstractAction> actions = TacheActionManager.getInstance().getActionsForTaskRow(rowTache);

            for (AbstractAction abstractAction : actions) {
                res.add(abstractAction);
            }

            return res;
        }
    });
}

From source file:graph.eventhandlers.MyEditingGraphMousePlugin.java

/**
 * If the mouse is pressed in an empty area, create a new vertex there. If
 * the mouse is pressed on an existing vertex, prepare to create an edge
 * from that vertex to another/*from  w  w  w  .java  2s  .  c  om*/
 */
public void mousePressed(MouseEvent e) {
    pw = graphInstance.getPathway();
    if (checkModifiers(e)) {

        final VisualizationViewer<BiologicalNodeAbstract, BiologicalEdgeAbstract> vv = (VisualizationViewer<BiologicalNodeAbstract, BiologicalEdgeAbstract>) e
                .getSource();
        // final Point2D p = vv.inverseViewTransform(e.getPoint());
        // System.out.println("Points: "+e.getPoint().getX()+", "+e.getPoint().getY());
        final Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
        // System.out.println(e.getPoint()+ " "+p);
        // System.out.println("Points: "+p.getX()+", "+p.getY());
        // final Point2D p = e.getPoint();
        GraphElementAccessor<BiologicalNodeAbstract, BiologicalEdgeAbstract> pickSupport = vv.getPickSupport();
        // System.out.println("Click: "+p);
        // System.out.println("regul: "+e.getPoint());

        Iterator<BiologicalNodeAbstract> it = pw.getGraph().getAllVertices().iterator();
        // while(it.hasNext()){
        // System.out.println(pw.getGraph().getVertexLocation(it.next()));
        // }
        // System.out.println(pw.getGraph().getAllEdges().size());
        // System.out.println(pickSupport.g);

        BiologicalNodeAbstract vertex = null;

        vertex = (BiologicalNodeAbstract) pickSupport.getVertex(vv.getGraphLayout(), e.getPoint().getX(),
                e.getPoint().getY());
        // System.out.println(vertex);

        if (vertex != null) { // get ready to make an edge
            // System.out.println(vertex);
            startVertex = vertex;
            super.down = e.getPoint();
            transformEdgeShape(down, down);
            vv.addPostRenderPaintable(edgePaintable);
            if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
                edgeIsDirected = true;
                transformArrowShape(down, e.getPoint());
                vv.addPostRenderPaintable(arrowPaintable);
            }
        } else { // make a new vertex
            Graph<BiologicalNodeAbstract, BiologicalEdgeAbstract> graph = vv.getGraphLayout().getGraph();
            //            BiologicalNodeAbstract newVertex = new BiologicalNodeAbstract(
            //                  "label", "name");
            // vertexLocations.put(newVertex, p);

            Layout<BiologicalNodeAbstract, BiologicalEdgeAbstract> layout = vv.getGraphLayout();

            // System.out.println("size V: "+layout.getGraph().getVertices().size());
            // System.out.println("size E: "+layout.getGraph().getEdges().size());

            // graph.addVertex(newVertex);
            /*
             * Object key = (((AggregateLayout)
             * layout).getDelegate()).getBaseKey(); Object datum = new
             * Coordinates(vv.inverseTransform( e.getPoint()).getX(),
             * vv.inverseTransform( e.getPoint()).getY());
             * newVertex.setUserDatum(key, datum, new CopyAction.Clone());
             */

            for (Iterator<BiologicalNodeAbstract> iterator = graph.getVertices().iterator(); iterator
                    .hasNext();) {
                layout.lock(iterator.next(), true);

            }

            if (con.isPetriView()) {
                // System.out.println("is petri");

                PetriNetVertexDialog dialog = new PetriNetVertexDialog(con.getPetriNetEditingMode());
                BiologicalNodeAbstract bna = dialog.getAnswer(p);
                // System.out.println();
                if (bna != null) {
                    // BiologicalNodeAbstract ba = new
                    // BiologicalNodeAbstract(
                    // answers[0], "", newVertex);
                    // ba.setBiologicalElement(answers[1]);
                    // ba.setCompartment(answers[2]);
                    // graphInstance.getPathway().addElement(ba);
                    // graph.addVertex(newVertex);

                    // vv.getModel().restart();
                    //System.out.println("update");
                    if (pw instanceof BiologicalNodeAbstract) {
                        bna.setParentNode((BiologicalNodeAbstract) pw);
                    }
                    MainWindowSingleton.getInstance().updateElementTree();
                    MainWindowSingleton.getInstance().updatePathwayTree();
                    //MainWindowSingelton.getInstance().updateAllGuiElements();
                    //MainWindowSingelton.getInstance().updateOptionPanel();
                    // MainWindowSingelton.getInstance()
                    // .updateTheoryProperties();

                    // Pathway pw = graphInstance.getPathway();

                }

            } else {
                // System.out.println("not petri");
                VertexDialog dialog = new VertexDialog();
                String[] answers = dialog.getAnswer();
                if (answers != null) {

                    // BiologicalNodeAbstract ba = new
                    // BiologicalNodeAbstract(
                    // answers[0], "");
                    String name = answers[0];
                    String label = answers[0];
                    String element = answers[1];
                    String compartment = answers[2];
                    //                  newVertex.setBiologicalElement(answers[1]);
                    //                  newVertex.setCompartment(answers[2]);
                    // graphInstance.getPathway().addElement(newVertex);
                    // graph.addVertex(newVertex);

                    BiologicalNodeAbstract newVertex = pw.addVertex(name, label, element, compartment, p);
                    if (pw instanceof BiologicalNodeAbstract) {
                        newVertex.setParentNode((BiologicalNodeAbstract) pw);
                    }
                    //pw.addVertex(newVertex, p);
                    if (graph.getVertices().size() > 1) {
                        // System.exit(0);
                    }

                    // pw.getGraph().setVertexLocation(newVertex, p);
                    // layout.setLocation(newVertex, p);
                    // vv.getModel().restart();
                    MainWindowSingleton.getInstance().updateElementTree();
                    // MainWindowSingelton.getInstance()
                    // .updateTheoryProperties();

                    for (Iterator<BiologicalNodeAbstract> iterator = graph.getVertices().iterator(); iterator
                            .hasNext();) {
                        layout.lock(iterator.next(), false);
                    }

                }

            }
            if (pw instanceof BiologicalNodeAbstract) {

            }
        }
        vv.repaint();
    }
}

From source file:gdsc.smlm.ij.plugins.ResultsManager.java

public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() > 1) // Double-click
    {/*from ww  w . j  ava  2 s  .  co m*/
        TextField text = (e.getSource() == text1) ? text1 : text2;
        String[] path = Utils.decodePath(text.getText());
        OpenDialog chooser = new OpenDialog("Coordinate file", path[0], path[1]);
        if (chooser.getFileName() != null) {
            text.setText(chooser.getDirectory() + chooser.getFileName());
        }
    }
}

From source file:canreg.client.gui.components.FastFilterInternalFrame.java

private void mouseClickHandler(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickHandler
    DatabaseVariablesListElement dbvle = (DatabaseVariablesListElement) variableComboBox.getSelectedItem();
    if (dictionaryPopUp && (valueTextField.equals(evt.getSource()) || valueTextField2.equals(evt.getSource()))
            && dbvle.getVariableType().equalsIgnoreCase("dict")) {
        if (possibleValuesMap == null) {
            JOptionPane.showInternalMessageDialog(this,
                    java.util.ResourceBundle
                            .getBundle("canreg/client/gui/components/resources/FastFilterInternalFrame")
                            .getString("EMPTY_DICTIONARY"),
                    java.util.ResourceBundle
                            .getBundle("canreg/client/gui/components/resources/FastFilterInternalFrame")
                            .getString("WARNING"),
                    JOptionPane.WARNING_MESSAGE);
        } else {//from  w w  w  .  j  a v a2 s .  c om
            // String oldValue = getValue().toString();
            // DictionaryEntry oldSelection = possibleValuesMap.get(oldValue);
            if (dictionaryElementChooser == null) {
                dictionaryElementChooser = new DictionaryElementChooser(this);
            } else {
                dictionaryElementChooser.setFirstPass();
            }
            dictionaryElementChooser.setDictionary(dictionary);
            // dictionaryElementChooser.setSelectedElement(oldSelection);

            // safe to cast as we check it in the first if-statement
            dictionaryElementChooserAssignedTextField = (JTextField) evt.getSource();
            CanRegClientView.showAndPositionInternalFrame(CanRegClientApp.getApplication().getDesktopPane(),
                    dictionaryElementChooser);
        }
    } else {
        // Do nothing
    }
    currentSelectionAdded = false;
}

From source file:ome.formats.importer.gui.ErrorTable.java

public void mouseReleased(MouseEvent e) {
    if (e.getSource() == cbe.checkbox) {
        cbe.stopCellEditing();
    }
}

From source file:de.tor.tribes.ui.views.DSWorkbenchTroopsFrame.java

private void fireApplyTroopAddEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fireApplyTroopAddEvent
    if (evt.getSource().equals(jApplyTroopAddButton)) {
        TroopTableTab tab = (TroopTableTab) getActiveTab();
        if (tab != null) {
            Village v = null;/*from   w w  w .  j  ava2 s.co  m*/
            try {
                v = (Village) jTroopAddVillage.getSelectedItem();
            } catch (Exception e) {
                tab.showError("Kein gltiges Dorf gewhlt");
                return;
            }
            TroopsManager.getSingleton().addManagedElement(tab.getTroopSet(),
                    new VillageTroopsHolder(v, new Date()));
        }
    }
    jTroopsAddDialog.setVisible(false);
}

From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java

private void setupTable() {
    tableModel = new ElementListTableModel();
    table = new JXTable(tableModel);

    tableSorter = new ElementListTableSorter(tableModel, table);
    table.getTableHeader().addMouseListener(tableSorter); // add sorter & header renderer
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(true);// w  ww . j a  va  2s  .co  m

    // set our column widths
    ElementListTableModel.setupColumnWidths(table);

    table.setDefaultRenderer(Object.class, new ElementListCellRenderer(this, false));
    table.setDefaultRenderer(Boolean.class, new BooleanCellRenderer(this, false));

    // hide irrelevent columns
    TableColumnModelExt colmodel = (TableColumnModelExt) table.getColumnModel();
    table.setColumnControlVisible(true);
    colmodel.getColumnExt(I18n.getText("hidden.MostRecentVersion")).setVisible(false);
    colmodel.getColumnExt(I18n.getText("dbbrowser.n")).setVisible(false);
    colmodel.getColumnExt(I18n.getText("dbbrowser.rec")).setVisible(false);
    colmodel.getColumnExt(I18n.getText("dbbrowser.hash")).setVisible(false);

    // popup menu
    table.addMouseListener(new PopupListener() {
        @Override
        public void showPopup(MouseEvent e) {
            // only clicks on tables
            if (!(e.getSource() instanceof JTable))
                return;

            JTable table = (JTable) e.getSource();
            ElementListTableModel model = (ElementListTableModel) table.getModel();

            // get the row and sanity check
            int row = table.rowAtPoint(e.getPoint());
            if (row < 0 || row >= model.getRowCount())
                return;

            // select it?
            table.setRowSelectionInterval(row, row);

            // get the element
            Element element = model.getElementAt(row);

            // create and show the menu
            JPopupMenu popup = new ElementListPopupMenu(element, ComponentViewerOld.this);
            popup.show(table, e.getX(), e.getY());
        }
    });
}