Data Request Broker
2-3-release

fr.gael.drb.query
Class XQueryDocument

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.DefaultStyledDocument
          extended by fr.gael.drb.query.XQueryDocument
All Implemented Interfaces:
Serializable, Document, StyledDocument

public class XQueryDocument
extends DefaultStyledDocument

XQuery document class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.DefaultStyledDocument
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement
 
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
protected  MutableAttributeSet baseStyle
          Base style.
protected  MutableAttributeSet commentStyle
          Comment style.
protected  MutableAttributeSet staticExceptionStyle
          Style of a static exception.
protected  Timer timer
          Timer to update the document.
protected  MutableAttributeSet typeExceptionStyle
          Style of a type exception.
protected  fr.gael.drb.query.XQueryDocument.DocumentUpdater updater
          Document syntax updater.
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
XQueryDocument()
          builds an empty XQueryDocument with default styles.
 
Method Summary
 MutableAttributeSet getBaseStyle()
          Base style accessor.
 String getComment()
          Accessor of a comment on the current text.
 Vector getCompletion(int offset)
          Builds the completion item array with the allowed item just after the specified offset in the text.
 void initFont()
          Initializes the font.
 void insertString(int offs, String str, AttributeSet attr)
          Updates document structure as a result of text insertion.
protected  void parseUpdate(int offs, int len)
          Updates document structure as a result of text change.
protected  void parseUpdateOld(int offs, int len)
          Updates document structure as a result of text change.
 void remove(int offs, int len)
          Updates document structure as a result of text removal.
 void setDefaultFontSize(float font_size)
          Sets the default font size.
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, create, createDefaultRoot, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, removeDocumentListener, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged
 
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, removeUndoableEditListener, render
 

Field Detail

commentStyle

protected MutableAttributeSet commentStyle
Comment style.


typeExceptionStyle

protected MutableAttributeSet typeExceptionStyle
Style of a type exception.


staticExceptionStyle

protected MutableAttributeSet staticExceptionStyle
Style of a static exception.


baseStyle

protected MutableAttributeSet baseStyle
Base style.


timer

protected Timer timer
Timer to update the document.


updater

protected fr.gael.drb.query.XQueryDocument.DocumentUpdater updater
Document syntax updater.

Constructor Detail

XQueryDocument

public XQueryDocument()
builds an empty XQueryDocument with default styles.

Method Detail

initFont

public void initFont()
Initializes the font.


getBaseStyle

public MutableAttributeSet getBaseStyle()
Base style accessor.

Returns:
the base style (font with size);

setDefaultFontSize

public void setDefaultFontSize(float font_size)
Sets the default font size.

Parameters:
font_size - the default font size to be used.

insertString

public void insertString(int offs,
                         String str,
                         AttributeSet attr)
                  throws BadLocationException
Updates document structure as a result of text insertion.

Specified by:
insertString in interface Document
Overrides:
insertString in class AbstractDocument
Parameters:
offs - insertion offset.
str - string to be inserted.
attr - the attribute set.
Throws:
BadLocationException - in case of error.

remove

public void remove(int offs,
                   int len)
            throws BadLocationException
Updates document structure as a result of text removal.

Specified by:
remove in interface Document
Overrides:
remove in class AbstractDocument
Parameters:
offs - remove offset.
len - the length to be removed.
Throws:
BadLocationException - in case of error.

parseUpdate

protected void parseUpdate(int offs,
                           int len)
Updates document structure as a result of text change.

Parameters:
offs - the offset.
len - the length.

parseUpdateOld

protected void parseUpdateOld(int offs,
                              int len)
Updates document structure as a result of text change.

Parameters:
offs - the offset.
len - the length.

getComment

public String getComment()
Accessor of a comment on the current text.

Returns:
the comment (maybe null).

getCompletion

public Vector getCompletion(int offset)
Builds the completion item array with the allowed item just after the specified offset in the text.

Parameters:
offset - the insertion offset.
Returns:
A vector of completion item array. A couple of (String,boolean). The String is the text that can be inserted. The boolean indicates if the item is insertable.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .