|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.randelshofer.gui.text.DocumentProxy
ch.randelshofer.gui.text.StyledDocumentProxy
public class StyledDocumentProxy
This class is designed to be less memory expensive than a standard StyledDocument object. This class tries to represent the document in form of a String. If the document is in use, the String is converted into a StyledDocument. If the document is no longer in use, then the PlainDocument is converted into a String (losing all styles).
| Field Summary |
|---|
| Fields inherited from interface javax.swing.text.Document |
|---|
StreamDescriptionProperty, TitleProperty |
| Constructor Summary | |
|---|---|
StyledDocumentProxy()
Creates new StyledDocumentProxy |
|
| Method Summary | |
|---|---|
javax.swing.text.Style |
addStyle(java.lang.String nm,
javax.swing.text.Style parent)
Adds a new style into the logical style hierarchy. |
protected javax.swing.text.Document |
createDocumentModel()
|
void |
fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Notify all listeners that have registered interest for notification on this event type. |
java.awt.Color |
getBackground(javax.swing.text.AttributeSet attr)
Takes a set of attributes and turn it into a background color specification. |
javax.swing.text.Element |
getCharacterElement(int pos)
Gets the element that represents the character that is at the given offset within the document. |
java.awt.Font |
getFont(javax.swing.text.AttributeSet attr)
Takes a set of attributes and turn it into a font specification. |
java.awt.Color |
getForeground(javax.swing.text.AttributeSet attr)
Takes a set of attributes and turn it into a foreground color specification. |
javax.swing.text.Style |
getLogicalStyle(int p)
Gets a logical style for a given position in a paragraph. |
javax.swing.text.Element |
getParagraphElement(int pos)
Gets the element that represents the paragraph that encloses the given offset within the document. |
javax.swing.text.Style |
getStyle(java.lang.String nm)
Fetches a named style previously added. |
void |
removeStyle(java.lang.String nm)
Removes a named style previously added to the document. |
void |
setCharacterAttributes(int offset,
int length,
javax.swing.text.AttributeSet s,
boolean replace)
Changes the content element attributes used for the given range of existing content in the document. |
void |
setIgnoreAttributeEdits(boolean newValue)
Sets whether AttributeEdits should be ignored. |
void |
setLogicalStyle(int pos,
javax.swing.text.Style s)
Sets the logical style to use for the paragraph at the given position. |
void |
setParagraphAttributes(int offset,
int length,
javax.swing.text.AttributeSet s,
boolean replace)
Sets paragraph attributes. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.text.Document |
|---|
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render |
| Constructor Detail |
|---|
public StyledDocumentProxy()
| Method Detail |
|---|
public void setIgnoreAttributeEdits(boolean newValue)
public javax.swing.text.Style addStyle(java.lang.String nm,
javax.swing.text.Style parent)
addStyle in interface javax.swing.text.StyledDocumentnm - the name of the style (must be unique within the
collection of named styles). The name may be null if the style
is unnamed, but the caller is responsible
for managing the reference returned as an unnamed style can't
be fetched by name. An unnamed style may be useful for things
like character attribute overrides such as found in a style
run.parent - the parent style. This may be null if unspecified
attributes need not be resolved in some other style.
public java.awt.Color getBackground(javax.swing.text.AttributeSet attr)
getBackground in interface javax.swing.text.StyledDocumentattr - the set of attributes
public javax.swing.text.Element getCharacterElement(int pos)
getCharacterElement in interface javax.swing.text.StyledDocumentpos - the offset >= 0
public java.awt.Font getFont(javax.swing.text.AttributeSet attr)
getFont in interface javax.swing.text.StyledDocumentattr - the set of attributes
public java.awt.Color getForeground(javax.swing.text.AttributeSet attr)
getForeground in interface javax.swing.text.StyledDocumentattr - the set of attributes
public javax.swing.text.Style getLogicalStyle(int p)
getLogicalStyle in interface javax.swing.text.StyledDocumentp - the position >= 0
public javax.swing.text.Element getParagraphElement(int pos)
getParagraphElement in interface javax.swing.text.StyledDocumentpos - the offset >= 0
public javax.swing.text.Style getStyle(java.lang.String nm)
getStyle in interface javax.swing.text.StyledDocumentnm - the name of the style
public void removeStyle(java.lang.String nm)
removeStyle in interface javax.swing.text.StyledDocumentnm - the name of the style to remove
public void setCharacterAttributes(int offset,
int length,
javax.swing.text.AttributeSet s,
boolean replace)
setCharacterAttributes in interface javax.swing.text.StyledDocumentoffset - the start of the change >= 0length - the length of the change >= 0s - the non-null attributes to change to. Any attributes
defined will be applied to the text for the given range.replace - indicates whether or not the previous
attributes should be cleared before the new attributes
as set. If true, the operation will replace the
previous attributes entirely. If false, the new
attributes will be merged with the previous attributes.
public void setLogicalStyle(int pos,
javax.swing.text.Style s)
setLogicalStyle in interface javax.swing.text.StyledDocumentpos - the starting position >= 0s - the style to set
public void setParagraphAttributes(int offset,
int length,
javax.swing.text.AttributeSet s,
boolean replace)
setParagraphAttributes in interface javax.swing.text.StyledDocumentoffset - the start of the change >= 0length - the length of the change >= 0s - the non-null attributes to change to. Any attributes
defined will be applied to the text for the given range.replace - indicates whether or not the previous
attributes should be cleared before the new attributes
are set. If true, the operation will replace the
previous attributes entirely. If false, the new
attributes will be merged with the previous attributes.protected javax.swing.text.Document createDocumentModel()
createDocumentModel in class DocumentProxypublic void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
fireUndoableEditHappened in class DocumentProxy
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||