Java Code Examples for org.openide.nodes.PropertySupport#Reflection

The following examples show how to use org.openide.nodes.PropertySupport#Reflection . 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: 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 2
Source File: ClusterizeInfo.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public PropertySet[] getPropertySets() {
    if (sheet != null) {
        return sheet.toArray();
    }
    try {
        sheet = Sheet.createDefault();
        Set ss = sheet.get(Sheet.PROPERTIES);
        final Reflection<String> cnb = new PropertySupport.Reflection<String>(this, String.class, "getCodeName", null); // NOI18N
        cnb.setDisplayName(NbBundle.getMessage(ClusterizeInfo.class, "MSG_ClusterizeCodeNameBase"));
        cnb.setName("cnb"); // NOI18N
        ss.put(cnb); // NOI18N
        final Reflection<ClusterizeAction> act = new PropertySupport.Reflection<ClusterizeAction>(this, ClusterizeAction.class, "action"); // NOI18N
        act.setDisplayName(NbBundle.getMessage(ClusterizeInfo.class, "MSG_ClusterizeActivateAs"));
        act.setName("action"); // NOI18N
        ss.put(act); // NOI18N
        final Reflection<Integer> count = new PropertySupport.Reflection<Integer>(this, Integer.class, "getSelectedFilesCount", null); // NOI18N
        count.setDisplayName(NbBundle.getMessage(ClusterizeInfo.class, "MSG_ClusterizeNumberOfModules"));
        count.setName("selectedFilesCount"); // NOI18N
        ss.put(act); // NOI18N
        return sheet.toArray();
    } catch (NoSuchMethodException ex) {
        throw new IllegalStateException(ex);
    }
}
 
Example 3
Source File: OneComponentNode.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
private void createOutputProperty(AbstractOutput anOutput, Sheet.Set sheetSet) {
    try {
        String outputName = anOutput.getName();
        PropertySupport.Reflection nextNodeProp = 
                new PropertySupport.Reflection(anOutput,
                String.class,
                "getTypeName",null);
        nextNodeProp.setValue("canEditAsText", Boolean.FALSE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
        nextNodeProp.setName(outputName);
        // String to show at bottom of Properties panel 
        nextNodeProp.setShortDescription(anOutput.getPathName());
        sheetSet.put(nextNodeProp);
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example 4
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 5
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 6
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 7
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 8
Source File: OpenSimObjectNode.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
protected Reflection createNodePropForObjectName(OpenSimObject obj, Model model, boolean isSettable) throws NoSuchMethodException {
    PropertySupport.Reflection nextNodeProp = new PropertySupport.Reflection(new ObjectNameEditor(obj, model, this),
         String.class,
         "getName",
         (isSettable?"setName":null));
    nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
    nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
    return nextNodeProp;
}
 
Example 9
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 10
Source File: OneBodyNode.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
@Override
public Sheet createSheet() {
    Sheet sheet;

    sheet = super.createSheet();
    Sheet.Set set = sheet.get(Sheet.PROPERTIES);
    // Add property for Location
    Body obj = Body.safeDownCast(getOpenSimObject());
    Model theModel = getModelForNode();
    try {
        
        // customize com
        set.remove("mass_center");
        PropertySupport.Reflection massCenterNodeProp;
        massCenterNodeProp = new PropertySupport.Reflection(this, String.class, "getCOMString", "setCOMString");
        ((Node.Property) massCenterNodeProp).setValue("oneline", Boolean.TRUE);
        ((Node.Property) massCenterNodeProp).setValue("suppressCustomEditor", Boolean.TRUE);
        massCenterNodeProp.setName("mass_center");
        massCenterNodeProp.setShortDescription(getPropertyComment("mass_center"));
        set.put(massCenterNodeProp);
   
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }

    return sheet;
}
 
Example 11
Source File: TableNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
    Sheet s = Sheet.createDefault();
    Sheet.Set ss = s.get(Sheet.PROPERTIES);
    try {
        PropertySupport.Reflection p;
        p = new Reflection(this, String.class, "getTableName", null); // NOI18N
        p.setName("tableName"); // NOI18N
        String tableDisplayName = NbBundle.getMessage(TableNode.class, "TABLE_DISPLAY_NAME");    // NOI18N
        // p.setDisplayName("Table Name"); // NOI18N
        p.setDisplayName(tableDisplayName);

        String tableShortDescription = NbBundle.getMessage(TableNode.class, "TABLE_SHORT_DESCRIPTION");    // NOI18N
        // p.setShortDescription("Table name"); // NOI18N
        p.setShortDescription(tableShortDescription); 
        ss.put(p);
        p = new Reflection(this, String.class, "getCorrName", "setCorrName"); // NOI18N
        p.setName("aliasName"); // NOI18N
        String aliasDisplayName = NbBundle.getMessage(TableNode.class, "ALIAS_DISPLAY_NAME");    // NOI18N
        // p.setDisplayName("Table Alias"); // NOI18N
        p.setDisplayName(aliasDisplayName); 
        String aliasShortDescription = NbBundle.getMessage(TableNode.class, "ALIAS_SHORT_DESCRIPTION");    // NOI18N
        // p.setShortDescription("Alias name for the table"); // NOI18N
        p.setShortDescription(aliasShortDescription); 
        ss.put(p);
    } catch (NoSuchMethodException nsme) {
        Exceptions.printStackTrace(nsme);
    }
    return s;
}
 
Example 12
Source File: Pin.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet s = Sheet.createDefault();
    Set ss = s.get("general"); // NOI18N
    if (ss == null) {
        ss = new Sheet.Set();
        ss.setName("general"); // NOI18N
        ss.setDisplayName(NbBundle.getMessage(Pin.class, "General")); // NOI18N
        ss.setShortDescription(NbBundle.getMessage(Pin.class, "GeneralHint")); // NOI18N
        s.put(ss);
    }
    Set gs = ss;

    try {
        PropertySupport.Reflection p = new Reflection<String>(pageContentItem, String.class, "getName", "setName"); // NOI18N
        p.setName("fromView"); // NOI18N
        p.setDisplayName(NbBundle.getMessage(Pin.class, "FromView")); // NOI18N
        p.setShortDescription(NbBundle.getMessage(Pin.class, "FromViewHint")); // NOI18N
        ss.put(p);

        p = new Reflection<String>(pageContentItem, String.class, "getFromOutcome", "setFromOutcome"); // NOI18N
        p.setName("fromOutcome"); // NOI18N
        p.setDisplayName(NbBundle.getMessage(Pin.class, "Outcome")); // NOI18N
        p.setShortDescription(NbBundle.getMessage(Pin.class, "OutcomeHint")); // NOI18N
        ss.put(p);
    } catch (NoSuchMethodException nsme) {
        ErrorManager.getDefault().notify(nsme);
    }

    return s;
}
 
Example 13
Source File: OneFrameNode.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
private void addFrameProperties(Sheet sheet) {
    Frame frame = Frame.safeDownCast(comp);
    PhysicalOffsetFrame offsetFrame = PhysicalOffsetFrame.safeDownCast(frame);
    Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
    if (offsetFrame!=null){ 
        sheetSet.remove("translation");
        sheetSet.remove("orientation");
        try {
            // Expose traslations and rotatiosn
            PropertySupport.Reflection translationProp = new PropertySupport.Reflection(this,
                    String.class, "getTranslationString", "setTranslationString");
            translationProp.setValue("canEditAsText", Boolean.TRUE);
            translationProp.setDisplayName("Translation");
            translationProp.setValue("suppressCustomEditor", Boolean.TRUE);
            sheetSet.put(translationProp);
           
            PropertySupport.Reflection rotationProp = new PropertySupport.Reflection(this,
                    String.class, "getRotationString", "setRotationString");
            rotationProp.setValue("canEditAsText", Boolean.TRUE);
            rotationProp.setDisplayName("Rotation");
            rotationProp.setValue("suppressCustomEditor", Boolean.TRUE);
            sheetSet.put(rotationProp);
        } catch (NoSuchMethodException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}
 
Example 14
Source File: AssetDataNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    AssetData data = getLookup().lookup(AssetData.class);
    if (data == null) {
        return sheet;
    }
    AssetKey<?> key = data.getAssetKey();
    if (key == null) {
        return sheet;
    }
    
    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 15
Source File: CondNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected Sheet createSheet() {
        Sheet s = Sheet.createDefault();
        Sheet.Set ss = s.get(Sheet.PROPERTIES);
        try {
            PropertySupport.Reflection p;
            p = new Reflection(this, String.class, "getTable1", null); // NOI18N
            p.setName("table1"); // NOI18N
//            p.setDisplayName("Table 1"); // NOI18N
//            p.setShortDescription("first table for join"); // NOI18N

            String table1 = NbBundle.getMessage(CondNode.class, "TABLE_1");    // NOI18N
            p.setDisplayName(table1);

            String table1ShortDescription = NbBundle.getMessage(CondNode.class, "TABLE_1_SHORT_DESCRIPTION");    // NOI18N
            p.setShortDescription(table1ShortDescription);
            ss.put(p);
            p = new Reflection(this, String.class, "getColumn1", "setColumn1") {
                    public PropertyEditor getPropertyEditor () {
                        return new ColumnPropertyEditor1 ();
                    }}; // NOI18N
            p.setName("column1"); // NOI18N
//            p.setDisplayName("Column 1"); // NOI18N
//            p.setShortDescription("First column for join"); // NOI18N

            String column1 = NbBundle.getMessage(CondNode.class, "COLUMN_1");    // NOI18N
            p.setDisplayName(column1);

            String column1ShortDescription = NbBundle.getMessage(CondNode.class, "COLUMN_1_SHORT_DESCRIPTION");    // NOI18N
            p.setShortDescription(column1ShortDescription);
//          p.setPropertyEditorClass(ColumnPropertyEditor.class);
            ss.put(p);
            p = new Reflection(this, String.class, "getTable2", null); // NOI18N
            p.setName("table2"); // NOI18N
//            p.setDisplayName("Table 2"); // NOI18N
//            p.setShortDescription("second table for join"); // NOI18N

            String table2 = NbBundle.getMessage(CondNode.class, "TABLE_2");    // NOI18N
            p.setDisplayName(table2);

            String table2ShortDescription = NbBundle.getMessage(CondNode.class, "TABLE_2_SHORT_DESCRIPTION");    // NOI18N
            p.setShortDescription(table2ShortDescription); 

            ss.put(p);
            p = new Reflection(this, String.class, "getColumn2", "setColumn2") {
                    public PropertyEditor getPropertyEditor () {
                        return new ColumnPropertyEditor2 ();
                    }}; // NOI18N
            p.setName("column2"); // NOI18N
//            p.setDisplayName("Column 2"); // NOI18N
//            p.setShortDescription("Second column for join"); // NOI18N

            String column2 = NbBundle.getMessage(CondNode.class, "COLUMN_2");    // NOI18N
            p.setDisplayName(column2);

            String column2ShortDescription = NbBundle.getMessage(CondNode.class, "COLUMN_2_SHORT_DESCRIPTION");    // NOI18N
            p.setShortDescription(column2ShortDescription); 
//          p.setPropertyEditorClass(ColumnPropertyEditor.class);
            ss.put(p);
        } catch (NoSuchMethodException nsme) {
            Exceptions.printStackTrace(nsme);
        }
        return s;
    }
 
Example 16
Source File: OneMarkerNode.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
@Override
public Sheet createSheet() {
    Sheet sheet;

    sheet = super.createSheet();
    Sheet.Set set = sheet.get(Sheet.PROPERTIES);
    // Add property for Location
    Marker obj = Marker.safeDownCast(getOpenSimObject());
    MarkerAdapter gMarker = new MarkerAdapter(obj);
    Model theModel = getModelForNode();
    try {
        
        set.remove("name");
        Reflection nextNodeProp = createNodePropForObjectName(obj, theModel, true);
        if (nextNodeProp != null) {
            nextNodeProp.setName("name");
            nextNodeProp.setShortDescription("Name of the Object");
            nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
            set.put(nextNodeProp);
        }

        // customize offset
        set.remove("location");
        PropertySupport.Reflection locationNodeProp;
        locationNodeProp = new PropertySupport.Reflection(gMarker, String.class, "getOffsetString", "setOffsetString");
        ((Node.Property) locationNodeProp).setValue("oneline", Boolean.TRUE);
        ((Node.Property) locationNodeProp).setValue("suppressCustomEditor", Boolean.TRUE);
        locationNodeProp.setName("location");
        locationNodeProp.setShortDescription(getPropertyComment("location"));
        set.put(locationNodeProp);
        // Also replace seocket so we can fix frame/location
        Sheet.Set setSockets = sheet.get(Sheet.EXPERT);
        setSockets.remove("PhysicalFrame:parent_frame");
        AbstractSocket sock = obj.getSocket("parent_frame");
        String connecteeType = sock.getConnecteeTypeName();
        String connectionName = sock.getName();
        
        PropertySupport.Reflection nextNodePropFrame = 
                new PropertySupport.Reflection(this,
                String.class,
                "getConnectedToFrame",
                "setConnectedToFrame");
        nextNodePropFrame.setValue("canEditAsText", Boolean.TRUE);
        nextNodePropFrame.setValue("suppressCustomEditor", Boolean.TRUE);
        nextNodePropFrame.setName(connecteeType + ":" + connectionName);
        PropertyEditorSupport editor = EditorRegistry.getEditor(connecteeType);
        if (editor != null)
            nextNodePropFrame.setPropertyEditorClass(editor.getClass());
        setSockets.put(nextNodePropFrame);
       
    } catch (NoSuchMethodException ex) {
        Exceptions.printStackTrace(ex);
    }

    return sheet;
}
 
Example 17
Source File: NavigationCaseEdge.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet s = Sheet.createDefault();
    Set ss = s.get("general"); // NOI18N
    if (ss == null) {
        ss = new Sheet.Set();
        ss.setName("general"); // NOI18N
        ss.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "General")); // NOI18N
        ss.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "GeneralHint")); // NOI18N
        s.put(ss);
    }
    Set gs = ss;
    
    try {
        PropertySupport.Reflection<String> p;
        
        p = new ModelProperty(navCase, String.class, "getFromOutcome", "setFromOutcome"); // NOI18N
        p.setName("fromOutcome"); // NOI18N
        p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "Outcome")); // NOI18N
        p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "OutcomeHint")); // NOI18N
        ss.put(p);
        
        p = new ModelProperty(navCase, String.class, "getFromAction", "setFromAction"); // NOI18N
        p.setName("fromView"); // NOI18N
        p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "FromAction")); // NOI18N
        p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "FromActionHint")); // NOI18N
        //                p.setValue(PageSelector.PROPERTY_NAVDOC, document);
        //                p.setPropertyEditorClass(PageSelector.class);
        ss.put(p);
        
        p = new ModelProperty(navCase, String.class, "getToViewId", "setToViewId"); // NOI18N
        p.setName("toViewId"); // NOI18N
        p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "ToViewId")); // NOI18N
        p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "ToViewHint")); // NOI18N
        //                p.setValue(PageSelector.PROPERTY_NAVDOC, document);
        //                p.setPropertyEditorClass(PageSelector.class);
        ss.put(p);
        
    } catch (NoSuchMethodException nsme) {
        ErrorManager.getDefault().notify(nsme);
    }
    
    return s;
}
 
Example 18
Source File: OpenSimObjectNode.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
private Reflection createNodePropForOpenSimNoListProperty(OpenSimObject obj, int p, Model model) throws NoSuchMethodException {
    PropertySupport.Reflection nextNodeProp=null;
    AbstractProperty ap = obj.getPropertyByIndex(p);
    String apType = ap.getTypeName();
    if (apType.equalsIgnoreCase("double")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            getClassForTypeName(ap.getTypeName()),
            "getValueDouble",
            "setValueDouble");
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
   }
   else if (apType.equalsIgnoreCase("int")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            getClassForTypeName(ap.getTypeName()),
            "getValueInt",
            "setValueInt");
         nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
         nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
   }
   else if (apType.equalsIgnoreCase("bool")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            getClassForTypeName(ap.getTypeName()),
            "getValueBool",//mapPropertyEnumToGetters.get(currentPropType),
            "setValueBool");//mapPropertyEnumToSetters.get(currentPropType));
        //nextNodeProp.setValue("canEditAsText", Boolean.FALSE);
        //nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
   }
   else if (apType.equalsIgnoreCase("string")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            getClassForTypeName(ap.getTypeName()),
            "getValueString",//mapPropertyEnumToGetters.get(currentPropType),
            "setValueString");//mapPropertyEnumToSetters.get(currentPropType));
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
   }
   else if (apType.equalsIgnoreCase("Vec3")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            String.class,
            "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
            "setValueVec3FromString");//mapPropertyEnumToSetters.get(currentPropType));
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
   }
   else if (apType.equalsIgnoreCase("Vec6")){
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            String.class,
            "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
            "setValueVec6FromString");//mapPropertyEnumToSetters.get(currentPropType));
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
   }
   else { // fall through, unsupported for now
       nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
            String.class,
            "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
            null);//mapPropertyEnumToSetters.get(currentPropType));
        nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
        nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
   }
   return nextNodeProp;
}
 
Example 19
Source File: OpenSimObjectNode.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
private Reflection createNodePropForOpenSimListProperty(OpenSimObject obj, int p, Model model) throws NoSuchMethodException {
    PropertySupport.Reflection nextNodeProp=null;
     AbstractProperty ap = obj.getPropertyByIndex(p);
     String apType = ap.getTypeName();
     if (apType.equalsIgnoreCase("double")){
         if (ap.getName().toLowerCase().contains("color")){
             nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
                 Color.class,
                 "getPropertyDoubleListAsColor",//mapPropertyEnumToGetters.get(currentPropType),
                 "setValueDoubleListFromColor");
         }
         else
             nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
                 String.class,
                 "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
                 "setValueDoubleListFromString");//mapPropertyEnumToSetters.get(currentPropType));
         nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
         nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
    }
    else if (apType.equalsIgnoreCase("Transform")){
         nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
             String.class,
             "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
             "setValueTransformFromString");//mapPropertyEnumToSetters.get(currentPropType));
         nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
         nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
    }
    else if (apType.equalsIgnoreCase("string")){
         nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
             String.class,
             "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
             "setValueStringListFromString");//mapPropertyEnumToSetters.get(currentPropType));
         nextNodeProp.setValue("canEditAsText", Boolean.TRUE);
         nextNodeProp.setValue("suppressCustomEditor", Boolean.FALSE);
    }
    else { // fall through, unexpected, should handle arrays of strings
        nextNodeProp = new PropertySupport.Reflection(new PropertyEditorAdaptor(ap, this),
             String.class,
             "getPropertyAsString",//mapPropertyEnumToGetters.get(currentPropType),
             null);//mapPropertyEnumToSetters.get(currentPropType));
         nextNodeProp.setValue("canEditAsText", Boolean.FALSE);
         nextNodeProp.setValue("suppressCustomEditor", Boolean.TRUE);
    }
    return nextNodeProp;
}
 
Example 20
Source File: RepositoryNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Messages({
    "LBL_Id=ID",
    "LBL_Name=Name",
    "LBL_Local=Local",
    "LBL_Local_repository_path=Local repository path",
    "LBL_Remote_Index=Remote Index Downloadable",
    "LBL_Remote_URL=Remote Repository URL",
    "LBL_Remote_Index_URL=Remote Index URL",
    "LBL_last_indexed=Last Indexed"
})
@Override protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set basicProps = sheet.get(Sheet.PROPERTIES);
    try {
        Node.Property<?> id = new PropertySupport.Reflection<String>(info, String.class, "getId", null); //NOI18N
        id.setDisplayName(LBL_Id());
        id.setShortDescription(""); //NOI18N
        Node.Property<?> name = new PropertySupport.Reflection<String>(info, String.class, "getName", null); //NOI18N
        name.setDisplayName(LBL_Name());
        name.setShortDescription(""); //NOI18N
        Node.Property<?> local = new PropertySupport.Reflection<Boolean>(info, Boolean.TYPE, "isLocal", null); //NOI18N
        local.setName("local"); //NOI18N
        local.setDisplayName(LBL_Local());
        local.setShortDescription("");
        Node.Property<?> localRepoLocation = new PropertySupport.Reflection<String>(info, String.class, "getRepositoryPath", null); //NOI18N
        localRepoLocation.setDisplayName(LBL_Local_repository_path());
        Node.Property<?> remoteDownloadable = new PropertySupport.Reflection<Boolean>(info, Boolean.TYPE, "isRemoteDownloadable", null); //NOI18N
        remoteDownloadable.setDisplayName(LBL_Remote_Index());
        Node.Property<?> repoURL = new PropertySupport.Reflection<String>(info, String.class, "getRepositoryUrl", null); //NOI18N
        repoURL.setDisplayName(LBL_Remote_URL());
        Node.Property<?> indexURL = new PropertySupport.Reflection<String>(info, String.class, "getIndexUpdateUrl", null); //NOI18N
        indexURL.setDisplayName(LBL_Remote_Index_URL());
        Node.Property<?> lastIndexed = new PropertySupport.ReadOnly<Date>("lastIndexed", Date.class, LBL_last_indexed(), null) {
            @Override public Date getValue() throws IllegalAccessException, InvocationTargetException {
                return RepositoryPreferences.getLastIndexUpdate(info.getId());
            }
        };
        basicProps.put(new Node.Property<?>[] {
            id, name, local, localRepoLocation, remoteDownloadable, repoURL, indexURL, lastIndexed
        });
    } catch (NoSuchMethodException exc) {
        exc.printStackTrace();
    }
    return sheet;
}