Java Code Examples for org.openide.nodes.Node#PropertySet
The following examples show how to use
org.openide.nodes.Node#PropertySet .
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: GridDesigner.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Node.PropertySet[] getPropertySets() { for (Node.PropertySet pSet : super.getPropertySets()) { String name = pSet.getName(); if ("layout".equals(name)) { // NOI18N final Node.PropertySet set = pSet; String displayName = NbBundle.getMessage(GridDesigner.class, "GridDesigner.layoutConstraints"); // NOI18N return new Node.PropertySet[] {new PropertySet(set.getName(), displayName, set.getShortDescription()) { @Override public Property<?>[] getProperties() { return set.getProperties(); } }}; } } return new Node.PropertySet[0]; }
Example 2
Source File: FormI18nSupport.java From netbeans with Apache License 2.0 | 6 votes |
public boolean hasNext() { if (!ready) { if (first || (++propIndex == properties.length)) { if (first) { propSets = comp.getProperties(); first = false; } while (++propSetIndex != propSets.length) { Node.PropertySet propSet; if (isFormPropSet(propSet = propSets[propSetIndex]) && ((properties = propSet.getProperties()).length != 0)) { propIndex = 0; break; } } if (propSetIndex == propSets.length) { exhausted = true; } } ready = true; } return !exhausted; }
Example 3
Source File: NodeTableModel.java From netbeans with Apache License 2.0 | 6 votes |
/** Returns node property if found in nodes property sets. Could be overriden to * return property which is not in nodes property sets. * @param node represents single row * @param prop represents column * @return nodes property */ protected Property getPropertyFor(Node node, Property prop) { Node.PropertySet[] propSets = node.getPropertySets(); for (int i = 0; i < propSets.length; i++) { Node.Property[] props = propSets[i].getProperties(); for (int j = 0; j < props.length; j++) { if (prop.equals(props[j])) { return props[j]; } } } return null; }
Example 4
Source File: IndexedPropertyEditorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGetJavaInitializationString() throws Exception { ExPropertyEditor editor = new IndexedPropertyEditor(); PropertyEnv env = new PropertyEnv(); Node.Property<?> prop = null; Bean bean = new Bean(); bean.setStuff(new Stuff[] {new Stuff(1), new Stuff(2)}); for (Node.PropertySet s : new BeanNode<Bean>(bean).getPropertySets()) { for (Node.Property<?> p : s.getProperties()) { if (p.getName().equals("stuff")) { prop = p; break; } } } assertNotNull(prop); assertTrue(prop instanceof Node.IndexedProperty<?,?>); editor.setValue(bean.getStuff()); env.setFeatureDescriptor(prop); editor.attachEnv(env); String n = Stuff.class.getCanonicalName(); assertEquals("new" + n + "[]{new" + n + "(1),new" + n + "(2)}", editor.getJavaInitializationString().replaceAll("\\s+", "")); }
Example 5
Source File: NodeTableModel.java From netbeans with Apache License 2.0 | 6 votes |
/** Returns node property if found in nodes property sets. Could be overriden to * return property which is not in nodes property sets. * @param node represents single row * @param prop represents column * @return nodes property */ protected Property getPropertyFor(Node node, Property prop) { Node.PropertySet[] propSets = node.getPropertySets(); for (int i = 0; i < propSets.length; i++) { Node.Property[] props = propSets[i].getProperties(); for (int j = 0; j < props.length; j++) { if (prop.equals(props[j])) { return props[j]; } } } return null; }
Example 6
Source File: DataShadowTest.java From netbeans with Apache License 2.0 | 6 votes |
private static Node.Property findProperty (Node n, String name) { Node.PropertySet[] arr = n.getPropertySets (); StringBuffer names = new StringBuffer (); String prefix = ""; for (int i = 0; i < arr.length; i++) { Node.PropertySet set = arr[i]; Node.Property[] properties = set.getProperties (); for (int j = 0; j < properties.length; j++) { Node.Property p = properties[j]; if (name.equals (p.getName ())) { return p; } names.append (prefix); names.append (p.getName ()); prefix = ", "; } } fail ("Cannot find property \"" + name + "\" in node " + n + " it has only " + names + " propeties."); return null; }
Example 7
Source File: HtmlDataNode.java From netbeans with Apache License 2.0 | 5 votes |
/** * Sets custom Node.PropertySet[] to this node. * * {@link #firePropertySetsChange(org.openide.nodes.Node.PropertySet[], org.openide.nodes.Node.PropertySet[])} is called afterwards. * * @since 1.46 * @param sets the custom property sets or null if the default property sets should be used. */ public void setPropertySets(Node.PropertySet[] sets) { Node.PropertySet[] old = customPropertySet != null ? customPropertySet : getPropertySets(); Node.PropertySet[] neww = sets != null ? sets : getPropertySets(); customPropertySet = sets; firePropertySetsChange(old, neww); }
Example 8
Source File: MetaLayout.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void createPropertySets(java.util.List<Node.PropertySet> propSets) { super.createPropertySets(propSets); // RADComponent provides also Code Generation properties for which // we have no use here (yet) - so we remove them now for (int i=0, n=propSets.size(); i < n; i++) { Node.PropertySet propSet = propSets.get(i); if (!"properties".equals(propSet.getName()) // NOI18N && !"properties2".equals(propSet.getName())) { // NOI18N propSets.remove(i); i--; n--; } } }
Example 9
Source File: PropertiesRowModel.java From netbeans with Apache License 2.0 | 5 votes |
protected Node.Property getPropertyFor(Node node, Node.Property prop) { Node.PropertySet[] propSets = node.getPropertySets(); for (int i = 0; i < propSets.length; i++) { Node.Property[] props = propSets[i].getProperties(); for (int j = 0; j < props.length; j++) { if (prop.equals(props[j])) { return props[j]; } } } return null; }
Example 10
Source File: PSheet.java From netbeans with Apache License 2.0 | 5 votes |
public Object getTabbedContainerSelection() { JComponent tabbed = findTabbedContainer(); if (tabbed != null) { Object o = TabbedContainerBridge.getDefault().getSelectedItem(tabbed); if (o instanceof Node.PropertySet[]) { //won't be first time return o; } } return null; }
Example 11
Source File: NodeSelector.java From netbeans with Apache License 2.0 | 5 votes |
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 12
Source File: PropertiesAction.java From netbeans with Apache License 2.0 | 5 votes |
public JMenuItem getPopupPresenter() { JMenuItem prop = new Actions.MenuItem(this, false); Action customizeAction = SystemAction.get(CustomizeAction.class); // Retrieve context sensitive action instance if possible. if (lookup != null) { customizeAction = ((ContextAwareAction) customizeAction).createContextAwareInstance(lookup); } if (customizeAction.isEnabled()) { JInlineMenu mi = new JInlineMenu(); mi.setMenuItems(new JMenuItem[] { new Actions.MenuItem(customizeAction, false), prop }); return mi; } else { for (Node n : nodes()) { for (Node.PropertySet ps : n.getPropertySets()) { if (ps.getProperties().length > 0) { // OK, we have something to show! return prop; } } } // else nothing to show, so show nothing return new JInlineMenu(); } }
Example 13
Source File: PaletteItemNode.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Node.PropertySet[] getPropertySets() { return NO_PROPERTIES; }
Example 14
Source File: PhysicalView.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Node.PropertySet[] getPropertySets() { return new Node.PropertySet[0]; }
Example 15
Source File: PrintActionTest.java From netbeans with Apache License 2.0 | 4 votes |
public Node.PropertySet[] getPropertySets() { return null; }
Example 16
Source File: OpenActionTest.java From netbeans with Apache License 2.0 | 4 votes |
public Node.PropertySet[] getPropertySets() { return null; }
Example 17
Source File: EditActionTest.java From netbeans with Apache License 2.0 | 4 votes |
public Node.PropertySet[] getPropertySets() { return null; }
Example 18
Source File: TemplatesPanel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public PropertySet[] getPropertySets () { return new Node.PropertySet [] { createTemplateProperties (this) }; }
Example 19
Source File: CategoryNode.java From netbeans with Apache License 2.0 | 4 votes |
@Override public Node.PropertySet[] getPropertySets() { return NO_PROPERTIES; }
Example 20
Source File: AbstractLayoutSupport.java From netbeans with Apache License 2.0 | 4 votes |
/** This method provides properties of the supported layout - if it is * a JavaBean class implementing LayoutManager. The properties are obtained * from the BeanInfo of the layout manager. Note these are not properties * of individual components constraints. * @return properties of supported layout */ @Override public Node.PropertySet[] getPropertySets() { Node.PropertySet[] propertySets; FormProperty[] properties = getProperties(); if (properties == null) { propertySets = metaLayout != null ? metaLayout.getProperties() : null; } else { // a subclass provides special properties propertySets = new Node.PropertySet[1]; propertySets[0] = new Node.PropertySet( "properties", // NOI18N FormUtils.getBundleString("CTL_PropertiesTab"), // NOI18N FormUtils.getBundleString("CTL_PropertiesTabHint")) // NOI18N { @Override public Node.Property[] getProperties() { return AbstractLayoutSupport.this.getProperties(); } }; } if (propertySets != null) { java.util.List<Node.Property> allPropsList = new ArrayList<Node.Property>(); for (int i=0; i < propertySets.length; i++) { Node.Property[] props = propertySets[i].getProperties(); for (int j=0; j < props.length; j++) if (props[j] instanceof FormProperty) allPropsList.add(props[j]); } allProperties = new FormProperty[allPropsList.size()]; allPropsList.toArray(allProperties); } else { allProperties = new FormProperty[0]; propertySets = new Node.PropertySet[0]; } return propertySets; }