net.java.balloontip.positioners
Class BasicBalloonTipPositioner

java.lang.Object
  extended by net.java.balloontip.positioners.BalloonTipPositioner
      extended by net.java.balloontip.positioners.BasicBalloonTipPositioner
Direct Known Subclasses:
LeftAbovePositioner, LeftBelowPositioner, RightAbovePositioner, RightBelowPositioner

public abstract class BasicBalloonTipPositioner
extends BalloonTipPositioner

Provides common functionality for the positioner classes LeftAbovePositioner, LeftBelowPositioner, RightAbovePositioner and RightBelowPositioner

Author:
Tim Molderez

Field Summary
protected  float attachLocationX
           
protected  float attachLocationY
           
protected  boolean fixedAttachLocation
           
protected  boolean flipX
           
protected  boolean flipY
           
protected  int hOffset
           
protected  int minimumHorizontalOffset
           
protected  boolean offsetCorrection
           
protected  boolean orientationCorrection
           
protected  int preferredHorizontalOffset
           
protected  int preferredVerticalOffset
           
protected  int x
           
protected  int y
           
 
Fields inherited from class net.java.balloontip.positioners.BalloonTipPositioner
balloonTip
 
Constructor Summary
BasicBalloonTipPositioner(int hO, int vO)
          Constructor
 
Method Summary
protected  void applyOffsetCorrection()
           
 void determineAndSetLocation(java.awt.Rectangle attached)
          Determine and set the current location of the balloon tip
protected abstract  void determineLocation(java.awt.Rectangle attached)
           
 void enableFixedAttachLocation(boolean fixedAttachLocation)
          Set whether the tip should have a fixed location
 void enableOffsetCorrection(boolean offsetCorrection)
          Set offset correction
 void enableOrientationCorrection(boolean orientationCorrection)
          Set orientation correction
 float getAttachLocationX()
          Returns the percentage that determines the X-coordinate of the tip within the attached component (whereas 0.0 is the left side and 1.0 is the right side)
 float getAttachLocationY()
          Returns the percentage that determines the Y-coordinate of the tip within the attached component (whereas 0.0 is the top and 1.0 is the bottom)
 int getPreferredHorizontalOffset()
          Retrieve the preferred horizontal offset
 int getPreferredVerticalOffset()
          Retrieve the preferred vertical offset
 java.awt.Point getTipLocation()
          Find the current location of the balloon's tip, relative to the top-level container
 boolean isFixedAttachLocation()
          Does the tip have a fixed location?
 boolean isOffsetCorrected()
          Is offset correction enabled?
 boolean isOrientationCorrected()
          Is orientation correction enabled?
protected  void onStyleChange()
          This method is called whenever the balloon tip's style changes.
 void setAttachLocation(float attachLocationX, float attachLocationY)
          Set where the tip should be located, relative to the component the balloon is attached to.
 void setPreferredHorizontalOffset(int preferredHorizontalOffset)
          Set the preferred horizontal offset
 void setPreferredVerticalOffset(int preferredVerticalOffset)
          Set the preferred horizontal offset
 
Methods inherited from class net.java.balloontip.positioners.BalloonTipPositioner
finalize, getBalloonTip, setBalloonTip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected int x

y

protected int y

hOffset

protected int hOffset

flipX

protected boolean flipX

flipY

protected boolean flipY

preferredHorizontalOffset

protected int preferredHorizontalOffset

preferredVerticalOffset

protected int preferredVerticalOffset

minimumHorizontalOffset

protected int minimumHorizontalOffset

offsetCorrection

protected boolean offsetCorrection

orientationCorrection

protected boolean orientationCorrection

fixedAttachLocation

protected boolean fixedAttachLocation

attachLocationX

protected float attachLocationX

attachLocationY

protected float attachLocationY
Constructor Detail

BasicBalloonTipPositioner

public BasicBalloonTipPositioner(int hO,
                                 int vO)
Constructor

Parameters:
hO - Preferred horizontal offset
vO - Preferred vertical offset
Method Detail

onStyleChange

protected void onStyleChange()
Description copied from class: BalloonTipPositioner
This method is called whenever the balloon tip's style changes. The positioner will ensure the new style is set up properly.

Specified by:
onStyleChange in class BalloonTipPositioner

getPreferredHorizontalOffset

public int getPreferredHorizontalOffset()
Retrieve the preferred horizontal offset

Returns:
Preferred horizontal offset

setPreferredHorizontalOffset

public void setPreferredHorizontalOffset(int preferredHorizontalOffset)
Set the preferred horizontal offset

Parameters:
preferredHorizontalOffset -

getPreferredVerticalOffset

public int getPreferredVerticalOffset()
Retrieve the preferred vertical offset

Returns:
Preferred vertical offset

setPreferredVerticalOffset

public void setPreferredVerticalOffset(int preferredVerticalOffset)
Set the preferred horizontal offset

Parameters:
preferredVerticalOffset -

isOffsetCorrected

public boolean isOffsetCorrected()
Is offset correction enabled?

Returns:
True if offset correction is enabled

enableOffsetCorrection

public void enableOffsetCorrection(boolean offsetCorrection)
Set offset correction

Parameters:
offsetCorrection - enabled if true

isOrientationCorrected

public boolean isOrientationCorrected()
Is orientation correction enabled?

Returns:
True if orientation correction is enabled

enableOrientationCorrection

public void enableOrientationCorrection(boolean orientationCorrection)
Set orientation correction

Parameters:
orientationCorrection - enabled if true

isFixedAttachLocation

public boolean isFixedAttachLocation()
Does the tip have a fixed location?

Returns:
True if the balloon has a fixed attaching location

enableFixedAttachLocation

public void enableFixedAttachLocation(boolean fixedAttachLocation)
Set whether the tip should have a fixed location

Parameters:
fixedAttachLocation - the tip has a fixed location if true

getAttachLocationX

public float getAttachLocationX()
Returns the percentage that determines the X-coordinate of the tip within the attached component (whereas 0.0 is the left side and 1.0 is the right side)

Returns:
The percentage that determines the X-coordinate of the attaching location

getAttachLocationY

public float getAttachLocationY()
Returns the percentage that determines the Y-coordinate of the tip within the attached component (whereas 0.0 is the top and 1.0 is the bottom)

Returns:
The percentage that determines the Y-coordinate of the attaching location

setAttachLocation

public void setAttachLocation(float attachLocationX,
                              float attachLocationY)
Set where the tip should be located, relative to the component the balloon is attached to.

Parameters:
attachLocationX - a number from 0.0 to 1.0 (whereas 0 is the left side; 1 is the right side)
attachLocationY - a number from 0.0 to 1.0 (whereas 0 is the top; 1 is the bottom)

getTipLocation

public java.awt.Point getTipLocation()
Description copied from class: BalloonTipPositioner
Find the current location of the balloon's tip, relative to the top-level container

Specified by:
getTipLocation in class BalloonTipPositioner
Returns:
The location of the tip

applyOffsetCorrection

protected void applyOffsetCorrection()

determineAndSetLocation

public void determineAndSetLocation(java.awt.Rectangle attached)
Description copied from class: BalloonTipPositioner
Determine and set the current location of the balloon tip

Specified by:
determineAndSetLocation in class BalloonTipPositioner
Parameters:
attached - the balloon tip is attached to this rectangle

determineLocation

protected abstract void determineLocation(java.awt.Rectangle attached)


http://balloontip.java.net/