Search in sources :

Example 1 with ImageSelectionDialog

use of org.netxms.ui.eclipse.imagelibrary.dialogs.ImageSelectionDialog in project netxms by netxms.

the class ImageSelector method selectionButtonHandler.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.widgets.AbstractSelector#selectionButtonHandler()
	 */
@Override
protected void selectionButtonHandler() {
    ImageSelectionDialog dlg = new ImageSelectionDialog(getShell());
    if (dlg.open() == Window.OK) {
        LibraryImage image = dlg.getLibraryImage();
        if (image != null) {
            setText(image.getName());
            setImage(dlg.getImage());
            imageGuid = dlg.getGuid();
        } else {
            setText(Messages.get().ImageSelector_Default);
            setImage(null);
            imageGuid = NXCommon.EMPTY_GUID;
        }
        getParent().layout();
    }
}
Also used : LibraryImage(org.netxms.client.LibraryImage) ImageSelectionDialog(org.netxms.ui.eclipse.imagelibrary.dialogs.ImageSelectionDialog)

Example 2 with ImageSelectionDialog

use of org.netxms.ui.eclipse.imagelibrary.dialogs.ImageSelectionDialog in project netxms by netxms.

the class PredefinedMap method addImageDecoration.

/**
 * Add image decoration
 */
private void addImageDecoration() {
    ImageSelectionDialog dlg = new ImageSelectionDialog(getSite().getShell());
    if (dlg.open() != Window.OK)
        return;
    UUID imageGuid = dlg.getLibraryImage().getGuid();
    Rectangle imageBounds = dlg.getImage().getBounds();
    NetworkMapDecoration element = new NetworkMapDecoration(mapPage.createElementId(), NetworkMapDecoration.IMAGE);
    element.setSize(imageBounds.width, imageBounds.height);
    element.setTitle(imageGuid.toString());
    mapPage.addElement(element);
    saveMap();
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) NetworkMapDecoration(org.netxms.client.maps.elements.NetworkMapDecoration) UUID(java.util.UUID) ImageSelectionDialog(org.netxms.ui.eclipse.imagelibrary.dialogs.ImageSelectionDialog)

Aggregations

ImageSelectionDialog (org.netxms.ui.eclipse.imagelibrary.dialogs.ImageSelectionDialog)2 UUID (java.util.UUID)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 LibraryImage (org.netxms.client.LibraryImage)1 NetworkMapDecoration (org.netxms.client.maps.elements.NetworkMapDecoration)1