use of org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer 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;
}
use of org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer 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();
}
use of org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer 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;
}
use of org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer 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;
}
use of org.netxms.nebula.widgets.gallery.DefaultGalleryItemRenderer 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();
}
Aggregations