org.merlotxml.merlot
Class GenericDOMEditor

java.lang.Object
  extended byorg.merlotxml.merlot.GenericDOMEditor
All Implemented Interfaces:
MerlotConstants, MerlotDOMEditor

public class GenericDOMEditor
extends java.lang.Object
implements MerlotDOMEditor, MerlotConstants

Editor of nodes and such


Nested Class Summary
static class GenericDOMEditor.GenericSanityCheckListener
           
 
Field Summary
protected static java.util.Hashtable _invalidCharHash
           
protected static java.util.Hashtable _manditoryFieldHash
           
protected static int ATTRNAME
           
protected static int EQUALS
           
protected static int NODENAME
           
static java.lang.String SANITY_CHARS_PROP
           
static java.lang.String SANITY_MANDITORY_PROP
           
protected static int START
           
 
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
 
Constructor Summary
GenericDOMEditor()
           
 
Method Summary
 boolean editsChildren()
          returns true if this editor also edits it's children.
 java.lang.String[] getEditableTypes()
          Returns the element types that this editor handles
 javax.swing.JPanel getEditPanel(MerlotDOMNode node)
          returns a panel for editing this type of component.
protected static java.lang.String getInvalidChars(MerlotDOMNode node, java.lang.String fieldname)
           
protected static java.lang.String getManditoryFields(MerlotDOMNode node, java.lang.String fieldname)
           
 javax.swing.JMenuItem[] getMenuItems(MerlotDOMNode node)
          Returns a set of menu items for any special actions for this particular editor that it wants in the popup menu.
 void grabFocus(javax.swing.JPanel p)
          Tells the edit panel it's gaining focus, so it can put the cursor in the first field.
 void installListener(javax.swing.JPanel p, MerlotDOMNode node)
           
protected static void parseInvalidCharsProp(java.lang.String prop)
           
protected static void parseManditoryFieldsProp(java.lang.String prop)
           
 void savePanel(javax.swing.JPanel p)
          called by the editor when the user has chosen to save their changes in a panel.
 boolean suppressAddType(DTDElement el)
          allows the plugin to hide certain items on the add-> menu.
 boolean suppressAddType(GrammarComplexType el)
           
 boolean suppressNode(MerlotDOMNode node)
          Returns true if the component editor wants a particular node hidden from the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_invalidCharHash

protected static java.util.Hashtable _invalidCharHash

_manditoryFieldHash

protected static java.util.Hashtable _manditoryFieldHash

SANITY_CHARS_PROP

public static final java.lang.String SANITY_CHARS_PROP
See Also:
Constant Field Values

SANITY_MANDITORY_PROP

public static final java.lang.String SANITY_MANDITORY_PROP
See Also:
Constant Field Values

START

protected static final int START
See Also:
Constant Field Values

NODENAME

protected static final int NODENAME
See Also:
Constant Field Values

ATTRNAME

protected static final int ATTRNAME
See Also:
Constant Field Values

EQUALS

protected static final int EQUALS
See Also:
Constant Field Values
Constructor Detail

GenericDOMEditor

public GenericDOMEditor()
Method Detail

getMenuItems

public javax.swing.JMenuItem[] getMenuItems(MerlotDOMNode node)
Returns a set of menu items for any special actions for this particular editor that it wants in the popup menu. Standard stuff like cut, copy, paste is taken care of by other objects. If nothing needs added

Specified by:
getMenuItems in interface MerlotDOMEditor
Parameters:
node - the node for which to get the menu items

getEditPanel

public javax.swing.JPanel getEditPanel(MerlotDOMNode node)
returns a panel for editing this type of component.

Specified by:
getEditPanel in interface MerlotDOMEditor

savePanel

public void savePanel(javax.swing.JPanel p)
               throws java.beans.PropertyVetoException
Description copied from interface: MerlotDOMEditor
called by the editor when the user has chosen to save their changes in a panel.

Specified by:
savePanel in interface MerlotDOMEditor
Parameters:
p - the panel that was retreived with getEditPanel(node);
Throws:
java.beans.PropertyVetoException

getEditableTypes

public java.lang.String[] getEditableTypes()
Returns the element types that this editor handles


editsChildren

public boolean editsChildren()
returns true if this editor also edits it's children. If an editor says it handles it's children, then it must handle all it's children.


grabFocus

public void grabFocus(javax.swing.JPanel p)
Description copied from interface: MerlotDOMEditor
Tells the edit panel it's gaining focus, so it can put the cursor in the first field. XXX this should probably be handled by event listening instead

Specified by:
grabFocus in interface MerlotDOMEditor

suppressNode

public boolean suppressNode(MerlotDOMNode node)
Returns true if the component editor wants a particular node hidden from the user. If the editor wants to filter what the user sees in their display, it should look at the given node, otherwise it should return false

Specified by:
suppressNode in interface MerlotDOMEditor

suppressAddType

public boolean suppressAddType(DTDElement el)
Description copied from interface: MerlotDOMEditor
allows the plugin to hide certain items on the add-> menu. For example, the plugin for the accessibility permissions might not want the user to be able to directly add an "access" element, so it can request that that be suppressed.

Specified by:
suppressAddType in interface MerlotDOMEditor

suppressAddType

public boolean suppressAddType(GrammarComplexType el)
Specified by:
suppressAddType in interface MerlotDOMEditor

installListener

public void installListener(javax.swing.JPanel p,
                            MerlotDOMNode node)

parseInvalidCharsProp

protected static void parseInvalidCharsProp(java.lang.String prop)

parseManditoryFieldsProp

protected static void parseManditoryFieldsProp(java.lang.String prop)

getInvalidChars

protected static java.lang.String getInvalidChars(MerlotDOMNode node,
                                                  java.lang.String fieldname)

getManditoryFields

protected static java.lang.String getManditoryFields(MerlotDOMNode node,
                                                     java.lang.String fieldname)