/** Gets the GUI component for this pane. */ public JComponent getGUI() { if (cwp == null) { Object object = mWhiteBoard.get("device_definition"); Object ctx_obj = mWhiteBoard.get("context"); if (null != object && object instanceof ConfigDefinition && null != ctx_obj && ctx_obj instanceof ConfigContext) { mConfigContext = (ConfigContext) ctx_obj; ConfigDefinition def = (ConfigDefinition) object; String token = def.getToken(); // Create a temporary list of ConfigDefinitions to pass to factory. java.util.List def_list = new ArrayList(); def_list.add(def); // Initialize a ConfigElementFactory with the needed // ConfigDefinition. And create a new ConfigElement. ConfigElementFactory temp_factory = new ConfigElementFactory(def_list); mConfigElement = temp_factory.create("New " + token, def); List list = CustomEditorRegistry.findEditors(token); Color start_color = new Color(160, 160, 180); Object color = UIManager.get("window"); if (null != color && color instanceof Color) { start_color = (Color) color; } else { System.out.println("Could not get the desktop color from the UIManager."); } // XXX:This will be used after making findEditors -> findEditor // if(null != editor) if (null == list || list.size() == 0) { System.out.println("No CustomEditors registered for token: " + token); JScrollPane scroll_pane = new JScrollPane(); PropertySheet element_prop_sheet = PropertySheetFactory.instance() .makeSheet(mConfigContext, mConfigElement, start_color); scroll_pane.getViewport().removeAll(); scroll_pane.getViewport().add(element_prop_sheet, null); cwp = scroll_pane; } else if (null != list && list.size() > 0) { CustomEditor editor = (CustomEditor) list.get(0); cwp = (JComponent) editor.getPanel(); editor.setConfig(mConfigContext, mConfigElement); } } } // cwp.init(mWhiteBoard); return cwp; }