コード例 #1
0
 public void updateState(PropertyValue value) {
   customEditor.updateModel();
   if (isCurrentValueANull() || value == null) {
     customEditor.setValue(null);
   } else {
     customEditor.setValue(value);
   }
   radioButton.setSelected(!isCurrentValueAUserCodeType());
 }
コード例 #2
0
  /** 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;
  }
コード例 #3
0
 @Override
 public void customEditorOKButtonPressed() {
   super.customEditorOKButtonPressed();
   if (radioButton.isSelected()) {
     saveValue(customEditor.getText());
   }
 }
コード例 #4
0
 public void clean(DesignComponent component) {
   super.cleanUp(component);
   tags = null;
   values = null;
   if (customEditor != null) {
     customEditor.clean();
     customEditor = null;
   }
   radioButton = null;
   typeID = null;
 }
コード例 #5
0
 /**
  * Sets the value of the date format to be edited.
  *
  * @param value a SimpleDateFormat object to be edited
  */
 public void setValue(Object value) {
   m_Format = (SimpleDateFormat) value;
   m_customEditor.formatChanged();
 }