Java Code Examples for org.openide.nodes.Sheet#Set

The following examples show how to use org.openide.nodes.Sheet#Set . 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: AnnotationTypesNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Create properties sheet */
   protected Sheet createSheet() {
       Sheet sheet = super.createSheet();
       
Sheet.Set ps = sheet.get (Sheet.PROPERTIES);
if (ps == null) {
    ps = Sheet.createPropertiesSet ();
}
       
       ps.put(createProperty(AnnotationTypes.PROP_BACKGROUND_DRAWING, boolean.class)); //NOI18N
       ps.put(createProperty(AnnotationTypes.PROP_BACKGROUND_GLYPH_ALPHA, int.class)); //NOI18N
       ps.put(createProperty(AnnotationTypes.PROP_COMBINE_GLYPHS, boolean.class));    //NOI18N
       ps.put(createProperty(AnnotationTypes.PROP_GLYPHS_OVER_LINE_NUMBERS, boolean.class));    //NOI18N
       ps.put(createProperty(AnnotationTypes.PROP_SHOW_GLYPH_GUTTER, boolean.class));    //NOI18N
       sheet.put(ps);
       
       return sheet;
   }
 
Example 2
Source File: FindHelpTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected Sheet createSheet() {
    Sheet s = super.createSheet();
    Sheet.Set ss = Sheet.createPropertiesSet();
    ss.put(new WithoutHelpProperty("prop1"));
    ss.put(new WithoutHelpProperty("prop2"));
    ss.put(new WithoutHelpProperty("prop3"));
    ss.setValue("tabName", "Tab 1");
    ss.setValue("helpID", "set-help-id");
    s.put(ss);
    ss = Sheet.createExpertSet();
    ss.put(new WithoutHelpProperty("prop4"));
    ss.put(new WithoutHelpProperty("prop5"));
    ss.setValue("tabName", "Tab 2");
    s.put(ss);
    return s;
}
 
Example 3
Source File: JmeDistanceLodCalculator.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("DistanceLodControl");
    DistanceLodCalculator obj = lodCalculator;
    if (obj == null) {
        return sheet;
    }

    set.put(makeProperty(obj, float.class, "getLodMultiplier", "setLodMultiplier", "Multiplier"));
    
    sheet.put(set);
    return sheet;

}
 
Example 4
Source File: JmeAnimControl.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("AnimControl");
    set.setName(AnimControl.class.getName());
    if (animControl == null) {
        return sheet;
    }

    set.put(new AnimationProperty(animControl));

    sheet.put(set);
    return sheet;

}
 
Example 5
Source File: PropertiesFlushTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void replaceSets() {
    Sheet sheet = new Sheet();
    Sheet.Set props = sheet.get(Sheet.PROPERTIES);
    if (props == null) {
        props = Sheet.createPropertiesSet();
    }
    props.put(new TProperty("after - first", true));
    sheet.put(props);
    props = sheet.get(Sheet.EXPERT);
    if (props == null) {
        props = Sheet.createExpertSet();
    }
    props.put(new TProperty("after - second", true));
    sheet.put(props);
    setSheet(sheet);
}
 
Example 6
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 7
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 8
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 9
Source File: NodeSelector.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Node.PropertySet[] getPropertySets() {
    if (propSheet == null) {
        propSheet = Sheet.createDefault();
        Sheet.Set nodePropertySet = propSheet.get(Sheet.PROPERTIES);
        
        if (grammarQuery != null && hintContext != null) {
            Node.Property[] nodeProperties = grammarQuery.getProperties(hintContext);
            if (nodeProperties != null && nodeProperties.length > 0) {
                // The GrammarQuery controls the properties
                nodePropertySet.put(nodeProperties);
                return propSheet.toArray();
            }
        }
        
        // By default, we try to create properties from the attributes of the
        // selected element.
        org.w3c.dom.Element attributeOwningElem = null;
        if (hintContext != null) {
            if (hintContext.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
                attributeOwningElem = (org.w3c.dom.Element)hintContext;
            } else if (hintContext.getNodeType() == org.w3c.dom.Node.ATTRIBUTE_NODE) {
                attributeOwningElem = (org.w3c.dom.Element)((org.w3c.dom.Attr)hintContext).getOwnerElement();
            }
        }
        
        if (attributeOwningElem != null) {
            // We have a selected element that might have attributes
            org.w3c.dom.NamedNodeMap attributes = attributeOwningElem.getAttributes();
            for (int ind = 0; ind < attributes.getLength(); ind++) {
                org.w3c.dom.Node node = attributes.item(ind);
                nodePropertySet.put(new AttributeProperty(attributeOwningElem, node.getNodeName()));
            }
            
        }
    }
    
    return propSheet.toArray();
}
 
Example 10
Source File: BaseNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void clearProperties() {
    Sheet.Set propertySet = getSheet().get(Sheet.PROPERTIES);
    
    // This should be save - getProperties return an array, not a list
    // => assumption: This is a copy of the property set
    for (Property prop : propertySet.getProperties()) {
        propertySet.remove(prop.getName());
    }
    
    propMap.clear();
}
 
Example 11
Source File: SerialDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Method that converts properties of an object.
 * @param set set to add properties to
 * @param arr array of Node.Property and Node.IndexedProperty
 * @param ido provides task to invoke when a property changes
 */
private static final void convertProps (
    Sheet.Set set, Node.Property<?>[] arr, SerialDataNode ido
) {
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] instanceof Node.IndexedProperty) {
            set.put (new I ((Node.IndexedProperty)arr[i], ido));
        } else {
            set.put (new P (arr[i], ido));
        }
    }
}
 
Example 12
Source File: TreeModelNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected Sheet createSheet() {
    Sheet sheet = Sheet.createDefault();
    Sheet.Set ps = Sheet.createPropertiesSet ();
    int i, k = columns.length;
    for (i = 0; i < k; i++)
        ps.put (new MyProperty (columns [i], treeModelRoot));
    sheet.put (ps);
    return sheet;
}
 
Example 13
Source File: PUDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Sheet createSheet() {
    Sheet s = super.createSheet();
    Sheet.Set ss = s.get(Sheet.PROPERTIES);
    if (ss == null) {
        ss = Sheet.createPropertiesSet();
        s.put(ss);
    }
    // TODO add some relevant properties: ss.put(...)
    return s;
}
 
Example 14
Source File: PNode.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private void includeAbstractedMetadata(final Sheet.Set set) {
    final MetadataElement root = getProduct().getMetadataRoot();
    if (root != null) {
        final MetadataElement absRoot = root.getElement("Abstracted_Metadata");
        if (absRoot != null) {
            set.put(new PropertySupport.ReadOnly<String>("mission", String.class, "Mission", "Earth Observation Mission") {
                @Override
                public String getValue() {
                    return absRoot.getAttributeString("mission");
                }
            });
            set.put(new PropertySupport.ReadOnly<String>("mode", String.class, "Acquisition Mode", "Sensor Acquisition Mode") {
                @Override
                public String getValue() {
                    return absRoot.getAttributeString("ACQUISITION_MODE");
                }
            });
            set.put(new PropertySupport.ReadOnly<String>("pass", String.class, "Pass", "Orbital Pass") {
                @Override
                public String getValue() {
                    return absRoot.getAttributeString("pass");
                }
            });
            set.put(new PropertySupport.ReadOnly<String>("track", String.class, "Track", "Relative Orbit") {
                @Override
                public String getValue() {
                    return absRoot.getAttributeString("REL_ORBIT");
                }
            });
            set.put(new PropertySupport.ReadOnly<String>("orbit", String.class, "Orbit", "Absolute Orbit") {
                @Override
                public String getValue() {
                    return absRoot.getAttributeString("ABS_ORBIT");
                }
            });
        }
    }
}
 
Example 15
Source File: SerialDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void changeSheet(Sheet orig, SerialDataNode task) {
    Sheet.Set props = orig.get (Sheet.PROPERTIES);
    if (props != null) {
        convertProps (props, props.getProperties(), task);
    }

    props = orig.get(Sheet.EXPERT);
    if (props != null) {
        convertProps (props, props.getProperties(), task);
    }
}
 
Example 16
Source File: PersistenceManagerBeanDataNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void createProperties(Object bean, java.beans.BeanInfo info) {
        BeanNode.Descriptor d = BeanNode.computeProperties(bean, info);
        Node.Property p = new PropertySupport.ReadWrite(
        "extraParams", PersistenceManagerBeanDataNode.class,  //NOI18N
        NbBundle.getMessage(PersistenceManagerBeanDataNode.class,"LBL_ExtParams"), //NOI18N
        NbBundle.getMessage(PersistenceManagerBeanDataNode.class,"DSC_ExtParams") //NOI18N
        ) {
            public Object getValue() {
                return resource.getExtraParams();
            }
            
            public void setValue(Object val){
                if (val instanceof Object[])
                    resource.setExtraParams((Object[])val);
            }
            
            public PropertyEditor getPropertyEditor(){
                return new NameValuePairsPropertyEditor(resource.getExtraParams());
            }
        };
        
        Sheet sets = getSheet();
        Sheet.Set pset = Sheet.createPropertiesSet();
        pset.put(d.property);
        pset.put(p);
//        pset.setValue("helpID", "AS_Res_PMF_Props"); //NOI18N
        sets.put(pset);
    }
 
Example 17
Source File: EmulatorDeviceNode.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
private void addEmulatorControls(Sheet.Set defset) {
    if (!device.isEmulator()) {
        return;
    }

    for (final EmulatorControlSupport.Control ctrl : EmulatorControlSupport.Control.values()) {
        defset.put(new PropertySupport.ReadWrite<String>(
                ctrl.name(),
                String.class,
                ctrl.getDisplayName(),
                ctrl.getDescription()) {

            @Override
            public String getValue() throws IllegalAccessException, InvocationTargetException {
                return emulatorControl.getData(ctrl);
            }

            @Override
            public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                emulatorControl.setData(ctrl, val);
            }

            @Override
            public PropertyEditor getPropertyEditor() {
                return PropertyUtils.stringPropertyEditorWithTags(emulatorControl.getTags(ctrl));
            }
        });
    }
}
 
Example 18
Source File: OccurrenceTupleNode.java    From Llunatic with GNU General Public License v3.0 4 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(TID) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return cellref.getTupleOID().getValue().toString();
        }

        //TODO: implement inplace editor
        @Override
        public boolean canWrite() {
            return true;
        }
    });
    set.put(new StringProperty(TABLE) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return cellref.getAttributeRef().getTableName();
        }

        //TODO: implement inplace editor
        @Override
        public boolean canWrite() {
            return true;
        }
    });
    set.put(new StringProperty(ATTRIBUTE) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return cellref.getAttributeRef().getName();
        }

        //TODO: implement inplace editor
        @Override
        public boolean canWrite() {
            return true;
        }
    });
    set.put(new StringProperty(PREVIOUS_VALUE, Bundle.COL_PreviousValue()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            if (previousValue == null) {
                return "-";
            }
            return previousValue.toString();
        }

        //TODO: implement inplace editor
        @Override
        public boolean canWrite() {
            return true;
        }
    });
    
    set.put(new StringProperty(ORIGINAL_VALUE, Bundle.COL_OriginalValue()) {
        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return originalValue.toString();
        }

        //TODO: implement inplace editor
        @Override
        public boolean canWrite() {
            return true;
        }
    });
    return sheet;
}
 
Example 19
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;
}
 
Example 20
Source File: ClientNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public PropertySet[] getPropertySets() {
    final Sheet.Set ps = Sheet.createPropertiesSet();
    ps.put(new PropertySupport.ReadOnly<String>(
            "PROP_ClientDescription",
            String.class,
            NbBundle.getMessage(ClientNode.class, "PROP_ClientDescription"),
            NbBundle.getMessage(ClientNode.class, "DESC_ClientDescription")) {

        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return client.getClientData().getClientDescription();
        }
    });
    ps.put(new PropertySupport.ReadOnly<Integer>(
            "PROP_Pid",
            Integer.class,
            NbBundle.getMessage(ClientNode.class, "PROP_Pid"),
            NbBundle.getMessage(ClientNode.class, "DESC_Pid")) {

        @Override
        public Integer getValue() throws IllegalAccessException, InvocationTargetException {
            return client.getClientData().getPid();
        }
    });
    ps.put(new PropertySupport.ReadOnly<String>(
            "PROP_VmId",
            String.class,
            NbBundle.getMessage(ClientNode.class, "PROP_VmId"),
            NbBundle.getMessage(ClientNode.class, "DESC_VmId")) {

        @Override
        public String getValue() throws IllegalAccessException, InvocationTargetException {
            return client.getClientData().getVmIdentifier();
        }
    });
    ps.put(new PropertySupport.ReadOnly<Integer>("PROP_Port",
            Integer.class,
            NbBundle.getMessage(ClientNode.class, "PROP_Port"),
            NbBundle.getMessage(ClientNode.class, "DESC_Port")) {

        @Override
        public Integer getValue() throws IllegalAccessException, InvocationTargetException {
            return client.getDebuggerListenPort();
        }
    });
    return new PropertySet[]{
        ps
    };
}