use of org.openide.nodes.Sheet in project ACS by ACS-Community.
the class GPBeanNode method createSheet.
//
// -- PROTECTED METHODS -----------------------------------------------
//
/**
* Initialize a default
* property sheet; commonly overridden. If {@link #getSheet}
* is called and there is not yet a sheet,
* this method is called to allow a subclass
* to specify its properties.
* <P>
* <em>Warning:</em> Do not call <code>getSheet</code> in this method.
* <P>
* The default implementation returns an empty sheet.
*
* @return the sheet with initialized values (never <code>null</code>)
*/
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
// Make sure there is a "Properties" set:
// get by name, not display name
Set props = sheet.get(Sheet.PROPERTIES);
if (props == null) {
props = Sheet.createPropertiesSet();
sheet.put(props);
}
//props.put(new MyProp(someParams));
return sheet;
}
use of org.openide.nodes.Sheet in project gephi by gephi.
the class PreviewNode method createSheet.
@Override
protected Sheet createSheet() {
Sheet sheet = Sheet.createDefault();
PreviewController controller = Lookup.getDefault().lookup(PreviewController.class);
Set<Renderer> enabledRenderers = null;
if (controller.getModel() != null && controller.getModel().getManagedRenderers() != null) {
enabledRenderers = new HashSet<>();
for (ManagedRenderer mr : controller.getModel().getManagedRenderers()) {
if (mr.isEnabled()) {
enabledRenderers.add(mr.getRenderer());
}
}
}
PreviewModel model = controller.getModel();
if (model != null) {
PreviewProperties properties = model.getProperties();
Map<String, Sheet.Set> sheetSets = new HashMap<>();
for (PreviewProperty property : properties.getProperties()) {
Object source = property.getSource();
boolean propertyEnabled = true;
if (source instanceof Renderer) {
propertyEnabled = enabledRenderers == null || enabledRenderers.contains((Renderer) source);
}
if (propertyEnabled) {
String category = property.getCategory();
Sheet.Set sheetSet = sheetSets.get(category);
if (sheetSet == null) {
sheetSet = Sheet.createPropertiesSet();
sheetSet.setDisplayName(category);
sheetSet.setName(category);
}
Node.Property nodeProperty = null;
PreviewProperty[] parents = properties.getParentProperties(property);
PreviewProperty[] children = properties.getChildProperties(property);
if (parents.length > 0) {
nodeProperty = new ChildPreviewPropertyWrapper(property, parents);
} else if (children.length > 0) {
nodeProperty = new ParentPreviewPropertyWrapper(property, children);
} else {
nodeProperty = new PreviewPropertyWrapper(property);
}
sheetSet.put(nodeProperty);
sheetSets.put(category, sheetSet);
}
}
//Ordered
Sheet.Set nodeSet = sheetSets.remove(PreviewProperty.CATEGORY_NODES);
Sheet.Set nodeLabelSet = sheetSets.remove(PreviewProperty.CATEGORY_NODE_LABELS);
Sheet.Set edgeSet = sheetSets.remove(PreviewProperty.CATEGORY_EDGES);
Sheet.Set arrowsSet = sheetSets.remove(PreviewProperty.CATEGORY_EDGE_ARROWS);
Sheet.Set edgeLabelSet = sheetSets.remove(PreviewProperty.CATEGORY_EDGE_LABELS);
if (nodeSet != null) {
sheet.put(nodeSet);
}
if (nodeLabelSet != null) {
sheet.put(nodeLabelSet);
}
if (edgeSet != null) {
sheet.put(edgeSet);
}
if (arrowsSet != null) {
sheet.put(arrowsSet);
}
if (edgeLabelSet != null) {
sheet.put(edgeLabelSet);
}
for (Sheet.Set sheetSet : sheetSets.values()) {
sheet.put(sheetSet);
}
}
return sheet;
}
use of org.openide.nodes.Sheet in project ACS by ACS-Community.
the class BeanNode method createProperties.
//
// -- PROTECTED METHODS -----------------------------------------------
//
/**
* Prepare node properties based on the bean, storing them into the current property sheet.
* Called when the bean info is ready.
* This implementation always creates a set for standard properties
* and may create a set for expert ones if there are any.
* @see org.openide.nodes.BeanNode#computeProperties
* @param bean bean to compute properties for
* @param info information about the bean
* @param propertyInfo extra information of some properties (possibly null)
*/
protected void createProperties(Object bean, BeanInfo info, PropertyInfo[] propertyInfo) {
Descriptor d = computeProperties(bean, _beanInfo, true, _nodePropertiesCacheable, propertyInfo);
Sheet sets = getSheet();
Sheet.Set pset = Sheet.createPropertiesSet();
pset.put(d.property);
sets.put(pset);
if (d.expert.length != 0) {
Sheet.Set eset = Sheet.createExpertSet();
eset.put(d.expert);
sets.put(eset);
}
}
Aggregations