sg.edu.nus.gui.server
Class ServerGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by sg.edu.nus.gui.AbstractMainFrame
                          extended by sg.edu.nus.gui.server.ServerGUI
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, LogEventWatcher

public class ServerGUI
extends AbstractMainFrame

Main function of server peer GUI

Version:
2008-8-1
Author:
Han Xixian
See Also:
Serialized Form

Field Summary
static PeerLog inputLog
           
static PeerLog outputLog
           
static int RUN_PORT
          Define an obscure port to test whether an instance has existed.
 
Fields inherited from class sg.edu.nus.gui.AbstractMainFrame
EVENT_TABLE_WIDTH, HIGH_FREQ, LOW_FREQ, NORM_FREQ, SRC_PATH
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
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.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
ServerGUI()
          This is the default constructor
 
Method Summary
 Logo_Toolbar_Panel getLogo_Toolbar()
           
 OperatePanel getOperatePanel()
           
 ServerPeer getServerpeer()
           
 void log(java.lang.String type, java.lang.String desp, java.lang.String host, java.lang.String src, java.lang.String dest)
          Add a log event for displaying to users.
 void logout(boolean toBoot, boolean toServer, boolean toClient)
          Execute logout operation and broadcast MsgType.TROUBLESHOOT message to all relevant peers.
static void main(java.lang.String[] args)
           
 ServerPeer peer()
          Returns the handler of the ServerPeer.
 void restart()
           
 void scheduleUDPSender(long period)
          Re-schedule the UDP Sender with a new time interval.
 void setComponentText()
           
 void setMenuEnable(boolean flag)
          Set the menus in the menu bar enable or disable.
 void setServerpeer(ServerPeer serverpeer)
           
 void showSuccessfulLoginUI()
          When be successful to login, modify the interface of Loing manager
 boolean startService()
          Start the socket server for accepting incoming connections.
 boolean stopService()
          Stop the bootstrap server.
static boolean tryStartService()
          Try to start the socket server for accepting incoming connections.
 void updateInterface()
          call operatePanel update interface due to new data received in database
 void updatePane()
          Reset the UI of the content pane.
 void updatePane(TreeNode treeNode)
          Update the UI of the content pane.
 void updateSchema(java.lang.String newSchema)
           
 
Methods inherited from class sg.edu.nus.gui.AbstractMainFrame
componentHidden, componentMoved, componentResized, componentShown, processWindowEvent
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, 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, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, 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, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

RUN_PORT

public static final int RUN_PORT
Define an obscure port to test whether an instance has existed.

See Also:
Constant Field Values

inputLog

public static PeerLog inputLog

outputLog

public static PeerLog outputLog
Constructor Detail

ServerGUI

public ServerGUI()
This is the default constructor

Method Detail

peer

public ServerPeer peer()
Returns the handler of the ServerPeer.

Specified by:
peer in class AbstractMainFrame
Returns:
the handler of the ServerPeer

updateInterface

public void updateInterface()
call operatePanel update interface due to new data received in database


getOperatePanel

public OperatePanel getOperatePanel()

getLogo_Toolbar

public Logo_Toolbar_Panel getLogo_Toolbar()

restart

public void restart()

setComponentText

public void setComponentText()

showSuccessfulLoginUI

public void showSuccessfulLoginUI()
When be successful to login, modify the interface of Loing manager


tryStartService

public static boolean tryStartService()
Try to start the socket server for accepting incoming connections.

Returns:
if the socket server starts, return true; otherwise, return false

startService

public boolean startService()
Start the socket server for accepting incoming connections.

Returns:
if success, return true; otherwise, return false

stopService

public boolean stopService()
Stop the bootstrap server.

Returns:
if success, return true; otherwise, return false

scheduleUDPSender

public void scheduleUDPSender(long period)
Description copied from class: AbstractMainFrame
Re-schedule the UDP Sender with a new time interval.

Specified by:
scheduleUDPSender in class AbstractMainFrame
Parameters:
period - the new period for disseminating UDP packets

logout

public void logout(boolean toBoot,
                   boolean toServer,
                   boolean toClient)
Description copied from class: AbstractMainFrame
Execute logout operation and broadcast MsgType.TROUBLESHOOT message to all relevant peers.

Specified by:
logout in class AbstractMainFrame
Parameters:
toBoot - if true, send messages to bootstrapper
toServer - if true, send messages to server peers
toClient - if true, send messages to client peers

log

public void log(java.lang.String type,
                java.lang.String desp,
                java.lang.String host,
                java.lang.String src,
                java.lang.String dest)
Description copied from interface: LogEventWatcher
Add a log event for displaying to users. The format of the log event is defined by LogEvent.

Parameters:
type - the event type
desp - the event description
host - the host name who sends requests
src - the IP address of the requester
dest - the IP address of the receiver

updatePane

public void updatePane(TreeNode treeNode)
Update the UI of the content pane.

Parameters:
treeNode - the instance of TreeNode

updatePane

public void updatePane()
Reset the UI of the content pane.


setMenuEnable

public void setMenuEnable(boolean flag)
Set the menus in the menu bar enable or disable.

Parameters:
flag - the signal to determine if enable or disable

updateSchema

public void updateSchema(java.lang.String newSchema)

getServerpeer

public ServerPeer getServerpeer()
Returns:
the serverpeer

setServerpeer

public void setServerpeer(ServerPeer serverpeer)
Parameters:
serverpeer - the serverpeer to set

main

public static void main(java.lang.String[] args)
Parameters:
args -