Style Intelligence v12.0

inetsoft.report.painter
Class Bar2Presenter

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

public class Bar2Presenter
extends Object
implements Presenter

The Bar2Presenter presents a number as a horizontal bar. The Bar2Presenter handles both positive number and negative number. The area is divided into left and right portions. The negative number is painted as a horizontal bar that grows from the center to the left. The positive number is painted as a bar that grows from the center to the right.

This presenter can be used in a table cell to display numbers as horizontal bars.

See Also:
Serialized Form

Constructor Summary
Bar2Presenter()
          Create a default counter presenter.
Bar2Presenter(double max, Color color, Color neg)
          Create a counter presenter with the max value of the bar, and the color of the bar.
 
Method Summary
 boolean equals(Object obj)
          Check if equals another object.
 Color getBackground()
          Get the background.
 Color getColor()
          Get the color of the bar.
 String getDisplayName()
          Get the display name of this presenter.
 double getMaximum()
          Get the maximum value.
 Color getNegativeColor()
          Get the color of the negative bar.
 Dimension getPreferredSize(Object v)
          Calculate the preferred size of the object representation.
 int hashCode()
          Get the presenter's hash code.
 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 setColor(Color color)
          Set the color of the bar.
 void setFont(Font font)
          Set the font to use for this presenter.
 void setMaximum(double max)
          Set the maximum value.
 void setNegativeColor(Color color)
          Set the color of the negative bar.
 void setPreferredSize(Dimension psize)
          Change the preferred size of the presenter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bar2Presenter

public Bar2Presenter()
Create a default counter presenter.


Bar2Presenter

public Bar2Presenter(double max,
                     Color color,
                     Color neg)
Create a counter presenter with the max value of the bar, and the color of the bar.

Parameters:
max - bar maximum value.
color - bar color.
neg - negative bar color.
Method Detail

getColor

public Color getColor()
Get the color of the bar.


setColor

public void setColor(Color color)
Set the color of the bar.


getNegativeColor

public Color getNegativeColor()
Get the color of the negative bar.


setNegativeColor

public void setNegativeColor(Color color)
Set the color of the negative bar.


getMaximum

public double getMaximum()
Get the maximum value.


setMaximum

public void setMaximum(double max)
Set the maximum value.


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.

setPreferredSize

public void setPreferredSize(Dimension psize)
Change the preferred size of the 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.

isFill

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

Specified by:
isFill in interface Presenter

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

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class Object
Parameters:
obj - the specified object
Returns:
true if equals, false otherwise

hashCode

public int hashCode()
Get the presenter's hash code.

Overrides:
hashCode in class Object
Returns:
hash code

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.