📄 view.html
字号:
<A NAME="getView(int)"><!-- --></A><H3>getView</H3><PRE>public <A HREF="../../../javax/swing/text/View.html">View</A> <B>getView</B>(int n)</PRE><DL><DD>Gets the nth child view. Since there are no children by default, this returns null.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - the number of the view to get, >= 0 && < getViewCount()<DT><B>Returns:</B><DD>the view</DL></DD></DL><HR><A NAME="removeAll()"><!-- --></A><H3>removeAll</H3><PRE>public void <B>removeAll</B>()</PRE><DL><DD>Removes all of the children. This is a convenience call to replace.<DD><DL></DL></DD><DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="remove(int)"><!-- --></A><H3>remove</H3><PRE>public void <B>remove</B>(int i)</PRE><DL><DD>Removes one of the children at the given position. This is a convenience call to replace.<DD><DL></DL></DD><DD><DL><DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="insert(int, javax.swing.text.View)"><!-- --></A><H3>insert</H3><PRE>public void <B>insert</B>(int offs, <A HREF="../../../javax/swing/text/View.html">View</A> v)</PRE><DL><DD>Inserts a single child view. This is a convenience call to replace.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>offs</CODE> - the offset of the view to insert before >= 0<DD><CODE>v</CODE> - the view<DT><B>Since: </B><DD>1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/View.html#replace(int, int, javax.swing.text.View[])"><CODE>replace(int, int, javax.swing.text.View[])</CODE></A></DL></DD></DL><HR><A NAME="append(javax.swing.text.View)"><!-- --></A><H3>append</H3><PRE>public void <B>append</B>(<A HREF="../../../javax/swing/text/View.html">View</A> v)</PRE><DL><DD>Appends a single child view. This is a convenience call to replace.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>v</CODE> - the view<DT><B>Since: </B><DD>1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/View.html#replace(int, int, javax.swing.text.View[])"><CODE>replace(int, int, javax.swing.text.View[])</CODE></A></DL></DD></DL><HR><A NAME="replace(int, int, javax.swing.text.View[])"><!-- --></A><H3>replace</H3><PRE>public void <B>replace</B>(int offset, int length, <A HREF="../../../javax/swing/text/View.html">View</A>[] views)</PRE><DL><DD>Replace child views. If there are no views to remove this acts as an insert. If there are no views to add this acts as a remove. Views being removed will have the parent set to null, and the internal reference to them removed so that they can be garbage collected. This is implemented to do nothing, because by default a view has no children.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the starting index into the child views to insert the new views. This should be a value >= 0 and <= getViewCount.<DD><CODE>length</CODE> - the number of existing child views to remove. This should be a value >= 0 and <= (getViewCount() - offset).<DD><CODE>views</CODE> - the child views to add. This value can be null to indicate no children are being added (useful to remove).<DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getViewIndex(int, javax.swing.text.Position.Bias)"><!-- --></A><H3>getViewIndex</H3><PRE>public int <B>getViewIndex</B>(int pos, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A> b)</PRE><DL><DD>Returns the child view index representing the given position in the model. By default a view has no children so this is implemented to return -1 to indicate there is no valid child index for any position.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pos</CODE> - the position >= 0<DT><B>Since: </B><DD>1.3</DD></DL></DD></DL><HR><A NAME="getChildAllocation(int, java.awt.Shape)"><!-- --></A><H3>getChildAllocation</H3><PRE>public <A HREF="../../../java/awt/Shape.html">Shape</A> <B>getChildAllocation</B>(int index, <A HREF="../../../java/awt/Shape.html">Shape</A> a)</PRE><DL><DD>Fetches the allocation for the given child view. This enables finding out where various views are located, without assuming the views store their location. This returns null since the default is to not have any child views.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the child, >= 0 && < getViewCount()<DD><CODE>a</CODE> - the allocation to this view.<DT><B>Returns:</B><DD>the allocation to the child</DL></DD></DL><HR><A NAME="getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])"><!-- --></A><H3>getNextVisualPositionFrom</H3><PRE>public int <B>getNextVisualPositionFrom</B>(int pos, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A> b, <A HREF="../../../java/awt/Shape.html">Shape</A> a, int direction, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A>[] biasRet) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Provides a way to determine the next visually represented model location that one might place a caret. Some views may not be visible, they might not be in the same order found in the model, or they just might not allow access to some of the locations in the model.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pos</CODE> - the position to convert >= 0<DD><CODE>a</CODE> - the allocated region to render into<DD><CODE>direction</CODE> - the direction from the current position that can be thought of as the arrow keys typically found on a keyboard. This may be SwingConstants.WEST, SwingConstants.EAST, SwingConstants.NORTH, or SwingConstants.SOUTH.<DT><B>Returns:</B><DD>the location within the model that best represents the next location visual position.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - <DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - for an invalid direction</DL></DD></DL><HR><A NAME="modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)"><!-- --></A><H3>modelToView</H3><PRE>public abstract <A HREF="../../../java/awt/Shape.html">Shape</A> <B>modelToView</B>(int pos, <A HREF="../../../java/awt/Shape.html">Shape</A> a, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A> b) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pos</CODE> - the position to convert >= 0<DD><CODE>a</CODE> - the allocated region to render into<DD><CODE>b</CODE> - the bias toward the previous character or the next character represented by the offset, in case the position is a boundary of two views.<DT><B>Returns:</B><DD>the bounding box of the given position is returned<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the given position does not represent a valid location in the associated document<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - for an invalid bias argument<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/View.html#viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])"><CODE>viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])</CODE></A></DL></DD></DL><HR><A NAME="modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape)"><!-- --></A><H3>modelToView</H3><PRE>public <A HREF="../../../java/awt/Shape.html">Shape</A> <B>modelToView</B>(int p0, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A> b0, int p1, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A> b1, <A HREF="../../../java/awt/Shape.html">Shape</A> a) throws <A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></PRE><DL><DD>Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>p0</CODE> - the position to convert >= 0<DD><CODE>b0</CODE> - the bias toward the previous character or the next character represented by p0, in case the position is a boundary of two views.<DD><CODE>p1</CODE> - the position to convert >= 0<DD><CODE>b1</CODE> - the bias toward the previous character or the next character represented by p1, in case the position is a boundary of two views.<DD><CODE>a</CODE> - the allocated region to render into<DT><B>Returns:</B><DD>the bounding box of the given position is returned<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/swing/text/BadLocationException.html">BadLocationException</A></CODE> - if the given position does not represent a valid location in the associated document<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - for an invalid bias argument<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/text/View.html#viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])"><CODE>viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])</CODE></A></DL></DD></DL><HR><A NAME="viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])"><!-- --></A><H3>viewToModel</H3><PRE>public abstract int <B>viewToModel</B>(float x, float y, <A HREF="../../../java/awt/Shape.html">Shape</A> a, <A HREF="../../../javax/swing/text/Position.Bias.html">Position.Bias</A>[] biasReturn)</PRE><DL><DD>Provides a mapping from the view coordinate space to the logical coordinate space of the model. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the X coordinate >= 0<DD><CODE>y</CODE> - the Y coordinate >= 0<DD><CODE>a</CODE> - the allocated region to render into<DT><B>Returns:</B><DD>the location within the model that best represents the given point in the view >= 0. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.</DL></DD></DL><HR><A NAME="insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)"><!-- --></A><H3>insertUpdate</H3><PRE>public void <B>insertUpdate</B>(<A HREF="../../../javax/swing/event/DocumentEvent.html">DocumentEvent</A> e, <A HREF="../../../java/awt/Shape.html">Shape</A> a, <A HREF="../../../javax/swing/text/ViewFactory.html">ViewFactory</A> f)</PRE><DL><DD>Gives notification that something was inserted into the document in a location that this view is responsible for. To reduce the burden to subclasses, this functionality is spread out into the following calls that subclasses can reimplement: <ol> <li><a href="#updateChildren">updateChildren</a> is called if there were any changes to the element this view is responsible for. If this view has child views that are represent the child elements, then this method should do whatever is necessary to make sure the child views correctly represent the model. <li><a href="#forwardUpdate">forwardUpdate</a> is called to forward the DocumentEvent to the appropriate child views. <li><a href="#updateLayout">updateLayout</a> is called to give the view a chance to either repair it's layout, to reschedule layout, or do nothing. </ol><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>e</CODE> - the change information from the associated document<DD><CODE>a</CODE> - the current allocation of the view<DD><CODE>f</CODE> - the factory to use to rebuild if the view has children<DT><B>See Also: </B><D
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -