本文整理匯總了Java中org.openide.nodes.Node.getPropertySets方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getPropertySets方法的具體用法?Java Node.getPropertySets怎麽用?Java Node.getPropertySets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.nodes.Node
的用法示例。
在下文中一共展示了Node.getPropertySets方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: getPropertyFor
import org.openide.nodes.Node; //導入方法依賴的package包/類
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;
}
示例5: findProperty
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Used in case of 1 element array */
static Property findProperty(Node n, String name) throws NullPointerException {
PropertySet[] ps = n.getPropertySets();
for (int j = 0; j < ps.length; j++) {
Property p = findProperty(ps[j], name);
if (p != null) {
return p;
}
}
return null;
}
示例6: testCreateTheShadow
import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testCreateTheShadow () throws Exception {
DataShadow shade = original.createShadow (folder);
Node node = shade.createNodeDelegate();
final AtomicBoolean modified = new AtomicBoolean();
shade.getPrimaryFile().addFileChangeListener(new FileChangeAdapter() {
@Override
public void fileChanged (FileEvent fe) {
modified.set(true);
}
});
String originName = node.getName();
PropertySet[] props = node.getPropertySets();
Node.Property p = null;
for (PropertySet propSet : props) {
for (Node.Property prop : propSet.getProperties()) {
if ("OriginalName".equals(prop.getName())) {
p = prop;
break;
}
}
}
assertNotNull(p);
// set name to the same value
p.setValue(originName);
// nothing should happen
assertFalse(modified.get());
assertEquals(originName, original.getName());
// set name to the same value
p.setValue(originName + ".txt");
// link should be changed
assertTrue(modified.get());
assertEquals(originName + ".txt", original.getName());
}
示例7: testDisplayName
import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testDisplayName() throws Exception {
String res = "Settings/org-netbeans-modules-settings-convertors-testDisplayName.settings";
FileObject fo = FileUtil.getConfigFile(res);
assertNotNull(res, fo);
assertNull("name", fo.getAttribute("name"));
DataObject dobj = DataObject.find (fo);
Node n = dobj.getNodeDelegate();
assertNotNull(n);
assertEquals("I18N", n.getDisplayName());
// property sets have to be initialized otherwise the change name would be
// propagated to the node after some delay (~2s)
Object garbage = n.getPropertySets();
InstanceCookie ic = (InstanceCookie) dobj.getCookie(InstanceCookie.class);
assertNotNull (dobj + " does not contain instance cookie", ic);
FooSetting foo = (FooSetting) ic.instanceCreate();
String newName = "newName";
foo.setName(newName);
assertEquals(n.toString(), newName, n.getDisplayName());
newName = "newNameViaNode";
n.setName(newName);
assertEquals(n.toString(), newName, n.getDisplayName());
assertEquals(n.toString(), newName, foo.getName());
}
示例8: 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();
}
}
示例9: getTabItems
import org.openide.nodes.Node; //導入方法依賴的package包/類
private static final TabInfo getTabItems(Node n) {
Map<String, List<PropertySet>> titlesToContents = new HashMap<String, List<PropertySet>>();
ArrayList<String> order = new ArrayList<String>();
PropertySet[] sets = n.getPropertySets();
for (int i = 0; i < sets.length; i++) {
String currTab = (String) sets[i].getValue("tabName"); //NOI18N
if (currTab == null) {
currTab = PropUtils.basicPropsTabName();
}
List<PropertySet> l = titlesToContents.get(currTab);
if (l == null) {
l = new ArrayList<PropertySet>();
l.add(sets[i]);
titlesToContents.put(currTab, l);
} else {
l.add(sets[i]);
}
if (!order.contains(currTab)) {
order.add(currTab);
}
}
String[] titles = new String[order.size()];
Object[] setSets = new Object[order.size()];
int count = 0;
for (Iterator<String> i = order.iterator(); i.hasNext();) {
titles[count] = i.next();
List<PropertySet> currSets = titlesToContents.get(titles[count]);
setSets[count] = new PropertySet[currSets.size()];
setSets[count] = currSets.toArray((PropertySet[]) setSets[count]);
count++;
}
return new TabInfo(titles, setSets);
}