Class View
All Packages Class Hierarchy This Package Previous Next Index
Class View
public class netscape.application.View
extends java.lang.Object
implements netscape.util.Codable
{
/* Fields
*/
public final static int ALWAYS;
public final static int ARROW_CURSOR;
public final static int BOTTOM_MARGIN_CAN_CHANGE;
public final static int CENTER_HORIZ;
public final static int CENTER_VERT;
public final static int CROSSHAIR_CURSOR;
public final static int E_RESIZE_CURSOR;
public final static int HAND_CURSOR;
public final static int HEIGHT_CAN_CHANGE;
public final static int LEFT_MARGIN_CAN_CHANGE;
public final static int MOVE_CURSOR;
public final static int NE_RESIZE_CURSOR;
public final static int NW_RESIZE_CURSOR;
public final static int N_RESIZE_CURSOR;
public final static int RIGHT_MARGIN_CAN_CHANGE;
public final static int SE_RESIZE_CURSOR;
public final static int SW_RESIZE_CURSOR;
public final static int S_RESIZE_CURSOR;
public final static int TEXT_CURSOR;
public final static int TOP_MARGIN_CAN_CHANGE;
public final static int WAIT_CURSOR;
public final static int WHEN_IN_MAIN_WINDOW;
public final static int WHEN_SELECTED;
public final static int WIDTH_CAN_CHANGE;
public final static int W_RESIZE_CURSOR;
public Rect bounds;
/* Constructors
*/
public View();
public View(Rect);
public View(int, int, int, int);
/* Methods
*/
public DragDestination acceptsDrag(DragSession, int, int);
public void addDirtyRect(Rect);
public void addSubview(View);
protected void ancestorWasAddedToViewHierarchy(View);
protected void ancestorWillRemoveFromViewHierarchy(View);
public Rect bounds();
public boolean canBecomeSelectedView();
public boolean canDraw();
public void computeVisibleRect(Rect);
public boolean containsPoint(int, int);
public boolean containsPointInVisibleRect(int, int);
public MouseEvent convertEventToView(View, MouseEvent);
public void convertPointToView(View, Point, Point);
public Point convertPointToView(View, Point);
public void convertRectToView(View, Rect, Rect);
public Rect convertRectToView(View, Rect);
public void convertToView(View, int, int, Point);
public Point convertToView(View, int, int);
protected Bitmap createBuffer();
public Graphics createGraphics();
public int cursorForPoint(int, int);
public void decode(Decoder);
public boolean descendsFrom(View);
public void describeClassInfo(ClassInfo);
public void didMoveBy(int, int);
public void didSizeBy(int, int);
public void disableDrawing();
public boolean doesAutoResizeSubviews();
public void draw(Graphics, Rect);
public void draw(Rect);
public void draw();
public void drawSubviews(Graphics);
public void drawView(Graphics);
public Bitmap drawingBuffer();
public void encode(Encoder);
public void finishDecoding();
public int graphicsDebugOptions();
public int height();
public boolean hidesSubviewsFromKeyboard();
public int horizResizeInstruction();
public void invalidateKeyboardSelectionOrder();
public boolean isBuffered();
public boolean isDirty();
public boolean isDrawingEnabled();
public boolean isInViewHierarchy();
public boolean isTransparent();
public void keyDown(KeyEvent);
public void keyTyped(KeyEvent);
public void keyUp(KeyEvent);
public Rect keyboardRect();
public LayoutManager layoutManager();
public void layoutView(int, int);
public Rect localBounds();
public Size minSize();
public boolean mouseDown(MouseEvent);
public void mouseDragged(MouseEvent);
public void mouseEntered(MouseEvent);
public void mouseExited(MouseEvent);
public void mouseMoved(MouseEvent);
public void mouseUp(MouseEvent);
public void moveBy(int, int);
public void moveTo(int, int);
public View nextSelectableView();
public void pauseFocus();
public View previousSelectableView();
public void reenableDrawing();
public void removeAllCommandsForKeys();
public void removeCommandForKey(int);
public void removeFromSuperview();
protected void removeSubview(View);
public void resumeFocus();
public RootView rootView();
public void scrollRectToVisible(Rect);
public void setAutoResizeSubviews(boolean);
public void setBounds(Rect);
public void setBounds(int, int, int, int);
public void setBuffered(boolean);
public void setCommandForKey(String, Object, int, int, int);
public void setCommandForKey(String, int, int);
public void setDirty(boolean);
public void setFocusedView();
public void setGraphicsDebugOptions(int);
public void setHorizResizeInstruction(int);
public void setLayoutManager(LayoutManager);
public void setMinSize(int, int);
public void setVertResizeInstruction(int);
public void sizeBy(int, int);
public void sizeTo(int, int);
public void sizeToMinSize();
public void startFocus();
public void stopFocus();
public void subviewDidMove(View);
public void subviewDidResize(View);
public Vector subviews();
public View superview();
public String toString();
public int vertResizeInstruction();
public View viewForMouse(int, int);
public boolean wantsAutoscrollEvents();
public boolean wantsMouseEventCoalescing();
public int width();
public void willBecomeSelected();
public void willBecomeUnselected();
public InternalWindow window();
public int x();
public int y();
}
A View is a rectangular entity capable of drawing on the screen and
receiving Events. All objects that need to perform one or both of these
functions (Buttons, Sliders, Windows) are View subclasses. Views are
arranged in a tree-like hierarchy, with each View having zero or more
subviews, called descendants. Before a View can draw or receive Events,
it must be placed within this hierarchy, through some form of the
addSubview() method. A RootView instance sits at the top
of the hierarchy, and all other Views descend from it.
Each View has an origin and size, defined by the View's bounds
instance variable. A View's origin is defined in its superview's
coordinates. A RootView has an origin of (0, 0) and a size as
defined by the HTML document that invoked the Application, or
ExternalWindow containing the RootView. The
coordinate system's positive Y-axis points down. For example, a subview
of the RootView with its origin 50 pixels below and 100 pixels
to the right of the RootView's origin has an origin of (100, 50).
A View subclass that wants to draw must override the drawView()
method. The Graphics object passed into this method has its clip rect set
such that the View cannot accidentally draw outside of its bounds. The
Graphics object's coordinate system has been altered, allowing the View to
draw using its own relative coordinate system. Using the subview in the
above example, the following code draws a red square at the View's origin:
g.setColor(Color.red);
g.fillRect(0, 0, 20, 20);
While Views encompass rectangular regions within the View hierarchy, they
can simulate non-rectangular entities through the notion of transparency.
Overriding the method isTransparent() to return true tells
the IFC's drawing machinery that at
least some portion of the View's drawing area is not redrawn by its
drawView() method. Whenever the View needs to be redrawn, the
drawing machinery assures that the transparent View's superview, or
some other opaque ancestor, redraws the region behind the transparent
View before calling the transparent View's drawView() method.
In general, you do not need to know the exact mechanism - just
have your View's isTransparent() method return true and
everything else happens as it
should. By default, isTransparent() returns true, so if
your View is not transparent, you should override this method to return
false.
You can also make a View "buffered," meaning that
all drawing performed by the View goes first to an offscreen buffer
and then onscreen. With a buffered View, you get flicker-free drawing,
but at the cost of slightly reduced performance.
To force a View to draw itself,
you call the View's draw() method. All drawing is synchronous,
meaning that a draw() request is peformed
immediately (draw() does not return until all drawing has
completed).
Views interested in processing mouse events must override one of the mouse
event methods and take appropriate action. Event locations are presented
in terms of the View's coordinate system.
- See Also:
- addSubview, removeFromSuperview, draw, drawView, isTransparent, setBuffered
Fields
bounds
public Rect bounds
- The View's bounding rectangle, in its superview's coordinate
system. The bounds field should only be used for reading.
You should never modify this field directly. To move or resize a
View call setBounds().
- See Also:
- setBounds, bounds, localBounds
RIGHT_MARGIN_CAN_CHANGE
public final static int RIGHT_MARGIN_CAN_CHANGE
- Horizontal resize instruction.
LEFT_MARGIN_CAN_CHANGE
public final static int LEFT_MARGIN_CAN_CHANGE
- Horizontal resize instruction.
WIDTH_CAN_CHANGE
public final static int WIDTH_CAN_CHANGE
- Horizontal resize instruction.
CENTER_HORIZ
public final static int CENTER_HORIZ
- Horizontal resize instruction.
BOTTOM_MARGIN_CAN_CHANGE
public final static int BOTTOM_MARGIN_CAN_CHANGE
- Vertical resize instruction.
TOP_MARGIN_CAN_CHANGE
public final static int TOP_MARGIN_CAN_CHANGE
- Vertical resize instruction.
HEIGHT_CAN_CHANGE
public final static int HEIGHT_CAN_CHANGE
- Vertical resize instruction.
CENTER_VERT
public final static int CENTER_VERT
- Vertical resize instruction.
ARROW_CURSOR
public final static int ARROW_CURSOR
- Arrow cursor.
CROSSHAIR_CURSOR
public final static int CROSSHAIR_CURSOR
- Crosshair cursor.
TEXT_CURSOR
public final static int TEXT_CURSOR
- Text cursor.
WAIT_CURSOR
public final static int WAIT_CURSOR
- Wait cursor.
SW_RESIZE_CURSOR
public final static int SW_RESIZE_CURSOR
- Southwest resize cursor.
SE_RESIZE_CURSOR
public final static int SE_RESIZE_CURSOR
- Southeast resize cursor.
NW_RESIZE_CURSOR
public final static int NW_RESIZE_CURSOR
- Northwest resize cursor.
NE_RESIZE_CURSOR
public final static int NE_RESIZE_CURSOR
- Northeast resize cursor.
N_RESIZE_CURSOR
public final static int N_RESIZE_CURSOR
- North resize cursor.
S_RESIZE_CURSOR
public final static int S_RESIZE_CURSOR
- South resize cursor.
W_RESIZE_CURSOR
public final static int W_RESIZE_CURSOR
- West resize cursor.
E_RESIZE_CURSOR
public final static int E_RESIZE_CURSOR
- East resize cursor.
HAND_CURSOR
public final static int HAND_CURSOR
- Hand cursor.
MOVE_CURSOR
public final static int MOVE_CURSOR
- Move cursor.
WHEN_SELECTED
public final static int WHEN_SELECTED
- The view should receive the command only the selected
WHEN_IN_MAIN_WINDOW
public final static int WHEN_IN_MAIN_WINDOW
- The view should receive the command only when it is in the main window
The command is also sent when the view is selected.
ALWAYS
public final static int ALWAYS
- Always send the command. You should be careful with this option since
the command will always be sent, even when a modal session is running.
The command is also sent when the component is in the main window or is
selected.
Constructors
.View
public View()
- Constructs a View with origin (0, 0) and zero width
and height.
.View
public View(Rect rect)
- Constructs a View with bounds rect.
.View
public View(int x,
int y,
int width,
int height)
- Constructs a View with bounds
(x, y, width, height).
Methods
public Vector subviews()
- Returns the View's subviews. Do not modify the Vector's contents.
public boolean descendsFrom(View aView)
- Returns true if the View is a descendant of or equals
aView.
public InternalWindow window()
- Returns the View's InternalWindow, or null if a subview of
the RootView.
public Rect bounds()
- Returns a newly-allocated copy of the View's bounding rectangle, which
defines the View's size and position within its superview's coordinate
system.
- See Also:
- setBounds, moveBy, sizeBy, moveTo, sizeTo, localBounds
public int x()
- Returns the View's x location.
- See Also:
- bounds
public int y()
- Returns the View's y location.
- See Also:
- bounds
public int width()
- Returns the View's width.
- See Also:
- bounds
public int height()
- Returns the View's height.
- See Also:
- bounds
public View superview()
- Returns the View's superview.
- See Also:
- addSubview, removeFromSuperview
public void setHorizResizeInstruction(int instruction)
- Sets the View's horizontal resize instruction, an integer value that
represents the various ways in which a View can change its size in
response to its superview's resizing. The default horizontal
resize instruction is RIGHT_MARGIN_CAN_CHANGE, which keeps
the View's left margin and width a fixed number of pixels.
public int horizResizeInstruction()
- Returns the View's horizontal resize instruction.
- See Also:
- setHorizResizeInstruction
public void setVertResizeInstruction(int instruction)
- Sets the View's vertical resize instruction, an integer value
respresenting the various ways in which a View can change its size
in response to its superview's resizing. The default vertical
resize instruction is BOTTOM_MARGIN_CAN_CHANGE, which keeps
the View's top margin and height a fixed number of pixels.
public int vertResizeInstruction()
- Returns the View's vertical resize instruction.
- See Also:
- setVertResizeInstruction
public boolean wantsAutoscrollEvents()
- Returns true if the View wants to automatically receive
mouse dragged events when the user clicks and drags outside of its
bounds. Default implementation returns false. Views
that want to allow autoscrolling should override to return true.
public DragDestination acceptsDrag(DragSession session,
int x,
int y)
- Returns the object which should act as the destination of a
DragSession. Returns null.
- See Also:
- DragSession, DragDestination
public void setAutoResizeSubviews(boolean flag)
- Tells the IFC that this View should automatically resize
and reposition its subviews when resized.
public boolean doesAutoResizeSubviews()
- Returns true if the View automatically resizes and repositions
its subviews when it is resized.
- See Also:
- setAutoResizeSubviews
public void didMoveBy(int deltaX,
int deltaY)
- Called by View's implementation of setBounds(). Subviews
override this method to learn when they change position.
public void didSizeBy(int deltaWidth,
int deltaHeight)
- Called by setBounds() to resize a View's subviews. View
subclasses requiring specialized resizing behavior should override
this method.
public void setBounds(Rect rect)
- Convenience method for setting the bounds with a Rect. Equivalent
to the code:
setBounds(rect.x, rect.y, rect.width, rect.height);
- See Also:
- setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Primitive method for changing a View's bounds Rect. Sets the
View's bounding rectangle and then calls didMoveBy()
with the old origin, and didSizeBy() with the old size. It also
adjusts the size of its drawingBuffer, if any, and notifies its
superview if this View's size has changed.
- See Also:
- bounds, localBounds
public void moveBy(int deltaX,
int deltaY)
- Convenience method to translate the View's origin by deltaX
and deltaY. Calls setBounds().
public void moveTo(int x,
int y)
- Convenience method to translate the View's origin. Calls
setBounds().
public void sizeBy(int deltaWidth,
int deltaHeight)
- Convenience method for changing the View's size. Calls
setBounds().
public void sizeTo(int width,
int height)
- Convenience method for setting the View's size. Call
setBounds().
public void setMinSize(int width,
int height)
- Convenience method for setting the View's minimum size to
(width, height). This is the size that will be
returned from the minSize() method. Normally, minSize()
computes a View subclass' minimum based on current conditions. Setting
a minimum size of (-1, -1) erases the previous minimum size set.
- See Also:
- minSize
public Size minSize()
- Returns the View's minimum size. If the minimum size has not been
set, returns a Size instance with zero width and height.
- See Also:
- setMinSize
public void sizeToMinSize()
- Resizes the View to the minimum size needed to display its contents.
Calls the minSize() method to get the View's minimum size
information.
- See Also:
- minSize
public void subviewDidResize(View aSubview)
- Notifies a View that one of its subviews has changed size. This
information is important to ScrollViews and other View subclasses
that need to know if a descendant has changed size. The default
implementation simply passes the notification up to the View's
superview.
public void subviewDidMove(View aSubview)
- Notifies a View that one of its subviews has moved. This
information is important to ScrollViews and other View subclasses
that need to know if a descendant has moved. The default
implementation simply passes the notification up to the View's
superview.
public void addSubview(View aView)
- Adds aView to the Application's View hierarchy, as a subview
of this View.
- See Also:
- removeFromSuperview, ancestorWasAddedToViewHierarchy
protected void ancestorWasAddedToViewHierarchy(View addedView)
- Called when the View or one of its ancestors has been added to the
Application's View hierarchy.
- See Also:
- addSubview, ancestorWillRemoveFromViewHierarchy
protected void removeSubview(View aView)
public void removeFromSuperview()
- Removes the View from the Application's View hierarchy, setting its
superview to becomes null.
- See Also:
- addSubview, ancestorWillRemoveFromViewHierarchy
protected void ancestorWillRemoveFromViewHierarchy(View removedView)
- Called when the View or one of its ancestors has been removed from
the Application's View hierarchy.
You should call
super.ancestorWillRemoveFromViewHierarchy(removedView);
before returning.
- See Also:
- removeFromSuperview, ancestorWasAddedToViewHierarchy
public boolean containsPoint(int x,
int y)
- Returns true if the View's bounds contains the point
(x, y).
public boolean containsPointInVisibleRect(int x,
int y)
- Returns true if the View contains the point (x,
y) within its visible rect.
- See Also:
- computeVisibleRect
public View viewForMouse(int x,
int y)
- Returns the View containing the point (x, y). The
View first checks its subviews to see if they contain the point,
and if not, checks itself.
public int cursorForPoint(int x,
int y)
- Returns the cursor that should appear when the mouse is over
the point (x, y) in the View's coordinate system. By
default, this method returns ARROW_CURSOR. Subclassers
should override this method to implement custom cursor behavior.
public boolean mouseDown(MouseEvent event)
- Called when the user clicks the mouse in the View. You should override
this method to return true if you want to receive subsequent
mouseDragged() and mouseUp() messages. By default, this
method returns false.
- See Also:
- mouseDragged, mouseUp
public void mouseDragged(MouseEvent event)
- Called when the user drags the mouse (moves it with the mouse button
depressed) after having initially clicked in the View. The mouse
down View will receive mouseDragged() messages until the
user releases the mouse button, even if the user drags the mouse
outside the mouse down View's bounds.
- See Also:
- mouseDown, mouseUp
public void mouseUp(MouseEvent event)
- Called when the user releases the mouse button.
- See Also:
- mouseDown
public void mouseEntered(MouseEvent event)
- Called when the mouse enters the View's bounds.
- See Also:
- mouseMoved, mouseExited
public void mouseMoved(MouseEvent event)
- Called when the mouse moves within the View's bounds, after an initial
mouseEntered() message.
- See Also:
- mouseEntered, mouseMoved
public void mouseExited(MouseEvent event)
- Called when the mouse exits the View's bounds, after an initial
mouseEntered() message.
- See Also:
- mouseEntered, mouseMoved
public void keyDown(KeyEvent event)
- Called when the user presses a key. The View must register itself with
the Application by calling its setFocusedView() method before it
can receive key down and key up events.
- See Also:
- setFocusedView, keyUp
public void keyUp(KeyEvent event)
- Called when the user releases a key, after an initial key down message.
- See Also:
- keyDown
public void keyTyped(KeyEvent event)
- Called when a unicode character has been generated after pressing one or more
keys. Note: This method is called only when running with a 1.1 virtual machine
and Application.application().handleExtendedKeyEvent returns true
- See Also:
- keyUp, keyDown
public void scrollRectToVisible(Rect aRect)
- Forwards the scrollRectToVisible() message to the View's
superview. Views that can service the request, such as a ScrollView,
override this method and perform the scrolling.
- See Also:
- ScrollView
public void disableDrawing()
- Disables drawing within the View and its subviews. Call
reenableDrawing() to enable drawing.
disableDrawing()/reenableDrawing() pairs can be nested,
and must be balanced.
- See Also:
- reenableDrawing
public void reenableDrawing()
- Reenables drawing within the View and its subviews.
- See Also:
- disableDrawing
public boolean isDrawingEnabled()
- Returns true if drawing is enabled within the View.
- See Also:
- disableDrawing
public boolean isInViewHierarchy()
- Returns true if the View is a member of the Application's View
hierarchy.
public RootView rootView()
- Returns the View's RootView, or null if the View isn't
currently in the View hierarchy.
public boolean canDraw()
- Returns true if the View is a member of the Application's View
hierarchy and drawing for the View is enabled.
- See Also:
- isDrawingEnabled
public void computeVisibleRect(Rect visibleRect)
- Computes the View's "visible rect," the intersection
of the View's and all of its ancestors' bounding rectangles, placing
it in visibleRect.
- See Also:
- Rect
public boolean isTransparent()
- Returns true if the View is transparent. A View that's
transparent has a drawView() method that doesn't paint all of
the bits within the View's bounds. By default, this method returns
true. Views which are totally opaque should override this method
to return false to improve drawing performance. It is always
safe to return true, but the View's superviews may be drawn
unnecessarily.
public boolean wantsMouseEventCoalescing()
- Returns true if the View wants the IFC to
coalesce mouse move or drag events, instead of sending each
individual event to the View. Returns true unless overridden.
- See Also:
- Window
public void addDirtyRect(Rect rect)
- Adds a rectangle to be drawn after the current Event is processed.
Calling addDirtyRect(null) dirties the entire View and is
equivalent to setDirty(true).
- See Also:
- setDirty, drawDirtyViews
public void setDirty(boolean flag)
- Registers the View to be drawn after processing the current Event.
If flag() is true, the entire View is
marked as needing to be redrawn. If flag() is
false, then the View is marked as not needing to be drawn.
RootView's drawDirtyViews() method calls
setDirty(false) on each dirty View after it has been drawn.
- See Also:
- drawDirtyViews
public boolean isDirty()
- Returns true if the View will be redrawn after the current
Event has been processed.
- See Also:
- addDirtyRect, setDirty
public void drawView(Graphics g)
- Draws the View's contents. You rarely call this method directly,
but you will override it to implement any View subclass drawing.
The IFC sets the Graphics' clipping rectangle to the region requiring
a redraw, and the Graphics object's origin to correspond to the View's
coordinate system origin. This method draws only the View's contents,
not its subviews. The default implementation does nothing.
- See Also:
- draw
public void drawSubviews(Graphics g)
- Calls the drawView() method of each of the View's subviews.
You never call this method directly, but you can override it to
implement special drawing. For example, the following code draws a
blue rectangle around the View's perimeter, on top of any drawing its
subviews may have performed.
super.drawSubviews(g);
g.setColor(Color.blue);
g.drawRect(0, 0, width(),height());
Placing the drawRect() within the View's drawView()
gives its subviews a chance to draw over the rect. The IFC sets the
passed-in Graphics' clipping rectangle to the region that requires a
redraw.
public void draw(Graphics g,
Rect clipRect)
- Primitive method, instructing the View to draw the clipRect
portion of itself and its subviews to the Graphics g. If
clipRect is null, draws the entire View. If g
is null, uses the RootView's graphics().
draw() sets the Graphics' clipping rectangle and ultimately
calls the View's and its subviews' drawView() methods. All
drawing occurs synchronously (that is, this method does not return
until the requested drawing has been performed).
You should
only call this form of draw() if you have to draw to a specific
Graphics. If not, use one of the more generic versions.
public void draw(Rect clipRect)
- Convenience method for drawing the clipRect portion of the
View. Equivalent to the code:
draw(createGraphics(), clipRect);
public void draw()
- Convenience method for drawing the entire View. Equivalent to
the code:
draw(createGraphics(), null);
public void setBuffered(boolean flag)
- Calling setBuffered(true) causes the View to allocate
an offscreen drawing buffer. The results of all drawing operations
performed within the View's drawView() method, and those of
its subviews, go first to the buffer and then to the screen, reducing
drawing flicker at the cost of speed and memory. In general,
reasonably flicker-free drawing can be achieved without drawing
buffers by careful attention to redrawing the minimum amount
necessary.
public boolean isBuffered()
- Returns true if the View has an offscreen drawing buffer.
- See Also:
- setBuffered
public Bitmap drawingBuffer()
- Returns the View's offscreen drawing buffer, if any.
- See Also:
- setBuffered
public void startFocus()
- Tells the View that it has become the focus of KeyEvents.
- See Also:
- stopFocus
public void stopFocus()
- Tells the View that it has ceased being the focus of KeyEvents.
- See Also:
- startFocus
public void pauseFocus()
- Tells the View that it has temporarily ceased being the focus of
KeyEvents, such as when the user begins working with another
application. The View will receive a resumeFocus() message when
it again regains focus.
- See Also:
- resumeFocus
public void resumeFocus()
- Tells the View that it has regained the KeyEvent focus.
- See Also:
- pauseFocus
public void setFocusedView()
- Tells a View that it should become the focus of KeyEvents. The
View must be part of the View hierarchy in order to receive
KeyEvents.
public void describeClassInfo(ClassInfo info)
- Describes the View class' information.
- See Also:
- describeClassInfo
public void encode(Encoder encoder) throws CodingException
- Encodes the View instance.
- See Also:
- decode
public void decode(Decoder decoder) throws CodingException
- Decodes the View instance.
- See Also:
- decode
public void finishDecoding() throws CodingException
- Finishes the View instance decoding.
- See Also:
- finishDecoding
public void convertToView(View otherView,
int x,
int y,
Point destPoint)
- Converts the x and y to otherView's
coordinate system, and stores the result in destPoint. If
otherView is null, destPoint will be in the
absolute coordinate system.
public Point convertToView(View otherView,
int x,
int y)
- Converts the x and y to otherView's
coordinate system, and returns the result. If
otherView is null, destPoint will be in the
absolute coordinate system.
public void convertRectToView(View otherView,
Rect sourceRect,
Rect destRect)
- Converts the sourceRect to otherView's coordinate
system, and stores the result in destRect. If otherView
is null, destRect will be in the absolute coordinate
system.
public void convertPointToView(View otherView,
Point sourcePoint,
Point destPoint)
- Converts the sourcePoint to otherView's coordinate
system, and stores the result in destPoint. If otherView
is null, destPoint will be in the absolute coordinate
system.
public Rect convertRectToView(View otherView,
Rect sourceRect)
- Returns the rectangle containing sourceRect converted
to otherView's coordinate system. If otherView is
null, the returned Rect is in the absolute coordinate system.
public Point convertPointToView(View otherView,
Point sourcePoint)
- Returns a rectangle containing srcPoint converted
to otherView's coordinate system. If otherView is
null, the returned Rect is in the absolute coordinate system.
public MouseEvent convertEventToView(View otherView,
MouseEvent sourceEvent)
- Returns a MouseEvent similar to sourceEvent except that its x
and y members have been converted to otherView's coordinate
system. If otherView is null, the
returned MouseEvent is in the absolute coordinate system.
public void setGraphicsDebugOptions(int debugOptions)
- Enables or disables diagnostic information about every graphics
operation performed within the View or one of its subviews. The
value of debug determines how the View should display this
information:
- DebugGraphics.LOG_OPTION - causes a text message to be printed.
- DebugGraphics.FLASH_OPTION - causes the drawing to flash several
times.
- DebugGraphics.BUFFERED_OPTION - creates an ExternalWindow that
displays the operations performed on the View's offscreen buffer.
debug is bitwise OR'd into the current value.
DebugGraphics.NONE_OPTION disables debugging.
A value of 0 causes no changes to the debugging options.
public int graphicsDebugOptions()
- Returns the state of graphics debugging.
- See Also:
- setGraphicsDebugOptions
public void setLayoutManager(LayoutManager value)
- Sets the View's LayoutManager, the object responsible for sizing
and positioning the View's subviews.
public LayoutManager layoutManager()
- Returns the View's LayoutManager.
- See Also:
- setLayoutManager
public void layoutView(int deltaWidth,
int deltaHeight)
- Sizes and positions the View's subviews. By default, a View acts as
its own LayoutManager.
public Rect localBounds()
- Returns the rectangle (0, 0, width(), height()).
- See Also:
- bounds
public Graphics createGraphics()
- Creates a Graphics object for the View. The caller must call
dispose() on this Graphics to free its resources. Subclasses
of View can override this method to return custom subclasses of
Graphics.
This method throws an exception if the View is not in the View
hierarchy.
- See Also:
- dispose
protected Bitmap createBuffer()
- Creates a Bitmap for the View to use as a drawing buffer. View
subclasses can override this method to return custom subclasses of
Bitmap.
public String toString()
- Returns the View's string representation.
- Overrides:
- toString in class Object
public boolean canBecomeSelectedView()
- Return whether this view can become the selected view
when the user is moving from view to views with the keyboard
The default implementation returns false.
public boolean hidesSubviewsFromKeyboard()
- Return whether this view hides its subviews from the keyboard ui
main system The default implementation returns false. Override this
method and return true if your view provides a different keyboard
UI strategy for its subviews.
public View nextSelectableView()
- Return the View that should become selected when the user
press the tab key. If the result is null, the keyboard UI
system will select the next available view.
The default implementation returns null.
public View previousSelectableView()
- Return the View that should become selected when the user
press the backtab key. If the result is null, the keyboard UI
system will select the next available view.
The default implementation returns null.
public void invalidateKeyboardSelectionOrder()
- You should call this method if the result of nextSelectableView() or
previousSelectableView() changes.
public void willBecomeSelected()
- Inform the view that it is about to become the selected view
The default implementation requests RootView to display the
keyboard arrow.
public void willBecomeUnselected()
- Inform the view that it will no longer be the selected view
The default implementation requests RootView to hide the
keyboard arrow.
public void setCommandForKey(String aCommand,
Object cmdData,
int key,
int modifiers,
int when)
- Inform the keyboard UI system that the receiving view should
receive the command aCommand with data cmdData
when the key aKey is pressed with the modifier modifier.
when can be View.WHEN_SELECTED, View.WHEN_IN_MAIN_WINDOW or
View.ALWAYS If aCommand is null, this method removes the
binding. aKey can be one of the constants defined into the
KeyEvent class
- See Also:
- KeyEvent
public void setCommandForKey(String aCommand,
int aKey,
int when)
- Convenience to add aCommand when the key aKey is pressed.
This method calls setCommandForKey() with cmdData set to the
receiver and modifiers set to null.
public void removeCommandForKey(int aKey)
- Convenience to remove a command associated with a key.
public void removeAllCommandsForKeys()
- Remove all the command for all the keys
public Rect keyboardRect()
- Return the rect that should be used to show the keyboard UI
arrow. The default implementation returns localBounds()
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997