|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.event.MouseAdapter
net.pacbell.jfai.toh.ui.TowerOfHanoiView
public class TowerOfHanoiView
Provides the user interface for the Solver of Tower Of Hanoi. It also functions as the "glue" between the model (Solver) and the various user interface components. Provides apply/cancel editor functions for the bound properties of the Solver model.
| Field Summary | |
|---|---|
(package private) static Log |
LOG
The trace log. |
| Constructor Summary | |
|---|---|
TowerOfHanoiView(Solver aModel)
Creates an instance for the given Solver. |
|
| Method Summary | |
|---|---|
protected void |
beginPinSelection(BufferedValue pinModel)
Prepares for the selection of a pin in the scene. |
protected void |
changeButtonLabel(JToggleButton button,
String caption)
Changes the text of the given button. |
protected void |
changeEditing(boolean isChanging)
When changes are present, enables the controls to apply changes and disables the start button. |
protected void |
changeSizeSlider(int value)
Changes the value of the slider for number of disks. |
void |
cleanUp()
Ends the visualization. |
static float |
depth()
Answers the depth of the puzzle. |
protected void |
enableConfigurationControls(boolean isEnable)
Enables or disables the user interface components that change the puzzle. |
protected void |
endPinSelection()
Ends the selection of a pin. |
protected CanvasPanel |
getCanvasPanel()
Gets the canvas panel. |
protected JPanel |
getContainer()
Gets the container. |
protected ControlPanel |
getControlPanel()
Gets the control panel. |
protected TowerOfHanoiEditor |
getEditor()
Gets the editor. |
Solver |
getModel()
Gets the model. |
(package private) ActionListener |
getStartButtonListener()
Gets the listener for the start button. |
(package private) StatusPanel |
getStatusPanel()
Gets the status panel. |
static float |
height()
Answers the height of the puzzle. |
void |
idling()
Notifies the listener that the state was changed to Idle. |
void |
mouseExited(MouseEvent e)
When a pin selection button is pressed, this view is registered as a listener for mouse events for the 3D canvas. |
protected void |
pause()
Tells the model to pause while solving the puzzle. |
void |
paused()
Notifies the listener that the state was changed to Paused. |
void |
prepare(JPanel contentPane)
Prepares the initial view of the model. |
protected void |
resume()
Tells the model to resume solving the puzzle. |
(package private) void |
setStartButtonListener(ActionListener startButtonListener)
Sets the listener for the start button action. |
protected void |
solve()
Tells the model to start solving the puzzle. |
void |
solving()
Notifies the listener that the state was changed to Solving. |
static float |
width()
Answers the width of the puzzle. |
| Methods inherited from class java.awt.event.MouseAdapter |
|---|
mouseClicked, mouseEntered, mousePressed, mouseReleased |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final Log LOG
| Constructor Detail |
|---|
public TowerOfHanoiView(Solver aModel)
aModel - a Solver| Method Detail |
|---|
public static final float depth()
public static final float height()
public static final float width()
public void cleanUp()
public Solver getModel()
public void idling()
idling in interface Solver.IStateListenerSolver.IStateListener.idling()public void mouseExited(MouseEvent e)
mouseExited in interface MouseListenermouseExited in class MouseAdapterMouseAdapter.mouseExited(java.awt.event.MouseEvent)public void paused()
paused in interface Solver.IStateListenerSolver.IStateListener.paused()public void prepare(JPanel contentPane)
TODO: prevent window from getting too small
contentPane - the content pane of a root containerpublic void solving()
solving in interface Solver.IStateListenerSolver.IStateListener.solving()protected void beginPinSelection(BufferedValue pinModel)
pinModel - a BufferedValue for the selected pin
protected void changeButtonLabel(JToggleButton button,
String caption)
button - the buttoncaption - the new captionprotected void changeEditing(boolean isChanging)
This may be called from a thread different than the event dispatch thread.
isChanging - Are any changes pending?protected void changeSizeSlider(int value)
value - the number of disksprotected void enableConfigurationControls(boolean isEnable)
isEnable - enable the controls?protected void endPinSelection()
protected CanvasPanel getCanvasPanel()
protected JPanel getContainer()
protected ControlPanel getControlPanel()
protected TowerOfHanoiEditor getEditor()
protected void pause()
Assumes that this method is called in the event dispatch thread, for example, when a pause button was pressed.
protected void resume()
Assumes that this method is called in the event dispatch thread, for example, when a resume button was pressed.
protected void solve()
Assumes that this method is called in the event dispatch thread, for example, when a start button was pressed.
ActionListener getStartButtonListener()
StatusPanel getStatusPanel()
void setStartButtonListener(ActionListener startButtonListener)
startButtonListener - the listener for the start button action
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||