use of org.netxms.ui.eclipse.imagelibrary.shared.ImageProvider in project netxms by netxms.
the class ImageSelectionDialog method refreshImages.
/**
*/
private void refreshImages() {
final ImageProvider provider = ImageProvider.getInstance(getShell().getDisplay());
final List<LibraryImage> imageLibrary = provider.getImageLibrary();
Map<String, List<LibraryImage>> categories = new HashMap<String, List<LibraryImage>>();
for (LibraryImage image : imageLibrary) {
final String category = image.getCategory();
final Image swtImage = provider.getImage(image.getGuid());
final Rectangle bounds = swtImage.getBounds();
if (bounds.height <= maxHeight && bounds.width <= maxWidth) {
if (!categories.containsKey(category)) {
categories.put(category, new ArrayList<LibraryImage>());
}
categories.get(category).add(image);
}
}
// this.knownCategories = categories.keySet();
gallery.removeAll();
for (String category : categories.keySet()) {
final GalleryItem categoryItem = new GalleryItem(gallery, SWT.NONE);
categoryItem.setText(category);
final List<LibraryImage> categoryImages = categories.get(category);
for (LibraryImage image : categoryImages) {
final GalleryItem imageItem = new GalleryItem(categoryItem, SWT.NONE);
imageItem.setText(image.getName());
imageItem.setImage(provider.getImage(image.getGuid()));
imageItem.setData(image);
}
}
gallery.redraw();
}
use of org.netxms.ui.eclipse.imagelibrary.shared.ImageProvider in project netxms by netxms.
the class PredefinedMap method dispose.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.networkmaps.views.NetworkMap#dispose()
*/
@Override
public void dispose() {
ImageProvider p = ImageProvider.getInstance(display);
if (p != null)
p.removeUpdateListener(this);
if (defaultLinkColor != null)
defaultLinkColor.dispose();
super.dispose();
}
Aggregations