Java Code Examples for org.openide.nodes.PropertySupport#ReadOnly
The following examples show how to use
org.openide.nodes.PropertySupport#ReadOnly .
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: MatchedPropertyNode.java From netbeans with Apache License 2.0 | 6 votes |
/** * 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 2
Source File: MatchedRuleNode.java From netbeans with Apache License 2.0 | 6 votes |
/** * 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 3
Source File: EarDataNode.java From netbeans with Apache License 2.0 | 6 votes |
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 4
Source File: ClientDataNode.java From netbeans with Apache License 2.0 | 6 votes |
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 5
Source File: RepositoryNode.java From netbeans with Apache License 2.0 | 4 votes |
@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; }
Example 6
Source File: WildflyManagerNode.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Sheet createSheet() { Sheet sheet = super.createSheet(); Sheet.Set properties = sheet.get(Sheet.PROPERTIES); if (properties == null) { properties = Sheet.createPropertiesSet(); sheet.put(properties); } final InstanceProperties ip = getDeploymentManager().getInstanceProperties(); Node.Property property = new PropertySupport.ReadWrite( NbBundle.getMessage(WildflyManagerNode.class, "LBL_DISPLAY_NAME"), //NOI18N String.class, NbBundle.getMessage(WildflyManagerNode.class, "LBL_DISPLAY_NAME"), NbBundle.getMessage(WildflyManagerNode.class, "HINT_DISPLAY_NAME")) { @Override public Object getValue() { return ip.getProperty(WildflyPluginProperties.PROPERTY_DISPLAY_NAME); } @Override public void setValue(Object val) { ip.setProperty(WildflyPluginProperties.PROPERTY_DISPLAY_NAME, (String) val); } }; properties.put(property); // servewr name property = new PropertySupport.ReadOnly( NbBundle.getMessage(WildflyManagerNode.class, "LBL_SERVER_NAME"), //NOI18N String.class, NbBundle.getMessage(WildflyManagerNode.class, "LBL_SERVER_NAME"), NbBundle.getMessage(WildflyManagerNode.class, "HINT_SERVER_NAME")) { @Override public Object getValue() { return ip.getProperty(WildflyPluginProperties.PROPERTY_SERVER); } }; properties.put(property); //server location property = new PropertySupport.ReadOnly( NbBundle.getMessage(WildflyManagerNode.class, "LBL_SERVER_PATH"), //NOI18N String.class, NbBundle.getMessage(WildflyManagerNode.class, "LBL_SERVER_PATH"), NbBundle.getMessage(WildflyManagerNode.class, "HINT_SERVER_PATH")) { @Override public Object getValue() { return ip.getProperty(WildflyPluginProperties.PROPERTY_SERVER_DIR); } }; properties.put(property); //host property = new PropertySupport.ReadOnly( NbBundle.getMessage(WildflyManagerNode.class, "LBL_HOST"), //NOI18N String.class, NbBundle.getMessage(WildflyManagerNode.class, "LBL_HOST"), NbBundle.getMessage(WildflyManagerNode.class, "HINT_HOST")) { @Override public Object getValue() { return ip.getProperty(WildflyPluginProperties.PROPERTY_HOST); } }; properties.put(property); //port property = new PropertySupport.ReadOnly( NbBundle.getMessage(WildflyManagerNode.class, "LBL_PORT"), //NOI18N Integer.TYPE, NbBundle.getMessage(WildflyManagerNode.class, "LBL_PORT"), NbBundle.getMessage(WildflyManagerNode.class, "HINT_PORT")) { @Override public Object getValue() { return new Integer(ip.getProperty(WildflyPluginProperties.PROPERTY_PORT)); } }; properties.put(property); return sheet; }
Example 7
Source File: DependencyNode.java From BART with MIT License | 4 votes |
@Override protected Sheet createSheet() { Sheet sheet = Sheet.createDefault(); Sheet.Set set = Sheet.createPropertiesSet(); final Dependency dc = getLookup().lookup(Dependency.class); Property dependency= new PropertySupport.ReadOnly<String>("dependency", String.class, "Dependency ID: ", "") { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return dc.getId(); } }; dependency.setValue("htmlDisplayValue",R.HTML_Prop+dc.getId()+R.HTML_CL_Prop); dependency.setValue("suppressCustomEditor",Boolean.TRUE); Property dependencyType= new PropertySupport.ReadOnly<String>("dependencyType", String.class, "Type : ", "") { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return dc.getType(); } }; dependencyType.setValue("htmlDisplayValue",R.HTML_Prop+dc.getType()+R.HTML_CL_Prop); dependencyType.setValue("suppressCustomEditor",Boolean.TRUE); Property vioGQSize= new PropertySupport.ReadOnly<String>("VioGenQuerySize", String.class, "VioGenQuery Size : ", "") { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return dc.getVioGenQueries().size()+""; } }; vioGQSize.setValue("htmlDisplayValue",R.HTML_Prop+dc.getVioGenQueries().size()+R.HTML_CL_Prop); vioGQSize.setValue("suppressCustomEditor",Boolean.TRUE); set.put(dependency); set.put(dependencyType); set.put(vioGQSize); sheet.put(set); return sheet; }
Example 8
Source File: StatisticNode.java From BART with MIT License | 4 votes |
@Override protected Sheet createSheet() { Sheet sheet = Sheet.createDefault(); Sheet.Set set = Sheet.createPropertiesSet(); set.setName("statInfo");set.setDisplayName("Statistics Result info"); Sheet.Set set2 = Sheet.createPropertiesSet(); set2.setName("systemtInfo");set2.setDisplayName("System info"); final Statistic stat = getLookup().lookup(Statistic.class); if(stat == null)return sheet; try{ //set1 Property name = new PropertySupport.Reflection(stat,String.class,"getName",null); name.setName("name");name.setDisplayName("NAME :"); StringBuilder sbName = new StringBuilder(R.HTML_Prop); sbName.append(stat.getName()); sbName.append(R.HTML_CL_Prop); name.setValue("htmlDisplayValue",sbName.toString()); name.setValue("suppressCustomEditor", Boolean.TRUE); set.put(name); Property startTime = new PropertySupport.Reflection(stat,String.class,"getStarTime",null); startTime.setName("startTime");startTime.setDisplayName("Start Time : "); StringBuilder sbStartTime = new StringBuilder(R.HTML_Prop); sbStartTime.append(stat.getStarTime()); sbStartTime.append(R.HTML_CL_Prop); startTime.setValue("htmlDisplayValue",sbStartTime.toString()); startTime.setValue("suppressCustomEditor", Boolean.TRUE); set.put(startTime); Property timeExecution = new PropertySupport.Reflection(stat,double.class,"getTimeExecution",null); timeExecution.setName("timeExecution");timeExecution.setDisplayName("Execution Time : "); StringBuilder sbTimeExecution = new StringBuilder(R.HTML_Prop); sbTimeExecution.append(stat.getTimeExecution()); sbTimeExecution.append(R.HTML_CL_Prop); timeExecution.setValue("htmlDisplayValue",sbTimeExecution.toString()); timeExecution.setValue("suppressCustomEditor", Boolean.TRUE); set.put(timeExecution); Property changes = new PropertySupport.ReadOnly("changes", String.class , "Changes : ", "") { @Override public Object getValue() throws IllegalAccessException, InvocationTargetException { return stat.getNumCellChanges(); } }; StringBuilder sbchanges = new StringBuilder(R.HTML_Prop); sbchanges.append(stat.getNumCellChanges()); sbchanges.append(R.HTML_CL_Prop); changes.setValue("htmlDisplayValue",sbchanges.toString()); changes.setValue("suppressCustomEditor", Boolean.TRUE); set.put(changes); //Set 2 Property osName = new PropertySupport.Reflection(stat,String.class,"getOsName",null); osName.setName("osname");osName.setDisplayName("OS Name : "); StringBuilder sbOsName = new StringBuilder(R.HTML_Prop); sbOsName.append(stat.getOsName()); sbOsName.append(R.HTML_CL_Prop); osName.setValue("htmlDisplayValue",sbOsName.toString()); osName.setValue("suppressCustomEditor", Boolean.TRUE); set2.put(osName); Property osArch = new PropertySupport.Reflection(stat,String.class,"getOsArch",null); osArch.setName("osArch");osArch.setDisplayName("OS Arch : "); StringBuilder sbOsArch = new StringBuilder(R.HTML_Prop); sbOsArch.append(stat.getOsArch()); sbOsArch.append(R.HTML_CL_Prop); osArch.setValue("htmlDisplayValue",sbOsArch.toString()); osArch.setValue("suppressCustomEditor", Boolean.TRUE); set2.put(osArch); Property osVersion = new PropertySupport.Reflection(stat,String.class,"getOsVersion",null); osVersion.setName("osVersion");osVersion.setDisplayName("OS Version : "); StringBuilder sbosVersion = new StringBuilder(R.HTML_Prop); sbosVersion.append(stat.getOsVersion()); sbosVersion.append(R.HTML_CL_Prop); osVersion.setValue("htmlDisplayValue",sbosVersion.toString()); osVersion.setValue("suppressCustomEditor", Boolean.TRUE); set2.put(osVersion); Property javaVersion = new PropertySupport.Reflection(stat,String.class,"getJavaVersion",null); javaVersion.setName("osArch");javaVersion.setDisplayName("Java Version : "); StringBuilder sbjavaVersion = new StringBuilder(R.HTML_Prop); sbjavaVersion.append(stat.getJavaVersion()); sbjavaVersion.append(R.HTML_CL_Prop); javaVersion.setValue("htmlDisplayValue",sbjavaVersion.toString()); javaVersion.setValue("suppressCustomEditor", Boolean.TRUE); set2.put(javaVersion); }catch(Exception ex) { return sheet; } sheet.put(set); sheet.put(set2); return sheet; }
Example 9
Source File: MetadataElementLeafNode.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private PropertySupport[] createAttributeProperties() { List<PropertySupport> attributePropertyList = new ArrayList<>(); final int type = leaf.getDataType(); switch (type) { case ProductData.TYPE_INT32: attributePropertyList.add(new IntegerProperty("Value")); break; case ProductData.TYPE_UINT32: if(leaf.getData() instanceof ProductData.UTC) { attributePropertyList.add(new StringProperty("Value")); break; } attributePropertyList.add(new UIntegerProperty("Value")); break; case ProductData.TYPE_FLOAT64: attributePropertyList.add(new DoubleProperty("Value")); break; default: attributePropertyList.add(new StringProperty("Value")); } PropertySupport.ReadOnly<String> typeProperty = new PropertySupport.ReadOnly<String>("Type", String.class, "Type", null) { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return ProductData.getTypeString(leaf.getDataType()); } }; attributePropertyList.add(typeProperty); String unit = leaf.getUnit(); if (StringUtils.isNotNullAndNotEmpty(unit)) { PropertySupport.ReadOnly<String> unitProperty = new PropertySupport.ReadOnly<String>("Unit", String.class, "Unit", null) { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return leaf.getUnit(); } }; attributePropertyList.add(unitProperty); } String description = leaf.getDescription(); if (StringUtils.isNotNullAndNotEmpty(description)) { PropertySupport.ReadOnly<String> descriptionProperty = new PropertySupport.ReadOnly<String>("Description", String.class, "Description", null) { @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return leaf.getDescription(); } }; attributePropertyList.add(descriptionProperty); } return attributePropertyList.toArray(new PropertySupport[attributePropertyList.size()]); }