|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.View | +--net.sourceforge.spedit.ui.WrapperView
The WrapperView
class allows to wrap any view and add CSS-like
display properties to it. This works very well with views such as
ParagraphView
or BoxView
.
The XMLViewFactory
of the core package always wrap created
views in a WrapperView
, so as long as you use the core classes
you can assume assume safely that all the views are WrapperView
instances (excepted the root view).
Inner classes inherited from class net.sourceforge.spedit.core.Styleable |
Styleable.StyleSheet, Styleable.Utils |
Field Summary | |
protected boolean |
collapsed
|
protected Font |
collapsedFont
|
protected Element |
element
|
protected boolean |
focused
|
protected boolean |
hasToUpdate
|
protected View |
nested
|
protected String |
nestedName
|
protected boolean |
refreshBounds
|
protected boolean |
selected
|
protected net.sourceforge.spedit.ui.StyleSheet |
styleSheet
|
protected String |
title
|
protected Rectangle2D |
viewBounds
|
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface net.sourceforge.spedit.core.Stateable |
FOCUSED, SELECTED, UNFOCUSED, UNSELECTED |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
WrapperView(Element e,
String name)
|
|
WrapperView(Element e,
String name,
String title)
|
|
WrapperView(View v)
|
Method Summary | |
void |
append(View v)
|
View |
breakView(int axis,
int offset,
float pos,
float len)
|
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
|
void |
collapse()
|
View |
createFragment(int p0,
int p1)
|
void |
expand()
|
float |
getAlignment(int axis)
|
AttributeSet |
getAttributes()
|
Rectangle2D |
getBounds()
Returns the bounds of this view. |
int |
getBreakWeight(int axis,
float pos,
float len)
|
Shape |
getChildAllocation(int index,
Shape a)
|
Container |
getContainer()
|
Document |
getDocument()
|
Element |
getElement()
|
int |
getEndOffset()
|
Graphics |
getGraphics()
|
float |
getMaximumSpan(int axis)
|
float |
getMinimumSpan(int axis)
|
View |
getNestedView()
|
int |
getNextVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
|
View |
getParent()
|
Styleable.StyleSheet |
getParentStyleSheet()
|
float |
getPreferredSpan(int axis)
|
int |
getResizeWeight(int axis)
|
int |
getStartOffset()
|
Styleable.StyleSheet |
getStyleSheet()
|
View |
getView(int n)
|
WrapperView |
getViewAt(float x,
float y)
Returns the view that is located at the given coordinates. |
int |
getViewCount()
|
ViewFactory |
getViewFactory()
|
int |
getViewIndex(int pos,
Position.Bias b)
|
void |
insert(int offs,
View v)
|
void |
insertUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
|
boolean |
isCollapsed()
|
boolean |
isFocused()
|
boolean |
isSelected()
|
boolean |
isVisible()
|
Shape |
modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
|
Shape |
modelToView(int pos,
Shape a)
|
Shape |
modelToView(int pos,
Shape a,
Position.Bias b)
|
void |
paint(Graphics g,
Shape s)
|
void |
preferenceChanged(View child,
boolean width,
boolean height)
|
void |
propagateMouseClicked(MouseEvent e)
Propagates the given event to the nested view if it is a MouseListener instance. |
void |
propagateMouseEntered(MouseEvent e)
Propagates the given event to the nested view if it is a MouseListener instance. |
void |
propagateMouseExited(MouseEvent e)
Propagates the given event to the nested view if it is a MouseListener instance. |
void |
propagateMousePressed(MouseEvent e)
Propagates the given event to the nested view if it is a MouseListener instance. |
void |
propagateMouseReleased(MouseEvent e)
Propagates the given event to the nested view if it is a MouseListener instance. |
void |
remove(int i)
|
void |
removeAll()
|
void |
removeUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
|
void |
repaint()
|
void |
replace(int offset,
int length,
View[] views)
|
void |
setFocused(boolean focused)
|
void |
setParent(View parent)
|
void |
setSelected(boolean selected)
|
void |
setSize(float width,
float height)
|
void |
setStyleSheet(Styleable.StyleSheet s)
|
int |
viewToModel(float x,
float y,
Shape a)
|
int |
viewToModel(float x,
float y,
Shape a,
Position.Bias[] biasReturn)
|
Methods inherited from class javax.swing.text.View |
forwardUpdate, forwardUpdateToView, updateChildren, updateLayout |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected View nested
protected String nestedName
protected String title
protected Element element
protected net.sourceforge.spedit.ui.StyleSheet styleSheet
protected boolean focused
protected boolean selected
protected boolean collapsed
protected Font collapsedFont
protected boolean hasToUpdate
protected Rectangle2D viewBounds
protected boolean refreshBounds
Constructor Detail |
public WrapperView(View v)
public WrapperView(Element e, String name)
public WrapperView(Element e, String name, String title)
Method Detail |
public void paint(Graphics g, Shape s)
paint
in class View
public void repaint()
public void setFocused(boolean focused)
setFocused
in interface Stateable
public boolean isFocused()
isFocused
in interface Stateable
public void setSelected(boolean selected)
setSelected
in interface Stateable
public boolean isSelected()
isSelected
in interface Stateable
public void collapse()
public void expand()
public boolean isCollapsed()
public Rectangle2D getBounds()
public WrapperView getViewAt(float x, float y)
public void propagateMouseClicked(MouseEvent e)
Propagates the given event to the nested view if it is a
MouseListener
instance. If it is not the case then the
evenet is forwarded to the parent view, which has to be not null
(of course) but also a WrapperView
instance.
Note that this particular propagator intercepts the event in case the event occured on the "expander" icon if it has been set in the stylesheet.
e
- The mouse event to be propagated.public void propagateMousePressed(MouseEvent e)
Propagates the given event to the nested view if it is a
MouseListener
instance. If it is not the case then the
evenet is forwarded to the parent view, which has to be not null
(of course) but also a WrapperView
instance.
e
- The mouse event to be propagated.public void propagateMouseReleased(MouseEvent e)
Propagates the given event to the nested view if it is a
MouseListener
instance. If it is not the case then the
evenet is forwarded to the parent view, which has to be not null
(of course) but also a WrapperView
instance.
e
- The mouse event to be propagated.public void propagateMouseEntered(MouseEvent e)
Propagates the given event to the nested view if it is a
MouseListener
instance. If it is not the case then the
evenet is forwarded to the parent view, which has to be not null
(of course) but also a WrapperView
instance.
e
- The mouse event to be propagated.public void propagateMouseExited(MouseEvent e)
Propagates the given event to the nested view if it is a
MouseListener
instance. If it is not the case then the
evenet is forwarded to the parent view, which has to be not null
(of course) but also a WrapperView
instance.
e
- The mouse event to be propagated.public int viewToModel(float x, float y, Shape a)
viewToModel
in class View
public int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn)
viewToModel
in class View
public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException
modelToView
in class View
public Shape modelToView(int pos, Shape a) throws BadLocationException
modelToView
in class View
public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
modelToView
in class View
public float getPreferredSpan(int axis)
getPreferredSpan
in class View
public float getMinimumSpan(int axis)
getMinimumSpan
in class View
public float getMaximumSpan(int axis)
getMaximumSpan
in class View
public void setSize(float width, float height)
setSize
in class View
public void append(View v)
append
in class View
public View getParent()
getParent
in class View
public View getNestedView()
public void replace(int offset, int length, View[] views)
replace
in class View
public void setParent(View parent)
setParent
in class View
public void remove(int i)
remove
in class View
public void removeAll()
removeAll
in class View
public int getViewIndex(int pos, Position.Bias b)
getViewIndex
in class View
public void insert(int offs, View v)
insert
in class View
public View getView(int n)
getView
in class View
public int getViewCount()
getViewCount
in class View
public ViewFactory getViewFactory()
getViewFactory
in class View
public View breakView(int axis, int offset, float pos, float len)
breakView
in class View
public View createFragment(int p0, int p1)
createFragment
in class View
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate
in class View
public float getAlignment(int axis)
getAlignment
in class View
public AttributeSet getAttributes()
getAttributes
in class View
public int getBreakWeight(int axis, float pos, float len)
getBreakWeight
in class View
public Shape getChildAllocation(int index, Shape a)
getChildAllocation
in class View
public Container getContainer()
getContainer
in class View
public Document getDocument()
getDocument
in class View
public Element getElement()
getElement
in class View
public int getEndOffset()
getEndOffset
in class View
public Graphics getGraphics()
getGraphics
in class View
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) throws BadLocationException
getNextVisualPositionFrom
in class View
public int getResizeWeight(int axis)
getResizeWeight
in class View
public int getStartOffset()
getStartOffset
in class View
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
insertUpdate
in class View
public boolean isVisible()
isVisible
in class View
public void preferenceChanged(View child, boolean width, boolean height)
preferenceChanged
in class View
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
removeUpdate
in class View
public Styleable.StyleSheet getStyleSheet()
getStyleSheet
in interface Styleable
public void setStyleSheet(Styleable.StyleSheet s)
setStyleSheet
in interface Styleable
public Styleable.StyleSheet getParentStyleSheet()
getParentStyleSheet
in interface Styleable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |