Search in sources :

Example 16 with Gallery

use of org.netxms.nebula.widgets.gallery.Gallery in project netxms by netxms.

the class ImageSelectionDialog method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    final FillLayout layout = new FillLayout();
    dialogArea.setLayout(layout);
    gallery = new Gallery(dialogArea, SWT.V_SCROLL);
    DefaultGalleryGroupRenderer galleryGroupRenderer = new DefaultGalleryGroupRenderer();
    galleryGroupRenderer.setMinMargin(2);
    galleryGroupRenderer.setItemHeight(48);
    galleryGroupRenderer.setItemWidth(48);
    galleryGroupRenderer.setAutoMargin(true);
    galleryGroupRenderer.setAlwaysExpanded(true);
    gallery.setGroupRenderer(galleryGroupRenderer);
    DefaultGalleryItemRenderer itemRenderer = new DefaultGalleryItemRenderer();
    gallery.setItemRenderer(itemRenderer);
    gallery.addSelectionListener(this);
    gallery.addMouseListener(this);
    ImageProvider.getInstance(getShell().getDisplay()).addUpdateListener(this);
    refreshImages();
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) FillLayout(org.eclipse.swt.layout.FillLayout) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)

Aggregations

Gallery (org.netxms.nebula.widgets.gallery.Gallery)16 GalleryItem (org.netxms.nebula.widgets.gallery.GalleryItem)11 DefaultGalleryGroupRenderer (org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer)10 DefaultGalleryItemRenderer (org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)10 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)2 List (java.util.List)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Event (org.eclipse.swt.widgets.Event)2 Listener (org.eclipse.swt.widgets.Listener)2 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 TreePath (org.eclipse.jface.viewers.TreePath)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 SWTException (org.eclipse.swt.SWTException)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 MenuDetectEvent (org.eclipse.swt.events.MenuDetectEvent)1 MenuDetectListener (org.eclipse.swt.events.MenuDetectListener)1