Example usage for javax.swing Action SMALL_ICON

List of usage examples for javax.swing Action SMALL_ICON

Introduction

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

Prototype

String SMALL_ICON

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

Click Source Link

Document

The key used for storing a small Icon, such as ImageIcon.

Usage

From source file:pl.otros.logview.gui.actions.OpenLogInvestigationAction.java

public OpenLogInvestigationAction(OtrosApplication otrosApplication) {
    super(otrosApplication);
    putValue(Action.NAME, "Open log investigation");
    putValue(Action.SMALL_ICON, Icons.IMPORT);
}

From source file:pl.otros.logview.gui.actions.search.SearchAction.java

public SearchAction(OtrosApplication otrosApplication, SearchDirection searchDirection) {
    super(otrosApplication);
    this.searchDirection = searchDirection;
    if (searchDirection.equals(SearchDirection.FORWARD)) {
        this.putValue(Action.NAME, "Next");
        this.putValue(Action.SMALL_ICON, Icons.ARROW_DOWN);
    } else {/* w ww  .  j a v  a 2s.  c o  m*/
        this.putValue(Action.NAME, "Previous");
        this.putValue(Action.SMALL_ICON, Icons.ARROW_UP);
    }
    searchEngine = new SearchEngine();
}

From source file:pl.otros.logview.gui.actions.TailMultipleFilesIntoOneView.java

public TailMultipleFilesIntoOneView(OtrosApplication otrosApplication) {
    super(otrosApplication);
    putValue(Action.NAME, "Tail multiple log files into one view");
    putValue(Action.SHORT_DESCRIPTION, "Tail multiple log files into one view with log format autodetection");
    putValue(Action.SMALL_ICON, Icons.ARROW_JOIN);
}

From source file:ro.nextreports.designer.action.chart.OpenChartAction.java

public OpenChartAction(boolean fullName) {
    if (fullName) {
        putValue(Action.NAME, I18NSupport.getString("open.chart"));
    } else {//from  w  w  w.  j  av a  2 s . c o  m
        putValue(Action.NAME, I18NSupport.getString("open.chart.small"));
    }
    Icon icon = ImageUtil.getImageIcon("chart_open");
    putValue(Action.SMALL_ICON, icon);
    putValue(Action.MNEMONIC_KEY, ShortcutsUtil.getMnemonic("chart.open.mnemonic", new Integer('A')));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("chart.open.accelerator", "control A")));
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("open.chart"));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString("open.chart"));
}

From source file:ro.nextreports.designer.action.chart.PreviewChartAction.java

public PreviewChartAction(String chartRunnerType, byte chartGraphicType) {
    String image = "chart_preview_flash";
    if (ChartRunner.IMAGE_FORMAT.equals(chartRunnerType)) {
        image = "chart_preview_image";
    } else if (ChartRunner.HTML5_TYPE == chartGraphicType) {
        image = "chart_preview_html5";
    }//w  w  w.  j  a v  a  2s.c  o m
    Icon icon = ImageUtil.getImageIcon(image);
    putValue(Action.SMALL_ICON, icon);
    String descKey = "preview.chart.flash";
    if (ChartRunner.IMAGE_FORMAT.equals(chartRunnerType)) {
        descKey = "preview.chart.image";
    } else if (ChartRunner.HTML5_TYPE == chartGraphicType) {
        descKey = "preview.chart.html5";
    }
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString(descKey));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString(descKey));
    this.chartRunnerType = chartRunnerType;
    this.chartGraphicType = chartGraphicType;
    loaded = true;
}

From source file:ro.nextreports.designer.action.datasource.DataSourceConnectAction.java

public DataSourceConnectAction(DBBrowserTree tree, TreePath selPath) {
    putValue(Action.NAME, I18NSupport.getString("connect"));
    putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("database_connect"));
    putValue(Action.MNEMONIC_KEY, new Integer('C'));
    //        putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,
    //                KeyEvent.CTRL_DOWN_MASK));
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("connect.short.desc"));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString("connect.long.desc"));
    this.tree = tree;
    this.selPath = selPath;
}

From source file:ro.nextreports.designer.action.query.ValidateSqlsAction.java

public ValidateSqlsAction(DBObject sqlObject) {
    String text;//from   w  w  w. ja v a  2  s .  com

    multiple = (sqlObject.getType() == DBObject.REPORTS_GROUP)
            || (sqlObject.getType() == DBObject.QUERIES_GROUP) || (sqlObject.getType() == DBObject.CHARTS_GROUP)
            || (sqlObject.getType() == DBObject.FOLDER_QUERY) || (sqlObject.getType() == DBObject.FOLDER_REPORT)
            || (sqlObject.getType() == DBObject.FOLDER_CHART);

    if (multiple) {
        text = I18NSupport.getString("sql.validation");
    } else {
        text = I18NSupport.getString("sql.validation.single");
    }
    putValue(Action.NAME, text);
    putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("sql_validation"));
    putValue(Action.SHORT_DESCRIPTION, text);
    putValue(Action.LONG_DESCRIPTION, text);
    this.sqlObject = sqlObject;
}

From source file:ro.nextreports.designer.action.report.ViewReportSqlAction.java

public ViewReportSqlAction() {
    putValue(Action.NAME, I18NSupport.getString("view.sql"));
    putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("report_view"));
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("view.sql"));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString("view.sql"));
}

From source file:ro.nextreports.designer.action.tools.RestoreDockingAction.java

public RestoreDockingAction() {
    putValue(Action.NAME, I18NSupport.getString("restore.docking.action.name"));
    putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("docking_restore"));
    putValue(Action.MNEMONIC_KEY, ShortcutsUtil.getMnemonic("layout.reset.mnemonic", new Integer('L')));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("layout.reset.accelerator", "control L")));
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("restore.docking.action.name"));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString("restore.docking.action.name"));
}

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

private void initUI() {
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setDividerLocation(250);//w ww .j  a v  a2s  . 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();
}