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);
}
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());
}
});
}
Aggregations