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

Quick Search    Search Deep

org.merlotxml.merlot.plugins.configeditor
Class ConfigEditorCfgPanel  view ConfigEditorCfgPanel download ConfigEditorCfgPanel.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.ConfigEditorCfgPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, org.merlotxml.merlot.MerlotConstants, java.io.Serializable

public class ConfigEditorCfgPanel
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 ConfigEditorCfgPanel.IDObject
           
(package private)  class ConfigEditorCfgPanel.IDREFComboBoxRenderer
           
static class ConfigEditorCfgPanel.ScrollablePanel
           
protected  class ConfigEditorCfgPanel.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
          Defines the Config Editor actions
private  boolean _attr_first_component
          Flags for attr panel layout
private  javax.swing.JComponent _attr_first_field
           
protected  java.util.Hashtable _attrComponents
          Map of attribute names to attribute components (key is String, val is JComponent)
private  javax.swing.JPanel _attrPanel
          The panel which contains the actual layout of attributes.
protected  javax.swing.JComponent _attrprev
           
private  boolean _cfg_first_component
          Flags for cfg panel layout
private  javax.swing.JComponent _cfg_first_field
           
protected  java.util.Hashtable _cfgComponents
          Map of attribute names to attribute components (key is String, val is JComponent)
private  javax.swing.JPanel _cfgPanel
          The panel which contains the actual layout of the file component (text or table).
protected  javax.swing.JComponent _cfgprev
           
protected  java.util.Hashtable _dtd_attributes
          Map of attribute names to their DTDAttribute declaration
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 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
protected  javax.swing.JTable _table
          Table for Table File to be displayed
protected  javax.swing.table.DefaultTableModel _table_model
          Table Model for Table File to be displayed
protected  javax.swing.JTextArea _text
          Text Area for Text File to be displayed
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[] chHash
          A hashstable which contains the Field elements and their names for each Record.
 java.util.Hashtable childHash
          A hashstable which contains the Record elements and their names for the Table.
 java.util.Vector childNodes
          Contains the Record Elements for this Table
 java.util.Vector[] chNodes
          Contains the Field Elements for each Record
(package private)  java.lang.String[] fieldValues
           
(package private)  ConfigEditorDebug SEDebug
           
(package private)  java.lang.String[] titles
           
 
Fields inherited from class org.merlotxml.merlot.GenericDOMEditPanel
_attributePanel, _first_component, _first_field, _prev, _readonlyAttrs, _target
 
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
ConfigEditorCfgPanel()
           
ConfigEditorCfgPanel(org.merlotxml.merlot.MerlotDOMNode node)
           
 
Method Summary
protected  void addAttrComponent(javax.swing.JLabel l, javax.swing.JComponent c, int align)
           
protected  void addAttrData(java.lang.String a_name, org.merlotxml.util.xml.DTDAttribute a_value)
           
protected  void addCfgComponent(javax.swing.JLabel l, javax.swing.JComponent c, int align)
           
 void addVetoableChangeListener(java.beans.VetoableChangeListener l)
          Register a VetoableChangeListener.
 void buildEditorPanel()
           
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.
 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 save(java.util.HashMap attributes)
           
protected  void saveTable()
           
protected  void setChildren(org.merlotxml.merlot.MerlotDOMNode nd, java.util.Vector theseNodes, java.util.Hashtable thisHash)
           
private  void setupAttrPanel()
           
 void setupTablePanel()
           
protected  void setupTextPanel()
           
 
Methods inherited from class org.merlotxml.merlot.GenericDOMEditPanel
addAttribute, addAttributeComponent, buildPanel, getEditComponent, 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)


_cfgComponents

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


_text

protected javax.swing.JTextArea _text
Text Area for Text File to be displayed


_table

protected javax.swing.JTable _table
Table for Table File to be displayed


_table_model

protected javax.swing.table.DefaultTableModel _table_model
Table Model for Table File to be displayed


_attr_first_component

private boolean _attr_first_component
Flags for attr panel layout


_attrprev

protected javax.swing.JComponent _attrprev

_attr_first_field

private javax.swing.JComponent _attr_first_field

_cfg_first_component

private boolean _cfg_first_component
Flags for cfg panel layout


_cfgprev

protected javax.swing.JComponent _cfgprev

_cfg_first_field

private javax.swing.JComponent _cfg_first_field

_vetoListeners

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


_attrPanel

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


_cfgPanel

private javax.swing.JPanel _cfgPanel
The panel which contains the actual layout of the file component (text or table).


childNodes

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


chNodes

public java.util.Vector[] chNodes
Contains the Field Elements for each Record


childHash

public java.util.Hashtable childHash
A hashstable which contains the Record elements and their names for the Table.


chHash

public java.util.Hashtable[] chHash
A hashstable which contains the Field elements and their names for each Record.


titles

java.lang.String[] titles

fieldValues

java.lang.String[] fieldValues

SEDebug

ConfigEditorDebug SEDebug

_actions

ConfigEditorActions _actions
Defines the Config Editor actions

Constructor Detail

ConfigEditorCfgPanel

public ConfigEditorCfgPanel()

ConfigEditorCfgPanel

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

buildEditorPanel

public void buildEditorPanel()

init

public void init()

initPanelLayout

protected void initPanelLayout()

setupAttrPanel

private void setupAttrPanel()

setupTextPanel

protected void setupTextPanel()

setupTablePanel

public void setupTablePanel()

addAttrData

protected void addAttrData(java.lang.String a_name,
                           org.merlotxml.util.xml.DTDAttribute a_value)

getRequiredAttrIcon

protected javax.swing.Icon getRequiredAttrIcon()

addCfgComponent

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

addAttrComponent

protected void addAttrComponent(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


save

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

saveTable

protected void saveTable()

setChildren

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

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