synapsi.gui
Class NeuronMainWindow


java.lang.Object

  |

  +--java.awt.Component

        |

        +--java.awt.Container

              |

              +--java.awt.Window

                    |

                    +--java.awt.Frame

                          |

                          +--javax.swing.JFrame

                                |

                                +--synapsi.gui.NeuronMainWindow


public class NeuronMainWindow
extends javax.swing.JFrame
implements java.awt.event.ActionListener, GuiForMain, javax.swing.event.ListSelectionListener, GroupEditor, java.awt.event.MouseListener

Main window of Neuron server

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, 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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
NeuronMainWindow(java.lang.String title, MainForGui dataInterface)
          Construct new NeuronMainWindow and create layout for it
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles all action events from this window and menu bar
 int addClient(java.lang.String clientIP, java.lang.String groupID)
          Adds a new client, forwards call to MainForGui
 void addClientToGroup(java.lang.String clientIP, java.lang.String groupID)
          Adds client to specified group, used by client test window
 int addPackage(java.lang.String filepath, java.lang.String version, java.lang.String vers, java.lang.String os, byte[] MD5)
          Adds a new package, forwards call to MainForGui
 java.util.Vector getPackages()
          Gets the packages from MainForGui
 void groupSorted()
          Called by group table when it is sorted to ensure that clientTable has correct clients
 void informError(int errorCode)
          Informs GUI about an error that has occurred in some module of Neuron server.
 java.lang.String makeErrorMessage(int errorCode)
          Converts error number to error message
 void mouseClicked(java.awt.event.MouseEvent e)
          Used to catch double click from group table.
 void mouseEntered(java.awt.event.MouseEvent e)
          Not used, has to be implemented because NeuronMainWindow implements MouseListener
 void mouseExited(java.awt.event.MouseEvent e)
          Not used, has to be implemented because NeuronMainWindow implements MouseListener
 void mousePressed(java.awt.event.MouseEvent e)
          Not used, has to be implemented because NeuronMainWindow implements MouseListener
 void mouseReleased(java.awt.event.MouseEvent e)
          Not used, has to be implemented because NeuronMainWindow implements MouseListener
 int removeClientFromGroup(java.lang.String clientIP)
          Removes client from group.
 int removeGroup(java.lang.String groupId)
          Removes requested group from groupTable.
 int removePackage(java.lang.String packageId)
          Removes package, forwards call to MainForGui
 void sendInfo(java.lang.String info, boolean active)
          Test function that sends client info to MainForGui
 void setClientActive(java.lang.String clientIP, boolean active)
          Sets the status of requested client to active or passive
 void setClients(int clients)
          Sets the number of concurrent clients by calling MainForGui
 void setClientVersion(java.lang.String clientIP, java.lang.String version)
          Sets the version of requested client
 int setGroupInfo(java.lang.String oldID, java.lang.String newID, java.lang.String version)
          Modifies or adds new group.
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Listens to changes in GroupTable and updates clientTable, if group is changed
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeuronMainWindow


public NeuronMainWindow(java.lang.String title,
                        MainForGui dataInterface)
Construct new NeuronMainWindow and create layout for it
Parameters:
title - Title of this window
Method Detail

actionPerformed


public void actionPerformed(java.awt.event.ActionEvent e)
Handles all action events from this window and menu bar
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - action that just occurred

setClientActive


public void setClientActive(java.lang.String clientIP,
                            boolean active)
Sets the status of requested client to active or passive
Specified by:
setClientActive in interface GuiForMain
Parameters:
clientIP - ip of modified client
active - true, if status is active, otherwise false

setClientVersion


public void setClientVersion(java.lang.String clientIP,
                             java.lang.String version)
Sets the version of requested client
Specified by:
setClientVersion in interface GuiForMain
Parameters:
clientIP - ip of modified client
version - new version of a client

valueChanged


public void valueChanged(javax.swing.event.ListSelectionEvent e)
Listens to changes in GroupTable and updates clientTable, if group is changed
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
e - ListSelectionEvent caught

getPackages


public java.util.Vector getPackages()
Gets the packages from MainForGui
Specified by:
getPackages in interface GroupEditor

setGroupInfo


public int setGroupInfo(java.lang.String oldID,
                        java.lang.String newID,
                        java.lang.String version)
Modifies or adds new group. Forwards information also to MainForGui
Specified by:
setGroupInfo in interface GroupEditor
Parameters:
oldID - ID of modified group. null, if group was added
newID - new ID of a group
version - new version of a group

removeGroup


public int removeGroup(java.lang.String groupId)
Removes requested group from groupTable. Notifies MainForGui
Parameters:
groupID - ID of removed group

setClients


public void setClients(int clients)
Sets the number of concurrent clients by calling MainForGui
Parameters:
clients - number of concurrent clients

addPackage


public int addPackage(java.lang.String filepath,
                      java.lang.String version,
                      java.lang.String vers,
                      java.lang.String os,
                      byte[] MD5)
Adds a new package, forwards call to MainForGui
Parameters:
filepath - path to new packages setup file
version - version of a new package
vers - version number of package
os - operating system of package

removePackage


public int removePackage(java.lang.String packageId)
Removes package, forwards call to MainForGui
Parameters:
packageID - id of removed package

addClient


public int addClient(java.lang.String clientIP,
                     java.lang.String groupID)
Adds a new client, forwards call to MainForGui
Parameters:
clientIP - IP of a new client
groupID - ID of a new Group

addClientToGroup


public void addClientToGroup(java.lang.String clientIP,
                             java.lang.String groupID)
Adds client to specified group, used by client test window
Specified by:
addClientToGroup in interface GuiForMain
Parameters:
clientIP - IP of a moved client
groupID - ID of target group

removeClientFromGroup


public int removeClientFromGroup(java.lang.String clientIP)
Removes client from group. Forwards call to MainForGui and reSorts clientTable
Parameters:
clientIP - IP of removed client

sendInfo


public void sendInfo(java.lang.String info,
                     boolean active)
Test function that sends client info to MainForGui
Parameters:
info - client IP to be send
active - is client active or passive

groupSorted


public void groupSorted()
Called by group table when it is sorted to ensure that clientTable has correct clients

informError


public void informError(int errorCode)
Informs GUI about an error that has occurred in some module of Neuron server.
Specified by:
informError in interface GuiForMain
Parameters:
errorCode - Error code of the error occurred.

makeErrorMessage


public java.lang.String makeErrorMessage(int errorCode)
Converts error number to error message
Specified by:
makeErrorMessage in interface GroupEditor
Parameters:
errorCode - error number to be converted

mouseClicked


public void mouseClicked(java.awt.event.MouseEvent e)
Used to catch double click from group table. Double click event fires active group management
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - MouseEvent caught

mouseEntered


public void mouseEntered(java.awt.event.MouseEvent e)
Not used, has to be implemented because NeuronMainWindow implements MouseListener
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - MouseEvent caught

mouseExited


public void mouseExited(java.awt.event.MouseEvent e)
Not used, has to be implemented because NeuronMainWindow implements MouseListener
Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - MouseEvent caught

mousePressed


public void mousePressed(java.awt.event.MouseEvent e)
Not used, has to be implemented because NeuronMainWindow implements MouseListener
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - MouseEvent caught

mouseReleased


public void mouseReleased(java.awt.event.MouseEvent e)
Not used, has to be implemented because NeuronMainWindow implements MouseListener
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - MouseEvent caught