Style Intelligence v12.0

inetsoft.report.painter
Class TrafficLightPresenter

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

public class TrafficLightPresenter
extends Object
implements Presenter

The TrafficLightPresenter display an integer number as one of the traffic light color: red, yellow, or green. A color is chosen according to the low-high range. By default the high range is shown as the red light.

See Also:
Serialized Form

Constructor Summary
TrafficLightPresenter()
           
 
Method Summary
 Color getBackground()
          Get the background.
 int getBorder()
          Get the border size.
 Color getBorderColor()
          Get the border color.
 Color getColor1()
          Set the first (green) color.
 Color getColor2()
          Set the second (yellow) color.
 Color getColor3()
          Get the third (red) color.
 String getDisplayName()
          Get the display name of this presenter.
 double getHigh()
          Get the minimum value for the high value range.
 double getLow()
          Get the maximum value for the low value range.
 Dimension getPreferredSize(Object v)
          Calculate the preferred size of the object representation.
 int getSize()
          Get the diameter of the circle.
 boolean isFill()
          Check if this presenter should always fill the entire area of a cell.
 boolean isHighRed()
          Check the color mapping to value ranges.
 boolean isHorizontal()
          Check whether to show the lights horizontally.
 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.
 boolean isSingleLight()
          Check whether to show only a single light.
 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 setBorder(int w)
          Set the border size.
 void setBorderColor(Color bgColor)
          Set the border color.
 void setColor1(Color clr)
          Get the first (green) color.
 void setColor2(Color clr)
          Get the second (yellow) color.
 void setColor3(Color clr)
          Set the third (red) color.
 void setFont(Font font)
          Set the font to use for this presenter.
 void setHigh(double high)
          Set the minimum value for the high value range.
 void setHighRed(boolean red)
          Set how colors are matched to the low-mid-high ranges.
 void setHorizontal(boolean h)
          Set whether to show the lights horizontally.
 void setLow(double low)
          Set the mximum value for the low value range.
 void setSingleLight(boolean single)
          Set whether to show only a single light.
 void setSize(int size)
          Set the diameter of the circle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrafficLightPresenter

public TrafficLightPresenter()
Method Detail

setHigh

public void setHigh(double high)
Set the minimum value for the high value range.


getHigh

public double getHigh()
Get the minimum value for the high value range.


setLow

public void setLow(double low)
Set the mximum value for the low value range.


getLow

public double getLow()
Get the maximum value for the low value range.


setHorizontal

public void setHorizontal(boolean h)
Set whether to show the lights horizontally.


isHorizontal

public boolean isHorizontal()
Check whether to show the lights horizontally.


setHighRed

public void setHighRed(boolean red)
Set how colors are matched to the low-mid-high ranges. If true, the high value range is shown in red. Otherwise it's shown in green.


isHighRed

public boolean isHighRed()
Check the color mapping to value ranges.


setSingleLight

public void setSingleLight(boolean single)
Set whether to show only a single light.


isSingleLight

public boolean isSingleLight()
Check whether to show only a single light.


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.

setSize

public void setSize(int size)
Set the diameter of the circle.


getSize

public int getSize()
Get the diameter of the circle.


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.


setBorderColor

public void setBorderColor(Color bgColor)
Set the border color.


getBorderColor

public Color getBorderColor()
Get the border color.


setBorder

public void setBorder(int w)
Set the border size.


getBorder

public int getBorder()
Get the border size.


getColor1

public Color getColor1()
Set the first (green) color.


setColor1

public void setColor1(Color clr)
Get the first (green) color.


getColor2

public Color getColor2()
Set the second (yellow) color.


setColor2

public void setColor2(Color clr)
Get the second (yellow) color.


getColor3

public Color getColor3()
Get the third (red) color.


setColor3

public void setColor3(Color clr)
Set the third (red) color.


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