org.zaval.lw
Interface LwComponent

All Superinterfaces:
Drawable, Layoutable, Validationable
All Known Subinterfaces:
LwComposite, LwContainer, LwDesktop, LwLayer
All Known Implementing Classes:
LwCanvas

public interface LwComponent
extends Drawable

This is basic interface for GUI components of the light weight library. Every GUI components of the library should implement the interface. Actually the interface is analog of java.awt.Component class that is provided with Java AWT library. The lightweight library provides an implementation of the interface - LwCanvas - that is more handly for usage. To create lightweight components just to inherit the class. The another variation of the interface is lightweight container interface - LwContainer. The interface extends the component interface and has implementation to create own lightweight containers - LwPanel.


Method Summary
 boolean canHaveFocus()
          Specifies if the component can have focus.
 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.
 LwComponent getLwParent()
          Gets the lightweight parent of this component.
 LwViewMan getViewMan(boolean autoCreate)
          Returns a view manager of the component.
 java.awt.Rectangle getVisiblePart()
          Returns the bounding rectangle of the visible part for the component.
 void setBackground(java.awt.Color c)
          Sets the background color of this component.
 void setEnabled(boolean b)
          Enables or disables this component.
 void setLwParent(LwComponent p)
          Sets the lightweight parent of this component.
 void setViewMan(LwViewMan man)
          Sets the specified view manager for the component.
 void setVisible(boolean b)
          Shows or hides this lightweight component depending on the value of parameter b.
 
Methods inherited from interface org.zaval.lw.Drawable
getBackground, getOrigin, isEnabled, isOpaque, paint, repaint, repaint, setOpaque, update
 
Methods inherited from interface org.zaval.util.Validationable
invalidate, isValid, validate
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getPreferredSize, getSize, getWidth, getX, getY, isVisible, setLocation, setSize
 

Method Detail

getVisiblePart

public java.awt.Rectangle getVisiblePart()
Returns the bounding rectangle of the visible part for the component.
Returns:
a visible part bounding rectangle.

getLwComponentAt

public 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.
Parameters:
x - the x coordinate.
y - the y coordinate.
Returns:
the component or subcomponent that contains the (x, y) location; null if the location is outside this component.

getLwParent

public LwComponent getLwParent()
Gets the lightweight parent of this component. It is supposed that the parent implements LwContainer interface.
Returns:
the parent container of this component.

setLwParent

public void setLwParent(LwComponent p)
Sets the lightweight parent of this component. It is supposed that the parent implements LwContainer interface. The method is provided for lightweight core usage to support components hierarchy, not for applications that base on the library. Don't touch the method.
Parameters:
p - the specified parent container.
Returns:
a parent component of this lightweight component.

setEnabled

public void setEnabled(boolean b)
Enables or disables this component. An enabled component can participate in events handling and performing processes. Component is enabled initially by default.
Parameters:
b - if the value is true - enables the component; otherwise disables this component.

setVisible

public void setVisible(boolean b)
Shows or hides this lightweight component depending on the value of parameter b.
Parameters:
b - if it is true, shows this component; otherwise, hides this component.

setBackground

public void setBackground(java.awt.Color c)
Sets the background color of this component. The color is going to be used to fill the component background.
Parameters:
c - the color to become this component background color.

getViewMan

public LwViewMan getViewMan(boolean autoCreate)
Returns a view manager of the component. The view manager can be null. 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.
Parameters:
autoCreate - the flag defines if the view manager should be created automatically.
Returns:
a view manager for the component.

setViewMan

public void setViewMan(LwViewMan man)
Sets the specified view manager for the component. The view manager defines set of views that are used as a part of the component face.
Parameters:
man - the view manager to set for the component.

canHaveFocus

public boolean canHaveFocus()
Specifies if the component can have focus.
Returns:
true if the component can have the focus.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org