use of org.openide.nodes.Node.PropertySet in project gephi by gephi.
the class LayoutNode method getPropertySets.
@Override
public PropertySet[] getPropertySets() {
if (propertySets == null) {
try {
Map<String, Sheet.Set> sheetMap = new HashMap<>();
for (LayoutProperty layoutProperty : layout.getProperties()) {
Sheet.Set set = sheetMap.get(layoutProperty.getCategory());
if (set == null) {
set = Sheet.createPropertiesSet();
set.setDisplayName(layoutProperty.getCategory());
sheetMap.put(layoutProperty.getCategory(), set);
}
set.put(layoutProperty.getProperty());
}
propertySets = sheetMap.values().toArray(new PropertySet[0]);
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
return null;
}
}
return propertySets;
}
use of org.openide.nodes.Node.PropertySet in project ACS by ACS-Community.
the class TableHolderImpl method setTableColumns.
public void setTableColumns(GPNode node, String[] propNames, boolean[] sortable) {
// this is based on the org.openide.nodes.Node.getPropertySets() method, which is filled in by the
// cern.gp.nodes.impl.BeanNode.createProperties();
// get the normal and experts propertySets and concatenate them
Node.Property[] allProperties;
PropertySet[] propSets = node.getPeerNode().getPropertySets();
Node.Property[] normalProperties = propSets[0].getProperties();
if (propSets.length == 1) {
allProperties = normalProperties;
} else {
Node.Property[] expertProperties = propSets[1].getProperties();
allProperties = new Node.Property[normalProperties.length + expertProperties.length];
System.arraycopy(normalProperties, 0, allProperties, 0, normalProperties.length);
System.arraycopy(expertProperties, 0, allProperties, normalProperties.length, expertProperties.length);
}
final Node.Property[] tableProperties;
if (propNames == null) {
tableProperties = allProperties;
} else {
ArrayList list = new ArrayList(propNames.length);
for (int n = 0; n < propNames.length; n++) {
for (int p = 0; p < allProperties.length; p++) {
if (propNames[n].equals(allProperties[p].getName())) {
list.add(allProperties[p]);
}
}
}
tableProperties = (Node.Property[]) list.toArray(new Node.Property[list.size()]);
}
tablePropertyHolder.setProperties(tableProperties, sortable);
}
Aggregations