| java.lang.Object com.sun.midp.chameleon.CWindow
All known Subclasses: com.sun.midp.chameleon.MIDPWindow,
CWindow | abstract public class CWindow (Code) | | This class is a top-level "window" in Chameleon. A window is
a collection of other layers and serves to maintain a z-ordering
of those layers. The window also contains the complex repaint logic
to support semi-transparent windows, their dirty regions, and the
rectangle logic to repaint other layers of the window when necessary.
|
Constructor Summary | |
public | CWindow(Image bgImage, int bgColor) Construct a new CWindow given the background image and color.
If the background image is null, the fill color will be used
instead. |
Method Summary | |
public boolean | addLayer(CLayer layer) Add a new CLayer to the "deck" of layers associated
with this CWindow. | public boolean | isDirty() Returns true if any layer of this window is in need of repainting. | public boolean | keyInput(int type, int keyCode) Allow this window to process key input. | public boolean | methodInput(String str) Handle input from some type of device-dependent
input method. | public void | paint(Graphics g, CGraphicsQ refreshQ) Paint this window. | public boolean | pointerInput(int type, int x, int y) Allow this window to process pointer input. | public boolean | relocateLayer(CLayer layer, int x, int y, int w, int h) | public boolean | removeLayer(CLayer layer) Remove a layer from this CWindow. | abstract public void | requestRepaint() Request a repaint. | public void | resize() | public void | setAllDirty() Sets all visible layers to dirty state.
The method is needed on system events like screen rotation,
when generic layers system is not capabel to properly analyze
layers changes, e.g. | synchronized void | setBackground(Image bgImage, int bgColor) Establish a background. | public void | setDirty() Mark this window as being dirty and requiring a repaint. | CLayerElement | sweepLayer(CLayer layer) Update dirty regions of all visible layers in the stack regarding
the entire area of the given layer as being dirty. |
H | final public static int H(Code) | | Constant used to reference the '3' index of the bounds array
|
W | final public static int W(Code) | | Constant used to reference the '2' index of the bounds array
|
X | final public static int X(Code) | | Constant used to reference the '0' index of the bounds array
|
Y | final public static int Y(Code) | | Constant used to reference the '1' index of the bounds array
|
bgLayer | protected BackgroundLayer bgLayer(Code) | | Background layer of this window, should be the bottom most layer
of the window, can be invisible for transparent windows.
|
bounds | protected int[] bounds(Code) | | An array holding the bounds of this window. The indices are
as follows:
0 = window's 'x' coordinate
1 = window's 'y' coordinate
2 = window's width
3 = window's height
Note: The window's x and y coordinate can only be interpreted
by some outside entity. For example, if some sort of manager
was in charge of overseeing the placement of windows on the
screen, it could do so by using the x and y coordinate values
of this window's bounds.
|
cXcYcWcH | protected int cXcYcWcH(Code) | | Cache values for the clip rectangle
|
color | protected int color(Code) | | Cache value for the graphics foreground color
|
dirty | protected boolean dirty(Code) | | Flag indicating that at least one layer belonging to this
window is in need of repainting
|
dirtyCount | protected int dirtyCount(Code) | | The number of dirty layers to repaint
|
dirtyLayers | protected CLayer[] dirtyLayers(Code) | | Layers replication to not keep the lock on painting
|
dirtyMaxCount | protected int dirtyMaxCount(Code) | | Initial maximal number of the dirty layers
|
font | protected Font font(Code) | | Cache value for the graphics font
|
layers | protected CLayerList layers(Code) | | Ordered bi-directional list with all the layers of this window.
|
tranXtranY | protected int tranXtranY(Code) | | Cache values for the graphics translation
|
CWindow | public CWindow(Image bgImage, int bgColor)(Code) | | Construct a new CWindow given the background image and color.
If the background image is null, the fill color will be used
instead. In the case null image and negative color are specified
the window is considered to be transparent.
Parameters: bgImage - the background image to use for the window background Parameters: bgColor - the background fill color in 0xrrggbbaa format to usefor the window background if the background image is null. |
addLayer | public boolean addLayer(CLayer layer)(Code) | | Add a new CLayer to the "deck" of layers associated
with this CWindow. This method will sequentially add
layers to the window, placing subsequently added layers
on top of previously added layers.
Parameters: layer - the new layer to add to this window true if new layer was added, false otherwise |
isDirty | public boolean isDirty()(Code) | | Returns true if any layer of this window is in need of repainting.
true if any layer of this window is marked as 'dirty' and needs repainting. |
keyInput | public boolean keyInput(int type, int keyCode)(Code) | | Allow this window to process key input. The type of key input
will be press, release, repeat, etc. The key code will identify
which key generated the event. This method will return true if
the event was processed by this window or one of its layers,
false otherwise.
Parameters: type - the type of key event (press, release, repeat) Parameters: keyCode - the identifier of the key which generated the event true if this window or one of its layers processed the event |
methodInput | public boolean methodInput(String str)(Code) | | Handle input from some type of device-dependent
input method. This could be input from something
such as T9, or a phonebook lookup, etc.
Parameters: str - the text to handle as direct input true if this window or one of its layers processed the event |
paint | public void paint(Graphics g, CGraphicsQ refreshQ)(Code) | | Paint this window. This method should not generally be overridden by
subclasses. This method carefully stores the clip, translation, and
color before calling into subclasses. The graphics context should be
translated such that it is in this window's coordinate space (0,0 is
the top left corner of this window).
Parameters: g - The graphics object to use to paint this window. Parameters: refreshQ - The custom queue which holds the set of refreshregions needing to be blitted to the screen |
pointerInput | public boolean pointerInput(int type, int x, int y)(Code) | | Allow this window to process pointer input. The type of pointer input
will be press, release, drag, etc. The x and y coordinates will
identify the point at which the pointer event occurred in the coordinate
system of this window. This window will translate the coordinates
appropriately for each layer contained in this window. This method will
return true if the event was processed by this window or one of its
layers, false otherwise.
Parameters: type - the type of pointer event (press, release, drag) Parameters: x - the x coordinate of the location of the event Parameters: y - the y coordinate of the location of the event true if this window or one of its layers processed the event |
relocateLayer | public boolean relocateLayer(CLayer layer, int x, int y, int w, int h)(Code) | | Move layer to anotger location
Parameters: newBounds - new bounds for this layer Parameters: x - New 'x' coordinate of the layer's origin Parameters: y - New 'y' coordinate of the layer's origin Parameters: w - New width of the layer Parameters: h - New height of the layer true if successful, false otherwise |
removeLayer | public boolean removeLayer(CLayer layer)(Code) | | Remove a layer from this CWindow. This method will remove
the given layer from the "deck" of layers associated with
this CWindow. If successfull, this method will return true,
false otherwise (for example, if the layer does not belong
to this window).
Parameters: layer - the layer to remove from this window true if successful, false otherwise |
requestRepaint | abstract public void requestRepaint()(Code) | | Request a repaint. This method MUST be overridden
by subclasses to provide the implementation.
|
resize | public void resize()(Code) | | Resize window and its background according to updated skin values
|
setAllDirty | public void setAllDirty()(Code) | | Sets all visible layers to dirty state.
The method is needed on system events like screen rotation,
when generic layers system is not capabel to properly analyze
layers changes, e.g. of move/resize kind. It could be fixed in
the future and this method will be out of use.
|
setBackground | synchronized void setBackground(Image bgImage, int bgColor)(Code) | | Establish a background. This method will evaluate the parameters
and create a background which is appropriate. If the image is non-null,
the image will be used to create the background. If the image is null,
the values for the colors will be used and the background will be
painted in fill color instead. If the image is null, and the background
color is a negative value, this layer will become transparent and no
background will be painted.
Parameters: bgImage - the image to use for the background tile (or null) Parameters: bgColor - if the image is null, use this color as a backgroundfill color |
setDirty | public void setDirty()(Code) | | Mark this window as being dirty and requiring a repaint.
|
sweepLayer | CLayerElement sweepLayer(CLayer layer)(Code) | | Update dirty regions of all visible layers in the stack regarding
the entire area of the given layer as being dirty. The method is
needed to perform layer move/resize/remove opertion, since other
layers should be informed of changed area.
Parameters: layer - the layer whose area should be reported as dirty toother stack layers |
|
|