Example usage for javax.swing Action SHORT_DESCRIPTION

List of usage examples for javax.swing Action SHORT_DESCRIPTION

Introduction

In this page you can find the example usage for javax.swing Action SHORT_DESCRIPTION.

Prototype

String SHORT_DESCRIPTION

To view the source code for javax.swing Action SHORT_DESCRIPTION.

Click Source Link

Document

The key used for storing a short String description for the action, used for tooltip text.

Usage

From source file:edu.mit.fss.examples.gui.ExecutionControlPanel.java

/**
 * Instantiates a new execution control panel.
 *//*  w ww. j a v  a2  s. c o  m*/
public ExecutionControlPanel() {
    initializeAction.putValue(Action.SHORT_DESCRIPTION, "Initialize the execution.");
    initializeAction.setEnabled(false);
    runAction.putValue(Action.SHORT_DESCRIPTION, "Run the execution.");
    runAction.setEnabled(false);
    stopAction.putValue(Action.SHORT_DESCRIPTION, "Stop the execution.");
    stopAction.setEnabled(false);
    terminateAction.putValue(Action.SHORT_DESCRIPTION, "Terminate the execution.");
    terminateAction.setEnabled(false);

    setLayout(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());

    buttonPanel.add(new JButton(initializeAction));
    buttonPanel.add(new JButton(runAction));
    buttonPanel.add(new JButton(stopAction));
    buttonPanel.add(new JButton(terminateAction));

    timeStepField = new JFormattedTextField(NumberFormat.getNumberInstance());
    timeStepField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            checkUpdate();
        }

        private void checkUpdate() {
            long unitConversion = getTimeStepUnits();
            long timeStep = FastMath.round(unitConversion * ((Number) timeStepField.getValue()).doubleValue());
            setTimeStepAction.setEnabled(timeStep != federate.getTimeStep());
        }

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

        @Override
        public void removeUpdate(DocumentEvent e) {
            checkUpdate();
        }
    });
    timeStepField.setColumns(4);
    buttonPanel.add(new JLabel("Time Step: "));
    buttonPanel.add(timeStepField);
    timeStepUnits.setSelectedItem(TimeUnit.SECONDS);
    buttonPanel.add(timeStepUnits);
    timeStepUnits.addActionListener(new ActionListener() {
        private long lastUnitConversion = getTimeStepUnits();

        @Override
        public void actionPerformed(ActionEvent e) {
            long unitConversion = getTimeStepUnits();
            // update field value using new units
            timeStepField.setValue(((Double) timeStepField.getValue()) * lastUnitConversion / unitConversion);
            // update stored value
            lastUnitConversion = unitConversion;
        }
    });
    buttonPanel.add(new JButton(setTimeStepAction));

    buttonPanel.add(new JLabel("Min. Step Duration"));
    stepDurationField = new JFormattedTextField(NumberFormat.getNumberInstance());
    stepDurationField.setColumns(4);
    stepDurationField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            checkUpdate();
        }

        private void checkUpdate() {
            long unitConversion = getStepDurationUnits();
            long minStepDuration = FastMath
                    .round(unitConversion * ((Number) stepDurationField.getValue()).doubleValue());
            setMinStepDurationAction.setEnabled(minStepDuration != federate.getMinimumStepDuration());
        }

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

        @Override
        public void removeUpdate(DocumentEvent e) {
            checkUpdate();
        }
    });
    buttonPanel.add(stepDurationField);
    stepDurationUnits.setSelectedItem(TimeUnit.MILLISECONDS);
    buttonPanel.add(stepDurationUnits);
    stepDurationUnits.addActionListener(new ActionListener() {
        private long lastUnitConversion = getStepDurationUnits();

        @Override
        public void actionPerformed(ActionEvent e) {
            long unitConversion = getStepDurationUnits();
            // update field value using new units
            stepDurationField
                    .setValue(((Double) stepDurationField.getValue()) * lastUnitConversion / unitConversion);
            // update stored value
            lastUnitConversion = unitConversion;
        }
    });
    buttonPanel.add(new JButton(setMinStepDurationAction));

    add(buttonPanel, BorderLayout.CENTER);
}

From source file:com.intuit.tank.tools.debugger.ActionProducer.java

/**
 * //w w w .  ja v  a  2  s  .  c  o m
 * @return
 */
public Action getFindAction() {
    Action ret = actionMap.get(ACTION_FIND);
    if (ret == null) {
        ret = new AbstractAction(ACTION_FIND, getIcon("find.png", IconSize.SMALL)) {
            private static final long serialVersionUID = 1L;
            private FindReplaceDialog dialog;

            @Override
            public void actionPerformed(ActionEvent event) {
                try {
                    if (dialog == null) {
                        dialog = new FindReplaceDialog(debuggerFrame, DialogType.SEARCH);
                    }
                    dialog.setVisible(true);
                } catch (HeadlessException e) {
                    showError("Error opening file: " + e);
                }
            }
        };
        ret.putValue(Action.SHORT_DESCRIPTION, "Find in script.");
        ret.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('F', menuActionMods));
        ret.putValue(Action.MNEMONIC_KEY, new Integer('F'));
        ret.setEnabled(false);
        actionMap.put(ACTION_FIND, ret);
    }
    return ret;
}

From source file:com.anrisoftware.prefdialog.miscswing.actions.AbstractResourcesAction.java

/**
 * Returns the short description the action.
 *
 * @return the {@link String} short description or {@code null} if not set.
 * @see Action#SHORT_DESCRIPTION/*from  ww  w  .j  a  v  a  2  s.co m*/
 * @since 3.1
 */
public final String getShortDescription() {
    return (String) getValue(Action.SHORT_DESCRIPTION);
}

From source file:nz.ac.massey.cs.gql4jung.browser.ResultBrowser.java

private void initActions() {

    actExit = new AbstractAction("exit") {
        @Override/*from  ww  w  .j a va 2  s . c  o  m*/
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    };

    actLoadData = new AbstractAction("load data", getIcon("Open16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actLoadData();
        }
    };
    actLoadData.putValue(Action.SHORT_DESCRIPTION, "load a program dependency graph from a graphml file");

    actLoadQuery = new AbstractAction("load query", getIcon("Import16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actLoadQuery();
        }
    };
    actLoadQuery.putValue(Action.SHORT_DESCRIPTION, "load a query from a xml file");

    actRunQuery = new AbstractAction("run query", getIcon("Play16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actRunQuery();
        }
    };
    actRunQuery.putValue(Action.SHORT_DESCRIPTION, "execute the query");

    actCancelQuery = new AbstractAction("cancel", getIcon("Stop16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actCancelQuery();
        }
    };
    actCancelQuery.putValue(Action.SHORT_DESCRIPTION, "cancel the currently running query");

    actExport2CSV = new AbstractAction("export to csv", getIcon("Export16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actExport2CSV();
        }
    };
    actExport2CSV.putValue(Action.SHORT_DESCRIPTION, "export the query results to a CSV (spreadsheet) file");

    actPreviousMinorInstance = new AbstractAction("previous minor instance", getIcon("PreviousMinor16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actPreviousMinorInstance();
        }
    };
    actPreviousMinorInstance.putValue(Action.SHORT_DESCRIPTION,
            "show the previous variant of the selected instance");

    actNextMinorInstance = new AbstractAction("next minor instance", getIcon("NextMinor16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actNextMinorInstance();
        }
    };
    actNextMinorInstance.putValue(Action.SHORT_DESCRIPTION, "show the next variant of the selected instance");

    actPreviousMajorInstance = new AbstractAction("previous major instance", getIcon("PreviousMajor16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actPreviousMajorInstance();
        }
    };
    actPreviousMajorInstance.putValue(Action.SHORT_DESCRIPTION, "show the previous instance");

    actNextMajorInstance = new AbstractAction("next major instance", getIcon("NextMajor16.gif")) {
        @Override
        public void actionPerformed(ActionEvent e) {
            actNextMajorInstance();
        }
    };
    actNextMajorInstance.putValue(Action.SHORT_DESCRIPTION, "show the next instance");

    initBuiltInQueries();
}

From source file:ro.nextreports.designer.querybuilder.QueryBuilderPanel.java

private void initUI() {
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setDividerLocation(250);//from   w w  w.jav a2 s . c  o  m
    split.setOneTouchExpandable(true);

    JToolBar toolBar = new JToolBar();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar.setBorderPainted(false);

    // add refresh action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("refresh");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.refresh");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            try {
                if (Globals.getConnection() == null) {
                    return;
                }

                // refresh tables, views, procedures
                TreeUtil.refreshDatabase();

                // add new queries to tree
                TreeUtil.refreshQueries();

                // add new reports to tree
                TreeUtil.refreshReports();

                // add new charts to tree
                TreeUtil.refreshCharts();

            } catch (Exception ex) {
                Show.error(ex);
            }
        }

    });

    // add expand action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("expandall");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.expand.all");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            TreeUtil.expandAll(dbBrowserTree);
        }

    });

    // add collapse action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("collapseall");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.collapse.all");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            TreeUtil.collapseAll(dbBrowserTree);
        }

    });

    // add properties button
    /*
      JButton propButton = new MagicButton(new AbstractAction() {
            
      public Object getValue(String key) {
          if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("properties");
          }
            
          return super.getValue(key);
      }
            
      public void actionPerformed(ActionEvent e) {
          DBBrowserPropertiesPanel joinPanel = new DBBrowserPropertiesPanel();
          JDialog dlg = new DBBrowserPropertiesDialog(joinPanel);
          dlg.pack();
          dlg.setResizable(false);
          Show.centrateComponent(Globals.getMainFrame(), dlg);
          dlg.setVisible(true);
      }
            
      });
      propButton.setToolTipText(I18NSupport.getString("querybuilder.properties"));
      */
    //browserButtonsPanel.add(propButton);

    //        ro.nextreports.designer.util.SwingUtil.registerButtonsForFocus(browserButtonsPanel);

    browserPanel = new JXPanel(new BorderLayout());
    browserPanel.add(toolBar, BorderLayout.NORTH);

    // browser tree
    JScrollPane scroll = new JScrollPane(dbBrowserTree);
    browserPanel.add(scroll, BorderLayout.CENTER);
    split.setLeftComponent(browserPanel);

    tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
    //        tabbedPane.putClientProperty(Options.EMBEDDED_TABS_KEY, Boolean.TRUE); // look like eclipse

    JSplitPane split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split2.setResizeWeight(0.66);
    split2.setOneTouchExpandable(true);

    // desktop pane
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    desktop.setDropTarget(
            new DropTarget(desktop, DnDConstants.ACTION_MOVE, new DesktopPaneDropTargetListener(), true));

    // create the toolbar
    JToolBar toolBar2 = new JToolBar();
    toolBar2.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar2.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar2.setBorderPainted(false);

    Action distinctAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            if (distinctButton.isSelected()) {
                selectQuery.setDistinct(true);
            } else {
                selectQuery.setDistinct(false);
            }
        }

    };
    distinctAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.distinct"));
    distinctAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.distinct"));
    toolBar2.add(distinctButton = new JToggleButton(distinctAction));

    Action groupByAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            groupBy = groupByButton.isSelected();
            Globals.getEventBus().publish(new GroupByEvent(QueryBuilderPanel.this.desktop, groupBy));
        }

    };
    groupByAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.group_by"));
    groupByAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.group.by"));
    toolBar2.add(groupByButton = new JToggleButton(groupByAction));

    Action clearAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            clear(false);
        }

    };
    clearAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("clear"));
    clearAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.clear"));
    toolBar2.add(clearAction);

    // add separator
    SwingUtil.addCustomSeparator(toolBar2);

    // add run button
    Action runQueryAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            selectSQLViewTab();
            sqlView.doRun();
        }

    };
    runQueryAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("run"));
    KeyStroke ks = KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("query.run.accelerator", "control 4"));
    runQueryAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("run.query") + " ("
            + ShortcutsUtil.getShortcut("query.run.accelerator.display", "Ctrl 4") + ")");
    runQueryAction.putValue(Action.ACCELERATOR_KEY, ks);
    toolBar2.add(runQueryAction);
    // register run query shortcut
    GlobalHotkeyManager hotkeyManager = GlobalHotkeyManager.getInstance();
    InputMap inputMap = hotkeyManager.getInputMap();
    ActionMap actionMap = hotkeyManager.getActionMap();
    inputMap.put((KeyStroke) runQueryAction.getValue(Action.ACCELERATOR_KEY), "runQueryAction");
    actionMap.put("runQueryAction", runQueryAction);

    JScrollPane scroll2 = new JScrollPane(desktop, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll2.setPreferredSize(DBTablesDesktopPane.PREFFERED_SIZE);
    DecoratedScrollPane.decorate(scroll2);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridBagLayout());
    topPanel.add(toolBar2, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    topPanel.add(scroll2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    split2.setTopComponent(topPanel);
    designPanel = new DesignerTablePanel(selectQuery);
    split2.setBottomComponent(designPanel);
    split2.setDividerLocation(400);

    tabbedPane.addTab(I18NSupport.getString("querybuilder.query.designer"), ImageUtil.getImageIcon("designer"),
            split2);
    tabbedPane.setMnemonicAt(0, 'D');

    sqlView = new SQLViewPanel();
    sqlView.getEditorPane().setDropTarget(new DropTarget(sqlView.getEditorPane(), DnDConstants.ACTION_MOVE,
            new SQLViewDropTargetListener(), true));
    tabbedPane.addTab(I18NSupport.getString("querybuilder.query.editor"), ImageUtil.getImageIcon("sql"),
            sqlView);
    tabbedPane.setMnemonicAt(1, 'E');

    split.setRightComponent(tabbedPane);

    // register a change listener
    tabbedPane.addChangeListener(new ChangeListener() {

        // this method is called whenever the selected tab changes
        public void stateChanged(ChangeEvent ev) {
            if (ev.getSource() == QueryBuilderPanel.this.tabbedPane) {
                // get current tab
                int sel = QueryBuilderPanel.this.tabbedPane.getSelectedIndex();
                if (sel == 1) { // sql view
                    String query;
                    if (!synchronizedPanels) {
                        query = sqlView.getQueryString();
                        synchronizedPanels = true;
                    } else {
                        if (Globals.getConnection() != null) {
                            query = getSelectQuery().toString();
                        } else {
                            query = "";
                        }
                        //                     if (query.equals("")) {
                        //                        query = sqlView.getQueryString();
                        //                     }
                    }
                    if (resetTable) {
                        sqlView.clear();
                        resetTable = false;
                    }
                    //System.out.println("query="+query);
                    sqlView.setQueryString(query);
                } else if (sel == 0) { // design view
                    if (queryWasModified(false)) {
                        Object[] options = { I18NSupport.getString("optionpanel.yes"),
                                I18NSupport.getString("optionpanel.no") };
                        String m1 = I18NSupport.getString("querybuilder.lost");
                        String m2 = I18NSupport.getString("querybuilder.continue");
                        int option = JOptionPane.showOptionDialog(Globals.getMainFrame(),
                                "<HTML>" + m1 + "<BR>" + m2 + "</HTML>",
                                I18NSupport.getString("querybuilder.confirm"), JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

                        if (option != JOptionPane.YES_OPTION) {
                            synchronizedPanels = false;
                            tabbedPane.setSelectedIndex(1);
                        } else {
                            resetTable = true;
                        }
                    }
                } else if (sel == 2) { // report view

                }
            }
        }

    });

    //        this.add(split, BorderLayout.CENTER);

    parametersPanel = new ParametersPanel();
}

From source file:com.intuit.tank.tools.debugger.ActionProducer.java

/**
 * /*from   w w  w. java 2 s. co  m*/
 * @return
 */
public Action getOpenAction() {
    Action ret = actionMap.get(ACTION_OPEN);
    if (ret == null) {
        ret = new AbstractAction(ACTION_OPEN, getIcon("script_go.png", IconSize.SMALL)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent event) {
                try {
                    int option = jFileChooser.showOpenDialog(debuggerFrame);
                    if (option != JFileChooser.CANCEL_OPTION) {
                        File selectedFile = jFileChooser.getSelectedFile();
                        try {
                            String scriptXml = FileUtils.readFileToString(selectedFile);
                            setFromString(scriptXml);
                            debuggerFrame.setScriptSource(
                                    new ScriptSource(selectedFile.getAbsolutePath(), SourceType.file));
                        } catch (Exception e) {
                            LOG.error("Error reading file " + selectedFile.getName() + ": " + e);
                            JOptionPane.showMessageDialog(debuggerFrame, e.getMessage(),
                                    "Error unmarshalling xml", JOptionPane.ERROR_MESSAGE);
                        }
                    }
                } catch (HeadlessException e) {
                    showError("Error opening file: " + e);
                }
            }
        };
        ret.putValue(Action.SHORT_DESCRIPTION, "Open Agent xml from filesystem.");
        ret.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('O', menuActionMods));
        ret.putValue(Action.MNEMONIC_KEY, new Integer('O'));
        actionMap.put(ACTION_OPEN, ret);
    }
    return ret;
}

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

private void buildMenu() {
    JXTaskPane viewPane = new JXTaskPane();
    viewPane.setTitle("Ansicht");
    JXButton toSosView = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/axe24.png")));
    toSosView.setToolTipText("Eingelesene SOS-Anfragen anzeigen");
    toSosView.addMouseListener(new MouseAdapter() {

        @Override//from w  w w .  ja  v  a  2 s . co  m
        public void mouseReleased(MouseEvent e) {
            jScrollPane6.setViewportView(jAttacksTable);
        }
    });
    viewPane.getContentPane().add(toSosView);

    JXButton toSupportView = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/sword24.png")));
    toSupportView.setToolTipText("Errechnete Untersttzungen anzeigen");
    toSupportView.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            jScrollPane6.setViewportView(jSupportsTable);
        }
    });

    viewPane.getContentPane().add(toSupportView);

    JXTaskPane transferPane = new JXTaskPane();
    transferPane.setTitle("bertragen");
    JXButton toSupport = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/support_tool.png")));
    toSupport.setToolTipText(
            "bertrgt den ersten Angriff der gewhlten SOS-Anfrage in das Untersttzungswerkzeug");
    toSupport.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            transferToSupportTool();
        }
    });

    transferPane.getContentPane().add(toSupport);

    JXButton toRetime = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/re-time.png")));
    toRetime.setToolTipText(
            "bertrgt den gewhlten Angriff in den ReTimer. Anschlieend muss dort noch die vermutete Einheit gewhlt werden!");
    toRetime.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            transferToRetimeTool();
        }
    });

    transferPane.getContentPane().add(toRetime);

    JXButton toBrowser = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/att_browser.png")));
    toBrowser.setToolTipText("bertrgt die gewhlten Untersttzungen in den Browser");
    toBrowser.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            transferToBrowser();
        }
    });

    transferPane.getContentPane().add(toBrowser);

    transferPane.getContentPane().add(new JXButton(new AbstractAction(null,
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/sos_clipboard.png"))) {

        @Override
        public Object getValue(String key) {
            if (key.equals(Action.SHORT_DESCRIPTION)) {
                return "Untersttzungsanfragen fr die gewhlten, unvollstndigen Verteidigungen erstellen"
                        + " und in die Zwischenablage kopieren";
            }
            return super.getValue(key);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            copyDefRequests();
        }
    }));

    JXTaskPane miscPane = new JXTaskPane();
    miscPane.setTitle("Sonstiges");
    JXButton reAnalyzeButton = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/reanalyze.png")));
    reAnalyzeButton.setToolTipText(
            "Analysiert die eingelesenen Angriffe erneut, z.B. wenn man die Truppenzahlen in den Einstellungen gendert hat.");
    reAnalyzeButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            analyzeData(true);
        }
    });
    miscPane.getContentPane().add(reAnalyzeButton);
    JXButton setSelectionSecured = new JXButton(
            new ImageIcon(DSWorkbenchTagFrame.class.getResource("/res/ui/save.png")));
    setSelectionSecured.setToolTipText(
            "Die gewhlten Eintrge manuell auf 'Sicher' setzen, z.B. weil man sie ignorieren mchte oder bereits gengend Untersttzungen laufen.");
    setSelectionSecured.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseReleased(MouseEvent e) {
            setSelectionSecured();
        }
    });
    miscPane.getContentPane().add(setSelectionSecured);
    clickAccount = new ClickAccountPanel();
    profileQuickchangePanel = new ProfileQuickChangePanel();
    centerPanel.setupTaskPane(clickAccount, profileQuickchangePanel, viewPane, transferPane, miscPane);
}

From source file:com.diversityarrays.kdxplore.curate.SampleEntryPanel.java

SampleEntryPanel(CurationData cd, IntFunction<Trait> traitProvider, TypedSampleMeasurementTableModel tsm,
        JTable table, TsmCellRenderer tsmCellRenderer, JToggleButton showPpiOption,
        Closure<Void> refreshFieldLayoutView,
        BiConsumer<Comparable<?>, List<CurationCellValue>> showChangedValue, SampleType[] sampleTypes) {
    this.curationData = cd;
    this.traitProvider = traitProvider;
    this.typedSampleTableModel = tsm;
    this.typedSampleTable = table;

    this.showPpiOption = showPpiOption;

    this.initialTableRowHeight = typedSampleTable.getRowHeight();
    this.tsmCellRenderer = tsmCellRenderer;
    this.refreshFieldLayoutView = refreshFieldLayoutView;
    this.showChangedValue = showChangedValue;

    List<SampleType> list = new ArrayList<>();
    list.add(NO_SAMPLE_TYPE);/*from www .  j a v  a2 s  .  c o m*/
    for (SampleType st : sampleTypes) {
        list.add(st);
        sampleTypeById.put(st.getTypeId(), st);
    }

    sampleTypeCombo = new JComboBox<SampleType>(list.toArray(new SampleType[list.size()]));

    typedSampleTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (TableModelEvent.HEADER_ROW == e.getFirstRow()) {
                typedSampleTable.setAutoCreateColumnsFromModel(true);
                everSetData = false;
            }
        }
    });

    showStatsAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_STATS_FOR_KDSMART_SAMPLES());
    showStatsOption.setFont(showStatsOption.getFont().deriveFont(Font.BOLD));
    showStatsOption.setPreferredSize(new Dimension(30, 30));

    JLabel helpPanel = new JLabel();
    helpPanel.setHorizontalAlignment(JLabel.CENTER);
    String html = "<HTML>Either enter a value or select<br>a <i>Source</i> for <b>Value From:</b>";
    if (shouldShowSampleType(sampleTypes)) {
        html += "<BR>You may also select a <i>Sample Type</i> if it is relevant.";
    }
    helpPanel.setText(html);

    singleOrMultiCardPanel.add(helpPanel, CARD_SINGLE);
    singleOrMultiCardPanel.add(applyToPanel, CARD_MULTI);
    //        singleOrMultiCardPanel.add(multiCellControlsPanel, CARD_MULTI);

    validationMessage.setBorder(new LineBorder(Color.LIGHT_GRAY));
    validationMessage.setForeground(Color.RED);
    validationMessage.setBackground(new JLabel().getBackground());
    validationMessage.setHorizontalAlignment(SwingConstants.CENTER);
    //      validationMessage.setEditable(false);
    Box setButtons = Box.createHorizontalBox();
    setButtons.add(new JButton(deleteAction));
    setButtons.add(new JButton(notApplicableAction));
    setButtons.add(new JButton(missingAction));
    setButtons.add(new JButton(setValueAction));

    deleteAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_UNSET());
    notApplicableAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_NA());
    missingAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_MISSING());
    setValueAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_VALUE());

    Box sampleType = Box.createHorizontalBox();
    sampleType.add(new JLabel(Vocab.LABEL_SAMPLE_TYPE()));
    sampleType.add(sampleTypeCombo);

    statisticsControls = generateStatControls();

    setBorder(new TitledBorder(new LineBorder(Color.GREEN.darker().darker()), "Sample Entry Panel"));
    GBH gbh = new GBH(this);
    int y = 0;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, statisticsControls);
    ++y;

    if (shouldShowSampleType(sampleTypes)) {
        sampleType.setBorder(new LineBorder(Color.RED));
        sampleType.setToolTipText("DEVELOPER MODE: sampleType is possible hack for accept/suppress");
        gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleType);
        ++y;
    }

    sampleSourceControls = Box.createHorizontalBox();
    sampleSourceControls.add(new JLabel(Vocab.PROMPT_VALUES_FROM()));
    //        sampleSourceControls.add(new JSeparator(JSeparator.VERTICAL));
    sampleSourceControls.add(sampleSourceComboBox);
    sampleSourceControls.add(Box.createHorizontalGlue());
    sampleSourceComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateSetValueAction();
        }
    });

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleSourceControls);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, valueDescription);
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, showStatsOption);
    gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, sampleValueTextField);
    ++y;

    gbh.add(0, y, 2, 1, GBH.NONE, 1, 1, GBH.CENTER, setButtons);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 1, GBH.CENTER, validationMessage);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 0, GBH.CENTER, singleOrMultiCardPanel);
    ++y;

    deleteAction.setEnabled(false);
    sampleSourceControls.setVisible(false);

    sampleValueTextField.setGrayWhenDisabled(true);
    sampleValueTextField.addActionListener(enterKeyListener);

    sampleValueTextField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateSetValueAction();
        }

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

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateSetValueAction();
        }
    });

    setValueAction.setEnabled(false);
}

From source file:org.wings.SAbstractButton.java

protected void configurePropertiesFromAction(Action a) {
    // uncomment if compiled against < jdk 1.3
    //   setActionCommand((a != null
    //                  ? (String)a.getValue(Action.ACTION_COMMAND_KEY)
    //                  : null));
    setText((a != null ? (String) a.getValue(Action.NAME) : null));
    setIcon((a != null ? (SIcon) a.getValue(Action.SMALL_ICON) : null));
    setEnabled((a != null ? a.isEnabled() : true));
    setToolTipText((a != null ? (String) a.getValue(Action.SHORT_DESCRIPTION) : null));
}

From source file:org.wings.SAbstractButton.java

public String getToolTipText() {
    if (action == null)
        return super.getToolTipText();
    final String actionTool = (String) action.getValue(Action.SHORT_DESCRIPTION);
    return (actionTool != null) ? actionTool : super.getToolTipText();
}