Search in sources :

Example 1 with VendorOptionFactoryInterface

use of com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface 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 VendorOptionFactoryInterface

use of com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface in project sldeditor by robward-scisys.

the class VendorOptionInfoManager method getPanel.

/**
 * Gets the panel.
 *
 * @return the panel
 */
public VendorOptionInfoPanel getPanel(Class<?> instance) {
    InstanceData data = instanceMap.get(instance);
    if (data == null) {
        data = new InstanceData();
        List<VendorOptionInfo> infoList = new ArrayList<VendorOptionInfo>();
        for (VendorOptionFactoryInterface vo : voFactoryList) {
            List<VendorOptionInfo> vendorOptionInfoList = vo.getVendorOptionInfoList();
            if (vendorOptionInfoList != null) {
                infoList.addAll(vendorOptionInfoList);
            }
        }
        data.infoModel = new VendorOptionInfoModel();
        data.infoModel.addVendorOptionInfo(infoList);
        data.panel = new VendorOptionInfoPanel(data.infoModel);
        instanceMap.put(instance, data);
    }
    return data.panel;
}
Also used : ArrayList(java.util.ArrayList) VendorOptionFactoryInterface(com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface)

Aggregations

VendorOptionFactoryInterface (com.sldeditor.ui.detail.vendor.VendorOptionFactoryInterface)2 ArrayList (java.util.ArrayList)2 VersionData (com.sldeditor.common.vendoroption.VersionData)1 VendorOptionInfo (com.sldeditor.common.vendoroption.info.VendorOptionInfo)1 VendorOptionInfoPanel (com.sldeditor.common.vendoroption.info.VendorOptionInfoPanel)1 VendorOptionInterface (com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface)1 Test (org.junit.Test)1