|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.text.ComponentView javax.swing.text.html.EditableView javax.swing.text.html.HiddenTagView javax.swing.text.html.CommentView
CommentView subclasses HiddenTagView to contain a JTextArea showing a comment. When the textarea is edited the comment is reset. As this inherits from EditableView if the JTextComponent is not editable, the textarea will not be visible.
Nested Class Summary | |
(package private) static class |
CommentView.CommentBorder
|
(package private) static class |
HiddenTagView.EndTagBorder
|
(package private) static class |
HiddenTagView.StartTagBorder
|
Nested classes inherited from class javax.swing.text.ComponentView |
|
Field Summary | |
(package private) static Border |
CBorder
|
(package private) static int |
circleD
|
(package private) static int |
circleR
|
(package private) static int |
commentPadding
|
(package private) static int |
commentPaddingD
|
(package private) static Border |
EndBorder
|
(package private) boolean |
isSettingAttributes
Set to true when setting attributes. |
(package private) static int |
padding
|
(package private) static Border |
StartBorder
|
(package private) static int |
tagSize
|
(package private) static Color |
UnknownTagBorderColor
|
(package private) float |
yAlign
Alignment along the y axis, based on the font of the textfield. |
Fields inherited from class javax.swing.text.ComponentView |
|
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 | |
(package private) |
CommentView(Element e)
|
Method Summary | |
(package private) void |
_setTextFromModel()
This resets the text on the text component we created to match that of the AttributeSet for the Element we represent. |
(package private) void |
_updateModelFromText()
This is subclassed to put the text on the Comment attribute of the Element's AttributeSet. |
void |
changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed. |
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
Gives notification from the document that attributes were changed in a location that this view is responsible for. |
protected Component |
createComponent()
Create the component that is associated with this view. |
float |
getAlignment(int axis)
Determines the desired alignment for this view along an axis. |
float |
getMaximumSpan(int axis)
Determines the maximum span for this view along an axis. |
float |
getMinimumSpan(int axis)
Determines the minimum span for this view along an axis. |
float |
getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. |
(package private) String |
getRepresentedText()
|
(package private) JTextComponent |
getTextComponent()
|
void |
insertUpdate(DocumentEvent e)
Gives notification that there was an insert into the document. |
(package private) boolean |
isEndTag()
|
boolean |
isVisible()
Returns a boolean that indicates whether the view is visible or not. |
void |
paint(Graphics g,
Shape allocation)
The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view). |
void |
removeUpdate(DocumentEvent e)
Gives notification that a portion of the document has been removed. |
(package private) void |
resetBorder()
|
void |
setParent(View parent)
Sets the parent for a child view. |
(package private) void |
setTextFromModel()
This resets the text on the text component we created to match that of the AttributeSet for the Element we represent. |
(package private) void |
updateModelFromText()
This copies the text from the text component we've created to the Element's AttributeSet we represent. |
(package private) void |
updateYAlign(Font font)
|
Methods inherited from class javax.swing.text.ComponentView |
getComponent, modelToView, viewToModel |
Methods inherited from class javax.swing.text.View |
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setSize, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final Border CBorder
static final int commentPadding
static final int commentPaddingD
float yAlign
boolean isSettingAttributes
static final int circleR
static final int circleD
static final int tagSize
static final int padding
static final Color UnknownTagBorderColor
static final Border StartBorder
static final Border EndBorder
Constructor Detail |
CommentView(Element e)
Method Detail |
protected Component createComponent()
ComponentView
createComponent
in class HiddenTagView
void resetBorder()
resetBorder
in class HiddenTagView
void _updateModelFromText()
_updateModelFromText
in class HiddenTagView
JTextComponent getTextComponent()
getTextComponent
in class HiddenTagView
String getRepresentedText()
getRepresentedText
in class HiddenTagView
public float getAlignment(int axis)
ComponentView
getAlignment
in class ComponentView
axis
- may be either View.X_AXIS or View.Y_AXIS
public float getMinimumSpan(int axis)
ComponentView
getMinimumSpan
in class EditableView
public float getPreferredSpan(int axis)
ComponentView
getPreferredSpan
in class EditableView
public float getMaximumSpan(int axis)
ComponentView
getMaximumSpan
in class EditableView
public void insertUpdate(DocumentEvent e)
DocumentListener
insertUpdate
in interface DocumentListener
e
- the document eventpublic void removeUpdate(DocumentEvent e)
DocumentListener
removeUpdate
in interface DocumentListener
e
- the document eventpublic void changedUpdate(DocumentEvent e)
DocumentListener
changedUpdate
in interface DocumentListener
e
- the document eventpublic void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
View
changedUpdate
in class View
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
void updateYAlign(Font font)
void setTextFromModel()
If this is invoked on the event dispatching thread, this
directly invokes _setTextFromModel
, otherwise
SwingUtilities.invokeLater
is used to schedule execution
of _setTextFromModel
.
void _setTextFromModel()
void updateModelFromText()
If this is invoked on the event dispatching thread, this
directly invokes _updateModelFromText
, otherwise
SwingUtilities.invokeLater
is used to schedule execution
of _updateModelFromText
.
boolean isEndTag()
public void paint(Graphics g, Shape allocation)
ComponentView
paint
in class ComponentView
g
- the graphics contextallocation
- the shapeView.paint(java.awt.Graphics, java.awt.Shape)
public void setParent(View parent)
ComponentView
getContainer
.
If the parent view parameter is null, this view is being
cleaned up, thus the component is removed from its parent.
The changing of the component hierarchy will touch the component lock, which is the one thing that is not safe from the View hierarchy. Therefore, this functionality is executed immediately if on the event thread, or is queued on the event queue if called from another thread (notification of change from an asynchronous update).
setParent
in class ComponentView
parent
- the parentpublic boolean isVisible()
View
isVisible
in class View
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |