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

The following examples show how to use org.openide.nodes.Node#getOpenedIcon() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: netbeans   File: UISupport.java    License: 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 Project: netbeans   File: NodeRenderDataProvider.java    License: 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 Project: netbeans   File: Hk2ItemNode.java    License: 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 Project: netbeans   File: Hk2ItemNode.java    License: 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 Project: netbeans   File: ServerResourceNode.java    License: 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 Project: netbeans   File: ArchiveViews.java    License: 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 Project: netbeans   File: J2eeProjectView.java    License: 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 );
}