standup.clouds
Class CloudButton

java.lang.Object
  extended by standup.clouds.EntityAnimatedInteractive
      extended by standup.clouds.EntityAnimatedInteractiveBubbleLabel
          extended by standup.clouds.CloudButton
All Implemented Interfaces:
Entity, EntityAnimated
Direct Known Subclasses:
CloudButtonAddToFavourites, CloudButtonJokeGetter, CloudButtonJokeTypeChooser, CloudButtonLogin, CloudButtonNewJoke, CloudButtonOldJoke, CloudButtonOldJokes, CloudButtonProfile, CloudButtonProfileChooser, CloudButtonProfileTypeIn, CloudButtonRepeatJoke, CloudButtonSenseChooser, CloudButtonTellJoke, CloudButtonTellJokeSpeak, CloudButtonTopic, CloudButtonWordClustered, CloudButtonWordModeChooser, CloudButtonWordTrie, CloudButtonWordTypeIn

public abstract class CloudButton
extends EntityAnimatedInteractiveBubbleLabel

A CloudButton is a GUI button that appears inside a PanelCloudButtonMenu, i.e. the main interaction display in STANDUP.

It can also be thought of abstractly as a node in a tree that defines the menu choices presented to the user. A CloudButton has a number of child CloudButtons, which can either be peripheral children (appearing laid out in a radial fashion), or a centre child, appearing in the centre of the screen.

When a CloudButton is selected by the user, the executeClick() method is called.

Author:
Ruli Manurung

Nested Class Summary
static class CloudButton.LineMode
           
 
Field Summary
private  AnimatorCloudButton animator
           
private  CloudButton centreChild
          centreChild is the option that appears in the centre of the bubblebrowser.
protected  CloudLabel message
           
private  CloudButton parent
          Get this Lubble's parent, i.e.
private  List<? extends CloudButton> peripheralChildren
          peripheralChildren are the option that appears at the periphery of the bubblebrowser.
(package private)  PanelProgressMap.ProgressMapStage progressMapStage
           
 
Fields inherited from class standup.clouds.EntityAnimatedInteractiveBubbleLabel
bubbleLabel, cloudLabelLayout, myShape
 
Fields inherited from class standup.clouds.EntityAnimatedInteractive
containingPanel, frontend
 
Constructor Summary
CloudButton(CloudFrontend _frontend, CloudButton _parent, CloudLabel _label, CloudLabel _message, CloudLabel _help)
          METHODS
CloudButton(CloudFrontend f, CloudButton p, CloudLabel bl, CloudLabel msg, CloudLabel help, PanelProgressMap.ProgressMapStage pmn)
          Constructor method for a Lubble.
 
Method Summary
 void clicked()
          AnimatedEntityInteractive methods
 Milestone executeClick()
           This is the default action that is performed when a CloudButton is clicked, i.e.: Perform the appropriate animations: 'shrink' siblings, move to centre, 'grow' children, and Update progress map if necessary, and Return a Milestone representing the user's interaction choice.
 CloudButton getCentreChild()
           
 Dimension getCentreSize(Dimension bubbleBrowserDimension)
          This method returns the Dimension that determines the size of this Lubble in the BubbleBrowser when it is a centre child.
 int getMaxChildrenDisplay()
           
 CloudLabel getMessage()
          Returns this CloudButton's message to be displayed in the MessageWindow.
 int getOffsetAngle()
           
 CloudButton getParent()
           
 List<? extends CloudButton> getPeripheralChildren()
           
 Dimension getRingSize(Dimension bubbleBrowserDimension)
          This method returns the Dimension that determines the size of this Lubble in the BubbleBrowser when it is a peripheral child.
(package private)  void layoutCloudLabel(FontRenderContext frc)
           
 void prepareForAnimation(AnimatorCloudButton _a, PanelCloudButtonMenu bb)
           
(package private)  boolean removeChild(CloudButton orphan)
          This method removes a Lubble from this Lubble's children, whether central or peripheral...
 void setCentreChild(CloudButton centreChild)
           
(package private)  void setLocation(Point newCentre)
          Set this CloudButton's location.
 void setMessage(CloudLabel msg)
          Set this CloudButton's message to be displayed in the MessageWindow.
 void setPeripheralChildren(List<? extends CloudButton> peripheralChildren)
          Set this CloudButton's peripheral children, i.e.
(package private)  void setSize(Dimension newDimension)
          Set this CloudButton's size.
(package private)  void showMessage(CloudLabel message)
          Animate the display of this CloudButton's message.
(package private)  void showMessage(CloudLabel message, AnimatorLock al)
          Animate the display of this CloudButton's message using the given AnimatorLock.
 void step(int frame)
          Notify the AnimatorCloudButton to update this CloudButton's size and position.
 
Methods inherited from class standup.clouds.EntityAnimatedInteractiveBubbleLabel
contains, draw, getBubbleLabel, getCurrentDimension, getCurrentLocation, getSpeechText
 
Methods inherited from class standup.clouds.EntityAnimatedInteractive
dehighlight, getHelpText, getLogFileText, highlight, isHighlighted, speakSpeechText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

animator

private AnimatorCloudButton animator

parent

private final CloudButton parent
Get this Lubble's parent, i.e. the Lubble from which this Lubble was called. This is important because there will be instances where we want to go back to a previous Lubble!


centreChild

private CloudButton centreChild
centreChild is the option that appears in the centre of the bubblebrowser. this is optional...


peripheralChildren

private List<? extends CloudButton> peripheralChildren
peripheralChildren are the option that appears at the periphery of the bubblebrowser.


message

protected CloudLabel message

progressMapStage

PanelProgressMap.ProgressMapStage progressMapStage
Constructor Detail

CloudButton

public CloudButton(CloudFrontend _frontend,
                   CloudButton _parent,
                   CloudLabel _label,
                   CloudLabel _message,
                   CloudLabel _help)
METHODS

Parameters:
_f -
_a -
_t -
_lineMode -
_i -
bb -

CloudButton

public CloudButton(CloudFrontend f,
                   CloudButton p,
                   CloudLabel bl,
                   CloudLabel msg,
                   CloudLabel help,
                   PanelProgressMap.ProgressMapStage pmn)
Constructor method for a Lubble.

Parameters:
f - Frontend
p - This Lubble's parent
bl - BubbleLabel displayed on this Lubble
msg - BubbleLabel to display in the MessageWindow -- set to null if not required
pmn - ProgressMapStage that this Lubble leads towards
Method Detail

clicked

public void clicked()
AnimatedEntityInteractive methods

Overrides:
clicked in class EntityAnimatedInteractive

executeClick

public Milestone executeClick()

This is the default action that is performed when a CloudButton is clicked, i.e.:

Override this method if: -- you want this Lubble to perform other things when first clicked, e.g. joke generation (make sure to call super.getMilestone to return the Milestone!) -- you just want to perform some stuff that doesn't end up as a Milestone on the HistoryCoordinator (make sure to return null)

Returns:

getCentreChild

public CloudButton getCentreChild()

getCentreSize

public Dimension getCentreSize(Dimension bubbleBrowserDimension)
This method returns the Dimension that determines the size of this Lubble in the BubbleBrowser when it is a centre child. Since the BubbleBrowser window size itself is a factor, it is passed as a parameter here.

Parameters:
bubbleBrowserDimension - The Dimension of the BubbleBrowser this Lubble appears in
Returns:
The Dimension of this Lubble when appearing on the BubbleBrowser centre

getMaxChildrenDisplay

public int getMaxChildrenDisplay()

getOffsetAngle

public int getOffsetAngle()

getParent

public CloudButton getParent()

getPeripheralChildren

public List<? extends CloudButton> getPeripheralChildren()

getRingSize

public Dimension getRingSize(Dimension bubbleBrowserDimension)
This method returns the Dimension that determines the size of this Lubble in the BubbleBrowser when it is a peripheral child. Since the BubbleBrowser window size itself is a factor, it is passed as a parameter here.

Parameters:
bubbleBrowserDimension - The Dimension of the BubbleBrowser this Lubble appears in
Returns:
The Dimension of this Lubble when appearing on the BubbleBrowser peripheral ring/ellipse

removeChild

boolean removeChild(CloudButton orphan)
This method removes a Lubble from this Lubble's children, whether central or peripheral...

Parameters:
orphan -
Returns:

setCentreChild

public void setCentreChild(CloudButton centreChild)

setPeripheralChildren

public void setPeripheralChildren(List<? extends CloudButton> peripheralChildren)
Set this CloudButton's peripheral children, i.e. a list of CloudButtons to be displayed in a circle.

Parameters:
peripheralChildren -

step

public void step(int frame)
Notify the AnimatorCloudButton to update this CloudButton's size and position.


setSize

void setSize(Dimension newDimension)
Set this CloudButton's size.

Parameters:
newDimension - the new size of this CloudButton.

setLocation

void setLocation(Point newCentre)
Set this CloudButton's location.

Parameters:
newCentre - the new location of this CloudButton.

prepareForAnimation

public void prepareForAnimation(AnimatorCloudButton _a,
                                PanelCloudButtonMenu bb)

getMessage

public CloudLabel getMessage()
Returns this CloudButton's message to be displayed in the MessageWindow.

Returns:

setMessage

public void setMessage(CloudLabel msg)
Set this CloudButton's message to be displayed in the MessageWindow.

Parameters:
msg -

showMessage

void showMessage(CloudLabel message)
Animate the display of this CloudButton's message. Override this to call PanelMessageWindow.showJoke(CloudLabel) if the message is a joke!

Parameters:
message - The message to be displayed

showMessage

void showMessage(CloudLabel message,
                 AnimatorLock al)
Animate the display of this CloudButton's message using the given AnimatorLock. Override this to call PanelMessageWindow.showJoke(CloudLabel, AnimatorLock) if the message is a joke!

Parameters:
message - The message to be displayed
al - The object that controls animation synchronization

layoutCloudLabel

void layoutCloudLabel(FontRenderContext frc)
Overrides:
layoutCloudLabel in class EntityAnimatedInteractiveBubbleLabel