本文整理匯總了Java中org.openide.nodes.Node.PropertySet方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.PropertySet方法的具體用法?Java Node.PropertySet怎麽用?Java Node.PropertySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.nodes.Node
的用法示例。
在下文中一共展示了Node.PropertySet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
@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];
}
示例2: getPropertyFor
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** 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;
}
示例3: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
示例4: testGetJavaInitializationString
import org.openide.nodes.Node; //導入方法依賴的package包/類
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+", ""));
}
示例5: hasNext
import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
示例6: findProperty
import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
示例7: setPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
/**
* 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);
}
示例8: createPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
@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--;
}
}
}
示例9: getNodeProperty
import org.openide.nodes.Node; //導入方法依賴的package包/類
private Node.Property getNodeProperty(Node node, Node.Property prop) {
Node.PropertySet[] propsets = node.getPropertySets();
for (int i = 0, n = propsets.length; i < n; i++) {
Node.Property[] props = propsets[i].getProperties();
for (int j = 0, m = props.length; j < m; j++) {
if (props[j].equals(prop)) {
return props[j];
}
}
}
return null;
}
示例10: getTabbedContainerSelection
import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
示例11: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
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();
}
示例12: getPopupPresenter
import org.openide.nodes.Node; //導入方法依賴的package包/類
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();
}
}
示例13: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** 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;
}
示例14: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
public Node.PropertySet[] getPropertySets() {
return null;
}
示例15: getPropertySets
import org.openide.nodes.Node; //導入方法依賴的package包/類
@Override public Node.PropertySet[] getPropertySets() {
return new Node.PropertySet[0];
}