JIDE 3.5.15

com.jidesoft.tooltip.shapes
Class RoundedRectangularBalloonShape

java.lang.Object
  extended by com.jidesoft.tooltip.shapes.RoundedRectangularBalloonShape
All Implemented Interfaces:
BalloonShape
Direct Known Subclasses:
RectangularBalloonShape

public class RoundedRectangularBalloonShape
extends Object
implements BalloonShape

A balloon shape implemenation which implements the rounded rectangle as the balloon shape.


Field Summary
protected  double _arrowLeftRatio
          The offset ratio of the sticking arrow to left side of the popup.
protected  double _arrowRightRatio
          The offset ratio of the sticking arrow to right side of the popup.
protected  double _balloonSizeRatio
          The size ratio that a balloon in the whole popup.
protected  int _cornerSize
          The edge or corner size
protected  double _vertexPosition
          The offset ratio of the sticking arrow's vertex relative to the left side of the popup.
 
Constructor Summary
RoundedRectangularBalloonShape()
           
 
Method Summary
 Shape createOutline(Dimension balloonSize, Dimension contentSize)
          Create the outline of the balloon.
 double getArrowLeftRatio()
          Gets the ratio between the distance of the border to the arrow leading side and the whole balloon size.
 double getArrowRightRatio()
          Gets the ratio between the distance of the border to the arrow trailing side and the whole balloon size.
 double getBalloonSizeRatio()
          Gets the ratio between the balloon height and the balloon + arrow height.
 int getCornerSize()
          Gets the corner size of the balloon area.
static double getDistance(Point p, Point leftVertex, Point rightVertex, Point topVertex, int cornerSize, boolean contained)
           
 double getEdgeDistance(Point pixel, BalloonTip balloonTip)
          Caculate the distance of the specified pixel to the balloon tip egde.
 Point getHotSpot(Dimension balloonSize)
          Gets the arrow vertex position.
 Insets getInsets(Dimension contentSize)
          Get its insets arround the content component
 int getPosition()
          Gets the balloon tip's position : TOP, RIGHT, BOTTOM, LEFT.
protected  int getRoundedCornerSize()
           
 double getVertexPosition()
          Gets the vertex horizontal or vertical position.
 void setArrowLeftRatio(double arrowLeftRatio)
          Sets the ratio between the distance of the border to the arrow leading side and the whole balloon size.
 void setArrowRightRatio(double arrowRightRatio)
          Sets the ratio between the distance of the border to the arrow trailing side and the whole balloon size.
 void setBalloonSizeRatio(double balloonSizeRatio)
          Sets the ratio between the balloon height and the balloon + arrow height.
 void setCornerSize(int cornerSize)
          Sets the corner size of the balloon area.
 void setPosition(int position)
          Sets the balloon tip's position : TOP, RIGHT, BOTTOM, LEFT.
 void setVertexPosition(double vertexPosition)
          Sets the vertex horizontal or vertical position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_cornerSize

protected int _cornerSize
The edge or corner size


_balloonSizeRatio

protected double _balloonSizeRatio
The size ratio that a balloon in the whole popup.


_arrowLeftRatio

protected double _arrowLeftRatio
The offset ratio of the sticking arrow to left side of the popup.


_arrowRightRatio

protected double _arrowRightRatio
The offset ratio of the sticking arrow to right side of the popup.


_vertexPosition

protected double _vertexPosition
The offset ratio of the sticking arrow's vertex relative to the left side of the popup.

Constructor Detail

RoundedRectangularBalloonShape

public RoundedRectangularBalloonShape()
Method Detail

createOutline

public Shape createOutline(Dimension balloonSize,
                           Dimension contentSize)
Create the outline of the balloon.

Specified by:
createOutline in interface BalloonShape
Parameters:
balloonSize - the preferred size of the balloon.
contentSize - the preferred size of the content
Returns:
the balloon the shape

getRoundedCornerSize

protected int getRoundedCornerSize()

getHotSpot

public Point getHotSpot(Dimension balloonSize)
Description copied from interface: BalloonShape
Gets the arrow vertex position. BalloonTip has an arrow pointing out. The vertex should point to the place that needs the tooltip.

Specified by:
getHotSpot in interface BalloonShape
Parameters:
balloonSize - the preferred size of the balloon.
Returns:
the arrow vertex position.

getInsets

public Insets getInsets(Dimension contentSize)
Get its insets arround the content component

Specified by:
getInsets in interface BalloonShape
Parameters:
contentSize - the preferred size of the content component.
Returns:
the insets around the content component, including the outline shape.

getEdgeDistance

public double getEdgeDistance(Point pixel,
                              BalloonTip balloonTip)
Caculate the distance of the specified pixel to the balloon tip egde.

Specified by:
getEdgeDistance in interface BalloonShape
Parameters:
pixel - current point in the balloon coordinate system.
balloonTip - the balloon tip.
Returns:
the closest or effective distance of the pixel to the balloon outline.

getDistance

public static double getDistance(Point p,
                                 Point leftVertex,
                                 Point rightVertex,
                                 Point topVertex,
                                 int cornerSize,
                                 boolean contained)

getCornerSize

public int getCornerSize()
Gets the corner size of the balloon area.

Returns:
the corner size of the balloon area.

setCornerSize

public void setCornerSize(int cornerSize)
Sets the corner size of the balloon area.

Parameters:
cornerSize - the corner size of the balloon area.

getBalloonSizeRatio

public double getBalloonSizeRatio()
Gets the ratio between the balloon height and the balloon + arrow height. For example, if the ratio is 0.5, it means balloon has the same height as arrow.

Returns:
the ratio between the balloon height and the balloon + arrow height.

setBalloonSizeRatio

public void setBalloonSizeRatio(double balloonSizeRatio)
Sets the ratio between the balloon height and the balloon + arrow height.

Parameters:
balloonSizeRatio - a new ratio between the balloon height and the balloon + arrow height.

getArrowLeftRatio

public double getArrowLeftRatio()
Gets the ratio between the distance of the border to the arrow leading side and the whole balloon size.

Returns:
the ratio between the distance of the left border to the arrow left side and the whole balloon width, assuming the ballon position is TOP or BOTTOM. If the position is LEFT, it will be the ratio between the distance of the top border to the arrow top side and the whole balloon height. If the position is RIGHT, it will be the ratio between the distance of the bottom border to the arrow bottom side and the whole balloon height.

setArrowLeftRatio

public void setArrowLeftRatio(double arrowLeftRatio)
Sets the ratio between the distance of the border to the arrow leading side and the whole balloon size.

Parameters:
arrowLeftRatio - a new ratio between the distance of the left border to the arrow left side and the whole balloon width, assuming the ballon position is TOP or BOTTOM. If the position is LEFT, it will be the ratio between the distance of the top border to the arrow top side and the whole balloon height. If the position is RIGHT, it will be the ratio between the distance of the bottom border to the arrow bottom side and the whole balloon height.

getArrowRightRatio

public double getArrowRightRatio()
Gets the ratio between the distance of the border to the arrow trailing side and the whole balloon size.

Returns:
the ratio between the distance of the right border to the arrow right side and the whole balloon width, assuming the ballon position is TOP or BOTTOM. If the position is LEFT, it will be the ratio between the distance of the bottom border to the arrow bottom side and the whole balloon height. If the position is RIGHT, it will be the ratio between the distance of the top border to the arrow top side and the whole balloon height.

setArrowRightRatio

public void setArrowRightRatio(double arrowRightRatio)
Sets the ratio between the distance of the border to the arrow trailing side and the whole balloon size.

Parameters:
arrowRightRatio - a new ratio between the distance of the right border to the arrow right side and the whole balloon width, assuming the ballon position is TOP or BOTTOM. If the position is LEFT, it will be the ratio between the distance of the bottom border to the arrow bottom side and the whole balloon height. If the position is RIGHT, it will be the ratio between the distance of the top border to the arrow top side and the whole balloon height.

getVertexPosition

public double getVertexPosition()
Gets the vertex horizontal or vertical position.

Returns:
the vertex horizontal position. 0 means the arrow horizontal position is the same as the left border of the balloon. 1 means the same as the right border. This is the case when the balloon position is TOP or BOTTOM. If the position is LEFT, it is the vertex vertical position. 0 means the arrow vertical position is the same as the top border of the balloon. 1 means the same as the bottom border. If the position is RIGHT, it is the opposite vertex vertical position. 0 means the arrow vertical position is the same as the bottom border of the balloon. 1 means the same as the top border.

setVertexPosition

public void setVertexPosition(double vertexPosition)
Sets the vertex horizontal or vertical position.

Parameters:
vertexPosition - a new vertex horizontal position. 0 means the arrow horizontal position is the same as the left border of the balloon. 1 means the same as the right border. This is the case when the balloon position is TOP or BOTTOM. If the position is LEFT, it is the vertex vertical position. 0 means the arrow vertical position is the same as the top border of the balloon. 1 means the same as the bottom border. If the position is RIGHT, it is the opposite vertex vertical position. 0 means the arrow vertical position is the same as the bottom border of the balloon. 1 means the same as the top border.

setPosition

public void setPosition(int position)
Sets the balloon tip's position : TOP, RIGHT, BOTTOM, LEFT.

Parameters:
position - a new ratio balloon tip's position.

getPosition

public int getPosition()
Gets the balloon tip's position : TOP, RIGHT, BOTTOM, LEFT.

Returns:
the balloon tip's position.

JIDE 3.5.15