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

Quick Search    Search Deep

org.merlotxml.merlot.plugins.configeditor
Class ConfigEditorRecordPanel  view ConfigEditorRecordPanel download ConfigEditorRecordPanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.merlotxml.merlot.GenericDOMEditPanel
                      extended byorg.merlotxml.merlot.plugins.configeditor.ConfigEditorRecordPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, org.merlotxml.merlot.MerlotConstants, java.io.Serializable

public class ConfigEditorRecordPanel
extends org.merlotxml.merlot.GenericDOMEditPanel
implements org.merlotxml.merlot.MerlotConstants

This is a generic node editing panel which provides a component for each attribute listed with the element it's created to edit, along with a text box for PCDATA.

This class can be extended to change what the user sees for each attribute field. Typically the easiest methods to overload for this type of custom editors are getEditComponent() and sometimes save().


Nested Class Summary
(package private)  class ConfigEditorRecordPanel.IDObject
           
(package private)  class ConfigEditorRecordPanel.IDREFComboBoxRenderer
           
static class ConfigEditorRecordPanel.ScrollablePanel
           
protected  class ConfigEditorRecordPanel.StandardAttributeChecker
          Checks attributes according to their type.
 
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
(package private)  ConfigEditorActions _actions
           
protected  java.util.Hashtable _attrComponents
          Map of attribute names to attribute components (key is String, val is JComponent)
private  javax.swing.JPanel _attributePanel
          The panel which contains the actual layout of attributes.
protected  java.util.Hashtable _dtd_attributes
          Map of attribute names to their DTDAttribute declaration
private  boolean _first_component
          Flags used in Record panel layout
private  javax.swing.JComponent _first_field
           
protected  org.merlotxml.merlot.MerlotDOMNode _node
          The node this editor was created for
protected  org.w3c.dom.NamedNodeMap _node_attributes
          The attributes and their values from this node
protected  javax.swing.JComponent _prev
           
protected static javax.swing.Icon _requiredAttrIcon
          The icon to use for required attribute labels
protected  org.merlotxml.merlot.MerlotDOMText _subtext
          A node which is the child #text element for this node
private  java.util.Vector _vetoListeners
          List of PropertyChangeListeners that can veto editing actions.
static int ALIGN_BOTTOM
           
static int ALIGN_MIDDLE
           
static int ALIGN_TOP
           
 java.util.Hashtable childHash
          A hashstable which contains the field elements and their names.
 java.util.Vector childNodes
          Contains the Field Elements for this Record
(package private)  ConfigEditorDebug SEDebug
           
 
Fields inherited from class org.merlotxml.merlot.GenericDOMEditPanel
_readonlyAttrs, _target, _text
 
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 org.merlotxml.merlot.MerlotConstants
ACTION_MENU_ACCELERATOR, ACTION_MENU_ICON, ACTION_NAME, ACTION_SHORT_DESCRIPTION, ACTION_SMALL_ICON, AFTER, BEFORE, ERR, INTO, UI, XML
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ConfigEditorRecordPanel()
           
ConfigEditorRecordPanel(org.merlotxml.merlot.MerlotDOMNode node)
           
 
Method Summary
protected  void addAttributeComponent(javax.swing.JLabel l, javax.swing.JComponent c, int align)
           
protected  void addNameValuePair(java.lang.String a_name, org.merlotxml.util.xml.DTDAttribute a_value, org.merlotxml.merlot.MerlotDOMNode thisnode)
           
 void addVetoableChangeListener(java.beans.VetoableChangeListener l)
          Register a VetoableChangeListener.
protected  void buildPanel()
           
static char checkNmtokenChars(java.lang.String nmtoken)
          Check to see if a string is a valid Nmtoken according to [7] in the XML 1.0 Recommendation
 void fireVetoableChange(java.beans.PropertyChangeEvent evt)
           
protected  java.lang.String getDisplayTextForAttribute(org.merlotxml.merlot.MerlotDOMNode idRefNode, java.lang.String idRefAttrName, org.merlotxml.merlot.MerlotDOMNode idNode, java.lang.String idAttrName)
          Returns the text which represents the referenced node inan IDREF comboBox
protected  javax.swing.JComponent getEditComponent(org.merlotxml.util.xml.DTDAttribute attr, org.merlotxml.merlot.MerlotDOMNode node)
          Create a component based on the attribute type, and get the default from the node, or if the node doesn't have it set, get the default value from the attribute definition itself
protected  javax.swing.JComponent getIdComponent(org.merlotxml.merlot.MerlotDOMNode node, java.lang.String attrName)
          Returns a component aimed at editing the ID attribute from a DOM node.
 java.lang.String getIdForNode(org.merlotxml.merlot.MerlotDOMNode node)
           
protected  org.merlotxml.merlot.IDManager getIdManager()
           
protected  javax.swing.JComponent getIdRefComponent(org.merlotxml.merlot.MerlotDOMNode targetNode, java.lang.String targetAttrName)
          Returns a component aimed at editing the IDREF attribute from a DOM node.
private  int getIndexInVector(java.util.Vector v, java.lang.String s)
           
protected  javax.swing.Icon getRequiredAttrIcon()
           
 void grabFocus()
          Requests that this component receive input focus, giving window focus to the top level ancestor of this component.
 boolean IdAttributesAreCompatible(org.merlotxml.merlot.MerlotDOMNode idRefNode, java.lang.String idRefAttrName, org.merlotxml.merlot.MerlotDOMNode IdNode, java.lang.String idAttrName)
          Returns whether or not the value of an ID attribute can be used as a value of a target IDREF attribute.
protected  void init()
           
protected  void initPanelLayout()
           
 void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
          Unregister a VetoableChangeChangeListener.
 void save()
          Saves any changes back to the DOM
protected  void saveRecord(java.util.HashMap attributes)
           
protected  void setChildren(org.merlotxml.merlot.MerlotDOMNode nd, java.util.Vector theseNodes, java.util.Hashtable thisHash)
           
private  void setupRecordPanel()
           
 
Methods inherited from class org.merlotxml.merlot.GenericDOMEditPanel
addAttribute, getEditComponent, save, setupHideTable, setupPanel, setupReadonlyTable, suppressAttribute
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, 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, 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, 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

ALIGN_TOP

public static final int ALIGN_TOP
See Also:
Constant Field Values

ALIGN_MIDDLE

public static final int ALIGN_MIDDLE
See Also:
Constant Field Values

ALIGN_BOTTOM

public static final int ALIGN_BOTTOM
See Also:
Constant Field Values

_requiredAttrIcon

protected static javax.swing.Icon _requiredAttrIcon
The icon to use for required attribute labels


_node

protected org.merlotxml.merlot.MerlotDOMNode _node
The node this editor was created for


_subtext

protected org.merlotxml.merlot.MerlotDOMText _subtext
A node which is the child #text element for this node


_node_attributes

protected org.w3c.dom.NamedNodeMap _node_attributes
The attributes and their values from this node


_dtd_attributes

protected java.util.Hashtable _dtd_attributes
Map of attribute names to their DTDAttribute declaration


_attrComponents

protected java.util.Hashtable _attrComponents
Map of attribute names to attribute components (key is String, val is JComponent)


_first_component

private boolean _first_component
Flags used in Record panel layout


_prev

protected javax.swing.JComponent _prev

_first_field

private javax.swing.JComponent _first_field

_vetoListeners

private java.util.Vector _vetoListeners
List of PropertyChangeListeners that can veto editing actions.


_attributePanel

private javax.swing.JPanel _attributePanel
The panel which contains the actual layout of attributes.


childNodes

public java.util.Vector childNodes
Contains the Field Elements for this Record


childHash

public java.util.Hashtable childHash
A hashstable which contains the field elements and their names.


SEDebug

ConfigEditorDebug SEDebug

_actions

ConfigEditorActions _actions
Constructor Detail

ConfigEditorRecordPanel

public ConfigEditorRecordPanel()

ConfigEditorRecordPanel

public ConfigEditorRecordPanel(org.merlotxml.merlot.MerlotDOMNode node)
Method Detail

buildPanel

protected void buildPanel()

init

protected void init()

initPanelLayout

protected void initPanelLayout()

setupRecordPanel

private void setupRecordPanel()

addNameValuePair

protected void addNameValuePair(java.lang.String a_name,
                                org.merlotxml.util.xml.DTDAttribute a_value,
                                org.merlotxml.merlot.MerlotDOMNode thisnode)

getRequiredAttrIcon

protected javax.swing.Icon getRequiredAttrIcon()

addAttributeComponent

protected void addAttributeComponent(javax.swing.JLabel l,
                                     javax.swing.JComponent c,
                                     int align)

getEditComponent

protected javax.swing.JComponent getEditComponent(org.merlotxml.util.xml.DTDAttribute attr,
                                                  org.merlotxml.merlot.MerlotDOMNode node)
Create a component based on the attribute type, and get the default from the node, or if the node doesn't have it set, get the default value from the attribute definition itself


save

public void save()
          throws java.beans.PropertyVetoException
Saves any changes back to the DOM


setChildren

protected void setChildren(org.merlotxml.merlot.MerlotDOMNode nd,
                           java.util.Vector theseNodes,
                           java.util.Hashtable thisHash)

saveRecord

protected void saveRecord(java.util.HashMap attributes)
                   throws java.beans.PropertyVetoException

grabFocus

public void grabFocus()
Description copied from class: javax.swing.JComponent

Requests that this component receive input focus, giving window focus to the top level ancestor of this component. Only works on displayable, focusable, visible components.

This method should not be called by clients; it is intended for focus implementations. Use Component.AccessibleAWTComponent.requestFocus() 55 instead.


getIndexInVector

private int getIndexInVector(java.util.Vector v,
                             java.lang.String s)

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener l)
Description copied from class: javax.swing.JComponent
Register a VetoableChangeListener.


removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
Description copied from class: javax.swing.JComponent
Unregister a VetoableChangeChangeListener.


fireVetoableChange

public void fireVetoableChange(java.beans.PropertyChangeEvent evt)
                        throws java.beans.PropertyVetoException

getIdManager

protected org.merlotxml.merlot.IDManager getIdManager()

getIdComponent

protected javax.swing.JComponent getIdComponent(org.merlotxml.merlot.MerlotDOMNode node,
                                                java.lang.String attrName)
Returns a component aimed at editing the ID attribute from a DOM node.


getIdRefComponent

protected javax.swing.JComponent getIdRefComponent(org.merlotxml.merlot.MerlotDOMNode targetNode,
                                                   java.lang.String targetAttrName)
Returns a component aimed at editing the IDREF attribute from a DOM node.


getIdForNode

public java.lang.String getIdForNode(org.merlotxml.merlot.MerlotDOMNode node)

IdAttributesAreCompatible

public boolean IdAttributesAreCompatible(org.merlotxml.merlot.MerlotDOMNode idRefNode,
                                         java.lang.String idRefAttrName,
                                         org.merlotxml.merlot.MerlotDOMNode IdNode,
                                         java.lang.String idAttrName)
Returns whether or not the value of an ID attribute can be used as a value of a target IDREF attribute. By default in XML 1.0 specification, all ID values can be used for IDREFs. This decision can be constrained by subclassing this method.


getDisplayTextForAttribute

protected java.lang.String getDisplayTextForAttribute(org.merlotxml.merlot.MerlotDOMNode idRefNode,
                                                      java.lang.String idRefAttrName,
                                                      org.merlotxml.merlot.MerlotDOMNode idNode,
                                                      java.lang.String idAttrName)
Returns the text which represents the referenced node inan IDREF comboBox


checkNmtokenChars

public static char checkNmtokenChars(java.lang.String nmtoken)
Check to see if a string is a valid Nmtoken according to [7] in the XML 1.0 Recommendation