declare namespace javax {
namespace swing {
namespace text {
/**
* CompositeView
is an abstract View
* implementation which manages one or more child views.
* (Note that CompositeView
is intended
* for managing relatively small numbers of child views.)
* CompositeView
is intended to be used as
* a starting point for View
implementations,
* such as BoxView
, that will contain child
* View
s. Subclasses that wish to manage the
* collection of child View
s should use the
* {@link #replace} method. As View
invokes
* replace
during DocumentListener
* notification, you normally won't need to directly
* invoke replace
.
*
While CompositeView
* does not impose a layout policy on its child View
s,
* it does allow for inseting the child View
s
* it will contain. The insets can be set by either
* {@link #setInsets} or {@link #setParagraphInsets}.
*
In addition to the abstract methods of
* {@link javax.swing.text.View},
* subclasses of CompositeView
will need to
* override:
*
View
location is before the visual space
* of the CompositeView
.
* View
location is after the visual space
* of the CompositeView
.
* View
.
* getChildAllocation
will invoke
* childAllocation
after offseting
* the bounds by the Inset
s of the
* CompositeView
.
* CompositeView
for the given element.
* @param elem the element this view is responsible for
*/
// @ts-ignore
constructor(elem: javax.swing.text.Element)
/**
* Loads all of the children to initialize the view.
* This is called by the {@link #setParent}
* method. Subclasses can reimplement this to initialize
* their child views in a different manner. The default
* implementation creates a child view for each
* child element.
* @param f the view factory
* @see #setParent
*/
// @ts-ignore
loadChildren(f: javax.swing.text.ViewFactory): void
/**
* Sets the parent of the view.
* This is reimplemented to provide the superclass
* behavior as well as calling the loadChildren
* method if this view does not already have children.
* The children should not be loaded in the
* constructor because the act of setting the parent
* may cause them to try to search up the hierarchy
* (to get the hosting Container
for example).
* If this view has children (the view is being moved
* from one place in the view hierarchy to another),
* the loadChildren
method will not be called.
* @param parent the parent of the view, null
if none
*/
// @ts-ignore
public setParent(parent: javax.swing.text.View): void
/**
* Returns the number of child views of this view.
* @return the number of views >= 0
* @see #getView
*/
// @ts-ignore
public getViewCount(): number /*int*/
/**
* Returns the n-th view in this container.
* @param n the number of the desired view, >= 0 && < getViewCount()
* @return the view at index n
*/
// @ts-ignore
public getView(n: number /*int*/): javax.swing.text.View
/**
* Replaces 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
* may be garbage collected.
* @param offset the starting index into the child views to insert
* the new views; >= 0 and <= getViewCount
* @param length the number of existing child views to remove;
* this should be a value >= 0 and <= (getViewCount() - offset)
* @param views the child views to add; this value can be
* null
* to indicate no children are being added (useful to remove)
*/
// @ts-ignore
public replace(offset: number /*int*/, length: number /*int*/, views: javax.swing.text.View[]): void
/**
* Fetches the allocation for the given child view to
* render into. This enables finding out where various views
* are located.
* @param index the index of the child, >= 0 && < getViewCount()
* @param a the allocation to this view
* @return the allocation to the child
*/
// @ts-ignore
public getChildAllocation(index: number /*int*/, a: java.awt.Shape): java.awt.Shape
/**
* Provides a mapping from the document model coordinate space
* to the coordinate space of the view mapped to it.
* @param pos the position to convert >= 0
* @param a the allocated region to render into
* @param b a bias value of either Position.Bias.Forward
* or Position.Bias.Backward
* @return the bounding box of the given position
* @exception BadLocationException if the given position does
* not represent a valid location in the associated document
* @see View#modelToView
*/
// @ts-ignore
public modelToView(pos: number /*int*/, a: java.awt.Shape, b: javax.swing.text.Position.Bias): java.awt.Shape
/**
* Provides a mapping from the document model coordinate space
* to the coordinate space of the view mapped to it.
* @param p0 the position to convert >= 0
* @param b0 the bias toward the previous character or the
* next character represented by p0, in case the
* position is a boundary of two views; either
* Position.Bias.Forward
or
* Position.Bias.Backward
* @param p1 the position to convert >= 0
* @param b1 the bias toward the previous character or the
* next character represented by p1, in case the
* position is a boundary of two views
* @param a the allocated region to render into
* @return the bounding box of the given position is returned
* @exception BadLocationException if the given position does
* not represent a valid location in the associated document
* @exception IllegalArgumentException for an invalid bias argument
* @see View#viewToModel
*/
// @ts-ignore
public modelToView(p0: number /*int*/, b0: javax.swing.text.Position.Bias, p1: number /*int*/, b1: javax.swing.text.Position.Bias, a: java.awt.Shape): java.awt.Shape
/**
* Provides a mapping from the view coordinate space to the logical
* coordinate space of the model.
* @param x x coordinate of the view location to convert >= 0
* @param y y coordinate of the view location to convert >= 0
* @param a the allocated region to render into
* @param bias either Position.Bias.Forward
or
* Position.Bias.Backward
* @return the location within the model that best represents the
* given point in the view >= 0
* @see View#viewToModel
*/
// @ts-ignore
public viewToModel(x: number /*float*/, y: number /*float*/, a: java.awt.Shape, bias: javax.swing.text.Position.Bias[]): number /*int*/
/**
* 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.
* This is a convenience method for {@link #getNextNorthSouthVisualPositionFrom}
* and {@link #getNextEastWestVisualPositionFrom}.
* This method enables specifying a position to convert
* within the range of >=0. If the value is -1, a position
* will be calculated automatically. If the value < -1,
* the {@code BadLocationException} will be thrown.
* @param pos the position to convert
* @param b a bias value of either Position.Bias.Forward
* or Position.Bias.Backward
* @param a the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard;
* this may be one of the following:
* SwingConstants.WEST
* SwingConstants.EAST
* SwingConstants.NORTH
* SwingConstants.SOUTH
* direction
is invalid
*/
// @ts-ignore
public getNextVisualPositionFrom(pos: number /*int*/, b: javax.swing.text.Position.Bias, a: java.awt.Shape, direction: number /*int*/, biasRet: javax.swing.text.Position.Bias[]): number /*int*/
/**
* Returns the child view index representing the given
* position in the model. This is implemented to call the
* getViewIndexByPosition
* method for backward compatibility.
* @param pos the position >= 0
* @return index of the view representing the given position, or
* -1 if no view represents that position
* @since 1.3
*/
// @ts-ignore
public getViewIndex(pos: number /*int*/, b: javax.swing.text.Position.Bias): number /*int*/
/**
* Tests whether a point lies before the rectangle range.
* @param x the X coordinate >= 0
* @param y the Y coordinate >= 0
* @param alloc the rectangle
* @return true if the point is before the specified range
*/
// @ts-ignore
abstract isBefore(x: number /*int*/, y: number /*int*/, alloc: java.awt.Rectangle): boolean
/**
* Tests whether a point lies after the rectangle range.
* @param x the X coordinate >= 0
* @param y the Y coordinate >= 0
* @param alloc the rectangle
* @return true if the point is after the specified range
*/
// @ts-ignore
abstract isAfter(x: number /*int*/, y: number /*int*/, alloc: java.awt.Rectangle): boolean
/**
* Fetches the child view at the given coordinates.
* @param x the X coordinate >= 0
* @param y the Y coordinate >= 0
* @param alloc the parent's allocation on entry, which should
* be changed to the child's allocation on exit
* @return the child view
*/
// @ts-ignore
abstract getViewAtPoint(x: number /*int*/, y: number /*int*/, alloc: java.awt.Rectangle): javax.swing.text.View
/**
* Returns the allocation for a given child.
* @param index the index of the child, >= 0 && < getViewCount()
* @param a the allocation to the interior of the box on entry,
* and the allocation of the child view at the index on exit.
*/
// @ts-ignore
abstract childAllocation(index: number /*int*/, a: java.awt.Rectangle): void
/**
* Fetches the child view that represents the given position in
* the model. This is implemented to fetch the view in the case
* where there is a child view for each child element.
* @param pos the position >= 0
* @param a the allocation to the interior of the box on entry,
* and the allocation of the view containing the position on exit
* @return the view representing the given position, or
* null
if there isn't one
*/
// @ts-ignore
getViewAtPosition(pos: number /*int*/, a: java.awt.Rectangle): javax.swing.text.View
/**
* Fetches the child view index representing the given position in
* the model. This is implemented to fetch the view in the case
* where there is a child view for each child element.
* @param pos the position >= 0
* @return index of the view representing the given position, or
* -1 if no view represents that position
*/
// @ts-ignore
getViewIndexAtPosition(pos: number /*int*/): number /*int*/
/**
* Translates the immutable allocation given to the view
* to a mutable allocation that represents the interior
* allocation (i.e. the bounds of the given allocation
* with the top, left, bottom, and right insets removed.
* It is expected that the returned value would be further
* mutated to represent an allocation to a child view.
* This is implemented to reuse an instance variable so
* it avoids creating excessive Rectangles. Typically
* the result of calling this method would be fed to
* the childAllocation
method.
* @param a the allocation given to the view
* @return the allocation that represents the inside of the
* view after the margins have all been removed; if the
* given allocation was null
,
* the return value is null
*/
// @ts-ignore
getInsideAllocation(a: java.awt.Shape): java.awt.Rectangle
/**
* Sets the insets from the paragraph attributes specified in
* the given attributes.
* @param attr the attributes
*/
// @ts-ignore
setParagraphInsets(attr: javax.swing.text.AttributeSet): void
/**
* Sets the insets for the view.
* @param top the top inset >= 0
* @param left the left inset >= 0
* @param bottom the bottom inset >= 0
* @param right the right inset >= 0
*/
// @ts-ignore
setInsets(top: number /*short*/, left: number /*short*/, bottom: number /*short*/, right: number /*short*/): void
/**
* Gets the left inset.
* @return the inset >= 0
*/
// @ts-ignore
getLeftInset(): number /*short*/
/**
* Gets the right inset.
* @return the inset >= 0
*/
// @ts-ignore
getRightInset(): number /*short*/
/**
* Gets the top inset.
* @return the inset >= 0
*/
// @ts-ignore
getTopInset(): number /*short*/
/**
* Gets the bottom inset.
* @return the inset >= 0
*/
// @ts-ignore
getBottomInset(): number /*short*/
/**
* Returns the next visual position for the cursor, in either the
* north or south direction.
* @param pos the position to convert >= 0
* @param b a bias value of either Position.Bias.Forward
* or Position.Bias.Backward
* @param a the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard;
* this may be one of the following:
* SwingConstants.NORTH
* SwingConstants.SOUTH
* direction
is invalid
* @see #getNextVisualPositionFrom
* @return the next position west of the passed in position
*/
// @ts-ignore
getNextNorthSouthVisualPositionFrom(pos: number /*int*/, b: javax.swing.text.Position.Bias, a: java.awt.Shape, direction: number /*int*/, biasRet: javax.swing.text.Position.Bias[]): number /*int*/
/**
* Returns the next visual position for the cursor, in either the
* east or west direction.
* @param pos the position to convert >= 0
* @param b a bias value of either Position.Bias.Forward
* or Position.Bias.Backward
* @param a the allocated region to render into
* @param direction the direction from the current position that can
* be thought of as the arrow keys typically found on a keyboard;
* this may be one of the following:
* SwingConstants.WEST
* SwingConstants.EAST
* direction
is invalid
* @see #getNextVisualPositionFrom
*/
// @ts-ignore
getNextEastWestVisualPositionFrom(pos: number /*int*/, b: javax.swing.text.Position.Bias, a: java.awt.Shape, direction: number /*int*/, biasRet: javax.swing.text.Position.Bias[]): number /*int*/
/**
* Determines in which direction the next view lays.
* Consider the View
at index n. Typically the
* View
s are layed out from left to right,
* so that the View
to the EAST will be
* at index n + 1, and the View
to the WEST
* will be at index n - 1. In certain situations,
* such as with bidirectional text, it is possible
* that the View
to EAST is not at index n + 1,
* but rather at index n - 1, or that the View
* to the WEST is not at index n - 1, but index n + 1.
* In this case this method would return true, indicating the
* View
s are layed out in descending order.
*
* This unconditionally returns false, subclasses should override this
* method if there is the possibility for laying View
s in
* descending order.
* @param position position into the model
* @param bias either Position.Bias.Forward
or
* Position.Bias.Backward
* @return false
*/
// @ts-ignore
flipEastAndWestAtEnds(position: number /*int*/, bias: javax.swing.text.Position.Bias): boolean
}
}
}
}