Search in sources :

Example 11 with LibraryImage

use of org.netxms.client.LibraryImage in project netxms by netxms.

the class ImageSelector method setImageGuid.

/**
 * Set image GUID
 *
 * @param imageGuid image GUID
 * @param redoLayout if set to true, control will update it's layout
 */
public void setImageGuid(UUID imageGuid, boolean redoLayout) {
    this.imageGuid = imageGuid;
    if (imageGuid.equals(NXCommon.EMPTY_GUID)) {
        setText(Messages.get().ImageSelector_Default);
        setImage(null);
    } else {
        LibraryImage image = ImageProvider.getInstance(getDisplay()).getLibraryImageObject(imageGuid);
        if (image != null) {
            setText(image.getName());
            setImage(ImageProvider.getInstance(getDisplay()).getImage(imageGuid));
        } else {
            // $NON-NLS-1$
            setText("<?>" + imageGuid.toString());
            setImage(null);
        }
    }
    if (redoLayout)
        getParent().layout();
}
Also used : LibraryImage(org.netxms.client.LibraryImage)

Aggregations

LibraryImage (org.netxms.client.LibraryImage)11 SWTException (org.eclipse.swt.SWTException)5 IOException (java.io.IOException)4 NXCException (org.netxms.client.NXCException)4 Image (org.eclipse.swt.graphics.Image)3 GalleryItem (org.netxms.nebula.widgets.gallery.GalleryItem)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressListener (org.netxms.client.ProgressListener)2 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)2 Action (org.eclipse.jface.action.Action)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 DefaultGalleryGroupRenderer (org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer)1 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)1 ImagePropertiesDialog (org.netxms.ui.eclipse.imagelibrary.dialogs.ImagePropertiesDialog)1