Search in sources :

Example 1 with DefaultGalleryGroupRenderer

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

the class GalleryTest method createGallery.

private Gallery createGallery(int flags) {
    Gallery g = new Gallery(s, flags);
    // Renderers
    DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
    gr.setMinMargin(2);
    gr.setItemHeight(56);
    gr.setItemWidth(72);
    gr.setAutoMargin(true);
    g.setGroupRenderer(gr);
    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    g.setItemRenderer(ir);
    return g;
}
Also used : Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)

Example 2 with DefaultGalleryGroupRenderer

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

the class Bug212182Test method testBug212182OnGalleryItem.

public void testBug212182OnGalleryItem() {
    Gallery g = new Gallery(s, SWT.V_SCROLL);
    // Set Renderers
    DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
    g.setGroupRenderer(gr);
    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    g.setItemRenderer(ir);
    // Create an item
    GalleryItem item = new GalleryItem(g, SWT.None);
    // Check for NPE or null
    GalleryItem[] items = item.getItems();
    assertNotNull(items);
    assertEquals(0, items.length);
    g.dispose();
}
Also used : Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer) GalleryItem(org.netxms.nebula.widgets.gallery.GalleryItem)

Example 3 with DefaultGalleryGroupRenderer

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

the class Bug280635Test method createGallery.

private Gallery createGallery(int flags) {
    Gallery g = new Gallery(s, flags);
    // Renderers
    DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
    gr.setMinMargin(2);
    gr.setItemHeight(56);
    gr.setItemWidth(72);
    gr.setAutoMargin(true);
    g.setGroupRenderer(gr);
    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    g.setItemRenderer(ir);
    return g;
}
Also used : Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)

Example 4 with DefaultGalleryGroupRenderer

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

the class GalleryVirtualBehaviorTest method createGallery.

private Gallery createGallery(int flags) {
    Gallery g = new Gallery(s, flags);
    // Renderers
    DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
    gr.setMinMargin(2);
    gr.setItemHeight(56);
    gr.setItemWidth(72);
    gr.setAutoMargin(true);
    g.setGroupRenderer(gr);
    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    g.setItemRenderer(ir);
    return g;
}
Also used : Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)

Example 5 with DefaultGalleryGroupRenderer

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

the class Bug216204Test method testBug212182OnGallery.

public void testBug212182OnGallery() {
    Gallery g = new Gallery(s, SWT.V_SCROLL);
    // Set Renderers
    DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
    g.setGroupRenderer(gr);
    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    g.setItemRenderer(ir);
    // Create an item
    GalleryItem item1 = new GalleryItem(g, SWT.NONE);
    g.setSelection(new GalleryItem[] { item1 });
    GalleryItem[] selection = g.getSelection();
    assertEquals(1, selection.length);
    assertEquals(item1, selection[0]);
    // Dispose item
    item1.dispose();
    selection = g.getSelection();
    assertEquals(0, selection.length);
    // Create a lot of items
    GalleryItem[] items = new GalleryItem[10];
    GalleryItem[] children = new GalleryItem[10];
    for (int i = 0; i < 10; i++) {
        items[i] = new GalleryItem(g, SWT.None);
    }
    for (int i = 0; i < 10; i++) {
        children[i] = new GalleryItem(items[0], SWT.None);
    }
    assertEquals(10, g.getItemCount());
    assertEquals(10, items[0].getItemCount());
    g.setSelection(new GalleryItem[] { children[5], items[5] });
    selection = g.getSelection();
    // This gallery can only have a single selection
    assertEquals(1, selection.length);
    assertEquals(items[5], selection[0]);
    // Clean
    g.dispose();
}
Also used : Gallery(org.netxms.nebula.widgets.gallery.Gallery) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) DefaultGalleryItemRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer) GalleryItem(org.netxms.nebula.widgets.gallery.GalleryItem)

Aggregations

DefaultGalleryGroupRenderer (org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer)11 DefaultGalleryItemRenderer (org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer)10 Gallery (org.netxms.nebula.widgets.gallery.Gallery)10 GalleryItem (org.netxms.nebula.widgets.gallery.GalleryItem)5 IOException (java.io.IOException)2 SWTException (org.eclipse.swt.SWTException)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 NXCException (org.netxms.client.NXCException)2 Action (org.eclipse.jface.action.Action)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)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 Composite (org.eclipse.swt.widgets.Composite)1 LibraryImage (org.netxms.client.LibraryImage)1 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)1 ImagePropertiesDialog (org.netxms.ui.eclipse.imagelibrary.dialogs.ImagePropertiesDialog)1