Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

normal.packetui
Class DefaultPacketEditor  view DefaultPacketEditor download DefaultPacketEditor.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bynormal.packetui.DefaultPacketEditor
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, PacketUI, java.io.Serializable

public abstract class DefaultPacketEditor
extends javax.swing.JPanel
implements PacketUI

A skeleton PacketUI that is capable of both viewing and editing packets. The decision as to whether packets are allowed to be edited must be made when the constructor is called.

This interface will be an empty panel. Note that some routines from the PacketUI interface are not implemented.


Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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  boolean editor
          Is this interface allowed to edit packets?
private  boolean hasChanged
          Have there been changes to the interface that have not yet been applied to the underlying packet in the engine?
private  boolean shouldIgnoreSetChanged
          Should we ignore all calls to setChanged()?
private  java.util.Vector UIHasChangesListeners
          The list of listeners that will receive UIHasChangesEvent events fired by this interface.
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultPacketEditor(boolean editor)
          Creates a new empty panel.
 
Method Summary
 void addUIHasChangesListener(UIHasChangesListener l)
          Adds the given listener to the list of listeners that will receive UIHasChangesEvent events fired by this interface.
abstract  void applyChanges(normal.engine.Engine engine)
          Take any changes made in the interface and apply them to the underlying packet.
 void cleanUp()
          This will be called when the interface is about to be destroyed.
private  void fireUIHasChangesEvent()
          Sends a UIHasChangesEvent event to all listeners.
 java.awt.Component getInterface()
          Returns the component that forms the interface through which the user can interact with the packet.
abstract  normal.engine.packet.NPacket getPacket()
          Returns the individual packet for which we are providing an interface.
 boolean hasChanges()
          Have changes been made in the interface that have yet to be applied to the underlying packet in the engine?
 void ignoreSetChanged(boolean shouldIgnore)
          Sets whether to ignore all calls to setChanged() By default such calls will be attended to.
 boolean isEditor()
          Is this interface capable of editing the packet?
 boolean isIgnoringSetChanged()
          Determines if all calls to setChanged() are being ignored.
 void packetWasChanged(normal.engine.packet.NPacket packet, PacketUI ui, java.awt.Frame owner)
          This will be called whenever any packet's contents have changed.
 void packetWasRenamed(normal.engine.packet.NPacket packet, PacketUI ui, java.awt.Frame owner)
          This will be called whenever any packet has been renamed.
abstract  void reflectPacket()
          Update the component to reflect the underlying packet in the engine in its current state.
 void removeUIHasChangesListener(UIHasChangesListener l)
          Removes the given listener from the list of listeners that will receive UIHasChangesEvent events fired by this interface.
 void setChanged(boolean hasChanged)
          Sets whether there have been changes to the interface that have not yet been applied to the underlying packet in the engine.
 void subtreeHasChanged(normal.engine.packet.NPacket subtree, PacketUI ui, java.awt.Frame owner)
          This will be called whenever packets have been inserted and/or renamed and/or moved in the given subtree but more specific details about the alterations are not available.
 void subtreeToBeDeleted(normal.engine.packet.NPacket packet, PacketUI ui, java.awt.Frame owner)
          This will be called whenever a packet subtree is about to be deleted.
 void subtreeWasInserted(normal.engine.packet.NPacket subtree, PacketUI ui, java.awt.Frame owner)
          This will be called whenever a packet subtree has been inserted into the overall tree.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, processMouseEvent, 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

editor

private boolean editor
Is this interface allowed to edit packets?


hasChanged

private boolean hasChanged
Have there been changes to the interface that have not yet been applied to the underlying packet in the engine?


shouldIgnoreSetChanged

private boolean shouldIgnoreSetChanged
Should we ignore all calls to setChanged()?


UIHasChangesListeners

private java.util.Vector UIHasChangesListeners
The list of listeners that will receive UIHasChangesEvent events fired by this interface.

Constructor Detail

DefaultPacketEditor

public DefaultPacketEditor(boolean editor)
Creates a new empty panel.

Method Detail

addUIHasChangesListener

public void addUIHasChangesListener(UIHasChangesListener l)
Description copied from interface: PacketUI
Adds the given listener to the list of listeners that will receive UIHasChangesEvent events fired by this interface.

Precondition: The given listener is not already in this list.

Specified by:
addUIHasChangesListener in interface PacketUI

removeUIHasChangesListener

public void removeUIHasChangesListener(UIHasChangesListener l)
Description copied from interface: PacketUI
Removes the given listener from the list of listeners that will receive UIHasChangesEvent events fired by this interface.

Precondition: The given listener is currently in this list.

Specified by:
removeUIHasChangesListener in interface PacketUI

fireUIHasChangesEvent

private void fireUIHasChangesEvent()
Sends a UIHasChangesEvent event to all listeners.


getPacket

public abstract normal.engine.packet.NPacket getPacket()
Description copied from interface: PacketUI
Returns the individual packet for which we are providing an interface.

Specified by:
getPacket in interface PacketUI

getInterface

public java.awt.Component getInterface()
Description copied from interface: PacketUI
Returns the component that forms the interface through which the user can interact with the packet.

Specified by:
getInterface in interface PacketUI

reflectPacket

public abstract void reflectPacket()
Description copied from interface: PacketUI
Update the component to reflect the underlying packet in the engine in its current state. This can be used for instance when the underlying packet has been changed elsewhere.

Specified by:
reflectPacket in interface PacketUI

isEditor

public boolean isEditor()
Description copied from interface: PacketUI
Is this interface capable of editing the packet?

Specified by:
isEditor in interface PacketUI

setChanged

public void setChanged(boolean hasChanged)
Sets whether there have been changes to the interface that have not yet been applied to the underlying packet in the engine. The internal flag that stores this value is set to false when this interface is initially created.

This routine should be called whenever this status changes; this will handle any necessary consequences such as notifying other components that the status has changed. Note in particular that it will probably need to be called from both reflectPacket() and applyChanges().

If ignoreSetChanged(true) is called, subsequent calls to this routine will do nothing and will be ignored completely until ignoreSetChanged(false) is called. This feature is useful when a component is being updated and various event listeners will call setChanged() when you don't want them to. By default calls to this routine will be attended to.


hasChanges

public boolean hasChanges()
Description copied from interface: PacketUI
Have changes been made in the interface that have yet to be applied to the underlying packet in the engine?

Specified by:
hasChanges in interface PacketUI

ignoreSetChanged

public void ignoreSetChanged(boolean shouldIgnore)
Sets whether to ignore all calls to setChanged() By default such calls will be attended to.


isIgnoringSetChanged

public boolean isIgnoringSetChanged()
Determines if all calls to setChanged() are being ignored.


applyChanges

public abstract void applyChanges(normal.engine.Engine engine)
Description copied from interface: PacketUI
Take any changes made in the interface and apply them to the underlying packet.

Specified by:
applyChanges in interface PacketUI

packetWasChanged

public void packetWasChanged(normal.engine.packet.NPacket packet,
                             PacketUI ui,
                             java.awt.Frame owner)
Description copied from interface: PacketUI
This will be called whenever any packet's contents have changed. Often the UI will not be interested unless the packet changed was the specific packet that this UI is reflecting.

Specified by:
packetWasChanged in interface PacketUI

packetWasRenamed

public void packetWasRenamed(normal.engine.packet.NPacket packet,
                             PacketUI ui,
                             java.awt.Frame owner)
Description copied from interface: PacketUI
This will be called whenever any packet has been renamed.

Note that the renaming of packets might cause subtreeHasChanged() to be called instead of this routine if specific details are not available.

Specified by:
packetWasRenamed in interface PacketUI

subtreeToBeDeleted

public void subtreeToBeDeleted(normal.engine.packet.NPacket packet,
                               PacketUI ui,
                               java.awt.Frame owner)
Description copied from interface: PacketUI
This will be called whenever a packet subtree is about to be deleted. Note that this routine will only be called using the root packet of that subtree and will not be called again using its descendants.

The only exception is when the packet in this interface belongs to the subtree to be deleted, in which case this routine will not be called at all and this interface will instead be forcibly closed through other means.

Precondition: The packet in this interface does not belong to the subtree about to be deleted.

Specified by:
subtreeToBeDeleted in interface PacketUI

subtreeWasInserted

public void subtreeWasInserted(normal.engine.packet.NPacket subtree,
                               PacketUI ui,
                               java.awt.Frame owner)
Description copied from interface: PacketUI
This will be called whenever a packet subtree has been inserted into the overall tree. Note that this routine will only be called using the root packet of that subtree and will not be called again using its descendants.

Note that the insertion of packets might cause subtreeHasChanged() to be called instead of this routine if specific details are not available.

Specified by:
subtreeWasInserted in interface PacketUI

subtreeHasChanged

public void subtreeHasChanged(normal.engine.packet.NPacket subtree,
                              PacketUI ui,
                              java.awt.Frame owner)
Description copied from interface: PacketUI
This will be called whenever packets have been inserted and/or renamed and/or moved in the given subtree but more specific details about the alterations are not available. Multiple packets may have been operated upon.

Note that this routine does not cater for packet deletions.

Precondition: The root of the given subtree was not one of the newly inserted packets.

Specified by:
subtreeHasChanged in interface PacketUI

cleanUp

public void cleanUp()
Description copied from interface: PacketUI
This will be called when the interface is about to be destroyed.

Specified by:
cleanUp in interface PacketUI