use of org.netxms.nebula.widgets.gallery.Gallery 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.Gallery in project netxms by netxms.
the class GalleryTest method testClear.
public void testClear() {
Gallery g = createGallery(SWT.V_SCROLL);
// Add content
GalleryItem[] items = new GalleryItem[3];
GalleryItem[][] subItems = new GalleryItem[3][3];
for (int i = 0; i < 3; i++) {
items[i] = new GalleryItem(g, SWT.None);
items[i].setText("i" + i);
for (int j = 0; j < 3; j++) {
subItems[i][j] = new GalleryItem(items[i], SWT.None);
subItems[i][j].setText("si" + i + "_" + j);
}
}
g.clear(0, true);
assertEquals("", items[0].getText());
assertEquals("", subItems[0][0].getText());
assertEquals("", subItems[0][1].getText());
assertEquals("", subItems[0][2].getText());
g.clear(1);
assertEquals("", items[1].getText());
assertFalse("".equals(subItems[1][0].getText()));
assertFalse("".equals(subItems[1][1].getText()));
assertFalse("".equals(subItems[1][2].getText()));
g.clear(2, false);
assertEquals("", items[2].getText());
assertFalse("".equals(subItems[2][0].getText()));
assertFalse("".equals(subItems[2][1].getText()));
assertFalse("".equals(subItems[2][2].getText()));
}
use of org.netxms.nebula.widgets.gallery.Gallery in project netxms by netxms.
the class GalleryTest method testGalleryAddRemoveClear.
public void testGalleryAddRemoveClear() {
Gallery g = createGallery(SWT.V_SCROLL);
// Create 3 groups
GalleryItem[] items = new GalleryItem[3];
for (int i = 0; i < 3; i++) {
items[i] = new GalleryItem(g, SWT.None);
items[i].setText("i" + i);
}
assertEquals(g.getItemCount(), 3);
// Add content in groups
GalleryItem[][] subItems = new GalleryItem[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
subItems[i][j] = new GalleryItem(items[i], SWT.None);
subItems[i][j].setText("si" + i + "_" + j);
}
assertEquals(items[i].getItemCount(), 3);
}
// dispose si1_1
subItems[1][1].dispose();
assertEquals(2, items[1].getItemCount());
assertEquals("si1_0", items[1].getItem(0).getText());
assertEquals("si1_2", items[1].getItem(1).getText());
// dispose si0
items[0].dispose();
assertEquals(2, g.getItemCount());
assertTrue(subItems[0][1].isDisposed());
// clear si1
items[1].clear();
assertEquals("", items[1].getText());
assertFalse("".equals(subItems[1][0].getText()));
items[1].setText("si1");
// clearAll si1
items[1].clearAll(true);
assertEquals("", subItems[1][0].getText());
g.dispose();
}
use of org.netxms.nebula.widgets.gallery.Gallery 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.Gallery 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;
}
Aggregations