|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--org.zaval.lw.LwRoot
This class is a root light weight component that implements LwDesktop interface. The main purpose of the class to provide connection between native Java AWT library implementation and light weight components hierarchy. So, on the one hand the class is light weight components (implements LwContainer interface) and on the other hand this class inherits Java AWT component (java.awt.Panel). Using the class the light weight library:
getProperty and setProperty
methods to control the property.
...
LwContainer root = new LwRoot();
root.getRootLayer().setLwLayout(new LwBorderLayout());
LwButton button = new LwButton("Ok");
root.getRootLayer().add(LwBorderLayout.CENTER, button);
...
java.awt.Frame frame = java.awt.Frame();
frame.setSize(400, 400);
frame.setLayout(new BorderLayout());
frame.add("Center", root);
frame.setVisible(true);
...
OR
...
Applet applet = new Applet();
applet.setLayout(new BorderLayout());
applet.add("Center", root);
...
First of all the sample above uses the root layer component as a light weight container for creating
the light weight hierarchy. The second part shows the usage of the root as a part of Java AWT
frame component and a java applet.
More easy way is using of LwFrame class that inherits java.awt.Frame and provides the lightweight top-level container ready to create lightweight hierarchy:
...
LwFrame frame = LwFrame();
LwContainer root = frame.getRoot();
root.setLwLayout(new LwBorderLayout());
LwButton button = new LwButton("Ok");
root.add(LwBorderLayout.CENTER, button);
frame.setSize(400, 400);
frame.setVisible(true);
...
| Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
static int |
CURSOR_PROPERTY
Defines cursor property id. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
LwRoot()
Constructs the class instance. |
|
| Method Summary | |
void |
add(LwComponent c)
Adds the specified lightweight component as a child of this container. |
void |
add(java.lang.Object s,
LwComponent c)
Adds the specified lightweight component with the specified constraints as a child of this container. |
java.awt.Dimension |
calcPreferredSize(LayoutContainer target)
Calculates the preferred size dimension for the layout container. |
boolean |
canHaveFocus()
Specifies if the component can have focus. |
void |
componentAdded(java.lang.Object id,
Layoutable lw,
int index)
Invoked when the specified layoutable component is added to the layout container (that uses the layout manager). |
void |
componentHidden(java.awt.event.ComponentEvent e)
Invoked when component has been hidden. |
void |
componentMoved(java.awt.event.ComponentEvent e)
Invoked when component has been moved. |
void |
componentRemoved(Layoutable lw,
int index)
Invoked when the specified layoutable component is removed from the layout container, that uses the layout manager. |
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when component has been resized. |
void |
componentShown(java.awt.event.ComponentEvent e)
Invoked when component has been shown. |
int |
count()
Returns the number of child elements in this container. |
void |
focusGained(java.awt.event.FocusEvent e)
Invoked when a component gains the keyboard focus. |
void |
focusLost(java.awt.event.FocusEvent e)
Invoked when a component loses the keyboard focus. |
Layoutable |
get(int index)
Gets a child element at the given index. |
int |
getHeight()
Gets the height of this component. |
java.awt.Insets |
getInsets()
Determines the insets of this component. |
LwLayer |
getLayer(java.lang.Object id)
Gets the layer by the specified id. |
java.lang.Object[] |
getLayersIDs()
Gets the list of available layers' IDs. |
java.awt.Point |
getLayoutOffset()
Returns the offset. |
LwComponent |
getLwComponentAt(int x,
int y)
Determines if the component or an immediate child component contains the (x, y) location in its visible part and if so, returns the component. |
LwLayout |
getLwLayout()
Gets a layout manager for this container. |
LwComponent |
getLwParent()
Gets the lightweight parent of this component. |
java.awt.Point |
getOrigin()
Returns an origin of the drawable component. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of this component. |
java.lang.Object |
getProperty(int id)
Gets the value for the specified property. |
LwLayer |
getRootLayer()
Gets the root layer that should be used to add a light weight component on the desktop surface. |
LwViewMan |
getViewMan(boolean b)
Returns a view manager of the component. |
java.awt.Rectangle |
getVisiblePart()
Returns the bounding rectangle of the visible part for the component. |
int |
getWidth()
Gets the width of this component. |
int |
getX()
Gets the x location of this component specifying the component top-left corner. |
int |
getY()
Gets the y location of this component specifying the component top-left corner. |
int |
indexOf(LwComponent c)
Searches the specified component among this container children and returns an index of the component in the child list. |
void |
insert(int i,
java.lang.Object s,
LwComponent d)
Inserts the specified lightweight component with the specified constraints as a child of this container at the specified position in the container list. |
boolean |
isFocusTraversable()
Returns whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. |
boolean |
isOpaque()
Gets the opaque of this component. |
void |
keyPressed(java.awt.event.KeyEvent e)
Invoked when a key has been pressed. |
void |
keyReleased(java.awt.event.KeyEvent e)
Invoked when a key has been released. |
void |
keyTyped(java.awt.event.KeyEvent e)
Invoked when a key has been typed. |
void |
layout(LayoutContainer target)
Lays out the child layoutable components inside the layout container. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons no down). |
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
void |
paint(java.awt.Graphics g)
Paints this drawable component. |
void |
paintOnTop(java.awt.Graphics g)
Paints additional elements (for example, marker) after the container and its child components have been rendered. |
void |
remove(int i)
Removes the component, specified by the index, from this container. |
void |
removeAll()
Removes all child components from this container. |
void |
reshape(int x,
int y,
int w,
int h)
|
void |
setEnabled(boolean b)
Enables or disables this component. |
void |
setLwLayout(LwLayout l)
Sets the layout manager for this container. |
void |
setLwParent(LwComponent p)
Sets the lightweight parent of this component. |
void |
setOpaque(boolean b)
Sets the opaque of this component. |
void |
setProperty(int id,
java.lang.Object value)
Sets the value for the specified property. |
void |
setViewMan(LwViewMan v)
Sets the specified view manager for the component. |
void |
update(java.awt.Graphics g)
Updates this drawable component. |
void |
validate()
Validates this object. |
| Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setFont, setLayout, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zaval.lw.LwDesktop |
createImage, getGraphics |
| Methods inherited from interface org.zaval.lw.LwComponent |
setBackground, setVisible |
| Methods inherited from interface org.zaval.lw.Drawable |
getBackground, isEnabled, repaint, repaint |
| Methods inherited from interface org.zaval.util.Validationable |
invalidate, isValid |
| Methods inherited from interface org.zaval.lw.Layoutable |
getBounds, getLocation, getSize, isVisible, setLocation, setSize |
| Field Detail |
public static final int CURSOR_PROPERTY
getProperty and setProperty method to control
native cursor state.| Constructor Detail |
public LwRoot()
| Method Detail |
public void setLwLayout(LwLayout l)
LwContainersetLwLayout in interface LwContainerorg.zaval.lw.LwContainerm - the specified layout manager.public int getX()
Layoutablex location of this component specifying the component top-left corner.
The location is relative to the parent component coordinate space.getX in interface LayoutablegetX in class java.awt.Componentorg.zaval.lw.Layoutablex coordinate representing the top-left corner
of the component bounds in the coordinate space of the component parent.public int getY()
Layoutabley location of this component specifying the component top-left corner.
The location is relative to the parent component coordinate space.getY in interface LayoutablegetY in class java.awt.Componentorg.zaval.lw.Layoutabley coordinate representing the top-left corner
of the component bounds in the coordinate space of the component parent.public int getWidth()
LayoutablegetWidth in interface LayoutablegetWidth in class java.awt.Componentorg.zaval.lw.Layoutablepublic int getHeight()
LayoutablegetHeight in interface LayoutablegetHeight in class java.awt.Componentorg.zaval.lw.Layoutablepublic LwLayout getLwLayout()
LwContainergetLwLayout in interface LwContainerorg.zaval.lw.LwContainerpublic LwComponent getLwParent()
null, since the root component cannot have
a light weight component as a parent, because this component should be used as
a top-level light weight component.getLwParent in interface LwComponentnull.public void setLwParent(LwComponent p)
RuntimeException if you try to call it.setLwParent in interface LwComponentp - the parent component of this lightweight component.public LwViewMan getViewMan(boolean b)
LwComponentnull.
The input argument autoCreate defines if the view manager has to be created
automatically in a case if it has not been determined before. It means, if the argument is
true and the view manager is null, than the component will
try to create and initialize its view manager by a default view manager. If the argument
is false than the method returns the component view manager as is.getViewMan in interface LwComponentorg.zaval.lw.LwComponentautoCreate - the flag defines if the view manager should be created
automatically.public void setViewMan(LwViewMan v)
LwComponentsetViewMan in interface LwComponentorg.zaval.lw.LwComponentman - the view manager to set for the component.public java.awt.Rectangle getVisiblePart()
LwComponentgetVisiblePart in interface LwComponentorg.zaval.lw.LwComponent
public LwComponent getLwComponentAt(int x,
int y)
LwComponentgetLwComponentAt in interface LwComponentorg.zaval.lw.LwComponentx - the x coordinate.y - the y coordinate.null if the location is outside this component.public boolean isOpaque()
false than the component is transparent, in this case
update method has not be called during painting process.
The method allways returns true as result, because this is
root component.isOpaque in interface DrawableisOpaque in class java.awt.Componenttrue if the component is opaque; otherwise
false.public Layoutable get(int index)
LayoutContainerget in interface LayoutContainerorg.zaval.lw.LayoutContainerindex - the index of a child to be returned.public int count()
LayoutContainercount in interface LayoutContainerorg.zaval.lw.LayoutContainerpublic void add(LwComponent c)
LwContainer componentAdded method its layout manager to inform
the layout manager that the new child has been added.add in interface LwContainerorg.zaval.lw.LwContainerc - the lightweight component to be added.
public void add(java.lang.Object s,
LwComponent c)
LwContainer componentAdded method its
layout manager to inform the layout manager that the new child has been added.add in interface LwContainerorg.zaval.lw.LwContainers - the object expressing layout contraints for this.c - the lightweight component to be added.
public void insert(int i,
java.lang.Object s,
LwComponent d)
LwContainercomponentAdded method its layout manager to inform the layout manager
that the new child has been added with the given constraints.insert in interface LwContainerorg.zaval.lw.LwContaineri - the position in the container list at which to insert
the component.s - the object expressing layout contraints for this.c - the lightweight component to be added.public void remove(int i)
LwContainercomponentRemoved method of the manager.remove in interface LwContainerremove in class java.awt.Containerorg.zaval.lw.LwContainerindex - the index of the component to be removed.public void removeAll()
LwContainercomponentRemoved method of the manager for every child component
that has been removed.removeAll in interface LwContainerremoveAll in class java.awt.Containerpublic int indexOf(LwComponent c)
LwContainer-1.indexOf in interface LwContainerorg.zaval.lw.LwContainerc - the component to get index.public void validate()
Validationablevalidate in interface Validationablevalidate in class java.awt.Containerpublic void setEnabled(boolean b)
LwComponentsetEnabled in interface LwComponentsetEnabled in class java.awt.Componentorg.zaval.lw.LwComponentb - if the value is true - enables the component;
otherwise disables this component.public java.awt.Dimension getPreferredSize()
LayoutablegetPreferredSize in interface LayoutablegetPreferredSize in class java.awt.Containerorg.zaval.lw.Layoutablepublic java.awt.Insets getInsets()
LayoutablegetInsets in interface LayoutablegetInsets in class java.awt.Containerorg.zaval.lw.Layoutablepublic void update(java.awt.Graphics g)
Drawablepaint method and it is performed with
repaint method. The method can be used to fill the drawable
component with the background color if the component is opaque.update in interface Drawableupdate in class java.awt.Containerorg.zaval.lw.Drawableg - the specified context to be used for updating.public void paint(java.awt.Graphics g)
Drawablepaint in interface Drawablepaint in class java.awt.Containerorg.zaval.lw.Drawableg - the graphics context to be used for painting.public void paintOnTop(java.awt.Graphics g)
LwContainerpaintOnTop in interface LwContainerorg.zaval.lw.LwContainerg - the graphics context.public LwLayer getRootLayer()
LwDesktopgetRootLayer in interface LwDesktoporg.zaval.lw.LwDesktoppublic LwLayer getLayer(java.lang.Object id)
LwDesktopgetLayer in interface LwDesktoporg.zaval.lw.LwDesktopid - by the specified id.public java.lang.Object[] getLayersIDs()
LwDesktopgetLayersIDs in interface LwDesktoporg.zaval.lw.LwDesktoppublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden in interface java.awt.event.ComponentListenerpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved in interface java.awt.event.ComponentListener
public void reshape(int x,
int y,
int w,
int h)
reshape in class java.awt.Componentpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenerpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown in interface java.awt.event.ComponentListenerpublic boolean isFocusTraversable()
isFocusTraversable in class java.awt.Componentpublic void setOpaque(boolean b)
false
argument value to make a transparent component from this component.
The method usage has not any effect, because the root component has to
be always opaque.setOpaque in interface Drawableb - the opaque flag.public java.awt.Point getOrigin()
DrawablegetOrigin in interface Drawableorg.zaval.lw.Drawablepublic java.awt.Point getLayoutOffset()
LayoutContainerx is offset for x-coordinates and y
is offset for y-coordinates. The ability to offset child components with a layout manager
is used with the library to organize scrolling.getLayoutOffset in interface LayoutContainerorg.zaval.lw.LayoutContainerpublic void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListener
public void componentAdded(java.lang.Object id,
Layoutable lw,
int index)
LwLayoutcomponentAdded in interface LwLayoutorg.zaval.lw.LwLayoutid - the layoutable component constraints.lw - the layoutable component that has been added.index - the child index.
public void componentRemoved(Layoutable lw,
int index)
LwLayoutcomponentRemoved in interface LwLayoutorg.zaval.lw.LwLayoutlw - the layoutable component that has been removed.index - the child component index.public java.awt.Dimension calcPreferredSize(LayoutContainer target)
LwLayoutcalcPreferredSize in interface LwLayoutorg.zaval.lw.LwLayouttarget - the layout container.public void layout(LayoutContainer target)
LwLayoutlayout in interface LwLayoutorg.zaval.lw.LwLayouttarget - the layout container that needs to be laid out.public java.lang.Object getProperty(int id)
LwDesktopgetProperty in interface LwDesktoporg.zaval.lw.LwDesktopid - the specified property id.
public void setProperty(int id,
java.lang.Object value)
LwDesktopsetProperty in interface LwDesktoporg.zaval.lw.LwDesktopid - the specified property id.value - the specified property value.public boolean canHaveFocus()
LwComponentcanHaveFocus in interface LwComponentorg.zaval.lw.LwComponenttrue if the component can have the focus.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||