Search in sources :

Example 1 with VersionCellRenderer

use of com.sldeditor.common.vendoroption.selection.VersionCellRenderer in project sldeditor by robward-scisys.

the class VendorOptionUI method createUI.

/**
 * Creates the UI.
 */
public void createUI() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    // Vendor options
    JPanel vendorOptionSelectionPanel = new JPanel();
    vendorOptionSelectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), Localisation.getString(VendorOptionUI.class, "VendorOptionUI.vendorOptions"), TitledBorder.LEADING, TitledBorder.TOP, null, null));
    vendorOptionSelectionPanel.setLayout(new BorderLayout());
    add(vendorOptionSelectionPanel);
    vendorOptionTable = new JTable();
    JScrollPane scrollPane = new JScrollPane(vendorOptionTable);
    vendorOptionSelectionPanel.add(scrollPane, BorderLayout.CENTER);
    vendorOptionSelectionPanel.setPreferredSize(new Dimension(400, 100));
    vendorOptionModel = new VendorOptionTableModel(options, getClass());
    vendorOptionTable.setModel(vendorOptionModel);
    vendorOptionTable.getColumnModel().getColumn(1).setCellRenderer(new VersionCellRenderer());
    vendorOptionTable.getColumnModel().getColumn(1).setCellEditor(new VersionCellEditor(vendorOptionModel));
    // Vendor option information
    VendorOptionInfoPanel vendorOptionInfoPanel = VendorOptionInfoManager.getInstance().getPanel(getClass());
    vendorOptionInfoPanel.setPreferredSize(new Dimension(400, 200));
    add(vendorOptionInfoPanel);
    // VendorOption present table
    JPanel voPresentPanel = new JPanel();
    voPresentPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), Localisation.getString(VendorOptionUI.class, "VendorOptionUI.loadedSymbol"), TitledBorder.LEADING, TitledBorder.TOP, null, null));
    voPresentPanel.setLayout(new BorderLayout());
    voPresentPanel.setPreferredSize(new Dimension(400, 300));
    vendorOptionPresentTable = new JTable();
    vendorOptionPresentTable.setModel(vendorOptionPresentModel);
    JScrollPane scrollPaneTable = new JScrollPane(vendorOptionPresentTable);
    voPresentPanel.add(scrollPaneTable, BorderLayout.CENTER);
    add(voPresentPanel);
    JPanel panel = new JPanel();
    voPresentPanel.add(panel, BorderLayout.SOUTH);
    panel.setLayout(new BorderLayout(0, 0));
    JPanel panel_2 = new JPanel();
    panel.add(panel_2, BorderLayout.EAST);
    JButton btnHelp = new JButton(Localisation.getString(VendorOptionUI.class, "common.help"));
    panel_2.add(btnHelp);
    btnHelp.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Help.getInstance().display(CONTEXT_HELP);
        }
    });
    JPanel panel_1 = new JPanel();
    panel.add(panel_1, BorderLayout.CENTER);
    btnLatestVO = new JButton(Localisation.getString(VendorOptionUI.class, "VendorOptionUI.latest"));
    panel_1.add(btnLatestVO);
    btnLatestVO.setEnabled(false);
    btnMinimumVendorOption = new JButton(Localisation.getString(VendorOptionUI.class, "VendorOptionUI.minimumVO"));
    panel_1.add(btnMinimumVendorOption);
    btnMinimumVendorOption.setEnabled(false);
    btnMinimumVendorOption.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            vendorOptionsUpdated(vendorOptionPresentModel.getMinimum());
        }
    });
    btnLatestVO.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            vendorOptionsUpdated(VendorOptionManager.getInstance().getLatest());
        }
    });
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) VersionCellEditor(com.sldeditor.common.vendoroption.selection.VersionCellEditor) VendorOptionInfoPanel(com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel) VersionCellRenderer(com.sldeditor.common.vendoroption.selection.VersionCellRenderer) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) VendorOptionTableModel(com.sldeditor.common.vendoroption.selection.VendorOptionTableModel) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable)

Aggregations

VendorOptionInfoPanel (com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel)1 VendorOptionTableModel (com.sldeditor.common.vendoroption.selection.VendorOptionTableModel)1 VersionCellEditor (com.sldeditor.common.vendoroption.selection.VersionCellEditor)1 VersionCellRenderer (com.sldeditor.common.vendoroption.selection.VersionCellRenderer)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 BoxLayout (javax.swing.BoxLayout)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JTable (javax.swing.JTable)1 TitledBorder (javax.swing.border.TitledBorder)1