org.merlotxml.merlot.editors
Class ComplexTypeEditPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.merlotxml.merlot.editors.ComplexTypeEditPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ComplexTypeEditPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener

An alternative for GenericDOMEditPanel. Can display error messages for invalid values below an attribute or simple content. The simple content of an element is displayed in the same way as an attribute, but it is named the same as the element. A SimpleTypeEditor for each simple type (attribute or simple content), provides access to the JComponent for editing the simple types, and other methods.

Author:
Evert Hoff
See Also:
Serialized Form

Nested Class Summary
static class ComplexTypeEditPanel.ScrollablePanel
           
 
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
protected  GrammarComplexType _complexType
           
protected  GrammarSimpleType[] _grammarAttributes
           
protected  GrammarSimpleType _grammarSimpleContent
           
protected  MerlotDOMNode _node
          The node this editor was created for
protected  org.w3c.dom.NamedNodeMap _nodeAttributes
          The DOM Nodes with the values of the attributes
protected  javax.swing.JComponent _previousComponent
           
protected static java.util.Hashtable _readonlyAttrs
          Similar to the hidable attributes, except these are displayed, but can't be changed
protected static javax.swing.Icon _requiredAttrIcon
          The icon to use for required attribute labels
protected  java.util.Hashtable _simpleTypeEditors
           
protected  MerlotDOMText _subtext
          A node which is the child #text element for this node
static int ALIGN_BOTTOM
           
static int ALIGN_MIDDLE
           
static int ALIGN_TOP
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ComplexTypeEditPanel(MerlotDOMNode node)
          Constructor for the GenericComplexTypeEditPanel object
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
protected  void addDocumentation()
          Displays the documentation that is contained in the XSD for this element.
protected  void addSimpleType(GrammarSimpleType simpleType)
           
protected  void addSimpleTypeComponent(javax.swing.JLabel l, javax.swing.JComponent c, int align)
           
 void addVetoableChangeListener(java.beans.VetoableChangeListener l)
          Adds a feature to the VetoableChangeListener attribute of the ComplexTypeEditPanel object
protected  void buildPanel()
           
protected  SimpleTypeEditor createSimpleTypeEditor(GrammarSimpleType simpleType)
           
 void fireVetoableChange(java.beans.PropertyChangeEvent evt)
          To do: Revisit.
protected  FieldNode getFieldNode(GrammarSimpleType simpleType)
           
protected  javax.swing.Icon getRequiredAttrIcon()
           
protected  SimpleTypeEditor getSimpleTypeEditor(GrammarSimpleType simpleType)
           
protected  GrammarSimpleType[] getSimpleTypes()
          Gets all the simple types, including all the attributes and the simple content.
protected  org.w3c.dom.Node getTextNode(org.w3c.dom.Element el)
           
protected  void initPanelLayout()
           
protected  void rebuildPanel()
           
 void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
           
 void save()
          Saves any changes back to the DOM
protected  void setupHideTable()
           
protected  void setupPanel()
           
protected  void setupReadonlyTable()
           
protected  void setupSimpleTypeEditors()
           
protected  boolean suppressAttribute(GrammarSimpleType simpleType)
          returns true if the attribute doesn't show in the editor display
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, 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, removePropertyChangeListener, removePropertyChangeListener, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, 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, 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, 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
 

Field Detail

ALIGN_BOTTOM

public static final int ALIGN_BOTTOM
See Also:
Constant Field Values

ALIGN_MIDDLE

public static final int ALIGN_MIDDLE
See Also:
Constant Field Values

ALIGN_TOP

public static final int ALIGN_TOP
See Also:
Constant Field Values

_complexType

protected GrammarComplexType _complexType

_grammarAttributes

protected GrammarSimpleType[] _grammarAttributes

_grammarSimpleContent

protected GrammarSimpleType _grammarSimpleContent

_node

protected MerlotDOMNode _node
The node this editor was created for


_nodeAttributes

protected org.w3c.dom.NamedNodeMap _nodeAttributes
The DOM Nodes with the values of the attributes


_previousComponent

protected javax.swing.JComponent _previousComponent

_readonlyAttrs

protected static java.util.Hashtable _readonlyAttrs
Similar to the hidable attributes, except these are displayed, but can't be changed


_requiredAttrIcon

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


_simpleTypeEditors

protected java.util.Hashtable _simpleTypeEditors

_subtext

protected MerlotDOMText _subtext
A node which is the child #text element for this node

Constructor Detail

ComplexTypeEditPanel

public ComplexTypeEditPanel(MerlotDOMNode node)
Constructor for the GenericComplexTypeEditPanel object

Parameters:
node - Description of Parameter
Method Detail

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener l)
Adds a feature to the VetoableChangeListener attribute of the ComplexTypeEditPanel object

Parameters:
l - The feature to be added to the VetoableChangeListener attribute

fireVetoableChange

public void fireVetoableChange(java.beans.PropertyChangeEvent evt)
                        throws java.beans.PropertyVetoException
To do: Revisit. Here was the original reason for doing this: Gotta implement this stuff ourselves cause the PropertyChangeSupport classes compare the old and new values, and dont' fire if they're equal.

Parameters:
evt - Description of Parameter
Throws:
java.beans.PropertyVetoException - Description of Exception

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener l)

save

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

Throws:
java.beans.PropertyVetoException - Description of Exception

addSimpleType

protected void addSimpleType(GrammarSimpleType simpleType)

getFieldNode

protected FieldNode getFieldNode(GrammarSimpleType simpleType)

getTextNode

protected org.w3c.dom.Node getTextNode(org.w3c.dom.Element el)

addSimpleTypeComponent

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

buildPanel

protected void buildPanel()

getRequiredAttrIcon

protected javax.swing.Icon getRequiredAttrIcon()

getSimpleTypeEditor

protected SimpleTypeEditor getSimpleTypeEditor(GrammarSimpleType simpleType)

getSimpleTypes

protected GrammarSimpleType[] getSimpleTypes()
Gets all the simple types, including all the attributes and the simple content.


initPanelLayout

protected void initPanelLayout()

setupHideTable

protected void setupHideTable()

setupPanel

protected void setupPanel()

addDocumentation

protected void addDocumentation()
Displays the documentation that is contained in the XSD for this element.


setupReadonlyTable

protected void setupReadonlyTable()

setupSimpleTypeEditors

protected void setupSimpleTypeEditors()

createSimpleTypeEditor

protected SimpleTypeEditor createSimpleTypeEditor(GrammarSimpleType simpleType)

suppressAttribute

protected boolean suppressAttribute(GrammarSimpleType simpleType)
returns true if the attribute doesn't show in the editor display

Parameters:
simpleType - Description of Parameter
Returns:
Description of the Returned Value

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

rebuildPanel

protected void rebuildPanel()