当前位置: 首页>>代码示例>>Java>>正文


Java PropertySupport.ReadOnly方法代码示例

本文整理汇总了Java中org.openide.nodes.PropertySupport.ReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java PropertySupport.ReadOnly方法的具体用法?Java PropertySupport.ReadOnly怎么用?Java PropertySupport.ReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.nodes.PropertySupport的用法示例。


在下文中一共展示了PropertySupport.ReadOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSheet

import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:RepositoryNode.java

示例2: createSheet

import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
@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;
}
 
开发者ID:dbunibas,项目名称:BART,代码行数:42,代码来源:DependencyNode.java

示例3: createSheet

import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
@Override
    protected Sheet createSheet() {
        Sheet sheet = Sheet.createDefault();


        Sheet.Set setLinkedFile = Sheet.createPropertiesSet();
        setLinkedFile.setDisplayName("Linked file properties");
        setLinkedFile.setName("linked_file_properties");
        final FileDescriptor desc = getDataObject().getDescriptor();
        PropertySupport.ReadOnly<String> propOrigPath = new PropertySupport.ReadOnly<String>(
                "file_path", String.class, "Path to original file", "This is the path this descriptor links to") {
            @Override public String getValue() throws IllegalAccessException, InvocationTargetException {
                return desc.getPath().toAbsolutePath().toString();
            }
        };
        PropertySupport.ReadOnly<String> propSize = new PropertySupport.ReadOnly<String>(
                "file_size", String.class, "Size of original file", "The size of the file this descriptor links to") {
            @Override public String getValue() throws IllegalAccessException, InvocationTargetException {
                return String.format("%,.2f MB", (double)(desc.getSize()) / (1024 * 1024));
            }
        };
        

        setLinkedFile.put(propOrigPath);
        setLinkedFile.put(propSize);
        sheet.put(setLinkedFile);


        Sheet.Set setDescriptor = Sheet.createPropertiesSet();
        setDescriptor.setDisplayName("Descriptor properties");
        setDescriptor.setName("descriptor_properties");
        PropertySupport.ReadOnly<String> propUID = new PropertySupport.ReadOnly<String>(
                "desc_uid", String.class, "Descriptor UID", "Unique ID assigned to the descriptor at creation time") {
            @Override public String getValue() throws IllegalAccessException, InvocationTargetException {
                return desc.getUID();
            }
        };
        PropertySupport.ReadOnly<String> propDescPath = new PropertySupport.ReadOnly<String>(
                "desc_path", String.class, "Path to descriptor", "The path to the descriptor file") {
            @Override public String getValue() throws IllegalAccessException, InvocationTargetException {
                FileObject fo = getDataObject().getPrimaryFile();
                return fo.toURI().toASCIIString();
            }
        };
        

        setDescriptor.put(propDescPath);
        setDescriptor.put(propUID);
        sheet.put(setDescriptor);


//        try {
//            FileDescriptorDataObject descDataObject = getDataObject();
//            DataObject linkedDataObj = DataObject.find(FileUtil.toFileObject(desc.getPath().toFile()));
//            Sheet.Set setOrig = Sheet.createPropertiesSet();
//            //setOrig.setValue("tabName", "Original properties");
//            setOrig.setDisplayName("Properties from the original node");
//            setOrig.setName("props_copied");
//            PropertySet[] propertySets = linkedDataObj.getNodeDelegate().getPropertySets();
//            for (PropertySet propertySet : propertySets) {
//                Property<?>[] properties = propertySet.getProperties();
//                for (Property<?> property : properties) {
//                    setOrig.put(property);
//                }
//            }
//            sheet.put(setOrig);
//        } catch (DataObjectNotFoundException ex) {
//            Exceptions.printStackTrace(ex);
//        }

        return sheet;
    }
 
开发者ID:chhh,项目名称:batmass,代码行数:73,代码来源:FileDescriptorNode.java

示例4: createAttributeProperties

import org.openide.nodes.PropertySupport; //导入方法依赖的package包/类
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()]);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:53,代码来源:MetadataElementLeafNode.java


注:本文中的org.openide.nodes.PropertySupport.ReadOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。