public PropertyPanel(ManagedObject pManagedObject, Map<Class, PropertyEditor> pEditors) {
    super();
    try {
      managedObject = pManagedObject;
      if (pEditors != null) {
        PropertyEditorRegistry registry = (PropertyEditorRegistry) getEditorFactory();
        for (Class key : pEditors.keySet()) {
          registry.registerEditor(key, pEditors.get(key));
        }
      }
      setMode(PropertySheet.VIEW_AS_CATEGORIES);
      setSortingCategories(true);
      setSortingProperties(true);
      setRestoreToggleStates(true);

      setToolBarVisible(false);
      setDescriptionVisible(true);

      if (pManagedObject != null) {

        BeanInfo beanInfo = managedObject.getBeanInfo();

        if (beanInfo != null) setBeanInfo(beanInfo);

        readFromObject(managedObject);

        PropertyChangeListener listener =
            new PropertyChangeListener() {
              public void propertyChange(PropertyChangeEvent evt) {
                Property prop = (Property) evt.getSource();
                // System.out.println("WRITE " + prop.getName());
                prop.writeToObject(managedObject);
              }
            };
        addPropertySheetChangeListener(listener);
      }
    } catch (Throwable ex) {
      ex.printStackTrace();
    }
  }
 private void initEditorRegistry() {
   pEditorRegistry = new PropertyEditorRegistry();
   pEditorRegistry.registerDefaults();
   pEditorRegistry.registerEditor(LocationType.class, LocationTypePropertyEditor.class);
   pEditorRegistry.registerEditor(VehicleType.class, VehicleSelectionEditor.class);
   pEditorRegistry.registerEditor(Script.class, ScriptSelectionEditor.class);
   pEditorRegistry.registerEditor(RenderType.class, RenderSelectionEditor.class);
   pEditorRegistry.registerEditor(Enumerated.class, EnumeratedPropertyEditor.class);
   pEditorRegistry.registerEditor(Bitmask.class, BitmaskPropertyEditor.class);
   pEditorRegistry.registerEditor(ColorMap.class, ColorMapPropertyEditor.class);
   pEditorRegistry.registerEditor(ImcId16.class, ImcId16Editor.class);
   pEditorRegistry.registerEditor(PlanActions.class, PlanActionsEditor.class);
   pEditorRegistry.registerEditor(Double.class, NeptusDoubleEditor.class);
   pEditorRegistry.registerEditor(Float.class, NeptusDoubleEditor.class);
 }
  @SuppressWarnings("unchecked")
  private <T> PluginProperty extractPluginProperty(Field f, T class1) {
    NeptusProperty neptusProperty = f.getAnnotation(NeptusProperty.class);
    Object fieldValue = null;
    try {
      fieldValue = f.get(class1);
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }

    // Name
    String nameRaw = neptusProperty.name();
    String displayName;
    if (nameRaw == null || nameRaw.length() == 0) {
      nameRaw = f.getName();
      char firstLetter = Character.toUpperCase(nameRaw.charAt(0));
      displayName = firstLetter + nameRaw.substring(1);
    } else {
      displayName = nameRaw;
    }
    // Type
    Class<?> type = f.getType();

    PluginProperty pp = new PluginProperty(nameRaw, type, fieldValue);
    pp.setValue(fieldValue);

    // Editable
    if (neptusProperty.editable() == false) {
      pp.setEditable(false);
    } else {
      pp.setEditable(true);
    }
    // Display name
    // signal the scope is the whole Neptus
    if (class1.getClass().equals(GeneralPreferences.class))
      displayName = "* " + I18n.text(displayName);
    else displayName = I18n.text(displayName);
    pp.setDisplayName(displayName);
    // Category
    if (neptusProperty.category() != null) {
      pp.setCategory(I18n.text(neptusProperty.category()));
    }
    // Short description
    Map<String, PluginProperty> hashMap = PluginUtils.getDefaultsValues(class1);
    StringBuilder description = new StringBuilder();
    description.append(I18n.text(neptusProperty.description()));
    String defaultValue;
    if (hashMap == null) {
      // no value!
      defaultValue =
          I18n.textf("No default found for class %className", class1.getClass().getSimpleName());
    } else {
      PluginProperty pluginProperty = hashMap.get(f.getName());
      if (pluginProperty == null) {
        // no value!
        defaultValue = I18n.textf("No default found for field %fieldName", f.getName());
      } else {
        Object defaultPropValue = pluginProperty.getValue();
        defaultValue =
            (defaultPropValue == null
                ? I18n.text("Absence of value")
                : ((f.getType().getEnumConstants() != null
                    ? I18n.text(defaultPropValue.toString())
                    : defaultPropValue.toString())));
      }
    }
    description.append(" (");
    description.append(I18n.text("Default value"));
    description.append(": ");
    description.append(defaultValue);
    description.append(")");
    pp.setShortDescription(description.toString());

    // Editor class - ATTENTION must be the last or wont work!
    Class<? extends PropertyEditor> editClass = null;
    if (neptusProperty.editorClass() != PropertyEditor.class) {
      editClass = neptusProperty.editorClass();
    }
    if (editClass != null) {
      pEditorRegistry.registerEditor(pp, editClass);
    } else {
      if (ReflectionUtil.hasInterface(f.getType(), PropertyType.class)) {
        PropertyType pt = (PropertyType) fieldValue;
        pEditorRegistry.registerEditor(pp, pt.getPropertyEditor());
      }
      if (f.getType().getEnumConstants() != null) {
        if (fieldValue != null) {
          pEditorRegistry.registerEditor(
              pp, new EnumEditor((Class<? extends Enum<?>>) fieldValue.getClass()));
        }
      }
    }
    return pp;
  }