org.openide.nodes.AbstractNode.setIconBaseWithExtension()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(36)

本文整理了Java中org.openide.nodes.AbstractNode.setIconBaseWithExtension()方法的一些代码示例,展示了AbstractNode.setIconBaseWithExtension()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractNode.setIconBaseWithExtension()方法的具体详情如下:
包路径:org.openide.nodes.AbstractNode
类名称:AbstractNode
方法名:setIconBaseWithExtension

AbstractNode.setIconBaseWithExtension介绍

[英]Change the icon. One need only specify the base name of the icon resource, including the resource extension; the real name of the icon is obtained by inserting proper infixes into the resource name.

For example, for the base org/foo/resource/MyIcon.png the following images may be used according to the icon state and java.beans.BeanInfo#getIcon:

  • org/foo/resource/MyIcon.png
  • org/foo/resource/MyIconOpen.png
  • org/foo/resource/MyIcon32.png
  • org/foo/resource/MyIconOpen32.png

This method may be used to dynamically switch between different sets of icons for different configurations. If the set is changed, an icon property change event is fired.
[中]更改图标。只需指定图标资源的基本名称,包括资源扩展名;图标的真实名称是通过在资源名称中插入适当的中缀获得的。
例如,对于基本org/foo/resource/MyIcon.png,可以根据图标状态和java使用以下图像。豆。BeanInfo#getIcon:

  • org/foo/resource/MyIcon.png
  • org/foo/resource/MyIconOpen.png
  • org/foo/resource/MyIcon32.png
  • org/foo/resource/MyIconOpen32.png
    此方法可用于在不同配置的不同图标集之间动态切换。如果更改了集合,将触发图标属性更改事件。

代码示例

代码示例来源: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: org.netbeans.api/org-openide-nodes

setIconBaseWithExtension(baseExt, "");
} else {
  String base = baseExt.substring(0, lastDot);
  String ext = baseExt.substring(lastDot);
  setIconBaseWithExtension(base, ext);

代码示例来源: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 &quot;Please Wait...&quot;.
 *
 * @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.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-netbeans-modules-j2me-cdc-platform

public CDCPlatformNode (CDCPlatform platform, DataObject definition) {
  super (Children.LEAF, Lookups.fixed(new Object[] {platform, definition}));
  this.platform = platform;
  super.setIconBaseWithExtension ("org/netbeans/modules/j2me/cdc/platform/resources/cdcPlatform.png");
}

代码示例来源:origin: dcaoyuan/nbscala

public J2SEPlatformNode (J2SEPlatformImpl platform, DataObject definition) {
  super (Children.LEAF, Lookups.fixed(new Object[] {platform, definition}));
  this.platform = platform;
  super.setIconBaseWithExtension("org/netbeans/modules/scala/stdplatform/resources/platform.gif");
}

代码示例来源: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-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.netbeans.modules/org-netbeans-modules-javacard-spi

private Node invalidPlatformNode() {
  AbstractNode result = new AbstractNode(Children.LEAF);
  result.setIconBaseWithExtension("org/netbeans/modules/javacard/resources/empty.png"); //NOI18N
  result.setDisplayName(NbBundle.getMessage(DevicePanel.class, "LBL_INVALID_PLATFORM_SELECTED")); //NOI18N
  return result;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-jboss4

private Node createWaitNode() {
    AbstractNode n = new AbstractNode(Children.LEAF);
    n.setName(NbBundle.getMessage(JBApplicationsChildren.class, "LBL_WaitNode_DisplayName")); //NOI18N
    n.setIconBaseWithExtension("org/netbeans/modules/j2ee/jboss4/resources/wait.gif"); // NOI18N
    return n;
  }
}

代码示例来源: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.netbeans.modules/org-netbeans-modules-maven-repository

static Node createPartialNode() {
  AbstractNode node = new AbstractNode(Children.LEAF);
  node.setIconBaseWithExtension("org/netbeans/modules/maven/resources/wait.gif");
  node.setDisplayName(TXT_Partial_result());
  return node;
}

代码示例来源: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-j2eeserver

private Node createWaitNode() {
    AbstractNode node = new AbstractNode(Children.LEAF);
    node.setName(NbBundle.getMessage(InstanceTargetXNode.class, "LBL_WaitNode_DisplayName"));
    node.setIconBaseWithExtension("org/netbeans/modules/j2ee/deployment/impl/ui/resources/wait.gif"); // NOI18N
    
    Children.Array children = new Children.Array();
    children.add(new Node[]{node});
    return new AbstractNode(children);
  }
}

代码示例来源:origin: dschanoeh/Kayak

@Override
  protected Node[] createNodesForKey(String key) {
    AbstractNode node = new AbstractNode(Children.create(new PlatformChildFactory(key), false));
    node.setIconBaseWithExtension("com/github/kayak/logging/icons/folder.svg");
    node.setDisplayName(key);

    return new Node[] {node};
  }
}

代码示例来源:origin: dschanoeh/Kayak

@Override
protected Node[] createNodesForKey(Folders key) {
  if(key == Folders.DIRECTORY) {
    AbstractNode node = new AbstractNode(Children.create(new LogDirectoryFactory(), true));
    node.setDisplayName("Log directory");
    node.setIconBaseWithExtension("com/github/kayak/logging/icons/folder.png");
    return new Node[] {node};
  } else if(key == Folders.FAVOURTIES) {
    AbstractNode node = new AbstractNode(Children.create(new LogFavouritesFactory(), true));
    node.setDisplayName("Favourites");
    node.setIconBaseWithExtension("com/github/kayak/logging/icons/bookmark-new.png");
    return new Node[] {node};
  }
  return null;
}

代码示例来源:origin: dschanoeh/Kayak

@Override
protected Node[] createNodesForKey(Object key) {
  if(key instanceof Folder) {
    Folder folder = (Folder) key;
    switch(folder) {
      case DISCOVERY:
        AbstractNode discoveryNode = new AbstractNode(new ConnectionChildrenFactory(BusURLNode.Type.DISCOVERY));
        discoveryNode.setDisplayName("Auto discovery");
        discoveryNode.setIconBaseWithExtension("com/github/kayak/ui/icons/network-wireless.png");
        return new Node[] { discoveryNode };
      case FAVOURITES:
        AbstractNode favouritesFolderNode = new AbstractNode(new ConnectionChildrenFactory(BusURLNode.Type.FAVOURITE));
        favouritesFolderNode.setDisplayName("Favourites");
        favouritesFolderNode.setIconBaseWithExtension("com/github/kayak/ui/icons/bookmark-new.png");
        return new Node[] { favouritesFolderNode };
      case RECENT:
        AbstractNode recentFolderNode = new AbstractNode(new ConnectionChildrenFactory(BusURLNode.Type.RECENT));
        recentFolderNode.setDisplayName("Recent");
        recentFolderNode.setIconBaseWithExtension("com/github/kayak/ui/icons/folder.png");
        return new Node[] { recentFolderNode };
      default:
        return null;
    }
  }
  return null;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-io-javame

public MEDesignNode (MEDesignDataObject dataObject) {
  super (JavaDataSupport.createJavaNode (dataObject.getPrimaryFile ()));
  String projectType = IOSupport.resolveProjectType (IOSupport.getDataObjectContext (dataObject));
  if (projectType == null || ProjectTypeInfo.getProjectTypeInfoFor (projectType) == null)
    return;
  String iconResource = ProjectTypeInfo.getProjectTypeInfoFor (projectType).getIconResource ();
  ((AbstractNode) getOriginal ()).setIconBaseWithExtension (iconResource);
}

代码示例来源: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-visualweb-dataconnectivity

node.setIconBaseWithExtension("org/netbeans/modules/visualweb/dataconnectivity/resources/datasource.png"); //NOI18N

相关文章

最新文章

更多