Search in sources :

Example 1 with VendorOptionInfoPanel

use of com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel in project sldeditor by robward-scisys.

the class VendorOptionInfoManagerTest method testAddVendorOptionInfo.

/**
 * Test method for
 * {@link com.sldeditor.common.vendoroption.info.VendorOptionInfoManager#addVendorOptionInfo(com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface)}.
 * {@link com.sldeditor.common.vendoroption.info.VendorOptionInfoManager#getPanel(java.lang.Class)}.
 * {@link com.sldeditor.common.vendoroption.info.VendorOptionInfoManager#setSelectedVersion(java.lang.Class, com.sldeditor.common.vendoroption.VersionData)}.
 */
@Test
public void testAddVendorOptionInfo() {
    VendorOptionInfoManager.getInstance().addVendorOptionInfo(null);
    VendorOptionFactoryInterface f1 = new VendorOptionFactoryInterface() {

        @Override
        public List<VendorOptionInterface> getVendorOptionList() {
            return null;
        }

        @Override
        public List<VendorOptionInterface> getVendorOptionList(String className) {
            return null;
        }

        @Override
        public List<VendorOptionInfo> getVendorOptionInfoList() {
            List<VendorOptionInfo> list = new ArrayList<VendorOptionInfo>();
            return list;
        }
    };
    VendorOptionInfoManager.getInstance().addVendorOptionInfo(f1);
    VendorOptionInfoManager.getInstance().addVendorOptionInfo(f1);
    VendorOptionInfoPanel panel1 = VendorOptionInfoManager.getInstance().getPanel(String.class);
    VendorOptionInfoPanel panel2 = VendorOptionInfoManager.getInstance().getPanel(Double.class);
    VendorOptionInfoPanel panel3 = VendorOptionInfoManager.getInstance().getPanel(String.class);
    assertTrue(panel1 == panel3);
    assertTrue(panel1 != panel2);
    VendorOptionInfoManager.getInstance().setSelectedVersion(null, null);
    VersionData versionData = VersionData.decode(GeoServerVendorOption.class, "3.1.4");
    VendorOptionInfoManager.getInstance().setSelectedVersion(String.class, versionData);
}
Also used : VendorOptionInfoPanel(com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel) VersionData(com.sldeditor.common.vendoroption.VersionData) ArrayList(java.util.ArrayList) VendorOptionInfo(com.sldeditor.common.vendoroption.info.VendorOptionInfo) VendorOptionFactoryInterface(com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface) VendorOptionInterface(com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface) Test(org.junit.Test)

Example 2 with VendorOptionInfoPanel

use of com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel 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)2 VersionData (com.sldeditor.common.vendoroption.VersionData)1 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)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 VendorOptionFactoryInterface (com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface)1 VendorOptionInterface (com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)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 Test (org.junit.Test)1