ui.editor
Class XmlView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.CompositeView
          extended by javax.swing.text.BoxView
              extended by javax.swing.text.WrappedPlainView
                  extended by ui.editor.XmlView
All Implemented Interfaces:
javax.swing.SwingConstants, javax.swing.text.TabExpander

public class XmlView
extends javax.swing.text.WrappedPlainView

Thanks: http://groups.google.com/group/de.comp.lang.java/msg/2bbeb016abad270 IMPORTANT NOTE: regex should contain 1 group. Originally using PlainView here because we don't want line wrapping to occur. Replaced by WrappedPlainView by B.Mascret (2010)

Author:
kees 13-jan-2006

Field Summary
private static java.lang.String GENERIC_XML_NAME
          pattern for XM name
private static java.util.HashMap<java.util.regex.Pattern,java.awt.Color> patternColors
          map between colors and String patterns
private static java.lang.String TAG_ATTRIBUTE_PATTERN
          attribute tag pattern
private static java.lang.String TAG_ATTRIBUTE_VALUE
          attribute value pattern
private static java.lang.String TAG_CDATA
          cdaTA tag pattern
private static java.lang.String TAG_COMMENT
          comment tag pattern
private static java.lang.String TAG_END_PATTERN
          end tag pattern
private static java.lang.String TAG_PATTERN
          pattern for a tag
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
XmlView(javax.swing.text.Element element)
          constructor set up tabSize and fonte
 
Method Summary
protected  int drawUnselectedText(java.awt.Graphics graphics, int x, int y, int p0, int p1)
           
 
Methods inherited from class javax.swing.text.WrappedPlainView
calculateBreakPosition, changedUpdate, drawLine, drawSelectedText, getLineBuffer, getMaximumSpan, getMinimumSpan, getPreferredSpan, getTabSize, insertUpdate, loadChildren, nextTabStop, paint, removeUpdate, setSize
 
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, calculateMinorAxisRequirements, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAlignment, getAxis, getChildAllocation, getHeight, getOffset, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, viewToModel
 
Methods inherited from class javax.swing.text.CompositeView
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, modelToView, setInsets, setParagraphInsets, setParent
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

patternColors

private static java.util.HashMap<java.util.regex.Pattern,java.awt.Color> patternColors
map between colors and String patterns


GENERIC_XML_NAME

private static java.lang.String GENERIC_XML_NAME
pattern for XM name


TAG_PATTERN

private static java.lang.String TAG_PATTERN
pattern for a tag


TAG_END_PATTERN

private static java.lang.String TAG_END_PATTERN
end tag pattern


TAG_ATTRIBUTE_PATTERN

private static java.lang.String TAG_ATTRIBUTE_PATTERN
attribute tag pattern


TAG_ATTRIBUTE_VALUE

private static java.lang.String TAG_ATTRIBUTE_VALUE
attribute value pattern


TAG_COMMENT

private static java.lang.String TAG_COMMENT
comment tag pattern


TAG_CDATA

private static java.lang.String TAG_CDATA
cdaTA tag pattern

Constructor Detail

XmlView

public XmlView(javax.swing.text.Element element)
constructor set up tabSize and fonte

Parameters:
element - the element to display
Method Detail

drawUnselectedText

protected int drawUnselectedText(java.awt.Graphics graphics,
                                 int x,
                                 int y,
                                 int p0,
                                 int p1)
                          throws javax.swing.text.BadLocationException
Overrides:
drawUnselectedText in class javax.swing.text.WrappedPlainView
Throws:
javax.swing.text.BadLocationException
See Also:
Draws the text between p0 and p1 indexes