de.sciss.jcollider.gui
Class ServerPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by de.sciss.jcollider.gui.ServerPanel
All Implemented Interfaces:
Constants, ServerListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ServerPanel
extends javax.swing.JPanel
implements ServerListener, Constants

A quick hack to provide a GUI element looking similar to SCLang's server window. Additionally, you can opt to create a text console for scsynth text output when booting the local server.

Version:
0.32, 25-Feb-08
Author:
Hanns Holger Rutz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int BIGNAME
          Constructor flag: create a server name box
static int BOOTQUIT
          Constructor flag: create a boot/quit button
static int CONSOLE
          Constructor flag: create a console panel.
static int COUNTS
          Constructor flag: create a status panel for server CPU usage and number of nodes.
static int DUMP
          Constructor flag: create a button to turning OSC dumping on/off.
protected  ServerPanel enc_this
           
static java.awt.Font fntBigName
          Font used for server name box.
static java.awt.Font fntConsole
          Font used for the text console.
static java.awt.Font fntGUI
          Font used for the GUI elements (buttons).
static int MIMIC
          Constructor flag: shortcut for creating those GUI elements that SClang provides.
protected  Server server
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface de.sciss.jcollider.Constants
kAddAfter, kAddBefore, kAddReplace, kAddToHead, kAddToTail, kAudioRate, kControlRate, kDemandRate, kDoneFree, kDoneFreeAll, kDoneFreeAllPred, kDoneFreeAllSucc, kDoneFreeGroup, kDoneFreePausePred, kDoneFreePauseSucc, kDoneFreePred, kDoneFreePredGroup, kDoneFreePredGroupDeep, kDoneFreeSucc, kDoneFreeSuccGroup, kDoneFreeSuccGroupDeep, kDoneNothing, kDonePause, kDumpBoth, kDumpHex, kDumpOff, kDumpText, kHeaderAIFF, kHeaderIRCAM, kHeaderNeXT, kHeaderRaw, kHeaderWAVE, kSampleALaw, kSampleDouble, kSampleFloat, kSampleInt16, kSampleInt24, kSampleInt32, kSampleInt8, kSampleMuLaw, kScalarRate
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ServerPanel(Server server, int flags)
          Creates a new ServerPanel for the given server and with GUI elements specified by the flags.
 
Method Summary
 void dispose()
          Call this method if the server isn't used any more or the panel's parent window is disposed.
static javax.swing.JFrame makeWindow(Server server)
          Creates a window containing a ServerPanel for the given server.
static javax.swing.JFrame makeWindow(Server server, int flags)
          Creates a window with custom flags.
 void serverAction(ServerEvent e)
          This class implements the ServerListener interface to be notified about the server booting and quitting, and for tracking the status.
protected  void showHideConsole(boolean show)
           
protected  void updateBigName()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fntConsole

public static java.awt.Font fntConsole
Font used for the text console. You can set this field prior to instantiating the ServerPanel to use a different font.


fntGUI

public static java.awt.Font fntGUI
Font used for the GUI elements (buttons). You can set this field prior to instantiating the ServerPanel to use a different font.


fntBigName

public static java.awt.Font fntBigName
Font used for server name box. You can set this field prior to instantiating the ServerPanel to use a different font.


CONSOLE

public static final int CONSOLE
Constructor flag: create a console panel.

See Also:
Constant Field Values

BOOTQUIT

public static final int BOOTQUIT
Constructor flag: create a boot/quit button

See Also:
Constant Field Values

BIGNAME

public static final int BIGNAME
Constructor flag: create a server name box

See Also:
Constant Field Values

COUNTS

public static final int COUNTS
Constructor flag: create a status panel for server CPU usage and number of nodes.

See Also:
Constant Field Values

DUMP

public static final int DUMP
Constructor flag: create a button to turning OSC dumping on/off.

See Also:
Constant Field Values

MIMIC

public static final int MIMIC
Constructor flag: shortcut for creating those GUI elements that SClang provides.

See Also:
Constant Field Values

server

protected final Server server

enc_this

protected final ServerPanel enc_this
Constructor Detail

ServerPanel

public ServerPanel(Server server,
                   int flags)
Creates a new ServerPanel for the given server and with GUI elements specified by the flags.

Parameters:
server - the server to which this panel is connected
flags - a mask of flags that define which GUI elements should be created, e.g. CONSOLE, BOOTQUIT etc.
Method Detail

dispose

public void dispose()
Call this method if the server isn't used any more or the panel's parent window is disposed. This will free any resources occupied by the panel and remove listeners.


updateBigName

protected void updateBigName()

showHideConsole

protected void showHideConsole(boolean show)

makeWindow

public static javax.swing.JFrame makeWindow(Server server)
Creates a window containing a ServerPanel for the given server. Uses default flags (MIMIC).

Parameters:
server - the server to which the panel shall be connected
Returns:
a frame containing the panel. This frame is already made visible. The default close operation is DO_NOTHING_ON_CLOSE, so you will want to attach a WindowListener which deals with closing and cleanup.

makeWindow

public static javax.swing.JFrame makeWindow(Server server,
                                            int flags)
Creates a window with custom flags. See the one argument method for details.

Parameters:
server - the server to which the panel shall be connected
flags - a mask of flags that define which GUI elements should be created, e.g. CONSOLE, BOOTQUIT etc.
See Also:
makeWindow( Server )

serverAction

public void serverAction(ServerEvent e)
This class implements the ServerListener interface to be notified about the server booting and quitting, and for tracking the status.

Specified by:
serverAction in interface ServerListener
Parameters:
e - the event describing what REALLY happened