|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
frams_client_3d.MainWindow
The client main window class.
Nested Class Summary |
Nested classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
private Communication |
comm
|
private java.util.ArrayList |
creatureEvents
|
private java.util.ArrayList |
creatures
|
private java.util.Vector |
creaturesCount
|
private java.lang.String |
groupEvent
|
private java.util.ArrayList |
groups
|
private javax.swing.JPanel |
jContentPane
|
private javax.swing.JSplitPane |
jSplitPane
|
private javax.swing.JSplitPane |
jSplitPane1
|
private boolean |
listening
|
private java.lang.String |
messageEvent
|
private java.util.ArrayList |
messages
|
private Log |
networkLogs
|
private Options |
options
|
private boolean |
running
|
private java.lang.String |
runningEvent
|
private boolean |
showSelected
|
private StatusBar |
statusBar
|
private ViewGL |
viewGL
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Window |
|
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
MainWindow()
This is the default constructor |
Method Summary | |
private javax.swing.tree.DefaultTreeModel |
buildTree()
Read creatures and build the tree. |
private void |
connect(java.lang.Object value)
Connect/disconnect action. |
boolean |
getChangedCreatures()
Read changes on event-registered creatures lists. |
boolean |
getChangedGroups()
Read changes on groups list. |
boolean |
getChangedRunningState()
Read running state. |
private javax.swing.JPanel |
getJContentPane()
This method initializes jContentPane |
private javax.swing.JSplitPane |
getJSplitPane()
This method initializes jSplitPane |
private javax.swing.JSplitPane |
getJSplitPane1()
This method initializes jSplitPane1 |
boolean |
getMessages()
Read simulation messages. |
Options |
getOptions()
This method initializes options |
private StatusBar |
getStatusBar()
This method initializes statusBar |
private ViewGL |
getViewGL()
This method initializes viewGL |
private void |
handleCommunicationErrorException(CommunicationErrorException e)
Protocol error handling. |
private void |
handleException(java.lang.Exception e)
Error handling for unexpected exceptions. |
private void |
handleIOException(java.io.IOException e)
Communication error handling. |
private void |
initialize()
This method initializes this |
boolean |
isListening()
Listening property getter. |
static void |
main(java.lang.String[] args)
|
void |
passObjectsToView()
Pass objects to the viewGL window (according to GUI option all creatures are passed or just those selected on a creatures tree. |
private Creature |
readCreature(int group,
int index)
Read the creature data from a server. |
private java.lang.String |
readGroup(int index)
Read a group name from a server. |
private java.util.ArrayList[] |
readHeighfield()
Read terrain map. |
private void |
readInitialData()
Read terrain map and creatures lists data. |
private java.lang.Integer |
readRunningState()
Read if simulation is running. |
private void |
registerOnCreaturesChanged(int group,
boolean isAdd)
Register for creatures list change in given group. |
private void |
registerOnGroupsChanged()
Register for groups change. |
private void |
registerOnMessages()
Register for simulator messages. |
private void |
registerOnRunningChanged()
Register for simulation start/stop change. |
private java.util.ArrayList |
sendRequest(java.lang.String request)
Send request to server and receive a respond. |
void |
setListening(boolean state)
Listening property setter. |
private void |
startSimulation()
Simulation begin action. |
private void |
stopSimulation()
Simulation end action. |
private void |
updateCreature(int type,
Creature creature)
Update creatures data in a group. |
private void |
updateGroup(int type,
int position,
java.lang.String name)
Update group data in a tree. |
void |
updateLog()
Update network communication log. |
void |
updateMessages()
Show received messages in log window. |
void |
updateRunningState()
Activate/disactivate buttons. |
void |
updateTree()
Pass data of updated objects to the tree and GL View. |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
private Communication comm
private Log networkLogs
private boolean listening
private boolean showSelected
private java.util.ArrayList creatureEvents
private java.lang.String messageEvent
private java.lang.String runningEvent
private java.lang.String groupEvent
private java.util.Vector creaturesCount
private java.util.ArrayList groups
private java.util.ArrayList creatures
private java.util.ArrayList messages
private boolean running
private javax.swing.JPanel jContentPane
private javax.swing.JSplitPane jSplitPane
private javax.swing.JSplitPane jSplitPane1
private Options options
private ViewGL viewGL
private StatusBar statusBar
Constructor Detail |
public MainWindow()
Method Detail |
public static void main(java.lang.String[] args)
private void initialize()
private javax.swing.JPanel getJContentPane()
private javax.swing.JSplitPane getJSplitPane()
private javax.swing.JSplitPane getJSplitPane1()
public Options getOptions()
private StatusBar getStatusBar()
private ViewGL getViewGL()
private void connect(java.lang.Object value)
value
- true for connection, false for disconnectionprivate void readInitialData()
private void handleIOException(java.io.IOException e)
e
- catched exceptionprivate void handleCommunicationErrorException(CommunicationErrorException e)
e
- catched exceptionprivate void handleException(java.lang.Exception e)
e
- catched exceptionprivate void startSimulation()
private void stopSimulation()
private java.lang.Integer readRunningState() throws java.io.IOException, CommunicationErrorException
java.io.IOException
CommunicationErrorException
private java.util.ArrayList[] readHeighfield() throws java.io.IOException, CommunicationErrorException
CommunicationErrorException
java.io.IOException
private javax.swing.tree.DefaultTreeModel buildTree() throws java.io.IOException, CommunicationErrorException
java.io.IOException
CommunicationErrorException
private Creature readCreature(int group, int index) throws java.io.IOException, CommunicationErrorException
group
- creature groupindex
- creature index in the group
java.io.IOException
CommunicationErrorException
private java.lang.String readGroup(int index) throws java.io.IOException, CommunicationErrorException
index
- group index in populations
java.io.IOException
CommunicationErrorException
private void registerOnMessages() throws java.io.IOException, CommunicationErrorException
java.io.IOException
CommunicationErrorException
private void registerOnCreaturesChanged(int group, boolean isAdd) throws java.io.IOException, CommunicationErrorException
group
- index of a group
java.io.IOException
CommunicationErrorException
private void registerOnRunningChanged() throws java.io.IOException, CommunicationErrorException
java.io.IOException
CommunicationErrorException
private void registerOnGroupsChanged() throws java.io.IOException, CommunicationErrorException
java.io.IOException
CommunicationErrorException
private java.util.ArrayList sendRequest(java.lang.String request) throws java.io.IOException, CommunicationErrorException
request
-
java.io.IOException
CommunicationErrorException
public void updateLog()
public void passObjectsToView()
public boolean isListening()
public void setListening(boolean state)
state
- new valuepublic boolean getChangedCreatures() throws java.io.IOException, CommunicationErrorException
java.io.IOException
- Thrown on I/O error
CommunicationErrorException
- Thrown on protocol errorpublic boolean getMessages() throws java.io.IOException, CommunicationErrorException
java.io.IOException
- Thrown on I/O error
CommunicationErrorException
- Thrown on protocol errorpublic boolean getChangedRunningState() throws java.io.IOException, CommunicationErrorException
java.io.IOException
- Thrown on I/O error
CommunicationErrorException
- Thrown on protocol errorpublic boolean getChangedGroups() throws java.io.IOException, CommunicationErrorException
java.io.IOException
- Thrown on I/O error
CommunicationErrorException
- Thrown on protocol errorpublic void updateTree()
private void updateGroup(int type, int position, java.lang.String name)
type
- update type (0-add, 1-remove, 2-modify)position
- group position on population listname
- a name of a groupprivate void updateCreature(int type, Creature creature)
type
- update type (0-add, 1-remove, 2-modify)creature
- objectpublic void updateMessages()
public void updateRunningState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |