The component is placed relative to the text baseline
according to the value returned by
Component.getAlignmentY. For Swing components
this value can be conveniently set using the method
JComponent.setAlignmentY. For example, setting
a value of 0.75 will cause 75 percent of the
component to be above the baseline, and 25 percent of the
component to be below the baseline.
This class is implemented to do the extra work necessary to work properly in the presence of multiple threads (i.e. from asynchronous notification of model changes for example) by ensuring that all component access is done on the event thread.
The component used is determined by the return value of the createComponent method. The default implementation of this method is to return the component held as an attribute of the element (by calling StyleConstants.getComponent). A limitation of this behavior is that the component cannot be used by more than one text component (i.e. with a shared model). Subclasses can remove this constraint by implementing the createComponent to actually create a component based upon some kind of specification contained in the attributes. The ObjectView class in the html package is an example of a ComponentView implementation that supports multiple component views of a shared model.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | ComponentView.
This class feeds the invalidate back to the hosting View. |
| Modifier and Type | Field and Description |
|---|---|
| private ComponentView. | |
| private Component |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Component | Returns: the component that is associated with this viewCreate the component that is associated with this view. |
| public float | Returns: the desired alignment. This should be a value between 0.0 and 1.0 where 0 indicates alignment at the origin and 1.0 indicates alignment to the full span away from the origin. An alignment of 0.5 would be the center of the view.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the desired alignment for this view along an axis. |
| public final Component | Returns: the component associated with the viewFetch the component associated with the view. |
| public float | Returns: the span the view would like to be rendered into >=0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the maximum span for this view along an axis. |
| public float | Returns: the span the view would like to be rendered into >=0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.may be either View.X_AXIS or View.Y_AXIS axis)Overrides javax. Determines the minimum span for this view along an axis. |
| public float | Returns: the span the view would like to be rendered into >=0. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.may be either View.X_AXIS or View.Y_AXIS axis)Implements abstract javax. Determines the preferred span for this view along an axis. |
| public Shape | Returns: the bounding box of the given position is returnedthe position to convert >=0 pos, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the coordinate space of the model to that of the view. |
| public void | paint(Graphics
the graphics context g, Shape the shape a)Implements abstract javax. The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view). |
| pack-priv void | |
| public void | setParent(View
the parent p)Overrides javax. Sets the parent for a child view. |
| public int | Returns: the location within the model that best represents the given point in the viewthe X coordinate >=0 x, float the Y coordinate >=0 y, Shape the allocated region to render into a, Position.Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model. |
| c | back to summary |
|---|---|
| private ComponentView. | |
| createdC | back to summary |
|---|---|
| private Component createdC | |
| ComponentView | back to summary |
|---|---|
| public ComponentView(Element elem) Creates a new ComponentView object.
| |
| createComponent | back to summary |
|---|---|
| protected Component createComponent() Create the component that is associated with this view. This will be called when it has been determined that a new component is needed. This would result from a call to setParent or as a result of being notified that attributes have changed.
| |
| getAlignment | back to summary |
|---|---|
| public float getAlignment(int axis) Overrides javax. Determines the desired alignment for this view along an axis. This is implemented to give the alignment of the embedded component.
| |
| getComponent | back to summary |
|---|---|
| public final Component getComponent() Fetch the component associated with the view.
| |
| getMaximumSpan | back to summary |
|---|---|
| public float getMaximumSpan(int axis) Overrides javax. Determines the maximum span for this view along an axis. This is implemented to return the value returned by Component.getMaximumSize along the axis of interest.
| |
| getMinimumSpan | back to summary |
|---|---|
| public float getMinimumSpan(int axis) Overrides javax. Determines the minimum span for this view along an axis. This is implemented to return the value returned by Component.getMinimumSize along the axis of interest.
| |
| getPreferredSpan | back to summary |
|---|---|
| public float getPreferredSpan(int axis) Implements abstract javax. Determines the preferred span for this view along an axis. This is implemented to return the value returned by Component.getPreferredSize along the axis of interest.
| |
| modelToView | back to summary |
|---|---|
| public Shape modelToView(int pos, Shape a, Position. Implements abstract javax. Provides a mapping from the coordinate space of the model to that of the view.
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, Shape a) Implements abstract javax. The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view). This is implemented to do nothing.
| |
| setComponentParent | back to summary |
|---|---|
| pack-priv void setComponentParent() Set the parent of the embedded component with assurance that it is thread-safe. | |
| setParent | back to summary |
|---|---|
| public void setParent(View p) Overrides javax. Sets the parent for a child view.
The parent calls this on the child to tell it who its
parent is, giving the view access to things like
the hosting Container. The superclass behavior is
executed, followed by a call to createComponent if
the parent view parameter is non-null and a component
has not yet been created. The embedded components parent
is then set to the value returned by 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).
| |
| viewToModel | back to summary |
|---|---|
| public int viewToModel(float x, float y, Shape a, Position. Implements abstract javax. Provides a mapping from the view coordinate space to the logical coordinate space of the model.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Dimension | |
| pack-priv Dimension | |
| pack-priv Dimension | |
| pack-priv float | |
| pack-priv float |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | |
| public float | |
| public float | |
| public Set | getFocusTraversalKeys(int id)
Overrides java. Returns the Set of focus traversal keys for a given traversal operation for this Container. |
| public Dimension | getMaximumSize()
Overrides java. Returns the maximum size of this container. |
| public Dimension | getMinimumSize()
Overrides java. Returns the minimum size of this container. |
| public Dimension | getPreferredSize()
Overrides java. Returns the preferred size of this container. |
| public void | invalidate()
Overrides java. The components invalid layout needs to be propagated through the view hierarchy so the views (which position the component) can have their layout recomputed. |
| public boolean | |
| public void | propertyChange(PropertyChangeEvent ev)
Implements java. This method gets called when a bound property is changed. |
| public void | setBounds(int x, int y, int w, int h)
Overrides java. Moves and resizes this component. |
| public void | setVisible(boolean
If b)true, shows this component;
otherwise, hides this component.Overrides java. Shows or hides this component depending on the value of parameter
|
| public void |
| max | back to summary |
|---|---|
| pack-priv Dimension max | |
| min | back to summary |
|---|---|
| pack-priv Dimension min | |
| pref | back to summary |
|---|---|
| pack-priv Dimension pref | |
| xalign | back to summary |
|---|---|
| pack-priv float xalign | |
| yalign | back to summary |
|---|---|
| pack-priv float yalign | |
| Invalidator | back to summary |
|---|---|
| pack-priv Invalidator(Component child) | |
| cacheChildSizes | back to summary |
|---|---|
| private void cacheChildSizes() | |
| doLayout | back to summary |
|---|---|
| public void doLayout() Overrides java. Doc from java. Causes this container to lay out its components. Most programs
should not call this method directly, but should invoke
the | |
| getAlignmentX | back to summary |
|---|---|
| public float getAlignmentX() Overrides java. Doc from java. Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc. | |
| getAlignmentY | back to summary |
|---|---|
| public float getAlignmentY() Overrides java. Doc from java. Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc. | |
| getFocusTraversalKeys | back to summary |
|---|---|
| public Set Overrides java. Doc from java. Returns the Set of focus traversal keys for a given traversal operation
for this Container. (See
If a Set of traversal keys has not been explicitly defined for this Container, then this Container's parent's Set is returned. If no Set has been explicitly defined for any of this Container's ancestors, then the current KeyboardFocusManager's default Set is returned. | |
| getMaximumSize | back to summary |
|---|---|
| public Dimension getMaximumSize() Overrides java. Doc from java. Returns the maximum size of this container. If the maximum size has
not been set explicitly by Note some implementations may cache the value returned from the
| |
| getMinimumSize | back to summary |
|---|---|
| public Dimension getMinimumSize() Overrides java. Doc from java. Returns the minimum size of this container. If the minimum size has
not been set explicitly by Note some implementations may cache the value returned from the
| |
| getPreferredSize | back to summary |
|---|---|
| public Dimension getPreferredSize() Overrides java. Doc from java. Returns the preferred size of this container. If the preferred size has
not been set explicitly by Note some implementations may cache the value returned from the
| |
| invalidate | back to summary |
|---|---|
| public void invalidate() Overrides java. The components invalid layout needs to be propagated through the view hierarchy so the views (which position the component) can have their layout recomputed. | |
| isShowing | back to summary |
|---|---|
| public boolean isShowing() Overrides java. Overridden to fix 4759054. Must return true so that content is painted when inside a CellRendererPane which is normally invisible. | |
| propertyChange | back to summary |
|---|---|
| public void propertyChange(PropertyChangeEvent ev) Implements java. Doc from java. This method gets called when a bound property is changed. | |
| setBounds | back to summary |
|---|---|
| public void setBounds(int x, int y, int w, int h) Overrides java. Doc from java. Moves and resizes this component. The new location of the top-left
corner is specified by This method changes layout-related information, and therefore, invalidates the component hierarchy. | |
| setVisible | back to summary |
|---|---|
| public void setVisible(boolean b) Overrides java. Shows or hides this component depending on the value of parameter
| |
| validateIfNecessary | back to summary |
|---|---|
| public void validateIfNecessary() | |