Example usage for javax.swing AbstractAction AbstractAction

List of usage examples for javax.swing AbstractAction AbstractAction

Introduction

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

Prototype

public AbstractAction() 

Source Link

Document

Creates an Action .

Usage

From source file:net.pms.newgui.StatusTab.java

public void addRenderer(final RendererConfiguration renderer) {
    final RendererItem r = new RendererItem(renderer);
    r.addTo(renderers);/* w w w.  ja  v  a2s . c o  m*/
    renderer.setGuiComponents(r);
    r.icon.setAction(new AbstractAction() {
        private static final long serialVersionUID = -6316055325551243347L;

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (r.frame == null) {
                        JFrame top = (JFrame) SwingUtilities
                                .getWindowAncestor((Component) PMS.get().getFrame());
                        // We're using JFrame instead of JDialog here so as to have a minimize button. Since the player panel
                        // is intrinsically a freestanding module this approach seems valid to me but some frown on it: see
                        // http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice
                        r.frame = new JFrame();
                        r.panel = new RendererPanel(renderer);
                        r.frame.add(r.panel);
                        r.panel.update();
                        r.frame.setResizable(false);
                        r.frame.setIconImage(((JFrame) PMS.get().getFrame()).getIconImage());
                        r.frame.setLocationRelativeTo(top);
                        r.frame.setVisible(true);
                    } else {
                        r.frame.setVisible(true);
                        r.frame.toFront();
                    }
                }
            });
        }
    });
}

From source file:jchrest.gui.VisualSearchPane.java

private JPanel constructSelector() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(new JLabel("Scene: "), BorderLayout.WEST);

    _sceneSelector = new JComboBox(_scenes.getSceneNames());
    _sceneSelector.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            Scene newScene = _scenes.get(_sceneSelector.getSelectedIndex());
            //TODO: fix this when perceiver functionality working correctly.
            //        _model.getPerceiver().setScene (newScene);
            _sceneDisplay.updateScene(newScene);
        }//w  ww. j a  v a  2  s  .co m
    });
    panel.add(_sceneSelector);

    return panel;
}

From source file:edu.ku.brc.ui.tmanfe.SpreadSheet.java

/**
  * //from   w w w  .ja  v a2s .c o m
  */
protected void buildSpreadsheet() {

    this.setShowGrid(true);

    int numRows = model.getRowCount();

    scrollPane = new JScrollPane(this, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    final SpreadSheet ss = this;
    JButton cornerBtn = UIHelper.createIconBtn("Blank", IconManager.IconSize.Std16, "SelectAll",
            new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    ss.selectAll();
                }
            });
    cornerBtn.setEnabled(true);
    scrollPane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, cornerBtn);

    // Allows row and collumn selections to exit at the same time
    setCellSelectionEnabled(true);

    setRowSelectionAllowed(true);
    setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    addMouseListener(new MouseAdapter() {
        /* (non-Javadoc)
         * @see java.awt.event.MouseAdapter#mousePressed(java.awt.event.MouseEvent)
         */
        @SuppressWarnings("synthetic-access")
        @Override
        public void mouseReleased(MouseEvent e) {
            // XXX For Java 5 Bug
            prevRowSelInx = getSelectedRow();
            prevColSelInx = getSelectedColumn();

            if (e.getClickCount() == 2) {
                int rowIndexStart = getSelectedRow();
                int colIndexStart = getSelectedColumn();

                ss.editCellAt(rowIndexStart, colIndexStart);
                if (ss.getEditorComponent() != null && ss.getEditorComponent() instanceof JTextComponent) {
                    ss.getEditorComponent().requestFocus();

                    final JTextComponent txtComp = (JTextComponent) ss.getEditorComponent();
                    String txt = txtComp.getText();
                    FontMetrics fm = txtComp.getFontMetrics(txtComp.getFont());
                    int x = e.getPoint().x - ss.getEditorComponent().getBounds().x - 1;
                    int prevWidth = 0;
                    for (int i = 0; i < txt.length(); i++) {

                        int width = fm.stringWidth(txt.substring(0, i));
                        int basePlusHalf = prevWidth + (int) (((width - prevWidth) / 2) + 0.5);
                        //System.out.println(prevWidth + " X[" + x + "] " + width+" ["+txt.substring(0, i)+"] " + i + " " + basePlusHalf);
                        //System.out.println(" X[" + x + "] " + prevWidth + " - "+ basePlusHalf+" - " + width+" ["+txt.substring(0, i)+"] " + i);
                        if (x < width) {
                            // Clearing the selection is needed for Window for some reason
                            final int inx = i + (x <= basePlusHalf ? -1 : 0);
                            SwingUtilities.invokeLater(new Runnable() {
                                @SuppressWarnings("synthetic-access")
                                public void run() {
                                    txtComp.setSelectionStart(0);
                                    txtComp.setSelectionEnd(0);
                                    txtComp.setCaretPosition(inx > 0 ? inx : 0);
                                }
                            });
                            break;
                        }
                        prevWidth = width;
                    }
                }
            }
        }
    });

    // Create a row-header to display row numbers.
    // This row-header is made of labels whose Borders,
    // Foregrounds, Backgrounds, and Fonts must be
    // the one used for the table column headers.
    // Also ensure that the row-header labels and the table
    // rows have the same height.

    //i have no idea WHY this has to be called.  i rearranged
    //the table and find replace panel, 
    // i started getting an array index out of
    //bounds on the column header ON MAC ONLY.  
    //tried firing this off, first and it fixed the problem.//meg
    this.getModel().fireTableStructureChanged();

    /*
     * Create the Row Header Panel
     */
    rowHeaderPanel = new JPanel((LayoutManager) null);

    if (getColumnModel().getColumnCount() > 0) {
        TableColumn column = getColumnModel().getColumn(0);
        TableCellRenderer renderer = getTableHeader().getDefaultRenderer();
        if (renderer == null) {
            renderer = column.getHeaderRenderer();
        }

        Component cellRenderComp = renderer.getTableCellRendererComponent(this, column.getHeaderValue(), false,
                false, -1, 0);
        cellFont = cellRenderComp.getFont();

    } else {
        cellFont = (new JLabel()).getFont();
    }

    // Calculate Row Height
    cellBorder = (Border) UIManager.getDefaults().get("TableHeader.cellBorder");
    Insets insets = cellBorder.getBorderInsets(tableHeader);
    FontMetrics metrics = getFontMetrics(cellFont);

    rowHeight = insets.bottom + metrics.getHeight() + insets.top;
    rowLabelWidth = metrics.stringWidth("9999") + insets.right + insets.left;

    Dimension dim = new Dimension(rowLabelWidth, rowHeight * numRows);
    rowHeaderPanel.setPreferredSize(dim); // need to call this when no layout manager is used.

    rhCellMouseAdapter = new RHCellMouseAdapter(this);

    // Adding the row header labels
    for (int ii = 0; ii < numRows; ii++) {
        addRow(ii, ii + 1, false);
    }

    JViewport viewPort = new JViewport();
    dim.height = rowHeight * numRows;
    viewPort.setViewSize(dim);
    viewPort.setView(rowHeaderPanel);
    scrollPane.setRowHeader(viewPort);

    // Experimental from the web, but I think it does the trick.
    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (!ss.isEditing() && !e.isActionKey() && !e.isControlDown() && !e.isMetaDown() && !e.isAltDown()
                    && e.getKeyCode() != KeyEvent.VK_SHIFT && e.getKeyCode() != KeyEvent.VK_TAB
                    && e.getKeyCode() != KeyEvent.VK_ENTER) {
                log.error("Grabbed the event as input");

                int rowIndexStart = getSelectedRow();
                int colIndexStart = getSelectedColumn();

                if (rowIndexStart == -1 || colIndexStart == -1)
                    return;

                ss.editCellAt(rowIndexStart, colIndexStart);
                Component c = ss.getEditorComponent();
                if (c instanceof JTextComponent)
                    ((JTextComponent) c).setText("");
            }
        }
    });

    resizeAndRepaint();

    // Taken from a JavaWorld Example (But it works)
    KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(),
            false);
    KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(),
            false);
    KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);

    Action ssAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SpreadSheet.this.actionPerformed(e);
        }
    };

    getInputMap().put(cut, "Cut");
    getActionMap().put("Cut", ssAction);

    getInputMap().put(copy, "Copy");
    getActionMap().put("Copy", ssAction);

    getInputMap().put(paste, "Paste");
    getActionMap().put("Paste", ssAction);

    ((JMenuItem) UIRegistry.get(UIRegistry.COPY)).addActionListener(this);
    ((JMenuItem) UIRegistry.get(UIRegistry.CUT)).addActionListener(this);
    ((JMenuItem) UIRegistry.get(UIRegistry.PASTE)).addActionListener(this);

    setSortOrderCycle(SortOrder.ASCENDING, SortOrder.DESCENDING, SortOrder.UNSORTED);
}

From source file:org.kepler.gui.MenuMapper.java

/**
 * Recurse through all the submenu heirarchy beneath the passed JMenu
 * parameter, and for each "leaf node" (ie a menu item that is not a
 * container for other menu items), add the Action and its menu path to the
 * passed Map/*from w ww  .j  a va  2  s.c  om*/
 * 
 * @param nextMenuItem
 *            the JMenu to recurse into
 * @param menuPathBuff
 *            a delimited String representation of the hierarchical "path"
 *            to this menu item. This will be used as the key in the
 *            actionsMap. For example, the "Graph Editor" menu item beneath
 *            the "New" item on the "File" menu would have a menuPath of
 *            File->New->Graph Editor. Delimeter is "->" (no quotes), and
 *            spaces are allowed within menu text strings, but not around
 *            the delimiters; i.e: New->Graph Editor is OK, but File ->New
 *            is not.
 * @param MENU_PATH_DELIMITER
 *            String
 * @param actionsMap
 *            the Map containing key => value pairs of the form: menuPath
 *            (as described above) => Action (the javax.swing.Action
 *            assigned to this menu item)
 */
public static void storePTIIMenuItems(JMenuItem nextMenuItem, StringBuffer menuPathBuff,
        final String MENU_PATH_DELIMITER, Map<String, Action> actionsMap) {

    menuPathBuff.append(MENU_PATH_DELIMITER);
    if (nextMenuItem != null && nextMenuItem.getText() != null) {
        String str = nextMenuItem.getText();
        // do not make the recent files menu item upper case since
        // it contains paths in the file system.
        if (menuPathBuff.toString().startsWith("FILE->RECENT FILES->")) {
            menuPathBuff = new StringBuffer("File->Recent Files->");
        } else {
            str = str.toUpperCase();
        }
        menuPathBuff.append(str);
    }

    if (isDebugging) {
        log.debug(menuPathBuff.toString());
    }
    // System.out.println(menuPathBuff.toString());

    if (nextMenuItem instanceof JMenu) {
        storePTIITopLevelMenus((JMenu) nextMenuItem, menuPathBuff.toString(), MENU_PATH_DELIMITER, actionsMap);
    } else {
        Action nextAction = nextMenuItem.getAction();
        // if there is no Action, look for an ActionListener
        // System.out.println("Processing menu " + nextMenuItem.getText());
        if (nextAction == null) {
            final ActionListener[] actionListeners = nextMenuItem.getActionListeners();
            // System.out.println("No Action for " + nextMenuItem.getText()
            // + "; found " + actionListeners.length
            // + " ActionListeners");
            if (actionListeners.length > 0) {
                if (isDebugging) {
                    log.debug(actionListeners[0].getClass().getName());
                }
                // ASSUMPTION: there is only one ActionListener
                nextAction = new AbstractAction() {
                    public void actionPerformed(ActionEvent a) {
                        actionListeners[0].actionPerformed(a);
                    }
                };
                // add all these values - @see diva.gui.GUIUtilities
                nextAction.putValue(Action.NAME, nextMenuItem.getText());
                // System.out.println("storing ptII action for menu " +
                // nextMenuItem.getText());
                nextAction.putValue(GUIUtilities.LARGE_ICON, nextMenuItem.getIcon());
                nextAction.putValue(GUIUtilities.MNEMONIC_KEY, new Integer(nextMenuItem.getMnemonic()));
                nextAction.putValue("tooltip", nextMenuItem.getToolTipText());
                nextAction.putValue(GUIUtilities.ACCELERATOR_KEY, nextMenuItem.getAccelerator());
                nextAction.putValue("menuItem", nextMenuItem);
            } else {
                if (isDebugging) {
                    log.warn("No Action or ActionListener found for " + nextMenuItem.getText());
                }
            }
        }
        if (!actionsMap.containsValue(nextAction)) {
            actionsMap.put(menuPathBuff.toString(), nextAction);
            if (isDebugging) {
                log.debug(menuPathBuff.toString() + " :: ACTION: " + nextAction);
            }
        }
    }
}

From source file:org.geopublishing.atlasStyler.swing.AtlasStylerGUI.java

public JToggleButton getJTButtonShowXML() {
    final JToggleButton jButtonShowXML = new JToggleButton(ASUtil.R("AtlasStylerGUI.toolbarButton.show_xml"));
    jButtonShowXML.setSelected(false);//from   w w w  . j a  v a  2 s .c om

    jButtonShowXML.addActionListener(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean anAus = !xmlCodeFrame.isVisible();
            xmlCodeFrame.setVisible(anAus);
            // jButtonShowXML.setSelected(anAus);
            xmlCodeFrame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosed(WindowEvent e) {
                    jButtonShowXML.setSelected(false);
                }
            });
        }

    });
    return jButtonShowXML;
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopPickerField.java

@Override
public void addAction(Action action, int index) {
    checkNotNullArgument(action, "action must be non null");

    int oldIndex = findActionById(actionsOrder, action.getId());
    if (oldIndex >= 0) {
        removeAction(actionsOrder.get(oldIndex));
        if (index > oldIndex) {
            index--;//from   w w w  .j  av a 2s  . com
        }
    }

    actionsOrder.add(index, action);

    DesktopButton dButton = new DesktopButton();
    dButton.setParentEnabled(isEnabledWithParent());
    dButton.setShouldBeFocused(false);
    dButton.setAction(action);
    dButton.getImpl().setFocusable(false);
    dButton.getImpl().setText("");

    impl.addButton(dButton.getImpl(), index);
    buttons.add(dButton);

    // apply Editable after action owner is set
    if (action instanceof StandardAction) {
        ((StandardAction) action).setEditable(isEditable());
    }

    updateOrderedShortcuts();

    ActionMap actionMap = getImpl().getInputField().getActionMap();
    actionMap.put(action.getId(), new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            action.actionPerform(dButton);
        }
    });

    if (action.getShortcutCombination() != null) {
        InputMap inputMap = getImpl().getInputField().getInputMap(JComponent.WHEN_FOCUSED);

        KeyStroke shortcutKeyStroke = DesktopComponentsHelper
                .convertKeyCombination(action.getShortcutCombination());
        inputMap.put(shortcutKeyStroke, action.getId());
    }

    actionsPermissions.apply(action);
}

From source file:com.chart.SwingChart.java

/**
 * /*from   ww  w.  j  av  a  2s .  c o m*/
 * @param name Chart name
 * @param parent Skeleton parent
 * @param axes Configuration of axes
 * @param abcissaName Abcissa name
 */
public SwingChart(String name, final Skeleton parent, List<AxisChart> axes, String abcissaName) {
    this.skeleton = parent;
    this.axes = axes;
    this.name = name;

    this.abcissaFormat = NumberFormat.getInstance(Locale.getDefault());
    this.ordinateFormat = NumberFormat.getInstance(Locale.getDefault());

    plot = new XYPlot();
    plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor)));
    plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
    plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    abcissaAxis = new NumberAxis(abcissaName);
    ((NumberAxis) abcissaAxis).setAutoRangeIncludesZero(false);
    abcissaAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    abcissaAxis.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    abcissaAxis.setAutoRange(true);
    abcissaAxis.setLowerMargin(0.0);
    abcissaAxis.setUpperMargin(0.0);
    abcissaAxis.setTickLabelsVisible(true);
    abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));
    abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));

    plot.setDomainAxis(abcissaAxis);

    for (int i = 0; i < axes.size(); i++) {
        AxisChart categoria = axes.get(i);
        addAxis(categoria.getName());

        for (int j = 0; j < categoria.configSerieList.size(); j++) {
            SimpleSeriesConfiguration cs = categoria.configSerieList.get(j);
            addSeries(categoria.getName(), cs);
        }
    }
    chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 16), plot, false);

    chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

    chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)))));

    chartPanel.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escape");
    chartPanel.getActionMap().put("escape", new AbstractAction() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            for (int i = 0; i < plot.getDatasetCount(); i++) {
                XYDataset test = plot.getDataset(i);
                XYItemRenderer r = plot.getRenderer(i);
                r.removeAnnotations();
            }
        }
    });

    chartPanel.addChartMouseListener(cml = new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent event) {
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
            try {
                XYItemEntity xyitem = (XYItemEntity) event.getEntity(); // get clicked entity
                XYDataset dataset = (XYDataset) xyitem.getDataset(); // get data set    
                double x = dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem());
                double y = dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem());

                final XYPlot plot = chart.getXYPlot();
                for (int i = 0; i < plot.getDatasetCount(); i++) {
                    XYDataset test = plot.getDataset(i);
                    XYItemRenderer r = plot.getRenderer(i);
                    r.removeAnnotations();
                    if (test == dataset) {
                        NumberAxis ejeOrdenada = AxesList.get(i);
                        double y_max = ejeOrdenada.getUpperBound();
                        double y_min = ejeOrdenada.getLowerBound();
                        double x_max = abcissaAxis.getUpperBound();
                        double x_min = abcissaAxis.getLowerBound();
                        double angulo;
                        if (y > (y_max + y_min) / 2 && x > (x_max + x_min) / 2) {
                            angulo = 3.0 * Math.PI / 4.0;
                        } else if (y > (y_max + y_min) / 2 && x < (x_max + x_min) / 2) {
                            angulo = 1.0 * Math.PI / 4.0;
                        } else if (y < (y_max + y_min) / 2 && x < (x_max + x_min) / 2) {
                            angulo = 7.0 * Math.PI / 4.0;
                        } else {
                            angulo = 5.0 * Math.PI / 4.0;
                        }

                        CircleDrawer cd = new CircleDrawer((Color) r.getSeriesPaint(xyitem.getSeriesIndex()),
                                new BasicStroke(2.0f), null);
                        //XYAnnotation bestBid = new XYDrawableAnnotation(dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()), dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), 11, 11, cd);
                        String txt = "X:" + abcissaFormat.format(x) + ", Y:" + ordinateFormat.format(y);
                        XYPointerAnnotation anotacion = new XYPointerAnnotation(txt,
                                dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()),
                                dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), angulo);
                        anotacion.setTipRadius(10.0);
                        anotacion.setBaseRadius(35.0);
                        anotacion.setFont(new Font("SansSerif", Font.PLAIN, 10));

                        if (Long.parseLong((strChartBackgroundColor.replace("#", "")), 16) > 0xffffff / 2) {
                            anotacion.setPaint(Color.black);
                            anotacion.setArrowPaint(Color.black);
                        } else {
                            anotacion.setPaint(Color.white);
                            anotacion.setArrowPaint(Color.white);
                        }

                        //bestBid.setPaint((Color) r.getSeriesPaint(xyitem.getSeriesIndex()));
                        r.addAnnotation(anotacion);
                    }
                }

                //LabelValorVariable.setSize(LabelValorVariable.getPreferredSize());
            } catch (NullPointerException | ClassCastException ex) {

            }
        }
    });

    chartPanel.setPopupMenu(null);
    chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

    SwingNode sn = new SwingNode();
    sn.setContent(chartPanel);
    chartFrame = new VBox();
    chartFrame.getChildren().addAll(sn, legendFrame);
    VBox.setVgrow(sn, Priority.ALWAYS);
    VBox.setVgrow(legendFrame, Priority.NEVER);

    chartFrame.getStylesheets().addAll(SwingChart.class.getResource("overlay-chart.css").toExternalForm());

    legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;");

    MenuItem mi;
    mi = new MenuItem("Print");
    mi.setOnAction((ActionEvent t) -> {
        print(chartFrame);
    });
    contextMenuList.add(mi);

    sn.setOnMouseClicked((MouseEvent t) -> {
        if (menu != null) {
            menu.hide();
        }
        if (t.getClickCount() == 2) {
            backgroundEdition();
        }
    });

    mi = new MenuItem("Copy to clipboard");
    mi.setOnAction((ActionEvent t) -> {
        copyClipboard(chartFrame);
    });
    contextMenuList.add(mi);

    mi = new MenuItem("Export values");
    mi.setOnAction((ActionEvent t) -> {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Export to file");
        fileChooser.getExtensionFilters()
                .addAll(new FileChooser.ExtensionFilter("Comma Separated Values", "*.csv"));

        Window w = null;
        try {
            w = parent.getScene().getWindow();
        } catch (NullPointerException e) {

        }
        File file = fileChooser.showSaveDialog(w);
        if (file != null) {
            export(file);
        }
    });
    contextMenuList.add(mi);

    chartFrame.setOnContextMenuRequested((ContextMenuEvent t) -> {
        if (menu != null) {
            menu.hide();
        }
        menu = new ContextMenu();
        menu.getItems().addAll(contextMenuList);
        menu.show(chartFrame, t.getScreenX(), t.getScreenY());
    });

}

From source file:org.jets3t.gui.ObjectsAttributesDialog.java

/**
 * Initialise the GUI elements to display the given item.
 *///from  w ww.  j  a va  2  s  . c  o  m
private void initGui() {
    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel unmodifiableAttributesPanel = skinsFactory.createSkinnedJPanel("ObjectStaticAttributesPanel");
    unmodifiableAttributesPanel.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    metadataButtonsContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataButtonsPanel");
    metadataButtonsContainer.setLayout(new GridBagLayout());

    // Fields to display unmodifiable object details.
    JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
    objectKeyLabel.setText("Object key:");
    objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
    objectKeyTextField.setEditable(false);
    JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
    objectContentLengthLabel.setText("Size:");
    objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
    objectContentLengthTextField.setEditable(false);
    JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
    objectLastModifiedLabel.setText("Last modified:");
    objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
    objectLastModifiedTextField.setEditable(false);
    JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
    objectETagLabel.setText("ETag:");
    objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
    objectETagTextField.setEditable(false);
    JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
    bucketNameLabel.setText("Bucket:");
    bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
    bucketLocationTextField.setEditable(false);
    ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
    ownerNameLabel.setText("Owner name:");
    ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
    ownerNameTextField.setEditable(false);
    ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
    ownerIdLabel.setText("Owner ID:");
    ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
    ownerIdTextField.setEditable(false);

    int row = 0;

    unmodifiableAttributesPanel.add(objectKeyLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectKeyTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectContentLengthLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectContentLengthTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectLastModifiedLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectLastModifiedTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(objectETagLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(objectETagTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(ownerIdLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    row++;
    unmodifiableAttributesPanel.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    unmodifiableAttributesPanel.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Build metadata table.
    objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) {
        private static final long serialVersionUID = -3762866886166776851L;

        public boolean isCellEditable(int row, int column) {
            return isModifyMode();
        }
    };

    metadataTableSorter = new TableSorter(objectMetadataTableModel);
    metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
    metadataTable.setModel(metadataTableSorter);
    metadataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting() && removeMetadataItemButton != null) {
                int row = metadataTable.getSelectedRow();
                removeMetadataItemButton.setEnabled(row >= 0);
            }
        }
    });

    metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
    metadataTableSorter.setSortingStatus(0, TableSorter.ASCENDING);
    metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsHorizontalSpace, 0, 0));

    // Add/remove buttons for metadata table.
    removeMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    removeMetadataItemButton.setEnabled(false);
    removeMetadataItemButton.setToolTipText("Remove the selected metadata item(s)");
    guiUtils.applyIcon(removeMetadataItemButton, "/images/nuvola/16x16/actions/viewmag-.png");
    removeMetadataItemButton.addActionListener(this);
    removeMetadataItemButton.setActionCommand("removeMetadataItem");
    addMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    addMetadataItemButton.setToolTipText("Add a new metadata item");
    guiUtils.applyIcon(addMetadataItemButton, "/images/nuvola/16x16/actions/viewmag+.png");
    addMetadataItemButton.setActionCommand("addMetadataItem");
    addMetadataItemButton.addActionListener(this);
    metadataButtonsContainer.add(removeMetadataItemButton, new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataButtonsContainer.add(addMetadataItemButton, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0));
    metadataContainer.add(metadataButtonsContainer, new GridBagConstraints(0, 1, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    metadataButtonsContainer.setVisible(false);

    // OK Button.
    okButton = skinsFactory.createSkinnedJButton("ObjectPropertiesOKButton");
    okButton.setText("OK");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Cancel Button.
    cancelButton = null;
    cancelButton = skinsFactory.createSkinnedJButton("ObjectPropertiesCancelButton");
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setVisible(false);

    // Recognize and handle ENTER, ESCAPE, PAGE_UP, and PAGE_DOWN key presses.
    this.getRootPane().setDefaultButton(okButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -7768790936535999307L;

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_UP"),
            "PAGE_UP");
    this.getRootPane().getActionMap().put("PAGE_UP", new AbstractAction() {
        private static final long serialVersionUID = -6324229423705756219L;

        public void actionPerformed(ActionEvent actionEvent) {
            previousObjectButton.doClick();
        }
    });
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_DOWN"),
            "PAGE_DOWN");
    this.getRootPane().getActionMap().put("PAGE_DOWN", new AbstractAction() {
        private static final long serialVersionUID = -5808972377672449421L;

        public void actionPerformed(ActionEvent actionEvent) {
            nextObjectButton.doClick();
        }
    });

    // Put it all together.
    row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ObjectPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(unmodifiableAttributesPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    // Object previous and next buttons, if we have multiple objects.
    previousObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesPreviousButton");
    guiUtils.applyIcon(previousObjectButton, "/images/nuvola/16x16/actions/1leftarrow.png");
    previousObjectButton.addActionListener(this);
    previousObjectButton.setEnabled(false);
    nextObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesNextButton");
    guiUtils.applyIcon(nextObjectButton, "/images/nuvola/16x16/actions/1rightarrow.png");
    nextObjectButton.addActionListener(this);
    nextObjectButton.setEnabled(false);
    currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectPropertiesCurrentObjectLabel");
    currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

    nextPreviousPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesNextPreviousPanel");
    nextPreviousPanel.setLayout(new GridBagLayout());
    nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 1, 0,
            GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));
    nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0));
    nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    nextPreviousPanel.setVisible(false);
    row++;

    JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
    metadataLabel.setText("<html><b>Metadata Attributes</b></html>");
    metadataLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
    container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));

    // Destination Access Control List setting.
    destinationPanel = skinsFactory.createSkinnedJPanel("DestinationPanel");
    destinationPanel.setLayout(new GridBagLayout());

    JPanel actionButtonsPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesActionButtonsPanel");
    actionButtonsPanel.setLayout(new GridBagLayout());
    actionButtonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    actionButtonsPanel.add(okButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    cancelButton.setVisible(false);

    container.add(actionButtonsPanel, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    this.getContentPane().add(container);

    this.pack();
    this.setSize(new Dimension(450, 500));
    this.setLocationRelativeTo(this.getOwner());
}

From source file:net.sf.jabref.gui.ImportInspectionDialog.java

/**
 * Creates a dialog that displays the given list of fields in the table. The
 * dialog allows another process to add entries dynamically while the dialog
 * is shown./*  w w w  .j a  va 2s.c  om*/
 *
 * @param frame
 * @param panel
 */
public ImportInspectionDialog(JabRefFrame frame, BasePanel panel, String undoName, boolean newDatabase) {
    this.frame = frame;
    this.panel = panel;
    this.bibDatabaseContext = (panel == null) ? null : panel.getBibDatabaseContext();
    this.undoName = undoName;
    this.newDatabase = newDatabase;
    setIconImage(new ImageIcon(IconTheme.getIconUrl("jabrefIcon48")).getImage());
    preview = new PreviewPanel(null, bibDatabaseContext, Globals.prefs.get(JabRefPreferences.PREVIEW_0));

    duplLabel.setToolTipText(Localization.lang("Possible duplicate of existing entry. Click to resolve."));

    sortedList = new SortedList<>(entries);
    DefaultEventTableModel<BibEntry> tableModelGl = (DefaultEventTableModel<BibEntry>) GlazedListsSwing
            .eventTableModelWithThreadProxyList(sortedList, new EntryTableFormat());
    glTable = new EntryTable(tableModelGl);
    GeneralRenderer renderer = new GeneralRenderer(Color.white);
    glTable.setDefaultRenderer(JLabel.class, renderer);
    glTable.setDefaultRenderer(String.class, renderer);
    glTable.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.DELETE_ENTRY), "delete");
    DeleteListener deleteListener = new DeleteListener();
    glTable.getActionMap().put("delete", deleteListener);

    selectionModel = (DefaultEventSelectionModel<BibEntry>) GlazedListsSwing
            .eventSelectionModelWithThreadProxyList(sortedList);
    glTable.setSelectionModel(selectionModel);
    selectionModel.getSelected().addListEventListener(new EntrySelectionListener());
    comparatorChooser = TableComparatorChooser.install(glTable, sortedList,
            AbstractTableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD);
    setupComparatorChooser();
    glTable.addMouseListener(new TableClickListener());

    setWidths();

    getContentPane().setLayout(new BorderLayout());
    progressBar.setIndeterminate(true);
    JPanel centerPan = new JPanel();
    centerPan.setLayout(new BorderLayout());

    contentPane.setTopComponent(new JScrollPane(glTable));
    contentPane.setBottomComponent(preview);

    centerPan.add(contentPane, BorderLayout.CENTER);
    centerPan.add(progressBar, BorderLayout.SOUTH);

    popup.add(deleteListener);
    popup.addSeparator();
    if (!newDatabase && (bibDatabaseContext != null)) {
        GroupTreeNode node = bibDatabaseContext.getMetaData().getGroups();
        JMenu groupsAdd = new JMenu(Localization.lang("Add to group"));
        groupsAdd.setEnabled(false); // Will get enabled if there are groups that can be added to.
        insertNodes(groupsAdd, node);
        popup.add(groupsAdd);
    }

    // Add "Attach file" menu choices to right click menu:
    popup.add(new LinkLocalFile());
    popup.add(new DownloadFile());
    popup.add(new AutoSetLinks());
    popup.add(new AttachUrl());
    getContentPane().add(centerPan, BorderLayout.CENTER);

    ButtonBarBuilder bb = new ButtonBarBuilder();
    bb.addGlue();
    bb.addButton(ok);
    bb.addButton(stop);
    JButton cancel = new JButton(Localization.lang("Cancel"));
    bb.addButton(cancel);
    bb.addRelatedGap();
    JButton help = new HelpAction(HelpFile.IMPORT_INSPECTION).getHelpButton();
    bb.addButton(help);
    bb.addGlue();
    bb.getPanel().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    ButtonStackBuilder builder = new ButtonStackBuilder();
    JButton selectAll = new JButton(Localization.lang("Select all"));
    builder.addButton(selectAll);
    JButton deselectAll = new JButton(Localization.lang("Deselect all"));
    builder.addButton(deselectAll);
    builder.addButton(deselectAllDuplicates);
    builder.addRelatedGap();
    JButton delete = new JButton(Localization.lang("Delete"));
    builder.addButton(delete);
    builder.addRelatedGap();
    builder.addFixed(autoGenerate);
    builder.addButton(generate);
    builder.getPanel().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    centerPan.add(builder.getPanel(), BorderLayout.WEST);

    ok.setEnabled(false);
    generate.setEnabled(false);
    ok.addActionListener(new OkListener());
    cancel.addActionListener(e -> {
        signalStopFetching();
        dispose();
        frame.output(Localization.lang("Import canceled by user"));
    });
    generate.addActionListener(e -> {
        generate.setEnabled(false);
        generatedKeys = true; // To prevent the button from getting
        // enabled again.
        generateKeys(); // Generate the keys.
    });
    stop.addActionListener(e -> {
        signalStopFetching();
        entryListComplete();
    });
    selectAll.addActionListener(new SelectionButton(true));
    deselectAll.addActionListener(new SelectionButton(false));
    deselectAllDuplicates.addActionListener(e -> {
        for (int i = 0; i < glTable.getRowCount(); i++) {
            if (glTable.getValueAt(i, DUPL_COL) != null) {
                glTable.setValueAt(false, i, 0);
            }
        }
        glTable.repaint();
    });
    deselectAllDuplicates.setEnabled(false);
    delete.addActionListener(deleteListener);
    getContentPane().add(bb.getPanel(), BorderLayout.SOUTH);

    // Remember and default to last size:
    setSize(new Dimension(Globals.prefs.getInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_WIDTH),
            Globals.prefs.getInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_HEIGHT)));
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowOpened(WindowEvent e) {
            contentPane.setDividerLocation(0.5f);
        }

        @Override
        public void windowClosed(WindowEvent e) {
            Globals.prefs.putInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_WIDTH, getSize().width);
            Globals.prefs.putInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_HEIGHT, getSize().height);
        }
    });
    // Key bindings:
    Action closeAction = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    };
    ActionMap am = contentPane.getActionMap();
    InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
    am.put("close", closeAction);

}

From source file:de.codesourcery.eve.skills.ui.components.impl.ImportMarketLogFileComponent.java

@Override
protected JPanel createPanelHook() {

    final JPanel result = new JPanel();

    result.setLayout(new GridBagLayout());

    final JPanel crapFilterPanel = new JPanel();
    crapFilterPanel.setLayout(new GridBagLayout());
    crapFilterPanel.setBorder(BorderFactory.createTitledBorder("Import filter"));

    crapFilterPanel.add(priceFilter, constraints(0, 0).width(3).anchorWest().noResizing().end());
    priceFilter.addActionListener(actionListener);

    linkComponentEnabledStates(priceFilter, minPriceFilter);
    linkComponentEnabledStates(priceFilter, maxPriceFilter);

    final List<PriceInfo.Type> types = Arrays.asList(PriceInfo.Type.values());
    requiredOrderType.setModel(new DefaultComboBoxModel<Type>(types));
    requiredOrderType.setSelectedItem(PriceInfo.Type.ANY);
    requiredOrderType.addActionListener(actionListener);

    minPriceFilter.setEnabled(false);/*from  ww w  . j  a  v  a2s  .  c  om*/
    maxPriceFilter.setEnabled(false);

    minPriceFilter.setColumns(10);
    maxPriceFilter.setColumns(10);

    minPriceFilter.addActionListener(actionListener);
    maxPriceFilter.addActionListener(actionListener);

    crapFilterPanel.add(minPriceFilter, constraints(1, 1).anchorWest().noResizing().end());
    crapFilterPanel.add(maxPriceFilter, constraints(2, 1).anchorWest().noResizing().end());

    // order volume filter
    crapFilterPanel.add(orderVolumeFilter, constraints(0, 2).width(3).anchorWest().noResizing().end());
    orderVolumeFilter.addActionListener(actionListener);

    linkComponentEnabledStates(orderVolumeFilter, minOrderSize);
    linkComponentEnabledStates(orderVolumeFilter, maxOrderSize);

    minOrderSize.addActionListener(actionListener);
    maxOrderSize.addActionListener(actionListener);

    minOrderSize.setEnabled(false);
    maxOrderSize.setEnabled(false);

    minOrderSize.setColumns(10);
    maxOrderSize.setColumns(10);

    crapFilterPanel.add(minOrderSize, constraints(1, 3).anchorWest().noResizing().end());
    crapFilterPanel.add(maxOrderSize, constraints(2, 3).anchorWest().noResizing().end());

    crapFilterPanel.add(new JLabel("Imported order types"), constraints(1, 4).anchorWest().noResizing().end());
    crapFilterPanel.add(this.requiredOrderType, constraints(2, 4).anchorWest().noResizing().end());

    result.add(crapFilterPanel,
            constraints(0, 0).width(1).weightX(0.1).weightY(0.1).anchorWest().resizeBoth().end());

    // add text area
    infoArea.setEditable(false);
    infoArea.setLineWrap(true);
    infoArea.setWrapStyleWord(true);

    result.add(new JScrollPane(infoArea), constraints(1, 0).width(1).resizeBoth().end());

    // add table
    table.setModel(model);
    table.setDefaultRenderer(Double.class, new MyRenderer());
    table.setDefaultRenderer(String.class, new MyRenderer());
    table.setDefaultRenderer(EveDate.class, new MyRenderer());
    table.setDefaultRenderer(Boolean.class, new MyBooleanRenderer());
    table.setDefaultRenderer(Date.class, new MyRenderer());

    table.setRowSorter(model.getRowSorter());

    final JPanel splitPane = createSplitPanePanel(result, new JScrollPane(table));

    popupMenuBuilder = new PopupMenuBuilder().attach(table)
            .addItem("Clear user overrides", new AbstractAction() {

                @Override
                public boolean isEnabled() {
                    return model.hasUserOverrides();
                }

                @Override
                public void actionPerformed(ActionEvent e) {
                    model.clearUserOverrides();
                }
            }).addSeparatorIfNotEmpty().addItem("Add selected prices to import", new AbstractAction() {

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

                @Override
                public boolean isEnabled() {
                    return hasMultipleLinesSelection();
                }
            }).addItem("Remove selected prices from import", new AbstractAction() {

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

                @Override
                public boolean isEnabled() {
                    return hasMultipleLinesSelection();
                }
            });

    updateInfoTextArea();

    return splitPane;
}