org.eclipse.rap.rwt.template

## Class ImageCell

- java.lang.Object
- - org.eclipse.rap.rwt.template.Cell<ImageCell>
  - - org.eclipse.rap.rwt.template.ImageCell

All Implemented Interfaces:
  java.io.Serializable

    public class ImageCell
    extends Cell<ImageCell>

Defines a region in a template that displays an image.

Since:
  2.2
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `ImageCell.ScaleMode` Represents a method used to scale an image.

### Constructor Summary

Constructors
Constructor and Description
`ImageCell(Template template)` Constructs a new image cell and adds it to the given template.

### Method Summary

Methods
`ImageCell` `setImage(Image image)` Sets the image to be displayed in this cell if the bindingIndex is not set.
`ImageCell` `setScaleMode(ImageCell.ScaleMode scaleMode)` Selects the method used for image scaling.
`protected JsonObject` `toJson()` Creates a JSON representation of this cell.

### Methods inherited from class org.eclipse.rap.rwt.template.Cell

`setBackground, setBindingIndex, setBottom, setBottom, setFont, setForeground, setHeight, setHorizontalAlignment, setLeft, setLeft, setName, setRight, setRight, setSelectable, setTop, setTop, setVerticalAlignment, setWidth`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ImageCell

    public ImageCell(Template template)

Constructs a new image cell and adds it to the given template.

Parameters:
  `template` - the parent template, must not be `null`

### Method Detail

#### setImage

    public ImageCell setImage(Image image)

Sets the image to be displayed in this cell if the bindingIndex is not set. This can be used to display a static image.

Parameters:
  `image` - an image, or `null` if no image should be displayed
Returns:
  the cell itself, to enable method chaining

#### setScaleMode

    public ImageCell setScaleMode(ImageCell.ScaleMode scaleMode)

Selects the method used for image scaling. The default is ScaleMode.NONE.

Parameters:
  `scaleMode` - the scale mode to use, must not be `null`
Returns:
  the cell itself, to enable method chaining

#### toJson

    protected JsonObject toJson()

Description copied from class: `Cell`
Creates a JSON representation of this cell. Subclasses can override this method, but must call super and add additional attributes like this:

     protected JsonObject toJson() {
       JsonObject json = super.toJson();
       json.add( "foo", getFoo() );
       ...
       return json;
     }

Overrides:
  `toJson` in class `Cell<ImageCell>`
Returns:
  a json object that represents this cell

Copyright (c) EclipseSource and others 2002, 2017. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0