/** * Used to build property for each position coordinate of various nodes * (x,y,z) in the same way. * * @return Property for that coordinate */ private Property buildMultipleNodesGeneralPositionProperty(MultipleNodesPropertiesWrapper nodesWrapper, String coordinate) throws NoSuchMethodException { //Position: Property p = new PropertySupport.Reflection(nodesWrapper, Float.class, "getNodes" + coordinate.toUpperCase(), "setNodes" + coordinate.toUpperCase()); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.position.text", coordinate)); p.setName(coordinate); return p; } }
PropertySupport.Reflection support = new PropertySupport.Reflection( bean, p.getPropertyType(), p.getReadMethod(), p.getWriteMethod() ); support.setName(p.getName()); support.setDisplayName(p.getDisplayName()); support.setShortDescription(p.getShortDescription()); support.setPropertyEditorClass(p.getPropertyEditorClass()); support.setValue(aname, p.getValue(aname));
/** * Returns property's value, can be <code>null</code> * * @return property's value */ public Object getValue() { try { return property.getValue(); } catch (Exception e) { Logger.getLogger("").log(Level.SEVERE, "Error while getting value for property '" + getName() + "'", e); } return null; }
p = new Reflection<String>(box, String.class, "getStyles", null); // NOI18N p.setName("styles"); // NOI18N p.setDisplayName(getBundleString("LBL_Styles")); ss.put(p); p = new Reflection<String>(box, String.class, "getComputedStyles", null); // NOI18N p.setName("compstyles"); // NOI18N p.setDisplayName(getBundleString("LBL_ComputedStyles")); ss.put(p); p = new Reflection<String>(box, String.class, "getRules", null); // NOI18N p.setName("rules"); // NOI18N p.setDisplayName(getBundleString("LBL_Rules")); ss.put(p); p = new Reflection<Color>(box, Color.class, "getBg", null); // NOI18N p.setName("bg"); // NOI18N p.setDisplayName(getBundleString("LBL_Background")); p = new Reflection<Point>(box, Point.class, "getPosition", null); // NOI18N p.setName("position"); // NOI18N p.setDisplayName(getBundleString("LBL_Position")); ss.put(p); p = new Reflection<Point>(box, Point.class, "getRelPosition", null); // NOI18N p.setName("relposition"); // NOI18N p.setDisplayName(getBundleString("LBL_RelPosition")); ss.put(p);
p = new PropertySupport.Reflection(nodesWrapper, Float.class, "getNodesSize", "setNodesSize"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.size.text")); p.setName("size"); p = new PropertySupport.Reflection(nodesWrapper, Color.class, "getNodesColor", "setNodesColor"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.color.text")); p.setName("color"); p = new PropertySupport.Reflection(nodesWrapper, Color.class, "getLabelsColor", "setLabelsColor"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.label.color.text")); p.setName("labelcolor"); p = new PropertySupport.Reflection(nodesWrapper, Float.class, "getLabelsSize", "setLabelsSize"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.label.size.text")); p.setName("labelsize"); p = new PropertySupport.Reflection(nodesWrapper, Boolean.class, "getLabelsVisible", "setLabelsVisible"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.label.visible.text")); p.setName("labelvisible"); p = new PropertySupport.Reflection(node, Float.TYPE, "size", "setSize"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.size.text")); p.setName("size"); p = new PropertySupport.Reflection(nodeWrapper, Color.class, "getNodeColor", "setNodeColor"); p.setDisplayName(NbBundle.getMessage(EditNodes.class, "EditNodes.color.text")); p.setName("color"); p = new PropertySupport.Reflection(textProperties, Float.TYPE, "getSize", "setSize");
PropertySupport.Reflection support = new PropertySupport.Reflection ( bean, p.getPropertyType (), p.getReadMethod (), p.getWriteMethod () ); support.setName (p.getName ()); support.setDisplayName (p.getDisplayName ()); support.setShortDescription (p.getShortDescription ()); support.setPropertyEditorClass (p.getPropertyEditorClass ()); support.setValue(aname, p.getValue(aname));
p = new PropertySupport.Reflection(edgesWrapper, Color.class, "getEdgesColor", "setEdgesColor"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.color.text")); p.setName("color"); p = new PropertySupport.Reflection(edgesWrapper, Color.class, "getLabelsColor", "setLabelsColor"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.label.color.text")); p.setName("labelcolor"); p = new PropertySupport.Reflection(edgesWrapper, Float.class, "getLabelsSize", "setLabelsSize"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.label.size.text")); p.setName("labelsize"); p = new PropertySupport.Reflection(edgesWrapper, Boolean.class, "getLabelsVisible", "setLabelsVisible"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.label.visible.text")); p.setName("labelvisible"); p = new PropertySupport.Reflection(edgeWrapper, Color.class, "getEdgeColor", "setEdgeColor"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.color.text")); p.setName("color"); p = new PropertySupport.Reflection(textProperties, Float.TYPE, "getSize", "setSize"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.label.size.text")); p.setName("labelsize"); p = new PropertySupport.Reflection(edgeWrapper, Color.class, "getLabelColor", "setLabelColor"); p.setDisplayName(NbBundle.getMessage(EditEdges.class, "EditEdges.label.color.text")); p.setName("labelcolor"); p = new PropertySupport.Reflection(textProperties, Boolean.TYPE, "isVisible", "setVisible");
p = new PropertySupport.Reflection(wrap, type, "getValue" + type.getSimpleName(), "setValue" + type.getSimpleName()); } else {//Use the AttributeType as String: p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", "setValueAsString"); p = new PropertySupport.Reflection(wrap, type, "getValue" + type.getSimpleName(), null); } else {//Use the AttributeType as String: p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", null);
PropertySupport.Reflection support = new PropertySupport.Reflection ( bean, p.getPropertyType (), p.getReadMethod (), p.getWriteMethod () ); support.setName (p.getName ()); support.setDisplayName (p.getDisplayName ()); support.setShortDescription (p.getShortDescription ()); support.setPropertyEditorClass (p.getPropertyEditorClass ()); support.setValue(aname, p.getValue(aname));
p = new PropertySupport.Reflection(wrap, type, "getValue" + type.getSimpleName(), "setValue" + type.getSimpleName()); } else {//Use the AttributeType as String: p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", "setValueAsString"); p = new PropertySupport.Reflection(wrap, type, "getValue" + type.getSimpleName(), null); } else {//Use the AttributeType as String: p = new PropertySupport.Reflection(wrap, String.class, "getValueAsString", null);
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) {
Sheet.Set basicProps = sheet.get(Sheet.PROPERTIES); try { PropertySupport.Reflection id = new PropertySupport.Reflection<String>(info, String.class, "getId", null); //NOI18N id.setName("Id"); //NOI18N id.setDisplayName("Id"); id.setShortDescription(""); //NOI18N PropertySupport.Reflection name = new PropertySupport.Reflection<String>(info, String.class, "getName", null); //NOI18N name.setName("name"); //NOI18N name.setDisplayName("Name"); name.setShortDescription(""); //NOI18N PropertySupport.Reflection type = new PropertySupport.Reflection<String>(info, String.class, "getType", null); //NOI18N type.setName("type"); //NOI18N type.setDisplayName("Repository Manager Type"); PropertySupport.Reflection local = new PropertySupport.Reflection<Boolean>(info, Boolean.TYPE, "isLocal", null); //NOI18N local.setName("local"); //NOI18N local.setDisplayName("Local"); local.setShortDescription(""); PropertySupport.Reflection localRepoLocation = new PropertySupport.Reflection<String>(info, String.class, "getRepositoryPath", null); //NOI18N localRepoLocation.setName("repositoryPath"); //NOI18N localRepoLocation.setDisplayName("Local repository path"); PropertySupport.Reflection remoteDownloadable = new PropertySupport.Reflection<Boolean>(info, Boolean.TYPE, "isRemoteDownloadable", null); //NOI18N remoteDownloadable.setName("remoteDownloadable"); //NOI18N remoteDownloadable.setDisplayName("Remote Index Downloadable"); PropertySupport.Reflection repoURL = new PropertySupport.Reflection<String>(info, String.class, "getRepositoryUrl", null); //NOI18N repoURL.setName("repositoryUrl"); //NOI18N repoURL.setDisplayName("Remote Repository URL"); PropertySupport.Reflection indexURL = new PropertySupport.Reflection<String>(info, String.class, "getIndexUpdateUrl", null); //NOI18N indexURL.setName("indexUpdateUrl"); //NOI18N indexURL.setDisplayName("Remote Index URL");
p.setName("fromOutcome"); // NOI18N p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "Outcome")); // NOI18N p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "OutcomeHint")); // NOI18N ss.put(p); p.setName("fromView"); // NOI18N p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "FromAction")); // NOI18N p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "FromActionHint")); // NOI18N p.setName("toViewId"); // NOI18N p.setDisplayName(NbBundle.getMessage(NavigationCaseEdge.class, "ToViewId")); // NOI18N p.setShortDescription(NbBundle.getMessage(NavigationCaseEdge.class, "ToViewHint")); // NOI18N
Sheet.Set basicProps = sheet.get(Sheet.PROPERTIES); try { PropertySupport.Reflection artifactId = new PropertySupport.Reflection<String>(art, String.class, "getArtifactId", null); //NOI18N artifactId.setName("artifactId"); //NOI18N artifactId.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Artifact")); artifactId.setShortDescription(""); //NOI18N PropertySupport.Reflection groupId = new PropertySupport.Reflection<String>(art, String.class, "getGroupId", null); //NOI18N groupId.setName("groupId"); //NOI18N groupId.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Group")); groupId.setShortDescription(""); //NOI18N PropertySupport.Reflection version = new PropertySupport.Reflection<String>(art, String.class, "getVersion", null); //NOI18N version.setName("version"); //NOI18N version.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Version")); version.setShortDescription(org.openide.util.NbBundle.getMessage(DependencyNode.class, "HINT_Version")); PropertySupport.Reflection type = new PropertySupport.Reflection<String>(art, String.class, "getType", null); //NOI18N type.setName("type"); //NOI18N type.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Type")); PropertySupport.Reflection scope = new PropertySupport.Reflection<String>(art, String.class, "getScope", null); //NOI18N scope.setName("scope"); //NOI18N scope.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Scope")); PropertySupport.Reflection classifier = new PropertySupport.Reflection<String>(art, String.class, "getClassifier", null); //NOI18N classifier.setName("classifier"); //NOI18N classifier.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Classifier")); PropertySupport.Reflection hasJavadoc = new PropertySupport.Reflection<Boolean>(this, Boolean.TYPE, "hasJavadocInRepository", null); //NOI18N hasJavadoc.setName("javadoc"); //NOI18N hasJavadoc.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Javadoc_Locally")); PropertySupport.Reflection hasSources = new PropertySupport.Reflection<Boolean>(this, Boolean.TYPE, "hasSourceInRepository", null); //NOI18N hasSources.setName("sources"); //NOI18N hasSources.setDisplayName(org.openide.util.NbBundle.getMessage(DependencyNode.class, "PROP_Sources_Locally"));
p.setHidden(true); } else { ((PropertySupport.Reflection<?>)p).setPropertyEditorClass(c);
/** * Creates a node property of the given key (same as the column keys) * and specific getter/setter methods on the given object. * * @param key property name (same as matching column). * @param type Class of the property (e.g. String.class). * @param inst object on which to reflect. * @param getter name of getter method for property value. * @param setter name of setter method for property value (may be null). * @return new property. */ private Node.Property createProperty(String key, Class type, Object inst, String getter, String setter) { Property prop = null; try { prop = new Reflection(inst, type, getter, setter); prop.setName(key); prop.setDisplayName(NbBundle.getMessage( ExternalReferenceDataNode.class, "CTL_ExternalReferenceCreator_Column_Name_" + key)); prop.setShortDescription(NbBundle.getMessage( ExternalReferenceDataNode.class, "CTL_ExternalReferenceCreator_Column_Desc_" + key)); } catch (NoSuchMethodException nsme) { ErrorManager.getDefault().notify(nsme); } return prop; }
@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; } }
PropertySupport.Reflection property = new PropertySupport.Reflection( layout, valueType, getMethod, setMethod); property.setName(propertyName); property.setShortDescription(propertyDescription); property.setPropertyEditorClass(editorClass);
protected Sheet createSheet () { Sheet s = Sheet.createDefault (); Sheet.Set ss = s.get (Sheet.PROPERTIES); Node.Property p; p = createNameProperty (obj); ss.put (p); FileObject fo = getDataObject().getPrimaryFile(); if (couldBeTemplate(fo) && !fo.isReadOnly()) { try { p = new PropertySupport.Reflection(obj, Boolean.TYPE, "isTemplate", "setTemplate"); // NOI18N p.setName(DataObject.PROP_TEMPLATE); p.setDisplayName(DataObject.getString("PROP_template")); p.setShortDescription(DataObject.getString("HINT_template")); ss.put(p); } catch (Exception ex) { throw new InternalError(); } } if (fo.isData()) { ss.put(new AllFilesProperty()); ss.put(new SizeProperty()); ss.put(new LastModifiedProperty()); } return s; }
/** * Create a property, with a particular {@link PropertyEditor}. A particular * editor must be specified when the property type don't have a registered * editor class. * The parameter <code>propertyName</code> will be used as the canonical name of the <code>LayoutProperty</code>. * @param layout The layout instance * @param valueType The type of the property value, ex: <code>Double.class</code> * @param propertyName The display name of the property * @param propertyCategory A category string or <code>null</code> for using * default category * @param propertyDescription A description string for the property * @param getMethod The name of the get method for this property, must exist * to make Java reflexion working. * @param setMethod The name of the set method for this property, must exist * to make Java reflexion working. * @param editorClass A <code>PropertyEditor</code> class for the given type * @return the created property * @throws NoSuchMethodException if the getter or setter methods cannot be found */ public static LayoutProperty createProperty(Layout layout, Class valueType, String propertyName, String propertyCategory, String propertyDescription, String getMethod, String setMethod, Class<? extends PropertyEditor> editorClass) throws NoSuchMethodException { PropertySupport.Reflection property = new PropertySupport.Reflection( layout, valueType, getMethod, setMethod); property.setName(propertyName); property.setShortDescription(propertyDescription); property.setPropertyEditorClass(editorClass); return new LayoutProperty(property, propertyCategory, propertyName); }