org.openide.nodes.PropertySupport Java Examples

The following examples show how to use org.openide.nodes.PropertySupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OneComponentNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
private void createSocketProperty(AbstractSocket socket, Sheet.Set sheetSet) {
    try {
        String connecteeType = socket.getConnecteeTypeName();
        String connectionName = socket.getName();
        PropertySupport.Reflection nextNodeProp = 
                new PropertySupport.Reflection(new ConnectionEditor(socket, this),
                String.class,
                "getConnectedToPath",
                "setConnectedToPath");
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
        nextNodeProp.setName(connecteeType + ":" + connectionName);
        PropertyEditorSupport editor = EditorRegistry.getEditor(connecteeType);
        if (editor != null)
            nextNodeProp.setPropertyEditorClass(editor.getClass());
        sheetSet.put(nextNodeProp);
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example #2
Source File: MatchedPropertyNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates property sets of this node.
 *
 * @return property sets of this node.
 */
private PropertySet[] createPropertySets() {
    String displayName = NbBundle.getMessage(MatchedPropertyNode.class, "MatchedPropertyNode.displayName"); // NOI18N
    PropertySet set = new PropertySet(Sheet.PROPERTIES, displayName, null) {
        private final Property<?> valueProperty = new PropertySupport.ReadOnly<String>(
                PROPERTY_VALUE, String.class, null, null) {
            {
                setValue(COLOR_PROPERTY, CSSUtils.isColorProperty(property.getName()));
            }
            @Override
            public String getValue() throws IllegalAccessException, InvocationTargetException {
                return property.getValue();
            }
            @Override
            public String getShortDescription() {
                return MatchedPropertyNode.this.getShortDescription();
            }
        };
        @Override
        public Property<?>[] getProperties() {
            return new Property[] { valueProperty };
        }
    };
    return new PropertySet[] { set };
}
 
Example #3
Source File: JmeParticleEmitter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Property createButtonProperty() {
    return new PropertySupport.ReadWrite<Object>("emit", Object.class, "Emit all particles", "Click here to emit all particles of this emitter ") {

        JmeParticleEmitterButtonProperty pe;

        @Override
        public Object getValue() throws IllegalAccessException, InvocationTargetException {
            return "";
        }

        @Override
        public PropertyEditor getPropertyEditor() {
            if (pe == null) {
                pe = new JmeParticleEmitterButtonProperty(JmeParticleEmitter.this);
                pe.attachEnv(pe.env);
            }
            return pe;
        }

        @Override
        public void setValue(Object t) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        }
    };
}
 
Example #4
Source File: BiNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static <T> Node.Property<T> createProperty (Object inst, Class<T> type,
                                            String name, String dispName,
                                            String shortDesc,
                                            String getter, String setter ) {
    Node.Property<T> prop;

    try {
        prop = new PropertySupport.Reflection<T> (inst, type, getter, setter);
    } catch (NoSuchMethodException e) {            
        throw new IllegalStateException (e.getMessage() + " " + getter); // NOI18N
    }
    
    prop.setName (name);
    prop.setDisplayName (dispName);
    prop.setShortDescription (shortDesc);
    return prop;
}
 
Example #5
Source File: MatchedRuleNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates property sets of this node.
 *
 * @return property sets of this node.
 */
private PropertySet[] createPropertySets() {
    String displayName = NbBundle.getMessage(MatchedRuleNode.class, "MatchedRuleNode.properties"); // NOI18N
    PropertySet set = new PropertySet(Sheet.PROPERTIES, displayName, null) {
        private final Property<?> nodeProperty = new PropertySupport.ReadOnly<String>(
                PROPERTY_NODE, String.class, null, null) {
            @Override
            public String getValue() throws IllegalAccessException, InvocationTargetException {
                return node.getHtmlDisplayName();
            }
        };
        @Override
        public Property<?>[] getProperties() {
            return new Property[] { nodeProperty };
        }
    };
    return new PropertySet[] { set };
}
 
Example #6
Source File: ExperimentalForceSetNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
@Override
public Sheet createSheet() {
     Sheet defaultSheet = super.createSheet();
    try {
        Sheet.Set set = defaultSheet.get(Sheet.PROPERTIES);
        PropertySupport.Reflection nextNodeProp = new PropertySupport.Reflection(this, Color.class, "getColor", "setColorUI");
        nextNodeProp.setName("force color");
        set.put(nextNodeProp);

        PropertySupport.Reflection nextNodeProp2= new PropertySupport.Reflection(this, double.class, "getForceScaleFactor", "setForceScaleFactorUI");
        nextNodeProp2.setName("force size");
        set.put(nextNodeProp2);

        return defaultSheet;
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
    return defaultSheet;
}
 
Example #7
Source File: ExperimentalMarkerSetNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
@Override
public Sheet createSheet() {
     Sheet defaultSheet = super.createSheet();
    try {
        Sheet.Set set = defaultSheet.get(Sheet.PROPERTIES);
        PropertySupport.Reflection nextNodeProp = new PropertySupport.Reflection(this, Color.class, "getColor", "setColorUI");
        nextNodeProp.setName("marker color");
        set.put(nextNodeProp);

        PropertySupport.Reflection nextNodeProp2= new PropertySupport.Reflection(this, double.class, "getMarkerRadius", "setMarkerRadiusUI");
        nextNodeProp2.setName("marker radius (mm)");
        nextNodeProp2.setShortDescription("Number to scale current visualization with");
        set.put(nextNodeProp2);

        return defaultSheet;
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
    return defaultSheet;
}
 
Example #8
Source File: EarDataNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected Sheet createSheet () {
    Sheet s = new Sheet ();
    Sheet.Set ss = new Sheet.Set ();
    ss.setName (DEPLOYMENT);
    ss.setDisplayName (NbBundle.getMessage (EarDataNode.class, "PROP_deploymentSet"));
    ss.setShortDescription (NbBundle.getMessage (EarDataNode.class, "HINT_deploymentSet"));  
    ss.setValue ("helpID", "TBD---Ludo ejbjar node");   // NOI18N
    
    Node.Property p = new PropertySupport.ReadOnly (
        PROPERTY_DOCUMENT_TYPE,
        String.class,
        NbBundle.getBundle(EarDataNode.class).getString("PROP_documentDTD"),
        NbBundle.getBundle(EarDataNode.class).getString("HINT_documentDTD")
    ) {
        public Object getValue () {
            return dataObject.getApplication().getVersion();
        }
    };
    ss.put (p);
    s.put (ss);
    
    return s;
}
 
Example #9
Source File: WildflyMailSessionNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected final void initProperties(WildflyMailSessionResource mailSession) {
    if (mailSession.getJndiName() != null) {
        addProperty("JndiName", mailSession.getJndiName());
    }
    if (mailSession.getHostName() != null) {
        addProperty("Server", mailSession.getHostName());
    }
    addProperty("Port", mailSession.getPort());
    if (mailSession.getIsDebug() != null) {
        addProperty("Debug", mailSession.getIsDebug());
    }
    for (Map.Entry<String, String> property : mailSession.getConfiguration().entrySet()) {
        PropertySupport ps = new SimplePropertySupport(property.getKey(), property.getValue(), property.getKey(), property.getKey());
        getSheet().get(Sheet.PROPERTIES).put(ps);
    }
}
 
Example #10
Source File: ImportKeyNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    Sheet.Set set = sheet.createPropertiesSet();
    set.setName("AssetKey");
    set.setDisplayName("Conversion Settings");
    for (Field field : key.getClass().getDeclaredFields()) {
        PropertyDescriptor prop = PropertyUtils.getPropertyDescriptor(key.getClass(), field);
        if (prop != null) {
            try {
                Property sup = new PropertySupport.Reflection(key, prop.getPropertyType(), prop.getReadMethod(), prop.getWriteMethod());
                sup.setName(prop.getName());
                sup.setDisplayName(prop.getDisplayName());
                set.put(sup);
            } catch (Exception e) {
                Exceptions.printStackTrace(e);
            }
        }
    }
    sheet.put(set);
    return sheet;
}
 
Example #11
Source File: ClientDataNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected Sheet createSheet () {
    Sheet s = super.createSheet();
    Sheet.Set ss = s.get(Sheet.PROPERTIES);

    Node.Property p = new PropertySupport.ReadOnly (
        PROPERTY_DOCUMENT_TYPE,
        String.class,
        NbBundle.getBundle(ClientDataNode.class).getString("PROP_documentDTD"),
        NbBundle.getBundle(ClientDataNode.class).getString("HINT_documentDTD")
    ) {
        public Object getValue () {
            return dataObject.getAppClient().getVersion();
        }
    };
    ss.put (p);
    s.put (ss);
    
    return s;
}
 
Example #12
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 6 votes vote down vote up
public static PropertySupport getConverterProperties(JPAModelerScene scene, List<Converter> converters) {
    final NAttributeEntity attributeEntity = new NAttributeEntity("converters", "Converters", getMessage(PropertiesHandler.class, "INFO_COVERTER"));
    attributeEntity.setCountDisplay(new String[]{"No Converter exist", "One Converter exist", "Converters exist"});
    attributeEntity.setCustomDialog(new ConverterPanel(scene.getModelerFile()));

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("Converter Class", false, String.class));
    columns.add(new Column("Attribute Type", false, String.class));
    columns.add(new Column("DB Field Type", false, String.class));
    columns.add(new Column("Auto Apply", true, Boolean.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setTableDataListener(new NEntityDataListener<>(converters,
            t -> Arrays.asList(t.getClazz(), t.getAttributeType(), t.getFieldType(), t.isAutoApply()),
            (t, row) -> t.setAutoApply((boolean) row[4])));
    return new NEntityPropertySupport(scene.getModelerFile(), attributeEntity);
}
 
Example #13
Source File: ProcedureParamNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void updateProperties(Parameter param) {
    PropertySupport<String> ps = new PropertySupport.Name(this);
    addProperty(ps);

    switch (param.getDirection()) {
        case IN:
            addProperty(TYPE, TYPEDESC, String.class, false, NbBundle.getMessage (ProcedureParamNode.class, "In")); // NOI18N
            break;
        case OUT:
            addProperty(TYPE, TYPEDESC, String.class, false, NbBundle.getMessage (ProcedureParamNode.class, "Out")); // NOI18N
            break;
        case INOUT:
            addProperty(TYPE, TYPEDESC, String.class, false, NbBundle.getMessage (ProcedureParamNode.class, "InOut")); // NOI18N
            break;
    }

    addProperty(DATATYPE, DATATYPEDESC, String.class, false, param.getType() == null ? "null" : param.getType().toString()); // NOI18N

    addProperty(DBDATATYPE, DBDATATYPEDESC, String.class, false,
            param.getTypeName() == null ? "" : param.getTypeName());
}
 
Example #14
Source File: OneAssociatedMotionNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
@Override
public Sheet createSheet() {
    Sheet defaultSheet = super.createSheet();
    AnnotatedMotion dMotion = (AnnotatedMotion)this.getOpenSimObject();
    try {
        Sheet.Set set = defaultSheet.get(Sheet.PROPERTIES);
        PropertySupport.Reflection nextNodeProp = new PropertySupport.Reflection(dMotion.getMotionDisplayer(), Color.class, "getDefaultForceColor", "setDefaultForceColor");
        nextNodeProp.setName("force color");
        set.put(nextNodeProp);

        PropertySupport.Reflection nextNodeProp2= new PropertySupport.Reflection(dMotion, double.class, "getDisplayForceScale", "setDisplayForceScale");
        nextNodeProp2.setName("Force display size");
        set.put(nextNodeProp2);

        PropertySupport.Reflection nextNodeProp3= new PropertySupport.Reflection(dMotion, String.class, "getDisplayForceShape", "setDisplayForceShape");
        nextNodeProp3.setName("Force display shape");
        set.put(nextNodeProp3);

        return defaultSheet;
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
    return defaultSheet;
}
 
Example #15
Source File: ForeignKeyColumnNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void updateProperties(ForeignKeyColumn column) {
    PropertySupport ps = new PropertySupport.Name(this);
    addProperty(ps);

    try {
        Column referred = column.getReferredColumn();
        Column referring = column.getReferringColumn();

        addProperty(FKPOSITION, FKPOSITIONDESC, Integer.class, false, column.getPosition());
        addProperty(FKREFERRINGSCHEMA, FKREFERRINGSCHEMADESC, String.class, false, referring.getParent().getParent().getName());
        addProperty(FKREFERRINGTABLE, FKREFERRINGTABLEDESC, String.class, false, referring.getParent().getName());
        addProperty(FKREFERRINGCOLUMN, FKREFERRINGCOLUMNDESC, String.class, false, referring.getName());
        addProperty(FKREFERREDSCHEMA, FKREFERREDSCHEMADESC, String.class, false, referred.getParent().getParent().getName());
        addProperty(FKREFERREDTABLE, FKREFERREDTABLEDESC, String.class, false, referred.getParent().getName());
        addProperty(FKREFERREDCOLUMN, FKREFERREDCOLUMNDESC, String.class, false, referred.getName());

    } catch (Exception e) {
        Exceptions.printStackTrace(e);
    }
}
 
Example #16
Source File: AnnotationTypesNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Create PropertySupport for given property name and class */
private PropertySupport createProperty(final String name, final Class clazz) {
    return new PropertySupport.ReadWrite(name, clazz,
        getBundleString("PROP_" + name),    //NOI18N
        getBundleString("HINT_" + name)) {  //NOI18N
        public Object getValue() {
            return getProperty(name);
        }
        public void setValue(Object value) {
            setProperty(name, value);
        }
        public boolean supportsDefaultValue() {
            return false;
        }
    };
}
 
Example #17
Source File: OpenSimObjectNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
private Reflection createCustomNodePropertyAndEditor(AbstractProperty ap, OpenSimObject obj, Model model, Reflection nextNodeProp) throws NoSuchMethodException {
    // already know its not list, could be optional though
    // Custom editor for geometry
    if (ap.getTypeName().toLowerCase().equalsIgnoreCase("GeometryPath")){
      nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
         GeometryPath.class,
         "getValueObjAsGeometryPath",//mapPropertyEnumToGetters.get(currentPropType),
         "setValueObjFromGeometryPath");//mapPropertyEnumToSetters.get(currentPropType));              
      nextNodeProp.setPropertyEditorClass(OpenSimGeometryPathEditor.class);
    }
    else if (ap.getTypeName().toLowerCase().equalsIgnoreCase("Function")){
      nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
         Function.class,
         "getValueObjAsFunction",//mapPropertyEnumToGetters.get(currentPropType),
         null);//mapPropertyEnumToSetters.get(currentPropType));              
      nextNodeProp.setPropertyEditorClass(OpenSimFunctionEditor.class);
    }
    else 
     nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
         OpenSimObject.class,
         "getValueObj",//mapPropertyEnumToGetters.get(currentPropType),
         "setValueObj");//mapPropertyEnumToSetters.get(currentPropType));
    nextNodeProp.setValue("canEditAsText", Boolean.FALSE);
    nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
    return nextNodeProp;
}
 
Example #18
Source File: AdbNode.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
@Override
public PropertySet[] getPropertySets() {
    final Sheet.Set set = Sheet.createPropertiesSet();
    set.put(new PropertySupport.ReadOnly<Boolean>(
            "PROP_DebugBridgeConnected",
            Boolean.class,
            NbBundle.getMessage(DevicesNode.class, "PROP_DebugBridgeConnected"),
            NbBundle.getMessage(DevicesNode.class, "DESC_DebugBridgeConnected")) {
        @Override
        public Boolean getValue() throws IllegalAccessException, InvocationTargetException {
            final AndroidDebugBridge jp = AndroidSdkProvider.getAdb();
            return jp == null ? Boolean.FALSE : jp.isConnected();
        }
    });
    return new PropertySet[]{
        set
    };
}
 
Example #19
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 6 votes vote down vote up
public static PropertySupport getPrimaryKeyJoinColumnsProperty(EntityWidget entityWidget, Entity entity) {
    JPAModelerScene modelerScene = entityWidget.getModelerScene();
    final List<? extends PrimaryKeyJoinColumn> primaryKeyJoinColumnsSpec = entity.getPrimaryKeyJoinColumn();
    final NAttributeEntity attributeEntity = new NAttributeEntity("PrimaryKeyJoinColumns", "PrimaryKey Join Columns", "");
    attributeEntity.setCountDisplay(new String[]{"No PrimaryKeyJoinColumns exist", "One PrimaryKeyJoinColumn exist", "PrimaryKeyJoinColumns exist"});

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("Column Name", false, String.class));
    columns.add(new Column("Referenced Column Name", false, String.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setCustomDialog(new PrimaryKeyJoinColumnPanel(entity));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(primaryKeyJoinColumnsSpec,
            t -> Arrays.asList(t.getName(), t.getReferencedColumnName())));
    entityWidget.addPropertyVisibilityHandler("PrimaryKeyJoinColumns", () -> {
        InheritanceStateType state = entityWidget.getInheritanceState();
        return (state == BRANCH || state == LEAF) && !entity.getNoSQL();
    });
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
Example #20
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 6 votes vote down vote up
public static PropertySupport getNamedStoredProcedureQueryProperty(JPAModelerScene modelerScene, Entity entity) {
    final List<NamedStoredProcedureQuery> namedStoredProcedureQueriesSpec = entity.getNamedStoredProcedureQuery();
    final NAttributeEntity attributeEntity = new NAttributeEntity("NamedStoredProcedureQueries", "Named StoredProcedure Queries", getMessage(PropertiesHandler.class, "INFO_STORED_PROCEDURE_QUERY"));
    attributeEntity.setCountDisplay(new String[]{"No NamedStoredProcedureQueries exist", "One NamedStoredProcedureQuery exist", "NamedStoredProcedureQueries exist"});

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("#", true, Boolean.class));
    columns.add(new Column("Name", false, String.class));
    columns.add(new Column("ProcedureName", false, String.class));
    columns.add(new Column("Parameters", false, Integer.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setCustomDialog(new NamedStoredProcedureQueryPanel(modelerScene.getModelerFile()));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(namedStoredProcedureQueriesSpec,
            t -> Arrays.asList(t.isEnable(), t.getName(), t.getProcedureName(), t.getParameter().size()),
            (t, row) -> t.setEnable((boolean) row[1])));
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
Example #21
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 6 votes vote down vote up
public static PropertySupport getNamedQueryProperty(JPAModelerScene modelerScene, IdentifiableClass identifiableClass) {
    final NAttributeEntity attributeEntity = new NAttributeEntity("NamedQueries", "Named Queries", getMessage(PropertiesHandler.class, "INFO_JPQL_QUERY"));
    attributeEntity.setCountDisplay(new String[]{"No NamedQueries exist", "One NamedQuery exist", "NamedQueries exist"});
    final List<NamedQuery> namedQueriesSpec = identifiableClass.getNamedQuery();

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("#", true, Boolean.class));
    columns.add(new Column("Name", false, String.class));
    columns.add(new Column("Query", false, String.class));
    columns.add(new Column("Lock Mode Type", false, true, String.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setCustomDialog(new NamedQueryPanel(identifiableClass, modelerScene.getModelerFile()));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(namedQueriesSpec,
            t -> Arrays.asList(t.isEnable(), getShortQueryName(identifiableClass, t.getName()), t.getQuery(), t.getLockMode()),
            (t, row) -> t.setEnable((boolean) row[1])));
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
Example #22
Source File: PinWatchValueProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({"# {0} - the watched expression", "PropEditDisplayName=Value of {0}"})
private Action getPropertyEditorAction(final PropertyEditor pe,
                                       final ObjectVariable var,
                                       final ValueListeners vl,
                                       final String expression) {
    Property property = new PropertySupport.ReadWrite(expression, null,
                                                      Bundle.PropEditDisplayName(expression),
                                                      Bundle.PropEditDisplayName(expression)) {
        @Override
        public Object getValue() throws IllegalAccessException, InvocationTargetException {
            return var;
        }
        @Override
        public void setValue(final Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
            RP.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        vl.watchEv.setFromMirrorObject(val);
                        vl.watchEv.setEvaluated(null);
                        updateValueFrom(vl.watchEv);
                    } catch (InvalidObjectException ex) {
                        NotifyDescriptor msg = new NotifyDescriptor.Message(ex.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE);
                        DialogDisplayer.getDefault().notifyLater(msg);
                    }
                }
            });
            vl.value = getEvaluatingText();
            vl.valueOnly = null;

        }
        @Override
        public PropertyEditor getPropertyEditor() {
            return pe;
        }
    };
    PropertyPanel pp = new PropertyPanel(property);
    return pp.getActionMap().get("invokeCustomEditor");                     // NOI18N
}
 
Example #23
Source File: OneComponentWithGeometryNode.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
protected void addAppearanceProperties(Sheet sheet) {
    try {
        sheet.get(Sheet.PROPERTIES).remove("Appearance");
        Sheet.Set appearanceSheet = new Sheet.Set();
        appearanceSheet.setDisplayName("Appearance");
        sheet.put(appearanceSheet);
        // Visible boolean property
        PropertySupport.Reflection nextNodePropeVis;
        nextNodePropeVis = new PropertySupport.Reflection(this, Boolean.class, "getVisible", "setVisible");
        nextNodePropeVis.setName("Visible");
        nextNodePropeVis.setShortDescription(appearance.getPropertyByName("visible").getComment());
        appearanceSheet.put(nextNodePropeVis);
        // Opacity
        PropertySupport.Reflection nextNodeProp5;
        nextNodeProp5 = new PropertySupport.Reflection(this, double.class, "getOpacity", "setOpacity");
        nextNodeProp5.setName("Opacity");
        nextNodeProp5.setShortDescription(appearance.getPropertyByName("opacity").getComment());
        appearanceSheet.put(nextNodeProp5);
        // Color
        PropertySupport.Reflection nextNodeProp4;
        nextNodeProp4 = new PropertySupport.Reflection(this, Color.class, "getColor", "setColor");
        nextNodeProp4.setName("Color");
        appearanceSheet.put(nextNodeProp4);
        // Representation
        PropertySupport.Reflection nextNodePropRepresentation;
        SurfaceProperties surfApp = appearance.get_SurfaceProperties();
        nextNodePropRepresentation = new PropertySupport.Reflection(this, int.class, "getDisplayPreference", "setDisplayPreference");
        //nextNodePropRepresentation.setPropertyEditorClass(DisplayPreferenceEditor.class);
        nextNodePropRepresentation.setName("DisplayPreference");
        nextNodePropRepresentation.setShortDescription(surfApp.getPropertyByName("representation").getComment());
        appearanceSheet.put(nextNodePropRepresentation);
    } catch (NoSuchMethodException ex) {
        ex.printStackTrace();
    }
}
 
Example #24
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 5 votes vote down vote up
public static <T extends Annotation> PropertySupport getCustomAnnoation(JPAModelerScene modelerScene, List<T> annotations, Class<T> annotationType) {
    final NAttributeEntity attributeEntity = new NAttributeEntity("Annotations", "Annotations", "");
    attributeEntity.setCountDisplay(new String[]{"No Annotations exist", "One Annotation exist", "Annotations exist"});

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("#", true, Boolean.class));
    columns.add(new Column("Annoation", false, String.class));
    columns.add(new Column("Location", false, String.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setCustomDialog(new AnnotationPanel(modelerScene.getModelerFile(), annotationType));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(annotations,
            t -> Arrays.asList(t.isEnable(), t.getName(), t.getLocationType().getTitle()),
            (t, row) -> t.setEnable((boolean) row[1])));
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
Example #25
Source File: BaseNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void addProperty(String name, String desc, Class clazz, boolean writeable, Object value) {
    String propName = NbBundle.getMessage (BaseNode.class, name);

    String propDesc;
    if (desc == null) {
        propDesc = propName;
    } else {
        propDesc = NbBundle.getMessage (BaseNode.class, desc);
    }
    PropertySupport ps = new NodePropertySupport(this, name, clazz, propName, propDesc, writeable);
    propMap.put(ps.getName(), value);

    getSheet().get(Sheet.PROPERTIES).put(ps);
}
 
Example #26
Source File: ProcedureNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void updateProperties(Procedure proc) {
    PropertySupport.Name ps = new PropertySupport.Name(this);
    addProperty(ps);

    if (proc.getReturnValue() == null) {
        addProperty(TYPE, TYPEDESC, String.class, false, NbBundle.getMessage (ProcedureNode.class, "StoredProcedure")); // NOI18N
    } else {
        addProperty(TYPE, TYPEDESC, String.class, false, NbBundle.getMessage (ProcedureNode.class, "StoredFunction")); // NOI18N
    }
}
 
Example #27
Source File: JavaNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Node.Property createNameProperty () {
    Node.Property p = new PropertySupport.ReadWrite<String> (
            DataObject.PROP_NAME,
            String.class,
            getMessage (DataObject.class, "PROP_name"),
            getMessage (DataObject.class, "HINT_name")
            ) {
        public String getValue () {
            return JavaNode.this.getName();
        }
        @Override
        public Object getValue(String key) {
            if ("suppressCustomEditor".equals (key)) { //NOI18N
                return Boolean.TRUE;
            } else {
                return super.getValue (key);
            }
        }
        public void setValue(String val) throws IllegalAccessException,
                IllegalArgumentException, InvocationTargetException {
            if (!canWrite())
                throw new IllegalAccessException();
            JavaNode.this.setName(val);
        }
        @Override
        public boolean canWrite() {
            return JavaNode.this.canRename();
        }
        
    };
    
    return p;
}
 
Example #28
Source File: MetadataElementLeafNode.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected final Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    PropertySupport[] properties = createAttributeProperties();
    for (PropertySupport attributeProperty : properties) {
        set.put(attributeProperty);
    }
    sheet.put(set);
    return sheet;
}
 
Example #29
Source File: PropertiesHandler.java    From jeddict with Apache License 2.0 5 votes vote down vote up
public static <T extends Snippet> PropertySupport getCustomSnippet(JPAModelerScene modelerScene, List<T> snippets, Class<T> snippetType) {
    final NAttributeEntity attributeEntity = new NAttributeEntity("Snippets", "Snippets", "");
    attributeEntity.setCountDisplay(new String[]{"No Snippets exist", "One Snippet exist", "Snippets exist"});

    List<Column> columns = new ArrayList<>();
    columns.add(new Column("#", true, Boolean.class));
    columns.add(new Column("Snippet", false, String.class));
    columns.add(new Column("Location", false, String.class));
    attributeEntity.setColumns(columns);
    attributeEntity.setCustomDialog(new CustomSnippetPanel(modelerScene.getModelerFile(), snippetType));
    attributeEntity.setTableDataListener(new NEntityDataListener<>(snippets,
            t -> Arrays.asList(t.isEnable(), t.getValue(), t.getLocationType().getTitle()),
            (t, row) -> t.setEnable((boolean) row[1])));
    return new NEntityPropertySupport(modelerScene.getModelerFile(), attributeEntity);
}
 
Example #30
Source File: TableNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void updateProperties(Table table) {
    PropertySupport.Name ps = new PropertySupport.Name(TableNode.this);
    addProperty(ps);

    addProperty(CATALOG, CATALOGDESC, String.class, false, getCatalogName());
    addProperty(SCHEMA, SCHEMADESC, String.class, false, getSchemaName());
    addProperty(SYSTEM, SYSTEMDESC, Boolean.class, false, isSystem());
}