|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.org.arlott.simon.hw.f24.lbsta.NetworkView
public class NetworkView
Network viewing mode.
| Field Summary | |
|---|---|
private MainWindow |
mainWindow
The MainWindow. |
private Network |
network
The Network. |
private boolean |
paused
The pause state. |
private java.lang.Integer |
realSpeed
The current speed of the simulation. |
private java.util.Timer |
repaint
The redraw timer. |
private NetworkSimulation |
simulation
The simulation. |
private boolean |
speedChanged
Flag to indicate the speed has changed. |
private boolean |
steppingMode
Flag to indicate if stepping mode is in use. |
| Fields inherited from interface uk.org.arlott.simon.hw.f24.lbsta.CommonInterface |
|---|
MOUSE_PRIMARY, MOUSE_SECONDARY |
| Constructor Summary | |
|---|---|
NetworkView(Network network,
MainWindow mainWindow,
Script script)
Creates a new NetworkView object. |
|
| Method Summary | |
|---|---|
void |
hide()
Switches from this mode. |
boolean |
keyPressed(int keyCode)
Indicates that a key has been pressed. |
boolean |
mouseClick(int button,
java.lang.Object hover)
Handles mouse clicks. |
boolean |
mouseMoved(java.awt.Point position,
java.lang.Object hover)
Indicates that the mouse has been moved. |
void |
paint(java.awt.Graphics g,
java.awt.Dimension size)
Called after the network has been drawn to allow custom drawing to take place. |
private void |
pause()
Pauses the simulation. |
void |
paused(java.lang.String text)
Flags that the simulation has been paused. |
void |
restart()
Restarts the simulation. |
void |
setSpeed(int speed)
Changes the speed of the simulation. |
void |
show()
Switches to this mode. |
void |
start()
Starts the simulation. |
void |
stateChanged(javax.swing.event.ChangeEvent ce)
Handles the setting of component being viewed changing. |
void |
step()
Starts the simulation in stepping mode. |
private void |
unPause()
Unpauses the simulation. |
void |
updateScriptState(java.lang.String text)
Updates the script state status text. |
void |
updateSpeed(int speed)
Updates the record of the simulation's current speed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Network network
Network.
private final MainWindow mainWindow
MainWindow.
private java.util.Timer repaint
private NetworkSimulation simulation
private boolean paused
private java.lang.Integer realSpeed
private boolean speedChanged
private boolean steppingMode
| Constructor Detail |
|---|
public NetworkView(Network network,
MainWindow mainWindow,
Script script)
NetworkView object.
network - The Network.mainWindow - The MainWindow.script - The Script.| Method Detail |
|---|
public void stateChanged(javax.swing.event.ChangeEvent ce)
stateChanged in interface javax.swing.event.ChangeListenerce - Ignored.
public boolean mouseClick(int button,
java.lang.Object hover)
mouseClick in interface CommonInterfacebutton - The mouse button used.hover - The network component that the mouse pointer is over.
true if the network should be redrawn.
public boolean mouseMoved(java.awt.Point position,
java.lang.Object hover)
CommonInterface
mouseMoved in interface CommonInterfaceposition - The position of the mouse pointer.hover - The object, if any, that the mouse pointer is hovering over at the time.
public boolean keyPressed(int keyCode)
CommonInterface
keyPressed in interface CommonInterfacekeyCode - The KeyCode.getKeyCode() value.
public void paint(java.awt.Graphics g,
java.awt.Dimension size)
CommonInterface
paint in interface CommonInterfaceg - The Graphics object to draw to.size - The visible area of the panel to be drawn on.public void show()
show in interface CommonInterfacepublic void hide()
hide in interface CommonInterfacepublic void paused(java.lang.String text)
text - Reason for pausing.private void pause()
private void unPause()
public void setSpeed(int speed)
speed - New speed.public void updateSpeed(int speed)
speed - New speed.public void updateScriptState(java.lang.String text)
text - New status text.public void restart()
public void start()
public void step()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||