org.openide.nodes.Sheet Java Examples

The following examples show how to use org.openide.nodes.Sheet. 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: 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 #2
Source File: ExternalReferenceDataNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Set set = sheet.get(Sheet.PROPERTIES);
    set.put(createProperty(PROP_NAME, String.class, this,
            "getHtmlDisplayName", null));
    if (canSelect()) {
        set.put(createProperty(PROP_SELECTED, Boolean.TYPE, this,
                "isSelected", "setSelected"));
   //     Node.Property prop = createProperty(PROP_PREFIX, String.class,
       //         this, "getPrefix", "setPrefix");
        // Suppress the [...] button because it is not needed.
    //    prop.setValue("suppressCustomEditor", Boolean.TRUE);
    //    set.put(prop);
    } /*else {
        // Do not include this property so the checkbox is not shown.
        //set.put(createProperty(PROP_SELECTED, Boolean.TYPE, this,
        //        "isSelected", null));
        Node.Property prop = createProperty(PROP_PREFIX, String.class,
                this, "getPrefix", null);
        // Suppress the [...] button because it is not needed.
        prop.setValue("suppressCustomEditor", Boolean.TRUE);
        set.put(prop);
    }*/
    return sheet;
}
 
Example #3
Source File: OrderingAttributeNode.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    sheet.put(set);
    set.put(new StringProperty(ASSOCIATED_ATTRINUTE, Bundle.COL_AssociatedAttribute()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return attrib.getAssociatedAttribute().toString();
        }
    });
    set.put(new StringProperty(SORT, Bundle.COL_Sort()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return attrib.getValueComparator().getSort();
        }
    });
    return sheet;
}
 
Example #4
Source File: JmeDirectionalLight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = super.createSheet();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("DirectionalLight");
    set.setName(DirectionalLight.class.getName());
    DirectionalLight obj = directionalLight;
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, Vector3f.class, "getDirection", "setDirection", "Direction"));

    sheet.put(set);
    return sheet;

}
 
Example #5
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 #6
Source File: JmeGenericControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("Control");
    set.setName(Control.class.getName());
    if (control == null) {
        return sheet;
    }

    createFields(control.getClass(), set, control);

    sheet.put(set);
    return sheet;

}
 
Example #7
Source File: JmeAmbientLight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = super.createSheet();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("AmbientLight");
    set.setName(AmbientLight.class.getName());
    AmbientLight obj = AmbientLight;//getLookup().lookup(Spatial.class);
    if (obj == null) {
        return sheet;
    }

    sheet.put(set);
    return sheet;

}
 
Example #8
Source File: PropertiesFlushTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Node.PropertySet[] getPropertySets() {
    if (sets == null) {
        System.err.println("Create sheet");
        Sheet sheet = new Sheet();
        // Make sure there is a "Properties" set:
        Sheet.Set props = sheet.get(Sheet.PROPERTIES);
        props = Sheet.createPropertiesSet();
        sheet.put(props);
        TProperty tp = new TProperty("property", true);
        props.put(tp);
        if (firstTime) {
            props.put(new TProperty("second", true));
            System.err.println("first time");
            firstTime = false;
        } else {
            System.err.println("Second  time");
        }
        sets = sheet.toArray();
    }
    return sets;
}
 
Example #9
Source File: DevicesNode.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 #10
Source File: JmePointLight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = super.createSheet();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("PointLight");
    set.setName(PointLight.class.getName());
    PointLight obj = pointLight;//getLookup().lookup(Spatial.class);
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, Vector3f.class, "getPosition", "setPosition", "Position"));
    set.put(makeProperty(obj, float.class, "getRadius", "setRadius", "Radius"));

    sheet.put(set);
    return sheet;

}
 
Example #11
Source File: JmeGhostControl.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.setDisplayName("GhostControl");
    set.setName(GhostControl.class.getName());
    GhostControl obj = geom;//getLookup().lookup(Spatial.class);
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, Vector3f.class, "getPhysicsLocation", "setPhysicsLocation", "Physics Location"));
    set.put(makeProperty(obj, Quaternion.class, "getPhysicsRotation", "setPhysicsRotation", "Physics Rotation"));
    
    set.put(makeProperty(obj, CollisionShape.class, "getCollisionShape", "setCollisionShape", "Collision Shape"));
    set.put(makeProperty(obj, int.class, "getCollisionGroup", "setCollisionGroup", "Collision Group"));
    set.put(makeProperty(obj, int.class, "getCollideWithGroups", "setCollideWithGroups", "Collide With Groups"));

    sheet.put(set);
    return sheet;

}
 
Example #12
Source File: BiFeatureNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void addIncludedProperty( Sheet.Set ps ) {    
    ps.put(new PropertySupport.ReadWrite<Boolean> (
               PROP_INCLUDED,
               Boolean.TYPE,
               GenerateBeanInfoAction.getString ("PROP_Bi_" + PROP_INCLUDED ),
               GenerateBeanInfoAction.getString ("HINT_Bi_" + PROP_INCLUDED )
           ) {
               public Boolean getValue () {
                   return biFeature.isIncluded ();
               }
               public void setValue (Boolean val) throws
                   IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                   try {
                       biFeature.setIncluded ( val );
                       setIconBaseWithExtension( biFeature.getIconBase(false) + ".gif" );
                   } catch (ClassCastException e) {
                       throw new IllegalArgumentException ();
                   }
               }
           });
}
 
Example #13
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 #14
Source File: AssetPackBrowserItem.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
    protected Sheet createSheet() {
        Sheet sheet = super.createSheet();
        Set set = Sheet.createPropertiesSet();
        set.put(new ElementAttributeProperty(project, item, "name"));
        set.put(new ElementNodeTextProperty(project, item, "description"));
        set.put(new ElementAttributeProperty(project, item, "categories"));
        set.put(new ElementAttributeProperty(project, item, "tags"));
        Element elem = XmlHelper.findChildElement(item, "license");
        if ((project.getLookup().lookup(AssetPackLibrary.class) != null) && (elem == null || elem.getTextContent().trim().length() <= 0)) {
            set.put(new ElementNodeTextProperty(project, (Element) item.getParentNode().getParentNode(), "license"));
        } else {
            set.put(new ElementNodeTextProperty(project, item, "license"));
        }
        set.put(new ElementAttributeProperty(project, item, "type", ASSET_TYPES));
//        set.put(new ElementAttributeProperty(project, item, "format", ASSET_FORMATS));
        sheet.put(set);
        return sheet;
    }
 
Example #15
Source File: JmeLight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    //TODO: multithreading..
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("Light");
    set.setName(Light.class.getName());
    Light obj = light;
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, ColorRGBA.class, "getColor", "setColor", "Color"));


    sheet.put(set);
    return sheet;

}
 
Example #16
Source File: JmeLightScatteringFilter.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.setDisplayName("Blur");
        set.setName(Node.class.getName());
        LightScatteringFilter obj = (LightScatteringFilter) filter;
        if (obj == null) {
            return sheet;
        }
//        set.put(makeProperty(obj, float.class, "getBlurStart", "setBlurStart", "Blur Start"));
//        set.put(makeProperty(obj, float.class, "getBlurWidth", "setBlurWidth", "Blur Width"));
//        set.put(makeProperty(obj, float.class, "getLightDensity", "setLightDensity", "Light Density"));
//        set.put(makeProperty(obj, Vector3f.class, "getLightPosition", "setLightPosition", "Light Position"));
//        set.put(makeProperty(obj, int.class, "getNbSamples", "setNbSamples", "Sample Number"));
        
        createFields(LightScatteringFilter.class, set, obj);
        sheet.put(set);
        return sheet;

    }
 
Example #17
Source File: FilterXNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static PropertySet[] merge(PropertySet[] overridingSets, PropertySet[] baseSets) {
    java.util.Map ret = new java.util.HashMap();
    for (int i=0; i<baseSets.length; i++) {
        ret.put(baseSets[i].getName(), baseSets[i]);
    }
    for (int j=0; j<overridingSets.length; j++) {
        PropertySet base = (PropertySet) ret.get(overridingSets[j].getName());
        if (base == null) {
            ret.put(overridingSets[j].getName(), overridingSets[j]);
        } else {
            base = merge(overridingSets[j], base);
            ret.put(base.getName(), base);
        }
    }

    PropertySet top = (PropertySet) ret.remove(Sheet.PROPERTIES);
    List retList = new ArrayList();
    if (top != null)
        retList.add(top);
    retList.addAll(ret.values());
    return (PropertySet[]) retList.toArray(new PropertySet[retList.size()]);
}
 
Example #18
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 #19
Source File: TableTupleLoaderNode.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    logger.trace("Create tuple data: " + getName());
    Sheet sheet = Sheet.createDefault();
    Sheet.Set set = Sheet.createPropertiesSet();
    sheet.put(set);
    List<Cell> tupleCells = getTuple().getCells();
    for (final Cell cell : tupleCells) {
        StringProperty property = new StringProperty(cell.getAttribute()) {
            @Override
            public String getValue() throws IllegalAccessException, InvocationTargetException {
                return cell.getValue().toString();
            }

            //TODO: implement inplace editor
            @Override
            public boolean canWrite() {
                return true;
            }
        };
        set.put(property);
    }
    return sheet;
}
 
Example #20
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 #21
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 #22
Source File: JmeFogFilter.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.setDisplayName("Fog");
        set.setName(Node.class.getName());
        FogFilter obj = (FogFilter) filter;
        if (obj == null) {
            return sheet;
        }
//        set.put(makeProperty(obj, float.class, "getFogDistance", "setFogDistance", "Distance"));
//        set.put(makeProperty(obj, float.class, "getFogDensity", "setFogDensity", "Density"));
//        set.put(makeProperty(obj, ColorRGBA.class, "getFogColor", "setFogColor", "Color"));
         createFields(FogFilter.class, set, obj);
        sheet.put(set);
        return sheet;

    }
 
Example #23
Source File: DepTupleNode.java    From Llunatic with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    Sheet.Set set = Sheet.createPropertiesSet();
    set.put(new StringProperty(Bundle.PROP_DependencyType()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return dependency.getType();
        }
    });
    set.put(new StringProperty(Bundle.PROP_DependencyId()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return dependency.getId();
        }
    });
    sheet.put(set);
    return sheet;
}
 
Example #24
Source File: ProxyNodeTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    // Make sure there is a "Properties" set:
    Sheet.Set props = sheet.get(Sheet.PROPERTIES);
    if (props == null) {
        props = Sheet.createPropertiesSet();
        sheet.put(props);
    }
    props.put(myprop);
    myprop.setFiringNode(this);
    return sheet;
}
 
Example #25
Source File: NodeDeletionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();
    // Make sure there is a "Properties" set:
    Sheet.Set props = sheet.get(Sheet.PROPERTIES);
    if (props == null) {
        props = Sheet.createPropertiesSet();
        sheet.put(props);
    }
    TProperty tp = new TProperty("property", true);
    props.put(tp);
    return sheet;
}
 
Example #26
Source File: ComboTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
    sheet = super.createSheet();
    // Make sure there is a "Properties" set:
    props = sheet.get(Sheet.PROPERTIES);
    if (props == null) {
        props = Sheet.createPropertiesSet();
        sheet.put(props);
    }
    props.put(tp);
    props.put(tp1);
    return sheet;
}
 
Example #27
Source File: ExternalReferenceDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected final synchronized Sheet getSheet() {
    if (sheet != null) {
        return sheet;
    }
    sheet = createSheet();
    firePropertySetsChange(null, null);
    return sheet;
}
 
Example #28
Source File: SunDescriptorDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
        Sheet s = new Sheet();
        Sheet.Set ss = new Sheet.Set();
        ss.setName(SUN_DD);
        ss.setDisplayName(NbBundle.getMessage(SunDescriptorDataNode.class, "PROP_deploymentSet")); // NOI18N
        ss.setShortDescription(NbBundle.getMessage(SunDescriptorDataNode.class, "HINT_deploymentSet")); // NOI18N
        ss.setValue("helpID", "TBD: sun-dd node"); // NOI18N
        
//        Property p = new PropertySupport.ReadWrite(PROPERTY_DOCUMENT_TYPE,
//                String.class,
//                NbBundle.getBundle(SunDescriptorDataNode.class).getString("PROP_documentDTD"),
//                NbBundle.getBundle(SunDescriptorDataNode.class).getString("HINT_documentDTD")) {
//            public Object getValue() {
//                java.math.BigDecimal version = dataObject.getDDRoot().getVersion();
//                return (version == null ? "" : version.toString());
//            }
//            
//            public void setValue(Object value) {
//                String val = (String) value;
//                if (EjbJar.VERSION_2_1.equals(val) && !val.equals(dataObject.getDDRoot().getVersion().toString())) {
//                    dataObject.getDDRoot().setVersion(new java.math.BigDecimal(val));
//                    dataObject.modelUpdatedFromUI();
//                }
//            }
//        };
//        ss.put(p);
        s.put(ss);
        
        return s;
    }
 
Example #29
Source File: SerialDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Sheet.Set createPropertiesSet(BeanNode.Descriptor descr, BeanDescriptor bd) {
    Sheet.Set props;
    props = Sheet.createPropertiesSet();
    if (descr.property != null) {
        convertProps (props, descr.property, this);
    }
    if (bd != null) {
        // #29550: help from the beaninfo on property tabs
        Object helpID = bd.getValue("propertiesHelpID"); // NOI18N
        if (helpID != null && helpID instanceof String) {
            props.setValue("helpID", helpID); // NOI18N
        }
    }
    return props;
}
 
Example #30
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();
    }
}