|
|||||||||
| Home >> All >> org >> merlotxml >> [ merlot overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.merlotxml.merlot
Class GenericDOMEditPanel

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.merlotxml.merlot.GenericDOMEditPanel
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, MerlotConstants, java.io.Serializable
- Direct Known Subclasses:
- CommentEditPanel, ProcInstructionEditPanel, TextEditPanel
- public class GenericDOMEditPanel
- extends javax.swing.JPanel
- implements MerlotConstants
- extends javax.swing.JPanel
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.IDObject
|
class |
GenericDOMEditPanel.IDREFComboBoxRenderer
|
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 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 |
protected boolean |
_first_component
|
protected javax.swing.JComponent |
_first_field
|
private static java.util.Hashtable |
_hideAttrs
A list of attributes that should be hidden. |
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
|
protected java.util.Vector |
_vetoListeners
list of PropertyChangeListeners that can veto editing actions |
static int |
ALIGN_BOTTOM
|
static int |
ALIGN_MIDDLE
|
static int |
ALIGN_TOP
|
private static java.lang.String |
HIDE_PROP
|
private static java.lang.String |
RO_PROP
|
| 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 | |
GenericDOMEditPanel()
|
|
GenericDOMEditPanel(MerlotDOMNode node)
|
|
| Method Summary | |
protected void |
addAttribute(org.merlotxml.util.xml.DTDAttribute a)
|
protected void |
addAttributeComponent(javax.swing.JLabel l,
javax.swing.JComponent c,
int align)
|
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(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(org.merlotxml.util.xml.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 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. |
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(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)
Unregister a VetoableChangeChangeListener. |
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(org.merlotxml.util.xml.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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
HIDE_PROP
private static final java.lang.String HIDE_PROP
- See Also:
- Constant Field Values
RO_PROP
private static final java.lang.String RO_PROP
- See Also:
- Constant Field Values
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 MerlotDOMNode _node
- The node this editor was created for
_subtext
protected 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
protected boolean _first_component
_prev
protected javax.swing.JComponent _prev
_first_field
protected javax.swing.JComponent _first_field
_text
protected javax.swing.JTextArea _text
_target
protected javax.swing.JTextField _target
_hideAttrs
private static java.util.Hashtable _hideAttrs
- A list of attributes that should be hidden. Key is element.attr. If value is nonnull,
then the attribute is hidden in the generic panel. #text can also be hidden if key
'#text' is in this hash
_readonlyAttrs
protected static java.util.Hashtable _readonlyAttrs
- Similar to the hidable attributes, except these are displayed, but can't be changed
_vetoListeners
protected java.util.Vector _vetoListeners
- list of PropertyChangeListeners that can veto editing actions
_attributePanel
protected javax.swing.JPanel _attributePanel
- The panel which contains the actual layout of attributes
| Constructor Detail |
GenericDOMEditPanel
public GenericDOMEditPanel()
GenericDOMEditPanel
public GenericDOMEditPanel(MerlotDOMNode node)
| Method Detail |
buildPanel
protected void buildPanel()
init
protected void init()
initPanelLayout
protected void initPanelLayout()
setupPanel
protected void setupPanel()
suppressAttribute
protected boolean suppressAttribute(org.merlotxml.util.xml.DTDAttribute a)
- returns true if the attribute doesn't show in the editor display
setupHideTable
protected void setupHideTable()
setupReadonlyTable
protected void setupReadonlyTable()
addAttribute
protected void addAttribute(org.merlotxml.util.xml.DTDAttribute a)
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)
- 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
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
public 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 IDManager getIdManager()
getIdComponent
protected javax.swing.JComponent getIdComponent(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(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(MerlotDOMNode node)
IdAttributesAreCompatible
public 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.
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(MerlotDOMNode idRefNode, java.lang.String idRefAttrName, MerlotDOMNode idNode, java.lang.String idAttrName)
- Returns the text which represents the referenced node in an 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
|
|||||||||
| Home >> All >> org >> merlotxml >> [ merlot overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC