DESY ACOP Beans Home

de.desy.acop.displayers
Class AcopSpider

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by de.desy.acop.displayers.AcopSpider
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class AcopSpider
extends javax.swing.JLabel

AcopSpider is an error tracking monitor for Acop components. The component can be installed into any container and will be presented as a small spider icon.

Upon constructing this component it will start monitoring all TINE connections. When there is an error in any of the connections the component will change color from green to red and will start blinking. Clicking on the icon will open a dialog with description of the error. If there is an AcopDisplayer in the same window as the spider is and that particular error is connected with one of the displayers, the spider will change the visual appearance of the displayer to notify the user what the error refers to.

AcopSpider can also be used for logging the exceptions that occurs during the operation (see addError(Throwable)).

Version:
$Id: Templates.xml,v 1.10 2004/01/13 16:17:13 jbobnar Exp $
Author:
Jaka Bobnar
See Also:
Serialized Form

Nested Class Summary
protected  class AcopSpider.InfoDialog
          InfoDialog presents the fec info
protected  class AcopSpider.SpiderDebugPanel
          AcopDebugPanel shows debug data for certain connection point.
protected  class AcopSpider.SpiderDialog
          SpiderDialog is a dialog popup which appears when user clicks on the spider icon.
 
Nested classes/interfaces inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
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
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AcopSpider()
          Constructs a new AcopSpider.
 
Method Summary
 void addError(java.lang.Throwable e)
          Adds an exception and prints its stack trace in the exception panel.
 javax.swing.Action getCustomAction()
          Returns the currently set custom action.
protected  AcopSpider.SpiderDialog getSpiderDialog()
          Returns the spider dialog which enables inspection of the active links in the tine link factory.
protected  void initializeDefaultCustomAction()
          Initializes the default custom action.
 boolean isAutoResize()
          Returns true if icon resizes automatically when the component is resized.
 boolean isError()
          Returns true if AcopSpider is in error mode.
 boolean isPaintOverlayDecorations()
          Returns true if the spider will paint the overlay decorations across the displayers which are connected with a particular error.
static void main(java.lang.String[] args)
           
protected  void paintComponent(java.awt.Graphics g)
           
 void rescaleIconToFit()
          Rescales the image icon to fit the current size of the displayer.
 void setAutoResize(boolean autoResize)
          Sets whether icon should be resized automatically when component is resized.
 void setCustomAction(javax.swing.Action action)
          Sets the custom action for the custom button.
protected  void setError(boolean isError)
          Puts the spider into the error mode.
 void setIcon(javax.swing.Icon icon)
           
 void setPaintOverlayDecorations(boolean useVitrage)
          Enables/disables painting of overlay decorations on the displayers.
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, 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, 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, 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, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcopSpider

public AcopSpider()
Constructs a new AcopSpider.

Method Detail

initializeDefaultCustomAction

protected void initializeDefaultCustomAction()
Initializes the default custom action. This action will start a webstart application defined in the acop/acop.properties file. The application is provided all active links as JVM parameters identified by -C flag.


setIcon

public void setIcon(javax.swing.Icon icon)
Overrides:
setIcon in class javax.swing.JLabel

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

setError

protected void setError(boolean isError)
Puts the spider into the error mode. When in the error mode the spider will be red and will blink. If not in the error mode the spider will be green. In general this method should not be called from the outside except from the spider hierarchy classes if spider handles other types of processes beside monitoring the active links.

Parameters:
isError - a flag indicating if spider should be in error mode

isError

public boolean isError()
Returns true if AcopSpider is in error mode. The component is in error mode when there is a problem with one of the TINE connections or there has been an exception reported. When in error mode spider will blink in red color. If not in error mode, the component will be green.

Returns:
true if spider is error mode
See Also:
addError(Throwable)

getSpiderDialog

protected AcopSpider.SpiderDialog getSpiderDialog()
Returns the spider dialog which enables inspection of the active links in the tine link factory.

Returns:
the spider dialog

isPaintOverlayDecorations

public boolean isPaintOverlayDecorations()
Returns true if the spider will paint the overlay decorations across the displayers which are connected with a particular error.

Returns:
true if decorations are painted on the displayers

setPaintOverlayDecorations

public void setPaintOverlayDecorations(boolean useVitrage)
Enables/disables painting of overlay decorations on the displayers.

Parameters:
useVitrage -
See Also:
isPaintOverlayDecorations()

isAutoResize

public boolean isAutoResize()
Returns true if icon resizes automatically when the component is resized.

Returns:
true if automatical resizing is on

setAutoResize

public void setAutoResize(boolean autoResize)
Sets whether icon should be resized automatically when component is resized.

Parameters:
autoResize -

rescaleIconToFit

public void rescaleIconToFit()
Rescales the image icon to fit the current size of the displayer.


addError

public void addError(java.lang.Throwable e)
Adds an exception and prints its stack trace in the exception panel. The spider will automatically switch to error mode when this method is called.

Parameters:
e - reported exception
See Also:
isError()

setCustomAction

public void setCustomAction(javax.swing.Action action)
Sets the custom action for the custom button. If the action is non null the custom button will become visible in the information dialog and will execute the given action when pressed. If null action is set, the button will be invisible. Default value for the custom action is start of the webstart application defined in the acop/acop.properties file.

Parameters:
action - the action to be performed on click

getCustomAction

public javax.swing.Action getCustomAction()
Returns the currently set custom action.

Returns:
the custom action

main

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


Copyright © 2010. All Rights Reserved.