Java Code Examples for org.openide.nodes.Node#getOpenedIcon()

The following examples show how to use org.openide.nodes.Node#getOpenedIcon() . 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: UISupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static Image computeIcon(ServerIcon serverIcon) {
    // get the default folder icon
    Node folderNode = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate();
    Image folder;
    if (serverIcon == ServerIcon.EJB_OPENED_FOLDER || serverIcon == ServerIcon.WAR_OPENED_FOLDER 
            || serverIcon == ServerIcon.EAR_OPENED_FOLDER) {
        folder = folderNode.getOpenedIcon(BeanInfo.ICON_COLOR_16x16);
    } else {
        folder = folderNode.getIcon(BeanInfo.ICON_COLOR_16x16);
    }
    Image badge;
    if (serverIcon == ServerIcon.EJB_FOLDER || serverIcon == ServerIcon.EJB_OPENED_FOLDER) {
        badge = ImageUtilities.loadImage("org/netbeans/modules/j2ee/deployment/impl/ui/resources/ejbBadge.png"); // NOI18N
    } else if (serverIcon == ServerIcon.WAR_FOLDER || serverIcon == ServerIcon.WAR_OPENED_FOLDER) {
        badge = ImageUtilities.loadImage("org/netbeans/modules/j2ee/deployment/impl/ui/resources/warBadge.png"); // NOI18N
    } else if (serverIcon == ServerIcon.EAR_FOLDER || serverIcon == ServerIcon.EAR_OPENED_FOLDER) {
        badge = ImageUtilities.loadImage("org/netbeans/modules/j2ee/deployment/impl/ui/resources/earBadge.png" ); // NOI18N
    } else {
        return null;
    }
    return ImageUtilities.mergeImages(folder, badge, 7, 7);
}
 
Example 2
Source File: NodeRenderDataProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public javax.swing.Icon getIcon(Object o) {
    if (!showIcons) {
        return emptyIcon;
    }
    Node n = Visualizer.findNode(o);
    if (n == null) {
        throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName());
    }
    boolean expanded = false;
    if (o instanceof TreeNode) {
        TreeNode tn = (TreeNode)o;
        ArrayList<TreeNode> al = new ArrayList<TreeNode> ();
        while (tn != null) {
            al.add(tn);
            tn = tn.getParent();
        }
        Collections.reverse(al);
        TreePath tp = new TreePath(al.toArray());
        AbstractLayoutCache layout = table.getLayoutCache();
        expanded = layout.isExpanded(tp);
    }
    java.awt.Image image = null;
    if (expanded) {
        image = n.getOpenedIcon(java.beans.BeanInfo.ICON_COLOR_16x16);
    } else {
        image = n.getIcon(java.beans.BeanInfo.ICON_COLOR_16x16);
    }
    return ImageUtilities.image2Icon(image);
}
 
Example 3
Source File: Hk2ItemNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Applies a badge to an open or closed folder icon.
 * <p/>
 * @param badge  Badge image for folder.
 * @param opened Use open or closed folder.
 * @return An image of the badged folder.
 */
public static Image badgeFolder(Image badge, boolean opened) {
    Node folderNode = getIconDelegate();
    Image folder = opened
            ? folderNode.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)
            : folderNode.getIcon(BeanInfo.ICON_COLOR_16x16);
    return ImageUtilities.mergeImages(folder, badge, 7, 7);
}
 
Example 4
Source File: Hk2ItemNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Applies a badge to an open or closed folder icon.
 * <p/>
 * @param badge  Badge image for folder.
 * @param opened Use open or closed folder.
 * @return An image of the badged folder.
 */
public static Image badgeFolder(Image badge, boolean opened) {
    Node folderNode = getIconDelegate();
    Image folder = opened
            ? folderNode.getOpenedIcon(BeanInfo.ICON_COLOR_16x16)
            : folderNode.getIcon(BeanInfo.ICON_COLOR_16x16);
    return ImageUtilities.mergeImages(folder, badge, 7, 7);
}
 
Example 5
Source File: ServerResourceNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Image getOpenedIcon(int type) {
    Image image = null;
    Node imageDelegate = getImageDelegate();
    if (imageDelegate != null) {
        image = imageDelegate.getOpenedIcon(type);
    }
    if (image == null) {
        image = super.getOpenedIcon(type);
    }
    return image;
}
 
Example 6
Source File: ArchiveViews.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private Image computeIcon( boolean opened, int type ) {
    Node folderNode = getOriginal();
    Image image = opened ? folderNode.getOpenedIcon( type ) : folderNode.getIcon( type );
    return ImageUtilities.mergeImages( image, CONFIGURATION_FILES_BADGE, 7, 7 );
}
 
Example 7
Source File: J2eeProjectView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private Image computeIcon( boolean opened, int type ) {
    Node folderNode = getOriginal();
    Image image = opened ? folderNode.getOpenedIcon( type ) : folderNode.getIcon( type );
    return ImageUtilities.mergeImages( image, CONFIGURATION_FILES_BADGE, 7, 7 );
}