private PropertyEditor getPropertyEditor()

in kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/InspectorPanelController.java [1348:1477]


    private PropertyEditor getPropertyEditor(ValuePropertyMetadata propMeta) {
        PropertyEditor propertyEditor;

        if (propMeta instanceof StringPropertyMetadata) {
            switch (propMeta.getName().getName()) {
                case "style": //NOI18N
                    propertyEditor = makePropertyEditor(StyleEditor.class, propMeta);
                    break;
                case "id": //NOI18N
                    propertyEditor = makePropertyEditor(StringEditor.class, propMeta);
                    break;
                case "charset":
                    propertyEditor = makePropertyEditor(CharsetEditor.class, propMeta);
                    break;
                default:
                    propertyEditor = makePropertyEditor(I18nStringEditor.class, propMeta);
                    break;
            }
        } else if (propMeta instanceof ListValuePropertyMetadata) {
            switch (propMeta.getName().getName()) {
                case "styleClass": //NOI18N
                    propertyEditor = makePropertyEditor(StyleClassEditor.class, propMeta);
                    break;
                case "stylesheets": //NOI18N
                    propertyEditor = makePropertyEditor(StylesheetEditor.class, propMeta);
                    break;
                case "buttonTypes": //NOI18N
                    propertyEditor = makePropertyEditor(ButtonTypeEditor.class, propMeta);
                    break;
                case "dividerPositions": //NOI18N
                    propertyEditor = makePropertyEditor(DividerPositionsEditor.class, propMeta);
                    break;
                case "source": //NOI18N
                    propertyEditor = makePropertyEditor(IncludeFxmlEditor.class, propMeta);
                    break;
                default:
                    propertyEditor = makePropertyEditor(propMeta instanceof StringListPropertyMetadata? StringListEditor.class : GenericEditor.class, propMeta);
                    break;
            }
        } else if (propMeta instanceof DoublePropertyMetadata) {
            // Double editors
            DoublePropertyMetadata doublePropMeta = (DoublePropertyMetadata) propMeta;
            DoubleKind kind = doublePropMeta.getKind();
            if ((kind == DoubleKind.OPACITY) || (kind == DoubleKind.PROGRESS) || isBoundedByProperties(propMeta)) {
                propertyEditor = makePropertyEditor(BoundedDoubleEditor.class, propMeta);
            } else if ((kind == DoubleKind.COORDINATE)
                    || (kind == DoubleKind.USE_COMPUTED_SIZE) || (kind == DoubleKind.USE_PREF_SIZE)
                    || (kind == DoubleKind.NULLABLE_COORDINATE)) {
                // We may have constants to add
                propertyEditor = makePropertyEditor(DoubleEditor.class, propMeta);
            } else if (kind == DoubleKind.ANGLE) {
                propertyEditor = makePropertyEditor(RotateEditor.class, propMeta);
            } else {
                // other kind to be added when editors available...
                // Use simple double editor for now
                propertyEditor = makePropertyEditor(DoubleEditor.class, propMeta);
            }
        } else if (propMeta instanceof IntegerPropertyMetadata) {
            // Integer editor
            propertyEditor = makePropertyEditor(IntegerEditor.class, propMeta);
        } else if (propMeta instanceof BooleanPropertyMetadata) {
            // Boolean editor
            propertyEditor = makePropertyEditor(BooleanEditor.class, propMeta);
        } else if (propMeta instanceof EnumerationPropertyMetadata) {
            switch (propMeta.getName().getName()) {
                case "textAlignment": //NOI18N
                    propertyEditor = makePropertyEditor(TextAlignmentEditor.class, propMeta);
                    break;
                default:
                    propertyEditor = makePropertyEditor(EnumEditor.class, propMeta);
                    break;
            }
        } else if (propMeta instanceof InsetsPropertyMetadata) {
            // Insets editor
            propertyEditor = makePropertyEditor(InsetsEditor.class, propMeta);
        } else if (propMeta instanceof CursorPropertyMetadata) {
            // Cursor editor
            propertyEditor = makePropertyEditor(CursorEditor.class, propMeta);
        } else if (propMeta instanceof EventHandlerPropertyMetadata) {
            // EventHandler editor
            propertyEditor = makePropertyEditor(EventHandlerEditor.class, propMeta);
        } else if (propMeta instanceof FunctionalInterfacePropertyMetadata) {
          // Functional Interface editor
            propertyEditor = makePropertyEditor(FunctionalInterfaceEditor.class, propMeta);
        } else if (propMeta instanceof EffectPropertyMetadata) {
            // Effect editor
            propertyEditor = makePropertyEditor(EffectPopupEditor.class, propMeta);
        } else if (propMeta instanceof FontPropertyMetadata) {
            // Font editor
            propertyEditor = makePropertyEditor(FontPopupEditor.class, propMeta);
        } else if (propMeta instanceof PaintPropertyMetadata) {
            // Paint editor
            propertyEditor = makePropertyEditor(PaintPopupEditor.class, propMeta);
        } else if (propMeta instanceof ImagePropertyMetadata) {
            // Image editor
            propertyEditor = makePropertyEditor(ImageEditor.class, propMeta);
        } else if (propMeta instanceof BoundsPropertyMetadata) {
            // Bounds editor
            propertyEditor = makePropertyEditor(BoundsPopupEditor.class, propMeta);
        } else if (propMeta instanceof Point3DPropertyMetadata) {
            // Point3D editor
            propertyEditor = makePropertyEditor(Point3DEditor.class, propMeta);
        } else if (propMeta instanceof KeyCombinationPropertyMetadata) {
            // KeyCombination editor
            propertyEditor = makePropertyEditor(KeyCombinationPopupEditor.class, propMeta);
        } else if ((propMeta instanceof TableViewResizePolicyPropertyMetadata)
                || (propMeta instanceof TreeTableViewResizePolicyPropertyMetadata)) {
            // ColumnResizePolicy editor
            propertyEditor = makePropertyEditor(ColumnResizePolicyEditor.class, propMeta);
        } else if (propMeta instanceof Rectangle2DPropertyMetadata) {
            // Rectangle2D editor
            propertyEditor = makePropertyEditor(Rectangle2DPopupEditor.class, propMeta);
        } else if (propMeta instanceof ToggleGroupPropertyMetadata) {
            // ToggleGroup editor
            propertyEditor = makePropertyEditor(ToggleGroupEditor.class, propMeta);
        } else if (propMeta instanceof DurationPropertyMetadata) {
            propertyEditor = makePropertyEditor(DurationEditor.class, propMeta);
        } else if (propMeta instanceof ColorPropertyMetadata) {
            propertyEditor = makePropertyEditor(ColorPopupEditor.class, propMeta);
        } else {
            // Generic editor
            propertyEditor = makePropertyEditor(GenericEditor.class, propMeta);
        }

        // Set all the "Code" properties a double line layout
        if (isSameSection(propMeta.getInspectorPath().getSectionTag(), SectionId.CODE)) {
            propertyEditor.setLayoutFormat(LayoutFormat.DOUBLE_LINE);
        }
        return propertyEditor;
    }