Ejemplo n.º 1
0
  /** This is a callback that will allow us to create the viewer and initialize it. */
  @Override
  public void createPartControl(Composite parent) {
    Department department = (Department) IModel.INSTANCE.getStation();

    DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
    ir.setShowRoundedSelectionCorners(true);

    Gallery gallery = new Gallery(parent, SWT.NONE);
    gallery.setBackground(
        SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
    gallery.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE));
    gallery.setFont(SWTResourceManager.getFont("Segoe UI", 16, SWT.BOLD));
    gallery.setGroupRenderer(new NoGroupRenderer());
    gallery.setItemRenderer(ir);

    GalleryItem group = new GalleryItem(gallery, SWT.NONE);
    for (Employee employee : department.getEmployees()) {
      GalleryItem item = new GalleryItem(group, SWT.NONE);
      String imageName = getImageName(employee.getName());
      item.setImage(getCachedImage(imageName));
      item.setText(StringUtil.safe(employee.getName()));
    }
  }
 public void setSelectionForegroundColor(Color selectionForegroundColor) {
   itemRenderer.setSelectionForegroundColor(selectionForegroundColor);
 }
 public void setForegroundColor(Color foregroundColor) {
   itemRenderer.setForegroundColor(foregroundColor);
 }
 public void setBackgroundColor(Color backgroundColor) {
   itemRenderer.setBackgroundColor(backgroundColor);
 }
 public Color getSelectionForegroundColor() {
   return itemRenderer.getSelectionForegroundColor();
 }
 public Color getForegroundColor() {
   return itemRenderer.getForegroundColor();
 }
 public Color getBackgroundColor() {
   return itemRenderer.getBackgroundColor();
 }