本文整理了Java中org.openide.nodes.AbstractNode
类的一些代码示例,展示了AbstractNode
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractNode
类的具体详情如下:
包路径:org.openide.nodes.AbstractNode
类名称:AbstractNode
[英]A basic implementation of a node.
It simplifies creation of the display name, based on a message format and the system name. It also simplifies working with icons: one need only specify the base name and all icons will be loaded when needed. Other common requirements are handled as well.
[中]节点的基本实现。
它简化了基于消息格式和系统名称的显示名称的创建。它还简化了图标的使用:只需指定基本名称,所有图标都将在需要时加载。还处理了其他常见需求。
代码示例来源:origin: org.netbeans.api/org-openide-nodes
LazyNode(Map<String,?> map) {
this(new AbstractNode(new Children.Array()), map);
}
private LazyNode(AbstractNode an, Map<String,?> map) {
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** Get an icon for this node in the closed state.
* Uses the Bean's icon if possible.
*
* @param type constant from {@link java.beans.BeanInfo}
* @return icon to use
*/
@Override
public Image getIcon(int type) {
Image image = beanInfo.getIcon(type);
if (image != null) {
return image;
}
return super.getIcon(type);
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
private LazyNode(AbstractNode an, Map<String,?> map) {
super(an, new SwitchChildren(an));
((SwitchChildren)getChildren()).node = this;
this.map = map;
an.setName((String) map.get("name")); // NOI18N
an.setDisplayName((String) map.get("displayName")); // NOI18N
an.setShortDescription((String) map.get("shortDescription")); // NOI18N
String iconBase = (String) map.get("iconResource"); // NOI18N
if (iconBase != null) {
an.setIconBaseWithExtension(iconBase);
}
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** The lookup associated with this cookie set. Keeps track of
* the same things that are in the cookie set, but presents them
* as being inside the lookup.
*
* @return the lookup representing this cookie set
* @since 7.0
*/
public Lookup getLookup() {
synchronized (QUERY_MODE) {
if (lookup == null) {
AbstractNode an = new AbstractNode(this);
lookup = an.getLookup();
}
}
return lookup;
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/**
* Create the Node that should be shown while the keys are being computed
* on a background thread.
* This method will not be called if this ChildFactory is used for a
* synchronous children which does not compute its keys on a background
* thread. Whether an instance is synchronous or not is determined by a
* parameter to
* <a href="Children.html#create(ChildFactory, boolean)">Children.create()</a>.
* <p>
* To show no node at all when the Children object is initially expanded in
* the UI, simply return null.
* <p>
* The default implementation returns a Node that shows an hourglass cursor
* and the localized text "Please Wait...".
*
* @return A Node, or null if no wait node should be shown.
*/
protected Node createWaitNode() {
AbstractNode n = new AbstractNode(Children.LEAF) {
public @Override Action[] getActions(boolean context) {
return new Action[0];
}
};
n.setIconBaseWithExtension("org/openide/nodes/wait.gif"); //NOI18N
n.setDisplayName(NbBundle.getMessage(ChildFactory.class, "LBL_WAIT")); //NOI18N
return n;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javacard-spi
private Node noPlatformNode() {
AbstractNode result = new AbstractNode(Children.LEAF);
result.setIconBaseWithExtension("org/netbeans/modules/javacard/resources/empty.png"); //NOI18N
result.setDisplayName(NbBundle.getMessage(DevicePanel.class, "LBL_NO_PLATFORM_SELECTED")); //NOI18N
return result;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-repository
@Messages("LBL_Node_TooGeneral=Too general query")
private static Node getTooGeneralNode() {
if (tooGeneralNode == null) {
AbstractNode nd = new AbstractNode(Children.LEAF) {
@Override
public Image getIcon(int arg0) {
return ImageUtilities.loadImage(EMPTY_ICON);
}
@Override
public Image getOpenedIcon(int arg0) {
return getIcon(arg0);
}
};
nd.setName("Too General"); //NOI18N
nd.setDisplayName(LBL_Node_TooGeneral()); //NOI18N
tooGeneralNode = nd;
}
return new FilterNode (tooGeneralNode, Children.LEAF);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-jboss4
public static Node createWaitNode() {
AbstractNode n = new AbstractNode(Children.LEAF);
n.setName(NbBundle.getMessage(JBItemNode.class, "LBL_WaitNode_DisplayName")); //NOI18N
n.setIconBaseWithExtension("org/netbeans/modules/j2ee/jboss4/resources/wait.gif"); // NOI18N
return n;
}
代码示例来源:origin: org.codehaus.mevenide/nb-project
public static Node[] createNodes(Archetype arch, Children childs) {
if (arch == LOADING_ARCHETYPE) {
AbstractNode loading = new AbstractNode(Children.LEAF);
loading.setName("loading"); //NOI18N
loading.setDisplayName(NbBundle.getMessage(ChooseArchetypePanel.class, "LBL_Loading"));
return new Node[] {loading};
}
AbstractNode nd = new AbstractNode(childs);
String dn = arch.getName() == null ? arch.getArtifactId() : arch.getName();
nd.setName(dn);
nd.setDisplayName(dn);
nd.setIconBaseWithExtension("org/codehaus/mevenide/netbeans/Maven2Icon.gif"); //NOI18N
nd.setValue(PROP_ARCHETYPE, arch);
return new Node[] { nd };
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-jboss4
public static Node createInfoNode() {
AbstractNode n = new AbstractNode(Children.LEAF);
n.setName(NbBundle.getMessage(JBItemNode.class, "LBL_InfoNode_DisplayName")); //NOI18N
n.setShortDescription(NbBundle.getMessage(JBItemNode.class, "LBL_InfoNode_ToolTip")); //NOI18N
n.setIconBaseWithExtension("org/netbeans/core/resources/exception.gif"); // NOI18N
return n;
}
代码示例来源:origin: org.codehaus.mevenide/nb-repo-browser
public static Node createLoadingNode() {
AbstractNode nd = new AbstractNode(Children.LEAF){
@Override
public Image getIcon(int arg0) {
return Utilities.loadImage("org/codehaus/mevenide/repository/wait.gif");
}
};
nd.setName("Loading"); //NOI18N
nd.setDisplayName(NbBundle.getMessage(GroupListChildren.class, "Node_Loading"));
return nd;
}
private List keys;
代码示例来源:origin: net.sourceforge.javydreamercsw/Client-UI
@Override
protected Node createNodeForKey(Step key) {
AbstractNode node = new AbstractNode(Children.LEAF);
node.setDisplayName("Step: "+key.getStepSequence());
return node;
}
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** To allow inner classes to access the super.setName method.
*/
void setNameSilently(String name) {
super.setName(name);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-api-ejbmodule
protected Node[] createNodes(Key key) {
Node node = nodesHash.get(key);
if (!nodesHash.containsKey(key)){
node = null;
if (key.ejbType == Key.EjbType.SESSION) {
// do not create node for web service
if (!key.isWebService && nodeFactory != null) {
node = nodeFactory.createSessionNode(key.ejbClass, ejbModule, project);
}
}
if (key.ejbType == Key.EjbType.ENTITY && nodeFactory != null) {
node = nodeFactory.createEntityNode(key.ejbClass, ejbModule, project);
}
if (key.ejbType == Key.EjbType.MESSAGE_DRIVEN && nodeFactory != null) {
node = nodeFactory.createMessageNode(key.ejbClass, ejbModule, project);
}
if (key == Key.SCANNING){
node = new AbstractNode(Children.LEAF);
node.setDisplayName(NbBundle.getMessage(EjbContainerChildren.class, "MSG_Scanning_EJBs")); //NOI18N
((AbstractNode)node).setIconBaseWithExtension("org/netbeans/modules/j2ee/ejbjar/project/ui/wait.gif"); //NOI18N
}
nodesHash.put(key, node);
}
return node == null ? null : new Node[] { node };
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-ant-ui
protected Node[] createNodes(Variable var) {
Children ch = Children.LEAF;
AbstractNode n = new AbstractNode(ch, Lookups.singleton(var)) {
@Override
public Image getIcon(int type) {
return iconDelegate.getIcon(type);
}
};
n.setName(var.getName());
n.setDisplayName(var.getName() + "("+var.getValue().getPath()+")"); // NOI18N
n.setShortDescription(var.getName() + "("+var.getValue().getPath()+")"); // NOI18N
return new Node[] {n};
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** Get a cookie.
* @param clazz representation class
* @return the index implementation or children if these match the cookie class,
* else using the superclass cookie lookup
*/
public <T extends Node.Cookie> T getCookie(Class<T> clazz) {
if (clazz.isInstance(indexImpl)) {
// ok, Index implementor is enough
return clazz.cast(indexImpl);
}
Children ch = getChildren();
if (clazz.isInstance(ch)) {
// ok, children are enough
return clazz.cast(ch);
}
return super.getCookie(clazz);
}
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** Set the system name. Fires a property change event.
* Also may change the display name according to {@link #displayFormat}.
*
* @param s the new name
*/
public void setName(String s) {
super.setName(s);
MessageFormat mf = displayFormat;
if (mf != null) {
setDisplayName(mf.format(new Object[] { s }));
} else {
// additional hack, because if no display name is set, then it
// is taken from the getName, that means calling setName can
// also change display name
// fix of 10665
fireDisplayNameChange(null, null);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-api-ejbmodule
private Image computeIcon(boolean opened, int type) {
Image image;
Node iconDelegate = getIconDelegate();
if (opened) {
image = iconDelegate != null ? iconDelegate.getOpenedIcon(type) : super.getOpenedIcon(type);
} else {
image = iconDelegate != null ? iconDelegate.getIcon(type) : super.getIcon(type);
}
Image badge = ImageUtilities.loadImage(EJB_BADGE);
return ImageUtilities.mergeImages(image, badge, 7, 7);
}
代码示例来源:origin: org.netbeans.api/org-openide-nodes
/** Change the icon.
* One need only specify the base resource name without extension;
* the real name of the icon is obtained by the applying icon message
* formats.
*
* The method effectively behaves as if it was just delegating
* to {@link #setIconBaseWithExtension(java.lang.String)}
* using <code>base + ".gif"</code> as parameter.
*
* @param base base resouce name (no initial slash)
* @deprecated Use {@link #setIconBaseWithExtension(java.lang.String)}
*/
@Deprecated
public void setIconBase(String base) {
setIconBaseWithExtension(base, DEFAULT_ICON_EXTENSION);
}
代码示例来源:origin: dschanoeh/Kayak
@Override
public void setDisplayName(String s) {
super.setDisplayName(s);
project.setName(s);
}
内容来源于网络,如有侵权,请联系作者删除!