Style Intelligence v12.0

inetsoft.report.painter
Class IconCounterPresenter

java.lang.Object
  extended by inetsoft.report.painter.IconCounterPresenter
All Implemented Interfaces:
Presenter, Serializable

public class IconCounterPresenter
extends Object
implements Presenter

The IconCounterPresenter presents an integer number as a number of icons. It is commonly used to represent ratings or other small scale numbers. The image used in the presenter can be changed by the users. This can be used in a table to display numbers as number of icons.

See Also:
Serialized Form

Constructor Summary
IconCounterPresenter()
          Create a default counter presenter.
IconCounterPresenter(Image image)
          Create a counter presenter using the specified image as the icon.
 
Method Summary
 Color getBackground()
          Get the background.
 String getDisplayName()
          Get the display name of this presenter.
 Image getIcon()
          Get the icon used in this presenter.
 String getIconColor()
          Get the icon color theme.
 Dimension getPreferredSize(Object v)
          Calculate the preferred size of the object representation.
 boolean isFill()
          Check if this presenter should always fill the entire area of a cell.
 boolean isPresenterOf(Class type)
          Check if the presenter can handle this type of objects.
 boolean isPresenterOf(Object obj)
          Check if the presenter can handle this particular object.
 boolean isRawDataRequired()
          Determine if this Presenter requires raw (unformatted) data.
 void paint(Graphics g, Object v, int x, int y, int w, int h)
          Paint an object at the specified location.
 void setBackground(Color bg)
          Set the background.
 void setFont(Font font)
          Set the font to use for this presenter.
 void setIcon(Image icon)
          Set the icon used in this presenter.
 void setIconColor(String color)
          Set the icon color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconCounterPresenter

public IconCounterPresenter()
Create a default counter presenter.


IconCounterPresenter

public IconCounterPresenter(Image image)
Create a counter presenter using the specified image as the icon.

Parameters:
image - icon image.
Method Detail

setIcon

public void setIcon(Image icon)
Set the icon used in this presenter.


getIcon

public Image getIcon()
Get the icon used in this presenter.


setIconColor

public void setIconColor(String color)
Set the icon color. The following color icons are builtin: red, green, blue, rust, yellow.


getIconColor

public String getIconColor()
Get the icon color theme.


paint

public void paint(Graphics g,
                  Object v,
                  int x,
                  int y,
                  int w,
                  int h)
Paint an object at the specified location.

Specified by:
paint in interface Presenter
Parameters:
g - graphical context.
v - object value.
x - x coordinate of the left edge of the paint area.
y - y coordinate of the upper edge of the paint area.
w - area width.
h - area height.

getPreferredSize

public Dimension getPreferredSize(Object v)
Calculate the preferred size of the object representation.

Specified by:
getPreferredSize in interface Presenter
Parameters:
v - object value.
Returns:
preferred size.

isFill

public boolean isFill()
Check if this presenter should always fill the entire area of a cell.

Specified by:
isFill in interface Presenter

isPresenterOf

public boolean isPresenterOf(Class type)
Check if the presenter can handle this type of objects.

Specified by:
isPresenterOf in interface Presenter
Parameters:
type - object type.
Returns:
true if the presenter can handle this type.

isPresenterOf

public boolean isPresenterOf(Object obj)
Check if the presenter can handle this particular object. Normally a presenter handles a class of objects, which is checked by the isPresenterOf(Class) method. If this presenter does not care about the value in the object, it can just call the isPresenterOf() with the class of the object, e.g.
   if(type == null) {
      return false;
   }
   return isPresenterOf(obj.getClass());
 

Specified by:
isPresenterOf in interface Presenter
Parameters:
obj - object type.
Returns:
true if the presenter can handle this type.

setFont

public void setFont(Font font)
Set the font to use for this presenter. A table calls this function before the cell is printed when a presenter is used.

Specified by:
setFont in interface Presenter

getDisplayName

public String getDisplayName()
Get the display name of this presenter.

Specified by:
getDisplayName in interface Presenter
Returns:
a user-friendly name for this presenter.
Since:
5.1

isRawDataRequired

public boolean isRawDataRequired()
Determine if this Presenter requires raw (unformatted) data.

Specified by:
isRawDataRequired in interface Presenter
Returns:
true.

setBackground

public void setBackground(Color bg)
Set the background.

Specified by:
setBackground in interface Presenter

getBackground

public Color getBackground()
Get the background.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.