Example usage for java.awt.event ActionEvent toString

List of usage examples for java.awt.event ActionEvent toString

Introduction

In this page you can find the example usage for java.awt.event ActionEvent toString.

Prototype

public String toString() 

Source Link

Document

Returns a String representation of this object.

Usage

From source file:com.db2eshop.gui.listener.BaseMenuItemListener.java

/** {@inheritDoc} */
@Override//from w w w.  ja  v a 2  s.c  o m
public void actionPerformed(ActionEvent e) {
    log.info("Action performed: " + e.toString());
}

From source file:test.uk.co.modularaudio.util.swing.lwtc.TestShowLWTCToggleButton.java

public TestShowLWTCToggleButton() {
    tdb = new LWTCToggleButton(LWTCControlConstants.STD_TOGGLE_BUTTON_COLOURS, "Kill A", false, false) {
        private static final long serialVersionUID = -359196738631950261L;

        @Override/*from www  . j  a  va2s . com*/
        public void receiveUpdateEvent(final boolean previousValue, final boolean newValue) {
            log.debug("Received update event from " + previousValue + " to " + newValue);
        }
    };
    tdb.setMinimumSize(new Dimension(75, 30));
    otherButton = new JToggleButton("Kill B", false);
    otherButton.setMinimumSize(new Dimension(75, 30));
    final Font f = otherButton.getFont();
    log.debug("Regular button font size = " + f.toString());

    otherButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            log.debug("Received action event: " + e.toString());
        }

    });

    tdb.setSelected(true);
    otherButton.setSelected(true);
}

From source file:GUI.MainFrame.java

private void comboBoxAccessModelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxAccessModelActionPerformed
    if ((evt.toString()).equals("Online")) {
        accessModel = "Online";
    } else {/*from   w  w  w .j a  v a2  s.c  o m*/
        accessModel = "Offline";
    }
}

From source file:gdt.jgui.entity.folder.JFolderFacetOpenItem.java

/**
 * Get the popup menu for the child node of the facet node 
 * in the digest view./*from w  w w .  j  a va 2  s  .  c  o m*/
 * @return the popup menu.   
 */
@Override
public JPopupMenu getPopupMenu(final String digestLocator$) {
    JPopupMenu popup = new JPopupMenu();
    try {
        Properties locator = Locator.toProperties(digestLocator$);
        final String encodedSelection$ = locator.getProperty(JEntityDigestDisplay.SELECTION);
        byte[] ba = Base64.decodeBase64(encodedSelection$);
        final String selection$ = new String(ba, "UTF-8");
        //      System.out.println("JFolderFacetOpenItem:getPopupMenu:selection:="+selection$);
        locator = Locator.toProperties(selection$);
        String nodeType$ = locator.getProperty(JEntityDigestDisplay.NODE_TYPE);
        if (JEntityDigestDisplay.NODE_TYPE_FACET_OWNER.equals(nodeType$)) {
            JMenuItem openItem = new JMenuItem("Open");
            popup.add(openItem);
            openItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            openItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                        File file = new File(entihome$ + "/" + entityKey$);
                        Desktop.getDesktop().open(file);
                    } catch (Exception ee) {
                        Logger.getLogger(JFieldsFacetOpenItem.class.getName()).info(ee.toString());
                    }
                }
            });
            JMenuItem editItem = new JMenuItem("Edit");
            popup.add(editItem);
            editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            editItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                        JFolderPanel fp = new JFolderPanel();
                        String fpLocator$ = fp.getLocator();
                        fpLocator$ = Locator.append(fpLocator$, Entigrator.ENTIHOME, entihome$);
                        fpLocator$ = Locator.append(fpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                        JConsoleHandler.execute(console, fpLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JFieldsFacetOpenItem.class.getName()).info(ee.toString());
                    }
                }
            });
        }
        if (NODE_TYPE_FILE_NODE.equals(nodeType$)) {
            JMenuItem openItem = new JMenuItem("Open");
            popup.add(openItem);
            openItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            openItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Properties locator = Locator.toProperties(selection$);
                        String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
                        File file = new File(filePath$);
                        Desktop.getDesktop().open(file);
                    } catch (Exception ee) {
                        Logger.getLogger(JFieldsFacetOpenItem.class.getName()).info(ee.toString());
                    }
                }
            });
            String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
            final File file = new File(filePath$);
            if (isTextFile(file)) {
                JMenuItem editItem = new JMenuItem("Edit");
                popup.add(editItem);
                editItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                editItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            InputStream is = new FileInputStream(file);
                            ByteArrayOutputStream bos = new ByteArrayOutputStream();
                            byte[] b = new byte[1024];
                            int bytesRead = 0;
                            while ((bytesRead = is.read(b)) != -1) {
                                bos.write(b, 0, bytesRead);
                            }
                            byte[] ba = bos.toByteArray();
                            is.close();
                            String text$ = new String(ba, "UTF-8");
                            JTextEditor te = new JTextEditor();
                            String teLocator$ = te.getLocator();
                            teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                            teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, text$);
                            locator$ = Locator.append(locator$, JRequester.REQUESTER_ACTION,
                                    JFolderPanel.ACTION_EDIT_FILE);
                            locator$ = Locator.append(locator$, JFolderPanel.FILE_PATH, file.getPath());
                            locator$ = Locator.append(locator$, BaseHandler.HANDLER_METHOD, "response");
                            locator$ = Locator.append(locator$, JEntityDigestDisplay.SELECTION,
                                    encodedSelection$);
                            String requesterResponceLocator$ = Locator.compressText(locator$);
                            teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                    requesterResponceLocator$);
                            JConsoleHandler.execute(console, teLocator$);
                        } catch (Exception ee) {
                            Logger.getLogger(getClass().getName()).info(ee.toString());
                        }
                    }
                });
            }
        }
        return popup;
    } catch (Exception e) {
        Logger.getLogger(getClass().getName()).severe(e.toString());
        return null;
    }
}

From source file:search2go.UIFrame.java

public UIFrame() throws IOException, ParseException {
    topLevels = new TopLevelGTermSet[] { CCs, MFs, BPs };

    this.addWindowListener(new WindowAdapter() {
        @Override//from w  ww .  j  av  a2  s  . c  o m
        public void windowClosing(WindowEvent et) {
            try {
                if (os.isWindows()) {
                    Runtime.getRuntime().exec("cmd /C TaskKill -IM blastx.exe -F");
                    Runtime.getRuntime().exec("cmd /C TaskKill -IM blastn.exe -F");
                    Runtime.getRuntime().exec("cmd /C TaskKill -IM blastp.exe -F");
                    Runtime.getRuntime().exec("cmd /C TaskKill -IM python.exe -F");
                } else {
                    Runtime.getRuntime().exec("killAll -KILL blastx");
                    Runtime.getRuntime().exec("killAll -KILL blastn");
                    Runtime.getRuntime().exec("killAll -KILL blastp");
                    Runtime.getRuntime().exec("killAll -KILL python");
                }
            } catch (IOException ex) {
                System.out.println("Error closing child processes");
            }
        }
    });

    initComponents();

    txtBlastOutput.getDocument().addDocumentListener(new BufferEnforcer(txtBlastOutput));
    txtFullOutput.getDocument().addDocumentListener(new BufferEnforcer(txtFullOutput));
    txtMapOutput.getDocument().addDocumentListener(new BufferEnforcer(txtMapOutput));

    ((DefaultCaret) txtBlastOutput.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    ((DefaultCaret) txtMapOutput.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    ((DefaultCaret) txtFullOutput.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

    webSaveMenu = new JPopupMenu();
    JMenuItem saveWeb = new JMenuItem();
    saveWeb.setText("Save");
    saveWeb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            webSaveDialogue.showSaveDialog(pnlChartHolder);
            File saveFile = webSaveDialogue.getSelectedFile();
            if (!saveFile.getPath().contains(".png"))
                saveFile = new File(saveFile.getPath() + ".png");
            try {
                BufferedImage webChartImage = new BufferedImage(pnlChartHolder.getWidth(),
                        pnlChartHolder.getHeight(), BufferedImage.TYPE_INT_RGB);
                pnlChartHolder.print(webChartImage.getGraphics());
                ImageIO.write(webChartImage, "png", saveFile);
            } catch (Exception ex) {
                javax.swing.JOptionPane.showMessageDialog(pnlChartHolder,
                        "Error saving chart. Please try again.");
            }
        }

    });
    webSaveMenu.add(saveWeb);
    pnlChartHolder.add(webSaveMenu);
    pnlChartHolder.setLayout(new java.awt.BorderLayout());

    try {
        currentProj = Workspace.open(new Path("Search2GO_Data"));
        chkDoCCs.setState(currentProj.willDoCC());
        chkDoBPs.setState(currentProj.willDoBP());
        chkDoMFs.setState(currentProj.willDoMF());
        txtQuery.setText(currentProj.getQueryPath());
        txtQueryFP.setText(currentProj.getQueryPath());
        txtDatabase.setText(currentProj.getPathToDB());
        txtDatabaseFP.setText(currentProj.getPathToDB());
        txtThreads.setValue(currentProj.getThreadNo());
        txtThreadsFP.setValue(currentProj.getThreadNo());
        cbxNXP.setSelectedIndex(currentProj.getBlastTypeIndex());
        cbxNXPFP.setSelectedIndex(currentProj.getBlastTypeIndex());
        cbxDBID.setSelectedIndex(currentProj.getSelectedDBIndex());
        cbxDBIDFP.setSelectedIndex(currentProj.getSelectedDBIndex());
        txtBitScore.setValue(currentProj.getBitScoreThreshold());
        txtBitScoreFP.setValue(currentProj.getBitScoreThreshold());
        txtBlastE.setValue(currentProj.getEThreshold());
        txtMapE.setValue(currentProj.getEThreshold());
        txtEFP.setValue(currentProj.getEThreshold());
    } catch (FileNotFoundException e) {
        currentProj = Workspace.create(new Path("Search2GO_Data"));
        chkDoCCs.setState(currentProj.willDoCC());
        chkDoBPs.setState(currentProj.willDoBP());
        chkDoMFs.setState(currentProj.willDoMF());
    }
    this.setTitle("Search2GO " + currentProj.getPath().toString());

    GTermTableModel = new DefaultTableModel();
    GTermTableModel.setColumnCount(2);
    GTermTableModel.setColumnIdentifiers(new String[] { "GO ID", "Frequency" });

    ListSelectionModel GTermSelector = tblGOFreq.getSelectionModel();
    GTermSelector.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (tblGOFreq.getSelectedRow() > -1) {
                    DefaultListModel emptyModel = new DefaultListModel();
                    lstQueries.setModel(emptyModel);
                    txtTermInfo.setText("");
                    String selectedID = (String) tblGOFreq.getValueAt(tblGOFreq.getSelectedRow(), 0);
                    JTextArea tempHolderInfo = new JTextArea();
                    JTextArea tempHolderQueries = new JTextArea();

                    if (tblGOFreq.getSelectedRow() != -1) {
                        ResetGTermInfoGetter(tempHolderInfo, tempHolderQueries);
                        gTermInfoGetter.getProcess(0).addParameter("id",
                                selectedID.substring(0, selectedID.indexOf("[")));
                        gTermInfoGetter.getProcess(1).addParameter("id",
                                selectedID.substring(0, selectedID.indexOf("[")));
                        GTerm currentGTerm = gTerms.getGTerm(selectedID.substring(0, selectedID.indexOf("[")));
                        gTermInfoGetter.getProcess(1).addParameter("db", currentGTerm.getTopLevel().getCode());
                        gTermInfoGetter.setTail(new ProcessSequenceEnd() {
                            @Override
                            public void run() {
                                tempHolderInfo.setText("id: " + selectedID + "\n" + tempHolderInfo.getText());
                                txtTermInfo.setText(tempHolderInfo.getText());

                                DefaultListModel queryList = new DefaultListModel();
                                for (String str : tempHolderQueries.getText().split(";")) {
                                    queryList.addElement(str.replaceAll("Query: ", ""));
                                }

                                lstQueries.setModel(queryList);
                                prgIdentification.setIndeterminate(false);
                            }
                        });
                        try {
                            gTermInfoGetter.start();
                            prgIdentification.setIndeterminate(true);
                        } catch (IOException ex) {
                            Logger.getLogger(UIFrame.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }
                }
            }
        }
    });

    lstQueries.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting() && !e.toString().contains("invalid")
                    && lstQueries.getSelectedValue() != null) {
                JTextArea tempHolder = new JTextArea();

                ProcessSequence fetchLocusSequence = new ProcessSequence(new ProcessSequenceEnd() {
                    @Override
                    public void run() {
                        if (txtTermInfo.getText().contains("Score")) {
                            txtTermInfo.setText(
                                    txtTermInfo.getText().substring(0, txtTermInfo.getText().indexOf("Score")));
                        }
                        txtTermInfo.append(tempHolder.getText());
                        prgIdentification.setIndeterminate(false);
                    }
                });
                Path fetchLocusPath = new Path("Processes");
                fetchLocusPath.append("fetchLocus.py");
                Process fetchLocus = new Process(tempHolder);
                fetchLocus.setScriptCommand(fetchLocusPath.toEscString());
                fetchLocus.addParameter("dir", currentProj.getPath().toEscString());
                fetchLocus.addParameter("q",
                        new ParameterString(lstQueries.getSelectedValue().replace("\n", "")).toString());

                String selectedID = (String) tblGOFreq.getValueAt(tblGOFreq.getSelectedRow(), 0);
                GTerm currentGTerm = gTerms.getGTerm(selectedID.substring(0, selectedID.indexOf("[")));
                fetchLocus.addParameter("db", currentGTerm.getTopLevel().getCode());
                fetchLocus.addParameter("id", currentGTerm.getID());
                fetchLocusSequence.addProcess(fetchLocus);

                try {
                    fetchLocusSequence.start();
                    prgIdentification.setIndeterminate(true);
                } catch (IOException ex) {
                    Logger.getLogger(UIFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    });

    DocumentListener filterListener = new DocumentListener() {
        private void anyUpdate() {
            gTerms.getFilter().setFilterString(txtSearchTerms.getText());
            if (!txtMinFreqFilter.getText().equals(""))
                gTerms.getFilter().setMinFreq(Integer.parseInt(txtMinFreqFilter.getText()));
            else
                gTerms.getFilter().setMinFreq(0);
            if (!txtMaxFreqFilter.getText().equals(""))
                gTerms.getFilter().setMaxFreq(Integer.parseInt(txtMaxFreqFilter.getText()));
            else
                gTerms.getFilter().setMaxFreq(-1);
            fillIdentTable(gTerms.stringFilter(), false);
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            anyUpdate();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            anyUpdate();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            anyUpdate();
        }
    };
    txtSearchTerms.getDocument().addDocumentListener(filterListener);
    txtMinFreqFilter.getDocument().addDocumentListener(filterListener);
    txtMaxFreqFilter.getDocument().addDocumentListener(filterListener);

    NumberFormat numberMask = NumberFormat.getIntegerInstance();
    numberMask.setGroupingUsed(false);
    NumberFormatter numberMasker = new NumberFormatter(numberMask);
    NumberFormatter numberMaskerAndBlank = new NumberFormatter(numberMask) {
        @Override
        public Object stringToValue(String s) throws ParseException {
            if (s == null || s.length() == 0)
                return null;
            return super.stringToValue(s);
        }
    };
    DefaultFormatterFactory numberMaskFactory = new DefaultFormatterFactory(numberMasker);
    DefaultFormatterFactory numberMaskAndBlankFactory = new DefaultFormatterFactory(numberMaskerAndBlank);

    txtThreads.setFormatterFactory(numberMaskFactory);
    txtThreadsFP.setFormatterFactory(numberMaskFactory);
    txtBitScore.setFormatterFactory(numberMaskAndBlankFactory);
    txtBitScoreFP.setFormatterFactory(numberMaskAndBlankFactory);
    txtMinFreqFilter.setFormatterFactory(numberMaskFactory);
    txtMaxFreqFilter.setFormatterFactory(numberMaskFactory);
    txtBlastE.setFormatterFactory(numberMaskAndBlankFactory);
    txtMapE.setFormatterFactory(numberMaskAndBlankFactory);
    txtEFP.setFormatterFactory(numberMaskAndBlankFactory);

    blastButton = new StopButton(btnBlast);
    mapButton = new StopButton(btnMapIDs);
    identButton = new StopButton(btnGTermIdent);
    fullButton = new StopButton(btnProcessFP);

    if (currentProj.getStage() >= 2)
        identify(false);
}

From source file:AltiConsole.AltiConsoleMainScreen.java

/**
 * Constructs main screen of the application.
 * //w  ww. j ava 2  s.com
 * @param title
 *            the frame title.
 */
public AltiConsoleMainScreen(final String title) {

    super(title);
    trans = Application.getTranslator();

    // //////// Menu code starts her //////////////
    // File
    fileMenu = new JMenu();
    fileMenu.setText(trans.get("AltiConsoleMainScreen.File"));

    // Load data
    loadDataMenuItem = new JMenuItem();
    loadDataMenuItem.setText(trans.get("AltiConsoleMainScreen.RetrieveFlightData"));
    loadDataMenuItem.setActionCommand("RETRIEVE_FLIGHT");
    loadDataMenuItem.addActionListener(this);

    eraseAllDataMenuItem = new JMenuItem();
    eraseAllDataMenuItem.setText(trans.get("AltiConsoleMainScreen.EraseFlightData"));
    eraseAllDataMenuItem.setActionCommand("ERASE_FLIGHT");
    eraseAllDataMenuItem.addActionListener(this);

    // Save as
    saveASMenuItem = new JMenuItem();
    saveASMenuItem.setText(trans.get("AltiConsoleMainScreen.saveFlightData"));
    saveASMenuItem.setActionCommand("SAVE_FLIGHT");
    saveASMenuItem.addActionListener(this);

    // Exit
    exitMenuItem = new JMenuItem();
    exitMenuItem.setText(trans.get("AltiConsoleMainScreen.Exit"));
    exitMenuItem.setActionCommand("EXIT");
    exitMenuItem.addActionListener(this);

    fileMenu.add(saveASMenuItem);

    fileMenu.add(loadDataMenuItem);
    fileMenu.add(eraseAllDataMenuItem);
    fileMenu.add(exitMenuItem);

    // Option menu
    optionMenu = new JMenu(trans.get("AltiConsoleMainScreen.Option"));
    preferencesMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.Preferences"));
    preferencesMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("pref\n");
            Preferences.showPreferences(AltiConsoleMainScreen.this);
            //LicenseDialog.showPreferences(AltiConsoleMainScreen.this);
            System.out.println("change units\n");
            String Units;
            System.out.println(UserPref.getAppUnits());
            if (Utils.equals(UserPref.getAppUnits(), "Unit.Metrics"))
                Units = trans.get("Unit.Metrics");
            else
                Units = trans.get("Unit.Imperial");

            chart.getXYPlot().getRangeAxis()
                    .setLabel(trans.get("AltiConsoleMainScreen.altitude") + " (" + Units + ")");
            if (Serial.getConnected()) {
                RetrievingFlight();
            }

        }
    });

    optionMenu.add(preferencesMenuItem);

    // Configuration menu
    altiConfigMenu = new JMenu(trans.get("AltiConsoleMainScreen.ConfigAltimeter"));

    retrieveAltiConfigMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.RetrieveAltiConfig"));
    retrieveAltiConfigMenuItem.setActionCommand("RETRIEVE_ALTI_CFG");
    retrieveAltiConfigMenuItem.addActionListener(this);
    altiConfigMenu.add(retrieveAltiConfigMenuItem);

    uploadFirmwareMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.UploadFirmware"));

    uploadFirmwareMenuItem.setActionCommand("UPLOAD_FIRMWARE");
    uploadFirmwareMenuItem.addActionListener(this);
    altiConfigMenu.add(uploadFirmwareMenuItem);

    // Help
    helpMenu = new JMenu(trans.get("AltiConsoleMainScreen.Help"));
    jJMenuBar = new JMenuBar();

    // Manual
    onLineHelpMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.onLineHelp"));
    onLineHelpMenuItem.setActionCommand("ON_LINE_HELP");
    onLineHelpMenuItem.addActionListener(this);

    // license
    licenseMenuItem = new JMenuItem(trans.get("AltiConsoleMainScreen.license"));
    licenseMenuItem.setActionCommand("LICENSE");
    licenseMenuItem.addActionListener(this);

    // AboutScreen
    aboutMenuItem = new JMenuItem();
    aboutMenuItem.setText(trans.get("AltiConsoleMainScreen.About"));
    aboutMenuItem.setActionCommand("ABOUT");
    aboutMenuItem.addActionListener(this);

    helpMenu.add(onLineHelpMenuItem);
    helpMenu.add(licenseMenuItem);
    helpMenu.add(aboutMenuItem);

    jJMenuBar.add(fileMenu);
    jJMenuBar.add(optionMenu);
    jJMenuBar.add(altiConfigMenu);
    jJMenuBar.add(helpMenu);
    this.setJMenuBar(jJMenuBar);

    // ///// end of Menu code

    // Button
    retrieveFlights = new JButton();
    retrieveFlights.setText(trans.get("AltiConsoleMainScreen.RetrieveFlights"));
    retrieveFlights.setActionCommand("RETRIEVE_FLIGHT");
    retrieveFlights.addActionListener(this);
    retrieveFlights.setToolTipText(trans.get("AltiConsoleMainScreen.ttipRetrieveFlight"));

    // combo serial rate
    String[] serialRateStrings = { "300", "1200", "2400", "4800", "9600", "14400", "19200", "28800", "38400",
            "57600", "115200" };

    serialRatesLabel = new JLabel(trans.get("AltiConsoleMainScreen.comPortSpeed") + " ");
    serialRates = new JComboBox();
    System.out.println(UserPref.getDefComSpeed() + "\n");
    for (int i = 0; i < serialRateStrings.length; i++) {
        serialRates.addItem(serialRateStrings[i]);

        if (Utils.equals(UserPref.getDefComSpeed(), serialRateStrings[i])) {
            serialRates.setSelectedIndex(i);
        }
    }
    serialRates.setToolTipText(trans.get("AltiConsoleMainScreen.ttipChoosePortSpeed"));

    comPortsLabel = new JLabel(trans.get("AltiConsoleMainScreen.port") + " ");
    comPorts = new JComboBox();

    comPorts.setActionCommand("comPorts");
    comPorts.addActionListener(this);
    comPorts.setToolTipText(trans.get("AltiConsoleMainScreen.ttipChooseAltiport"));
    listData = new DefaultListModel();

    flightList = new JXList(listData);
    flightList.addListSelectionListener(new ValueReporter());

    JPanel TopPanelLeft = new JPanel();
    TopPanelLeft.setLayout(new BorderLayout());
    TopPanelLeft.add(comPortsLabel, BorderLayout.WEST);
    TopPanelLeft.add(comPorts, BorderLayout.EAST);

    JPanel TopPanelMiddle = new JPanel();
    TopPanelMiddle.setLayout(new BorderLayout());
    TopPanelMiddle.add(retrieveFlights, BorderLayout.WEST);

    JPanel TopPanelRight = new JPanel();
    TopPanelRight.setLayout(new BorderLayout());
    TopPanelRight.add(serialRatesLabel, BorderLayout.WEST);
    TopPanelRight.add(serialRates, BorderLayout.EAST);

    JPanel TopPanel = new JPanel();
    TopPanel.setLayout(new BorderLayout());

    TopPanel.add(TopPanelRight, BorderLayout.EAST);
    TopPanel.add(TopPanelMiddle, BorderLayout.CENTER);
    TopPanel.add(TopPanelLeft, BorderLayout.WEST);
    JPanel MiddlePanel = new JPanel();
    MiddlePanel.setLayout(new BorderLayout());

    MiddlePanel.add(TopPanel, BorderLayout.NORTH);
    MiddlePanel.add(flightList, BorderLayout.WEST);

    String Units;
    if (Utils.equals(UserPref.getAppUnits(), "Unit.Metrics"))
        Units = trans.get("Unit.Metrics");
    else
        Units = trans.get("Unit.Imperial");

    chart = ChartFactory.createXYLineChart(trans.get("AltiConsoleMainScreen.Title"),
            trans.get("AltiConsoleMainScreen.time"),
            trans.get("AltiConsoleMainScreen.altitude") + " (" + Units + ")", null);

    chart.setBackgroundPaint(Color.white);
    System.out.println(chart.getSubtitle(0));

    this.plot = chart.getXYPlot();
    this.plot.setBackgroundPaint(Color.lightGray);
    this.plot.setDomainGridlinePaint(Color.white);
    this.plot.setRangeGridlinePaint(Color.white);

    final ValueAxis axis = this.plot.getDomainAxis();
    axis.setAutoRange(true);

    final NumberAxis rangeAxis2 = new NumberAxis("Range Axis 2");
    rangeAxis2.setAutoRangeIncludesZero(false);

    final ChartPanel chartPanel = new ChartPanel(chart);

    MiddlePanel.add(chartPanel, BorderLayout.CENTER);

    JPanel InfoPanel = new JPanel(new MigLayout("fill"));
    InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.ApogeeAltitude")), "gapright para");
    apogeeAltitudeLabel = new JLabel();
    InfoPanel.add(apogeeAltitudeLabel, "growx");
    InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.MainAltitude")), "gapright para");
    mainAltitudeLabel = new JLabel();
    InfoPanel.add(mainAltitudeLabel, "growx");
    flightNbrLabel = new JLabel();

    InfoPanel.add(new JLabel(trans.get("AltiConsoleMainScreen.NbrOfPoint")), "growx");
    nbrPointLabel = new JLabel();
    InfoPanel.add(nbrPointLabel, "wrap rel,growx");

    txtLog = new JTextArea(5, 70);
    txtLog.setEditable(false);
    txtLog.setAutoscrolls(true);

    scrollPane = new JScrollPane(txtLog);
    scrollPane.setAutoscrolls(true);
    // BottomPanel.add(scrollPane, BorderLayout.WEST);
    InfoPanel.add(scrollPane, "span");
    // MiddlePanel.add(BottomPanel, BorderLayout.SOUTH);
    MiddlePanel.add(InfoPanel, BorderLayout.SOUTH);
    setContentPane(MiddlePanel);
    try {
        try {
            Serial = new AltimeterSerial(this);

            Serial.searchForPorts();
        } catch (UnsatisfiedLinkError e) {
            System.out.println("USB Library rxtxSerial.dll Not Found");
            System.out.println("Exception:" + e.toString() + ":" + e.getMessage());
            System.out.println(e.toString());
            JOptionPane.showMessageDialog(null,
                    "You must copy the appropriate rxtxSerial.dll \n "
                            + "to your local 32 bit or 64 bitjava JRE installation\n\n"
                            + " .../arduino-1.0.1-windows/arduino-1.0.1/rxtxSerial.dll\n"
                            + "to\n C:/Program Files (x86)/Java/jre7/bin/rxtxSerial.dll\n"
                            + "also right click Properties->Unblock",
                    trans.get("AltiConsoleMainScreen.InstallationProblem"), JOptionPane.WARNING_MESSAGE);
        }
    } catch (NoClassDefFoundError e) {
        System.out.println("Missing RXTXcomm.jar in java installation");
        System.out.println("Exception:" + e.toString() + ":" + e.getMessage());
        System.out.println(e.toString());
        JOptionPane.showMessageDialog(null,
                "You must copy RXTXcomm.jar from the Arduino software\n "
                        + "to your local 32 bit java JRE installation\n\n"
                        + " .../arduino-1.0.1-windows/arduino-1.0.1/lib/RXTXcomm.jar\n"
                        + "to\n C:/Program Files (x86)/Java/jre7/lib/ext/RXTXcomm.jar\n"
                        + "also right click Properties->Unblock",
                trans.get("AltiConsoleMainScreen.InstallationProblem"), JOptionPane.WARNING_MESSAGE);
    }
}

From source file:org.nuclos.client.main.MainController.java

private void initActions() {
    try {/*  w  w  w.ja v a2  s .  co m*/
        dha = new DirectHelpActionListener();

        // init Actions
        cmdDirectHelp = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dha.actionPerformed(e);
            }
        };
        cmdShowTimelimitTasks = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miShowTimelimitTasks", "Fristen anzeigen"),
                Icons.getInstance().getIconTabTimtlimit()) {

            @Override
            public void actionPerformed(ActionEvent e) {
                MainController.this.getTaskController().getTimelimitTaskController().cmdShowTimelimitTasks();
            }

            @Override
            public boolean isEnabled() {
                return getSecurityCache().isActionAllowed(Actions.ACTION_TIMELIMIT_LIST);
            }
        };
        cmdShowPersonalTasks = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miShowPersonalTasks", "Meine Aufgaben anzeigen"),
                Icons.getInstance().getIconTabTask()) {

            @Override
            public void actionPerformed(ActionEvent e) {
                MainController.this.getTaskController().getPersonalTaskController().cmdShowPersonalTasks();
            }

            @Override
            public boolean isEnabled() {
                return getSecurityCache().isActionAllowed(Actions.ACTION_TASKLIST);
            }
        };
        cmdShowPersonalSearchFilters = new AbstractAction(
                getSpringLocaleDelegate().getMessage("ExplorerPanel.3", "Meine Suchfilter anzeigen"),
                Icons.getInstance().getIconFilter16()) {

            @Override
            public void actionPerformed(ActionEvent e) {
                MainController.this.getExplorerController().cmdShowPersonalSearchFilters();
            }
        };
        cmdChangePassword = new AbstractAction() {

            private Boolean enabled;

            @Override
            public void actionPerformed(ActionEvent evt) {
                ChangePasswordPanel cpp = new ChangePasswordPanel(true, "", false);
                boolean result = cpp.showInDialog(getFrame(), new ChangePasswordPanel.ChangePasswordDelegate() {
                    @Override
                    public void changePassword(String oldPw, String newPw) throws CommonBusinessException {
                        RemoteAuthenticationManager ram = SpringApplicationContextHolder
                                .getBean(RemoteAuthenticationManager.class);
                        ram.changePassword(sUserName, oldPw, newPw);
                        getNuclosRemoteServerSession().relogin(sUserName, newPw);
                        try {
                            MainController.this.prefs.flush();
                        } catch (BackingStoreException e) {
                            LOG.fatal("actionPerformed failed: " + e, e);
                        }
                        LocalUserProperties props = LocalUserProperties.getInstance();
                        props.setUserPasswd("");
                        props.store();
                    }
                });
            }

            @Override
            public synchronized boolean isEnabled() {
                if (enabled == null) {
                    enabled = !SecurityDelegate.getInstance().isLdapAuthenticationActive()
                            || SecurityDelegate.getInstance().isSuperUser();
                }
                return LangUtils.defaultIfNull(enabled, Boolean.FALSE);
            }
        };
        cmdOpenManagementConsole = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miManagementConsole", "Management Console"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.158-wrench-2.png"))) {

            @Override
            public void actionPerformed(ActionEvent evt) {
                UIUtils.runCommand(getMainFrame(), new Runnable() {
                    @Override
                    public void run() {
                        try {
                            NuclosConsoleGui.showInFrame(getMainFrame().getHomePane().getComponentPanel());
                        } catch (Exception e) {
                            LOG.error("showInFrame failed: " + e, e);
                        }
                    }
                });
            }
        };

        cmdOpenEntityWizard = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miEntityWizard", "Entity Wizard"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.81-dashboard.png"))) {

            @Override
            public void actionPerformed(ActionEvent evt) {
                final MainFrameTabbedPane desktopPane = MainController.this.getHomePane();
                UIUtils.runCommand(getMainFrame(), new ShowNuclosWizard.NuclosWizardRoRunnable(desktopPane));
            }
        };

        cmdOpenEventSupportManagement = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miEventSupportManagement", "Regelmanagement"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.34-coffee.png"))) {

            @Override
            public void actionPerformed(ActionEvent evt) {
                final MainFrameTabbedPane desktopPane = MainController.this.getHomePane();
                UIUtils.runCommand(getMainFrame(),
                        new EventSupportManagementController.NuclosESMRunnable(desktopPane));
            }
        };

        cmdOpenCustomComponentWizard = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miResPlanWizard", "Ressourcenplanung"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.83-calendar.png"))) {

            @Override
            public void actionPerformed(final ActionEvent evt) {
                UIUtils.runCommand(getMainFrame(), new Runnable() {
                    @Override
                    public void run() {
                        try {
                            CustomComponentWizard.run();
                        } catch (Exception e) {
                            LOG.error("CustomComponentWizard failed: " + e, e);
                        }
                    }
                });
            }
        };
        cmdOpenRelationEditor = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miRelationEditor", "Relationeneditor"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.55-network.png"))) {

            @Override
            public void actionPerformed(final ActionEvent evt) {
                UIUtils.runCommand(getMainFrame(), new Runnable() {
                    @Override
                    public void run() {
                        try {
                            final CollectControllerFactorySingleton factory = CollectControllerFactorySingleton
                                    .getInstance();
                            Collection<MasterDataVO> colRelation = MasterDataDelegate.getInstance()
                                    .getMasterData(NuclosEntity.ENTITYRELATION.getEntityName());
                            EntityRelationShipCollectController result = factory
                                    .newEntityRelationShipCollectController(MainController.this.getFrame(),
                                            null);
                            if (colRelation.size() > 0) {
                                MasterDataVO vo = colRelation.iterator().next();
                                result.runViewSingleCollectableWithId(vo.getId());
                            } else {
                                result.runNew();
                            }
                        } catch (/* CommonBusiness */ Exception e1) {
                            LOG.error("actionPerformed " + evt + ": " + e1);
                        }
                    }
                });
            }
        };
        cmdOpenRelationEditor = new AbstractAction(
                getSpringLocaleDelegate().getMessage("miRelationEditor", "Relationeneditor"),
                MainFrame.resizeAndCacheTabIcon(NuclosResourceCache.getNuclosResourceIcon(
                        "org.nuclos.client.resource.icon.glyphish-blue.55-network.png"))) {

            @Override
            public void actionPerformed(final ActionEvent evt) {
                UIUtils.runCommand(getMainFrame(), new Runnable() {
                    @Override
                    public void run() {
                        try {
                            final CollectControllerFactorySingleton factory = CollectControllerFactorySingleton
                                    .getInstance();
                            Collection<MasterDataVO> colRelation = MasterDataDelegate.getInstance()
                                    .getMasterData(NuclosEntity.ENTITYRELATION.getEntityName());
                            EntityRelationShipCollectController result = factory
                                    .newEntityRelationShipCollectController(MainController.this.getFrame(),
                                            null);
                            if (colRelation.size() > 0) {
                                MasterDataVO vo = colRelation.iterator().next();
                                result.runViewSingleCollectableWithId(vo.getId());
                            } else {
                                result.runNew();
                            }
                        } catch (/* CommonBusiness */ Exception e1) {
                            LOG.error("actionPerformed " + evt + ": " + e1);
                        }
                    }
                });
            }
        };
        cmdOpenSettings = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {
                cmdOpenSettings();
            }
        };
        cmdRefreshClientCaches = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                UIUtils.runCommandLater(getFrame(), new CommonRunnable() {
                    @Override
                    public void run() throws CommonBusinessException {
                        invalidateAllClientCaches();
                        JOptionPane.showMessageDialog(getFrame(), getSpringLocaleDelegate().getMessage(
                                "MainController.3",
                                "Die folgenden Aktionen wurden erfolgreich durchgef\u00fchrt:\n"
                                        + "Caches aktualisiert: MasterDataCache, SecurityCache, AttributeCache, GenericObjectLayoutCache, GeneratorCache, MetaDataCache, ResourceCache, SearchFilterCache.\n"
                                        + "Men\u00fcs aktualisiert."));
                    }
                });
            }
        };
        cmdSelectAll = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                // select all rows in the Result panel of the current CollectController (if any):
                final MainFrameTab ifrm = (MainFrameTab) MainController.this.frm.getHomePane()
                        .getSelectedComponent();
                if (ifrm != null) {
                    final CollectController<?> ctl = getControllerForTab(ifrm);
                    if (ctl != null
                            && ctl.getCollectState().getOuterState() == CollectStateModel.OUTERSTATE_RESULT) {
                        ctl.getResultTable().selectAll();
                    } else if (ctl != null
                            && ((ctl.getCollectState().getOuterState() == CollectStateModel.OUTERSTATE_DETAILS)
                                    || ctl.getCollectState()
                                            .getOuterState() == CollectStateModel.OUTERSTATE_SEARCH)) {
                        Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager()
                                .getPermanentFocusOwner();

                        if (focusOwner instanceof JTextComponent) {
                            ((JTextComponent) focusOwner).selectAll();
                        }
                    }
                }
            }
        };
        cmdHelpContents = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                WikiController.getInstance().openURLinBrowser(ClientParameterProvider.getInstance()
                        .getValue(ClientParameterProvider.KEY_WIKI_STARTPAGE));
            }
        };
        cmdShowAboutDialog = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                cmdShowAboutDialog();
            }
        };
        cmdShowProjectReleaseNotes = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                new ReleaseNotesController().showReleaseNotes(ApplicationProperties.getInstance().getName());
            }
        };
        cmdShowNuclosReleaseNotes = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent evt) {
                ReleaseNotesController.openReleaseNotesInBrowser();
            }
        };
        cmdWindowClosing = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {
                cmdWindowClosing(new ResultListener<Boolean>() {
                    @Override
                    public void done(Boolean result) {
                    }
                });
            }
        };
        cmdLogoutExit = new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {
                cmdLogoutExit();
            }
        };
        cmdExecuteRport = createEntityAction(NuclosEntity.REPORTEXECUTION);
    } catch (Throwable e) {
        LOG.fatal("Creating MainController failed, this is fatal: " + e.toString(), e);
        throw new ExceptionInInitializerError(e);
    }
}

From source file:gdt.jgui.entity.index.JIndexPanel.java

private void initPopup() {
    try {//w ww . j ava  2  s .co  m
        //System.out.println("IndexPanel:initPopup:selection="+selection$);
        Properties locator = Locator.toProperties(selection$);
        String nodeType$ = locator.getProperty(NODE_TYPE);
        //System.out.println("IndexPanel:initPopup:node type="+nodeType$);
        if (NODE_TYPE_ROOT.equals(nodeType$)) {
            popup = null;
            return;
        }
        if (NODE_TYPE_GROUP.equals(nodeType$)) {
            popup = new JPopupMenu();
            JMenuItem newGroupItem = new JMenuItem("New group");
            newGroupItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        // System.out.println("JIndexPanel:popup:new parent group:  selection="+selection$); 
                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String title$ = "New group" + Identity.key().substring(0, 4);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT_TITLE, "Create group");
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_CREATE_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(newGroupItem);
            popup.addSeparator();
            JMenuItem renameItem = new JMenuItem("Rename");
            renameItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String title$ = locator.getProperty(Locator.LOCATOR_TITLE);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_RENAME_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(renameItem);
            JMenuItem setIconItem = new JMenuItem("Set icon");
            setIconItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        Properties locator = Locator.toProperties(selection$);
                        JIconSelector is = new JIconSelector();
                        String isLocator$ = is.getLocator();
                        isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_SET_ICON_GROUP);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, isLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(setIconItem);
            JMenuItem orderItem = new JMenuItem("Order");
            orderItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        Entigrator entigrator = console.getEntigrator(entihome$);
                        Sack index = entigrator.getEntityAtKey(entityKey$);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        index = orderGroupDefault(index, nodeKey$);
                        index.putElementItem("index.selection", new Core(null, "selection", nodeKey$));
                        entigrator.save(index);
                        JConsoleHandler.execute(console, getLocator());
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }

                }
            });
            popup.add(orderItem);
            popup.addSeparator();
            JMenuItem copyItem = new JMenuItem("Copy");
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        cut = false;
                        console.clipboard.clear();
                        if (selection$ != null)
                            console.clipboard.putString(selection$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }

            });
            popup.add(copyItem);
            JMenuItem cutItem = new JMenuItem("Cut");
            cutItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        cut = true;
                        console.clipboard.clear();
                        if (selection$ != null)
                            console.clipboard.putString(selection$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }

            });
            popup.add(cutItem);

            final String[] sa = console.clipboard.getContent();
            if (sa != null && sa.length > 0) {
                JMenuItem pasteItem = new JMenuItem("Paste");
                pasteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            //  System.out.println("JIndexPanel:popup:new parent group:  selection="+selection$); 
                            Properties selectionLocator = Locator.toProperties(selection$);
                            String indexLocator$ = getLocator();
                            String groupKey$ = selectionLocator.getProperty(NODE_KEY);
                            Properties indexLocator = Locator.toProperties(indexLocator$);
                            String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME);
                            String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            Sack index = entigrator.getEntityAtKey(entityKey$);
                            for (String aSa : sa) {

                                index = pasteItemToGroup(index, groupKey$, aSa);
                            }
                            entigrator.save(index);
                            cut = false;
                            JConsoleHandler.execute(console, getLocator());
                        } catch (Exception ee) {
                            Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                        }
                    }
                });
                popup.add(pasteItem);

            }
            popup.addSeparator();
            JMenuItem deleteItem = new JMenuItem("Delete");
            deleteItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                            "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (response == JOptionPane.YES_OPTION) {
                        try {

                            Properties locator = Locator.toProperties(selection$);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            Sack index = entigrator.getEntityAtKey(entityKey$);
                            String nodeKey$ = locator.getProperty(NODE_KEY);
                            String groupKey$ = locator.getProperty(NODE_GROUP_KEY);

                            index = removeNode(index, nodeKey$);
                            index.putElementItem("index.selection", new Core(null, "selection", groupKey$));
                            entigrator.save(index);
                            JConsoleHandler.execute(console, getLocator());
                        } catch (Exception ee) {
                            Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                        }
                    }
                }
            });
            popup.add(deleteItem);

            return;
        }
        if (NODE_TYPE_REFERENCE.equals(nodeType$)) {
            popup = new JPopupMenu();
            final String locatorType$ = locator.getProperty(Locator.LOCATOR_TYPE);

            JMenuItem openItem = new JMenuItem("Open");
            openItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Properties locator = Locator.toProperties(selection$);
                    //   String locatorType$=locator.getProperty(Locator.LOCATOR_TYPE);
                    //   System.out.println("IndexPanel:open:node type="+locatorType$);
                    if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locatorType$)) {
                        String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
                        File itemFile = new File(filePath$);
                        try {
                            Desktop.getDesktop().open(itemFile);
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                    if (JWeblinksPanel.LOCATOR_TYPE_WEB_LINK.equals(locatorType$)) {
                        try {
                            String url$ = locator.getProperty(JWeblinksPanel.WEB_LINK_URL);
                            Desktop.getDesktop().browse(new URI(url$));
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                    String responseLocator$ = getLocator();
                    //   System.out.println("IndexPanel:open:response locator="+Locator.remove(responseLocator$,Locator.LOCATOR_ICON));

                    selection$ = Locator.append(selection$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                            Locator.compressText(responseLocator$));
                    //   System.out.println("IndexPanel:open:selection="+Locator.remove(Locator.remove(selection$, Locator.LOCATOR_ICON),JRequester.REQUESTER_RESPONSE_LOCATOR));
                    selection$ = Locator.append(selection$, Entigrator.ENTIHOME, entihome$);
                    JConsoleHandler.execute(console, selection$);

                }
            });
            popup.add(openItem);
            if (JFolderPanel.LOCATOR_TYPE_FILE.equals(locator.getProperty(Locator.LOCATOR_TYPE))) {
                JMenuItem openFolderItem = new JMenuItem("Open folder");
                openFolderItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        Properties locator = Locator.toProperties(selection$);
                        String filePath$ = locator.getProperty(JFolderPanel.FILE_PATH);
                        File itemFile = new File(filePath$);
                        try {
                            Desktop.getDesktop().open(itemFile.getParentFile());
                        } catch (Exception ee) {
                            LOGGER.info(ee.toString());
                        }
                        return;
                    }
                });
                popup.add(openFolderItem);
            }
            JMenuItem deleteItem = new JMenuItem("Delete");
            deleteItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                            "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (response == JOptionPane.YES_OPTION) {
                        Properties selectionLocator = Locator.toProperties(selection$);
                        String indexLocator$ = getLocator();
                        Properties indexLocator = Locator.toProperties(indexLocator$);
                        String entihome$ = indexLocator.getProperty(Entigrator.ENTIHOME);
                        String entityKey$ = indexLocator.getProperty(EntityHandler.ENTITY_KEY);
                        Entigrator entigrator = console.getEntigrator(entihome$);
                        Sack index = entigrator.getEntityAtKey(entityKey$);
                        String nodeKey$ = selectionLocator.getProperty(NODE_KEY);
                        String groupKey$ = selectionLocator.getProperty(NODE_GROUP_KEY);

                        index.removeElementItem("index.jlocator", nodeKey$);
                        index.putElementItem("index.selection", new Core(null, "selection", groupKey$));
                        entigrator.save(index);
                        JConsoleHandler.execute(console, getLocator());
                    }

                }
            });
            popup.add(deleteItem);
            popup.addSeparator();
            JMenuItem renameItem = new JMenuItem("Rename");
            renameItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        String title$;
                        Core title = index.getElementItem("index.title", nodeKey$);
                        if (title != null && title.value != null)
                            title$ = title.value;
                        else
                            title$ = locator.getProperty(Locator.LOCATOR_TITLE);
                        JTextEditor te = new JTextEditor();
                        String teLocator$ = te.getLocator();
                        teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$);
                        teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, title$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_RENAME_REFERENCE);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, teLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(renameItem);
            JMenuItem setIconItem = new JMenuItem("Set icon");
            setIconItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        JIconSelector is = new JIconSelector();
                        String isLocator$ = is.getLocator();
                        isLocator$ = Locator.append(isLocator$, Entigrator.ENTIHOME, entihome$);
                        String ipLocator$ = getLocator();
                        ipLocator$ = Locator.append(ipLocator$, JRequester.REQUESTER_ACTION,
                                ACTION_SET_ICON_REFERENCE);
                        ipLocator$ = Locator.append(ipLocator$, SELECTION, Locator.compressText(selection$));
                        ipLocator$ = Locator.append(ipLocator$, BaseHandler.HANDLER_METHOD, "response");
                        isLocator$ = Locator.append(isLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                                Locator.compressText(ipLocator$));
                        JConsoleHandler.execute(console, isLocator$);
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(setIconItem);
            JMenuItem resetItem = new JMenuItem("Reset");
            resetItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    JConsoleHandler.execute(console, selection$);
                    try {

                        Properties locator = Locator.toProperties(selection$);
                        String nodeKey$ = locator.getProperty(NODE_KEY);
                        Core title = index.getElementItem("index.title", nodeKey$);
                        if (title != null) {
                            index.removeElementItem("index.title", nodeKey$);
                            Entigrator entigrator = console.getEntigrator(entihome$);
                            entigrator.save(index);
                            JConsoleHandler.execute(console, getLocator());
                        }
                    } catch (Exception ee) {
                        Logger.getLogger(JIndexPanel.class.getName()).info(ee.toString());
                    }
                }
            });
            popup.add(resetItem);
            popup.addSeparator();
            JMenuItem copyItem = new JMenuItem("Copy");
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cut = false;
                    console.clipboard.clear();
                    console.clipboard.putString(selection$);

                }
            });
            popup.add(copyItem);
            JMenuItem cutItem = new JMenuItem("Cut");
            cutItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cut = true;
                    console.clipboard.clear();
                    console.clipboard.putString(selection$);
                }
            });
            popup.add(cutItem);

        }
    } catch (Exception e) {
        Logger.getLogger(getClass().getName()).severe(e.toString());
    }
}