Search in sources :

Example 1 with IImageDescriptor

use of org.jowidgets.common.image.IImageDescriptor in project jo-client-platform by jo-source.

the class BeanRelationGraphImpl method renderIcon.

private void renderIcon(final Node node, final IBeanProxy<Object> bean, final IBeanProxyLabelRenderer<Object> renderer) {
    final IImageConstant icon = renderer.getLabel(bean).getIcon();
    if (icon != null) {
        final IImageHandle imageHandle = Toolkit.getImageRegistry().getImageHandle(icon);
        if (imageHandle != null) {
            final Object image = imageHandle.getImage();
            final IImageDescriptor imageDescriptor = imageHandle.getImageDescriptor();
            if (image instanceof Image) {
                renderIcon(node, (Image) image);
            } else if (imageDescriptor != null) {
                IImageHandle awtImageHandle = SwingImageRegistry.getInstance().getImageHandle(icon);
                if (awtImageHandle == null) {
                    SwingImageRegistry.getInstance().registerImageConstant(icon, imageDescriptor);
                    awtImageHandle = SwingImageRegistry.getInstance().getImageHandle(icon);
                }
                renderIcon(node, (Image) awtImageHandle.getImage());
            }
        }
    }
}
Also used : IImageHandle(org.jowidgets.common.image.IImageHandle) IImageConstant(org.jowidgets.common.image.IImageConstant) IImageDescriptor(org.jowidgets.common.image.IImageDescriptor) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage)

Example 2 with IImageDescriptor

use of org.jowidgets.common.image.IImageDescriptor in project jo-client-platform by jo-source.

the class NodeRenderer method initializeIcons.

private Image initializeIcons(final IImageConstant iconImage) {
    final IImageConstant icon = iconImage;
    if (icon != null) {
        final IImageHandle imageHandle = Toolkit.getImageRegistry().getImageHandle(icon);
        if (imageHandle != null) {
            final Object image = imageHandle.getImage();
            final IImageDescriptor imageDescriptor = imageHandle.getImageDescriptor();
            if (image instanceof Image) {
                return (Image) image;
            } else if (imageDescriptor != null) {
                IImageHandle awtImageHandle = SwingImageRegistry.getInstance().getImageHandle(icon);
                if (awtImageHandle == null) {
                    SwingImageRegistry.getInstance().registerImageConstant(icon, imageDescriptor);
                    awtImageHandle = SwingImageRegistry.getInstance().getImageHandle(icon);
                }
                return (Image) awtImageHandle.getImage();
            }
        }
    }
    return null;
}
Also used : IImageHandle(org.jowidgets.common.image.IImageHandle) IImageConstant(org.jowidgets.common.image.IImageConstant) IImageDescriptor(org.jowidgets.common.image.IImageDescriptor) Image(java.awt.Image)

Aggregations

Image (java.awt.Image)2 IImageConstant (org.jowidgets.common.image.IImageConstant)2 IImageDescriptor (org.jowidgets.common.image.IImageDescriptor)2 IImageHandle (org.jowidgets.common.image.IImageHandle)2 BufferedImage (java.awt.image.BufferedImage)1