|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.merlotxml.merlot.GenericDOMEditPanel
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 | |
class |
GenericDOMEditPanel.GenericComponent
|
static class |
GenericDOMEditPanel.ScrollablePanel
|
protected class |
GenericDOMEditPanel.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 | |
protected java.util.Hashtable |
_attrComponents
Map of attribute names to attribute components (key is String, val is JComponent) |
protected java.util.Hashtable |
_dtd_attributes
Map of attribute names to their DTDAttribute declaration |
protected 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 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 MerlotDOMText |
_subtext
A node which is the child #text element for this node |
protected javax.swing.JTextField |
_target
|
protected javax.swing.JTextArea |
_text
|
static int |
ALIGN_BOTTOM
|
static int |
ALIGN_MIDDLE
|
static int |
ALIGN_TOP
|
static boolean |
NAMESPACES
|
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 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 | |
GenericDOMEditPanel()
|
|
GenericDOMEditPanel(MerlotDOMNode node)
|
Method Summary | |
protected void |
addAttribute(DTDAttribute a)
|
protected void |
addAttributeComponent(javax.swing.JLabel l,
javax.swing.JComponent c,
int align)
|
protected void |
addTextPanel()
Add a text editing panel if required |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener l)
|
protected void |
buildPanel()
|
static char |
checkIdChars(java.lang.String id)
Check to see if a string is a valid ID according to [5] in the XML 1.0 Recommendation |
static char |
checkNCNameChars(java.lang.String ncName)
Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.0 Recommendation |
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(MerlotDOMNode idRefNode,
java.lang.String idRefAttrName,
MerlotDOMNode idNode,
java.lang.String idAttrName)
Returns the text which represents the referenced node in an IDREF comboBox |
protected javax.swing.JComponent |
getEditComponent(DTDAttribute attr)
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 FieldNode |
getFieldNode(GrammarSimpleType simpleType)
|
protected javax.swing.JComponent |
getIdComponent(MerlotDOMNode node,
java.lang.String attrName)
Returns a component aimed at editing the ID attribute from a DOM node. |
java.lang.String |
getIdForNode(MerlotDOMNode node)
|
protected IDManager |
getIdManager()
|
protected javax.swing.JComponent |
getIdRefComponent(MerlotDOMNode targetNode,
java.lang.String targetAttrName)
Returns a component aimed at editing the IDREF attribute from a DOM node. |
protected javax.swing.JComponent |
getIdRefsComponent(DTDAttribute attr)
|
protected javax.swing.JComponent |
getNmtokensComponent(DTDAttribute attr)
Gets the nmtokensComponent attribute of the GenericDOMEditPanel object |
protected javax.swing.Icon |
getRequiredAttrIcon()
|
void |
grabFocus()
|
boolean |
IdAttributesAreCompatible(MerlotDOMNode idRefNode,
java.lang.String idRefAttrName,
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)
|
void |
save()
Saves any changes back to the DOM |
protected void |
save(java.util.HashMap attributes)
|
protected void |
setupHideTable()
|
protected void |
setupPanel()
|
protected void |
setupReadonlyTable()
|
protected boolean |
suppressAttribute(DTDAttribute a)
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, 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 |
public static final int ALIGN_TOP
public static final int ALIGN_MIDDLE
public static final int ALIGN_BOTTOM
public static final boolean NAMESPACES
protected static javax.swing.Icon _requiredAttrIcon
protected MerlotDOMNode _node
protected MerlotDOMText _subtext
protected org.w3c.dom.NamedNodeMap _node_attributes
protected java.util.Hashtable _dtd_attributes
protected java.util.Hashtable _attrComponents
protected javax.swing.JComponent _prev
protected javax.swing.JTextArea _text
protected javax.swing.JTextField _target
protected static java.util.Hashtable _readonlyAttrs
Constructor Detail |
public GenericDOMEditPanel()
public GenericDOMEditPanel(MerlotDOMNode node)
Method Detail |
protected void buildPanel()
protected void init()
protected void initPanelLayout()
protected void setupPanel()
protected void addTextPanel()
protected boolean suppressAttribute(DTDAttribute a)
protected void setupHideTable()
protected void setupReadonlyTable()
protected void addAttribute(DTDAttribute a)
protected javax.swing.Icon getRequiredAttrIcon()
protected void addAttributeComponent(javax.swing.JLabel l, javax.swing.JComponent c, int align)
protected javax.swing.JComponent getEditComponent(DTDAttribute attr)
public void save() throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
protected void save(java.util.HashMap attributes) throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
public void grabFocus()
public void addVetoableChangeListener(java.beans.VetoableChangeListener l)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
public void fireVetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
protected IDManager getIdManager()
protected javax.swing.JComponent getIdComponent(MerlotDOMNode node, java.lang.String attrName)
node
- the node for which to generate the ID editing componentattrName
- the name of the ID attribute for which to generate the ID editing componentprotected javax.swing.JComponent getIdRefComponent(MerlotDOMNode targetNode, java.lang.String targetAttrName)
protected javax.swing.JComponent getIdRefsComponent(DTDAttribute attr)
protected javax.swing.JComponent getNmtokensComponent(DTDAttribute attr)
attr
- Description of the Parameter
public java.lang.String getIdForNode(MerlotDOMNode node)
public boolean IdAttributesAreCompatible(MerlotDOMNode idRefNode, java.lang.String idRefAttrName, MerlotDOMNode IdNode, java.lang.String idAttrName)
idRefNode
- node containing the IDREF attributeidRefAttrName
- name of the IDREF attributeidAttrName
- name of the ID attributeprotected java.lang.String getDisplayTextForAttribute(MerlotDOMNode idRefNode, java.lang.String idRefAttrName, MerlotDOMNode idNode, java.lang.String idAttrName)
public static char checkNmtokenChars(java.lang.String nmtoken)
nmtoken
- string to checj
public static char checkNCNameChars(java.lang.String ncName)
public static char checkIdChars(java.lang.String id)
protected FieldNode getFieldNode(GrammarSimpleType simpleType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |