com.sun.xml.registry.client.browser.swing
Class RegistryDocumentListener

java.lang.Object
  extended bycom.sun.xml.registry.client.browser.swing.RegistryDocumentListener
All Implemented Interfaces:
javax.swing.event.DocumentListener, java.util.EventListener
Direct Known Subclasses:
MappedDocumentListener

public abstract class RegistryDocumentListener
extends java.lang.Object
implements javax.swing.event.DocumentListener

DocumentListener that factors out some commonly used code. This in an implementation of the Strategy design pattern. The class implements the document listener methods and invokes an abstract method setText. The setText method is intended to set the entered text in the underlying model.

Author:
Fabian Ritzmann

Field Summary
protected  java.lang.String errorMessage
           
protected  javax.swing.JPanel panel
           
 
Constructor Summary
RegistryDocumentListener(javax.swing.JPanel p, java.lang.String error)
          Constructor.
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
          Invokes update.
 void insertUpdate(javax.swing.event.DocumentEvent e)
          Invokes update.
 void removeUpdate(javax.swing.event.DocumentEvent e)
          Invokes update.
protected abstract  void setText(java.lang.String text)
          Should be implemented to set a new text string on the underlying model.
protected  void update(javax.swing.event.DocumentEvent ev)
          Gets the text from the document and calls setText.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

panel

protected final javax.swing.JPanel panel

errorMessage

protected final java.lang.String errorMessage
Constructor Detail

RegistryDocumentListener

public RegistryDocumentListener(javax.swing.JPanel p,
                                java.lang.String error)
Constructor.

Parameters:
p - Panel to which this listener belongs
error - String that is prepended to error message if setText throws an exception
Method Detail

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Invokes update.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.insertUpdate(DocumentEvent)

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Invokes update.

Specified by:
removeUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.removeUpdate(DocumentEvent)

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Invokes update.

Specified by:
changedUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.changedUpdate(DocumentEvent)

update

protected void update(javax.swing.event.DocumentEvent ev)
Gets the text from the document and calls setText. Displays a message with an error if setText throws an exception.

Parameters:
ev - The event with changed text

setText

protected abstract void setText(java.lang.String text)
                         throws javax.xml.registry.JAXRException
Should be implemented to set a new text string on the underlying model.

Parameters:
text - The text in a document field
Throws:
javax.xml.registry.JAXRException - Should be thrown if an exception in the underlying model is triggered


Copyright © 2001-2004 OASIS. All Rights Reserved.