Java Doc for ComponentView.java in  » 6.0-JDK-Core » swing » javax » swing » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.text.View
      javax.swing.text.ComponentView

All known Subclasses:   javax.swing.text.html.FrameView,  javax.swing.text.html.ObjectView,  javax.swing.text.html.IsindexView,  javax.swing.text.html.FormView,  javax.swing.text.html.EditableView,
ComponentView
public class ComponentView extends View (Code)
Component decorator that implements the view interface. The entire element is used to represent the component. This acts as a gateway from the display-only View implementations to interactive lightweight components (ie it allows components to be embedded into the View hierarchy).

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.
author:
   Timothy Prinzing
version:
   1.60 05/05/07


Inner Class :class Invalidator extends Container implements PropertyChangeListener


Constructor Summary
public  ComponentView(Element elem)
     Creates a new ComponentView object.

Method Summary
protected  ComponentcreateComponent()
     Create the component that is associated with this view.
public  floatgetAlignment(int axis)
     Determines the desired alignment for this view along an axis.
final public  ComponentgetComponent()
     Fetch the component associated with the view.
public  floatgetMaximumSpan(int axis)
     Determines the maximum span for this view along an axis.
public  floatgetMinimumSpan(int axis)
     Determines the minimum span for this view along an axis.
public  floatgetPreferredSpan(int axis)
     Determines the preferred span for this view along an axis.
public  ShapemodelToView(int pos, Shape a, Position.Bias b)
     Provides a mapping from the coordinate space of the model to that of the view.
public  voidpaint(Graphics g, Shape a)
     The real paint behavior occurs naturally from the association that the component has with its parent container (the same container hosting this view).
 voidsetComponentParent()
     Set the parent of the embedded component with assurance that it is thread-safe.
public  voidsetParent(View p)
     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.
public  intviewToModel(float x, float y, Shape a, Position.Bias[] bias)
     Provides a mapping from the view coordinate space to the logical coordinate space of the model.


Constructor Detail
ComponentView
public ComponentView(Element elem)(Code)
Creates a new ComponentView object.
Parameters:
  elem - the element to decorate




Method Detail
createComponent
protected Component createComponent()(Code)
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
public float getAlignment(int axis)(Code)
Determines the desired alignment for this view along an axis. This is implemented to give the alignment of the embedded component.
Parameters:
  axis - may be either View.X_AXIS or View.Y_AXIS the desired alignment. This should be a valuebetween 0.0 and 1.0 where 0 indicates alignment at theorigin and 1.0 indicates alignment to the full spanaway from the origin. An alignment of 0.5 would be thecenter of the view.



getComponent
final public Component getComponent()(Code)
Fetch the component associated with the view.



getMaximumSpan
public float getMaximumSpan(int axis)(Code)
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.
Parameters:
  axis - may be either View.X_AXIS or View.Y_AXIS the span the view would like to be rendered into >= 0.Typically the view is told to render into the spanthat is returned, although there is no guarantee. The parent may choose to resize or break the view.
exception:
  IllegalArgumentException - for an invalid axis



getMinimumSpan
public float getMinimumSpan(int axis)(Code)
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.
Parameters:
  axis - may be either View.X_AXIS or View.Y_AXIS the span the view would like to be rendered into >= 0.Typically the view is told to render into the spanthat is returned, although there is no guarantee. The parent may choose to resize or break the view.
exception:
  IllegalArgumentException - for an invalid axis



getPreferredSpan
public float getPreferredSpan(int axis)(Code)
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.
Parameters:
  axis - may be either View.X_AXIS or View.Y_AXIS the span the view would like to be rendered into >= 0.Typically the view is told to render into the spanthat is returned, although there is no guarantee.The parent may choose to resize or break the view.
exception:
  IllegalArgumentException - for an invalid axis



modelToView
public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException(Code)
Provides a mapping from the coordinate space of the model to that of the view.
Parameters:
  pos - the position to convert >= 0
Parameters:
  a - the allocated region to render into the bounding box of the given position is returned
exception:
  BadLocationException - if the given position does notrepresent a valid location in the associated document
See Also:   View.modelToView



paint
public void paint(Graphics g, Shape a)(Code)
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.
Parameters:
  g - the graphics context
Parameters:
  a - the shape
See Also:   View.paint



setComponentParent
void setComponentParent()(Code)
Set the parent of the embedded component with assurance that it is thread-safe.



setParent
public void setParent(View p)(Code)
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 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).
Parameters:
  p - the parent




viewToModel
public int viewToModel(float x, float y, Shape a, Position.Bias[] bias)(Code)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.
Parameters:
  x - the X coordinate >= 0
Parameters:
  y - the Y coordinate >= 0
Parameters:
  a - the allocated region to render into the location within the model that best representsthe given point in the view
See Also:   View.viewToModel



Fields inherited from javax.swing.text.View
final public static int BadBreakWeight(Code)(Java Doc)
final public static int ExcellentBreakWeight(Code)(Java Doc)
final public static int ForcedBreakWeight(Code)(Java Doc)
final public static int GoodBreakWeight(Code)(Java Doc)
final public static int X_AXIS(Code)(Java Doc)
final public static int Y_AXIS(Code)(Java Doc)
final static Position.Bias[] sharedBiasReturn(Code)(Java Doc)

Methods inherited from javax.swing.text.View
public void append(View v)(Code)(Java Doc)
public View breakView(int axis, int offset, float pos, float len)(Code)(Java Doc)
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)(Code)(Java Doc)
public View createFragment(int p0, int p1)(Code)(Java Doc)
protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)(Code)(Java Doc)
protected void forwardUpdateToView(View v, DocumentEvent e, Shape a, ViewFactory f)(Code)(Java Doc)
public float getAlignment(int axis)(Code)(Java Doc)
public AttributeSet getAttributes()(Code)(Java Doc)
public int getBreakWeight(int axis, float pos, float len)(Code)(Java Doc)
public Shape getChildAllocation(int index, Shape a)(Code)(Java Doc)
public Container getContainer()(Code)(Java Doc)
public Document getDocument()(Code)(Java Doc)
public Element getElement()(Code)(Java Doc)
public int getEndOffset()(Code)(Java Doc)
public Graphics getGraphics()(Code)(Java Doc)
public float getMaximumSpan(int axis)(Code)(Java Doc)
public float getMinimumSpan(int axis)(Code)(Java Doc)
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) throws BadLocationException(Code)(Java Doc)
public View getParent()(Code)(Java Doc)
abstract public float getPreferredSpan(int axis)(Code)(Java Doc)
public int getResizeWeight(int axis)(Code)(Java Doc)
public int getStartOffset()(Code)(Java Doc)
public String getToolTipText(float x, float y, Shape allocation)(Code)(Java Doc)
public View getView(int n)(Code)(Java Doc)
public int getViewCount()(Code)(Java Doc)
public ViewFactory getViewFactory()(Code)(Java Doc)
public int getViewIndex(int pos, Position.Bias b)(Code)(Java Doc)
public int getViewIndex(float x, float y, Shape allocation)(Code)(Java Doc)
public void insert(int offs, View v)(Code)(Java Doc)
public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)(Code)(Java Doc)
public boolean isVisible()(Code)(Java Doc)
abstract public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException(Code)(Java Doc)
public Shape modelToView(int p0, Position.Bias b0, int p1, Position.Bias b1, Shape a) throws BadLocationException(Code)(Java Doc)
public Shape modelToView(int pos, Shape a) throws BadLocationException(Code)(Java Doc)
abstract public void paint(Graphics g, Shape allocation)(Code)(Java Doc)
public void preferenceChanged(View child, boolean width, boolean height)(Code)(Java Doc)
public void remove(int i)(Code)(Java Doc)
public void removeAll()(Code)(Java Doc)
public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)(Code)(Java Doc)
public void replace(int offset, int length, View[] views)(Code)(Java Doc)
public void setParent(View parent)(Code)(Java Doc)
public void setSize(float width, float height)(Code)(Java Doc)
protected boolean updateChildren(DocumentEvent.ElementChange ec, DocumentEvent e, ViewFactory f)(Code)(Java Doc)
protected void updateLayout(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a)(Code)(Java Doc)
abstract public int viewToModel(float x, float y, Shape a, Position.Bias[] biasReturn)(Code)(Java Doc)
public int viewToModel(float x, float y, Shape a)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.