: Download: FAQ: Licensing: Support: Contact ME
LwVCL Home
Introduction
Overview
Screen Shots
On-line Demos
Requirements
Further Plans
Docs
Tutorial
How-to (PDF)
API
FAQ
Download
Latest version

Home > J2SE > API

Overview  Package   Class  Tree  Deprecated  Index  Help 

org.zaval.lw.grid
Class LwGridCaption

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.grid.LwGridCaption
All Implemented Interfaces:
Cursorable, java.util.EventListener, Layoutable, LwComponent, LwMouseListener, LwMouseMotionListener, Validationable

public class LwGridCaption
extends LwCanvas
implements LwMouseMotionListener, LwMouseListener, Cursorable

This component is supposed to be used as the top or left grid caption component. The list below describes basic features of the component:

  • Use the putTitle method to set a caption title for an appropriate column or row. It is possible to specify a string or any view as the row or column title content. So it is easy to customize the caption view. For example if you need to have an image as the caption title content use the following code:
         ...
         LwGridCaption caption = new LwGridCaption(gridMetric);
         // set an image as the caption title content
         caption.putTitle (0, new LwImgRender("/imgs/captionImg.gif", LwView.ORIGINAL));
         ...
         
  • Use the setTitleProps method to customize the caption title view alignments and the caption title background color.
  • Use the setBorderView method to customize the caption border view.
  • It is possible to change size of the grid columns or rows using mouse. Use the setFlagState method to allow or disable columns or rows resizing.
  • It is possible to enable the grid columns or rows auto sizing according to its preferred sizes. The auto-sizing is initiated by the mouse double clicking inside the resize area. Use the setFlagState method for the purpose.


Field Summary
static int AUTOFIT
          The column and row auto size flag.
static int RESIZE
          The column and row resize flag.
 
Fields inherited from class org.zaval.lw.LwCanvas
bits, bottom, height, isValidValue, left, parent, psHeight, psWidth, right, skins, temporary, top, width, x, y
 
Constructor Summary
LwGridCaption(LwGridMetrics m)
          Constructs the object with the specified grid metrics.
LwGridCaption(LwGridMetrics m, int o)
          Constructs the object with the specified grid metrics and the given orientation.
 
Method Summary
 void addCaptionListener(LwActionListener l)
          Adds the specified caption listener.
protected  java.awt.Dimension calcPreferredSize()
          Gets the "pure" preferred size for this component.
 void endDragged(LwMouseEvent e)
          Invoked when the mouse ends dragged.
 int getCaptionAt(int x, int y)
          Gets the title row or column (depending on the caption orientation) at the specified location.
 int getCursorType(LwComponent target, int x, int y)
          Gets the cursor type for the specified location of the given component.
 boolean getFlagState(int flag)
          Gets the specified flag state.
 java.lang.Object getTitle(int rowcol)
          Gets the title value for the specified column or row (depending on the orientation property).
 void mouseClicked(LwMouseEvent e)
          Invoked when the mouse button has been clicked on a light weight component.
 void mouseDragged(LwMouseEvent e)
          Invoked when a mouse button is pressed on a component and then dragged.
 void mouseEntered(LwMouseEvent e)
          Invoked when the mouse enters a light weight component.
 void mouseExited(LwMouseEvent e)
          Invoked when the mouse exits a light weight component.
 void mouseMoved(LwMouseEvent e)
          Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down).
 void mousePressed(LwMouseEvent e)
          Invoked when the mouse button has been pressed on a light weight component.
 void mouseReleased(LwMouseEvent e)
          Invoked when the mouse button has been released on a light weight component.
 void paint(java.awt.Graphics g)
          Paints this component.
 void putTitle(int rowcol, java.lang.Object title)
          Sets the given title value for the specified column or row (depending on the caption orientation).
protected  void recalc()
          Invoked with validate method only if the component is not valid.
 void removeCaptionListener(LwActionListener l)
          Removes the specified caption listener.
 void setBorderView(LwView v)
          Sets the specified view to render the caption border.
 void setFlagState(int flag, boolean state)
          Sets the flag state.
 void setTitleProps(int rowcol, int ax, int ay, java.awt.Color bg)
          Sets the specified title properties.
 void startDragged(LwMouseEvent e)
          Invoked when the mouse starts dragged.
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, canHaveFocus, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwComponentAt, getLwParent, getOrigin, getPreferredSize, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isOpaque, isValid, isVisible, repaint, repaint, repaint, requestFocus, setBackground, setEnabled, setInsets, setLocation, setLwParent, setOpaque, setPSSize, setSize, setViewMan, setVisible, update, validate, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTOFIT

public static final int AUTOFIT
The column and row auto size flag.

RESIZE

public static final int RESIZE
The column and row resize flag.
Constructor Detail

LwGridCaption

public LwGridCaption(LwGridMetrics m)
Constructs the object with the specified grid metrics.
Parameters:
m - the specified grid metrics.

LwGridCaption

public LwGridCaption(LwGridMetrics m,
                     int o)
Constructs the object with the specified grid metrics and the given orientation.
Parameters:
m - the specified grid metrics.
o - the specified caption orientation. It is possible to use one of the following constants as the argument value:
  • LwToolkit.HORIZONTAL
  • LwToolkit.VERTICAL
Method Detail

setBorderView

public void setBorderView(LwView v)
Sets the specified view to render the caption border.
Parameters:
v - the specified view .

getTitle

public java.lang.Object getTitle(int rowcol)
Gets the title value for the specified column or row (depending on the orientation property).
Parameters:
rowcol - the specified column or row.
Returns:
a title value.

setFlagState

public void setFlagState(int flag,
                         boolean state)
Sets the flag state. You can use one of the following flag types:
  • RESIZE. Using the flag type it is possible to enable the grid rows or columns resizing.
  • AUTOFIT. Using the flag type it is possible to enable the grid row or column auto-sizing according to its preferred size.
Parameters:
flag - the specified flag.
state - use true to enable set on the flag; otherwise false. otherwise.

getFlagState

public boolean getFlagState(int flag)
Gets the specified flag state. Use one of the following values to identify the flag.
  • RESIZE. The flag indicates if the column or row can be sized.
  • AUTOFIT. The flag indicates if the column or row can be auto-sized according to its preferred size.
Parameters:
flag - the specified flag.
Returns:
the flag state.

putTitle

public void putTitle(int rowcol,
                     java.lang.Object title)
Sets the given title value for the specified column or row (depending on the caption orientation). It is possible to use null value as the title value to clear the title. You can use a string or any view as the title content.
Parameters:
rowcol - the specified column or row.
title - the specified title value. Use a string value or any preferred view as the title content.

setTitleProps

public void setTitleProps(int rowcol,
                          int ax,
                          int ay,
                          java.awt.Color bg)
Sets the specified title properties. The method allows setting the title vertical and horizontal alignments and the background color.
Parameters:
rowcol - the specified column or row.
ax - the specified horizontal alignment.
ay - the specified vertical alignment.
bg - the specified background color.

addCaptionListener

public void addCaptionListener(LwActionListener l)
Adds the specified caption listener.
Parameters:
l - the specified listener.

removeCaptionListener

public void removeCaptionListener(LwActionListener l)
Removes the specified caption listener.
Parameters:
l - the specified listener.

startDragged

public void startDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse starts dragged.
Specified by:
startDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

endDragged

public void endDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse ends dragged.
Specified by:
endDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mouseDragged

public void mouseDragged(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).
Specified by:
mouseDragged in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mouseMoved

public void mouseMoved(LwMouseEvent e)
Description copied from interface: LwMouseMotionListener
Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down).
Specified by:
mouseMoved in interface LwMouseMotionListener
Following copied from interface: org.zaval.lw.event.LwMouseMotionListener
Parameters:
e - the specified mouse event.

mousePressed

public void mousePressed(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been pressed on a light weight component.
Specified by:
mousePressed in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseEntered

public void mouseEntered(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse enters a light weight component.
Specified by:
mouseEntered in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseExited

public void mouseExited(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse exits a light weight component.
Specified by:
mouseExited in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseReleased

public void mouseReleased(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been released on a light weight component.
Specified by:
mouseReleased in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

mouseClicked

public void mouseClicked(LwMouseEvent e)
Description copied from interface: LwMouseListener
Invoked when the mouse button has been clicked on a light weight component.
Specified by:
mouseClicked in interface LwMouseListener
Following copied from interface: org.zaval.lw.event.LwMouseListener
Parameters:
e - the specified mouse event.

getCursorType

public int getCursorType(LwComponent target,
                         int x,
                         int y)
Description copied from interface: Cursorable
Gets the cursor type for the specified location of the given component. It is supposed to use set of cursors provided by java.awt.Cursor class.
Specified by:
getCursorType in interface Cursorable
Following copied from interface: org.zaval.lw.Cursorable
Parameters:
target - the given component.
x - the x coordinate of the location.
y - the y coordinate of the location.
Returns:
a cursor type.

paint

public void paint(java.awt.Graphics g)
Description copied from class: LwCanvas
Paints this component. You can use the method to define a face of the component
Overrides:
paint in class LwCanvas
Following copied from class: org.zaval.lw.LwCanvas
Parameters:
g - the graphics context to be used for painting.

getCaptionAt

public int getCaptionAt(int x,
                        int y)
Gets the title row or column (depending on the caption orientation) at the specified location.
Parameters:
x - the x coordinate.
y - the y coordinate.
Returns:
a title row or column.

recalc

protected void recalc()
Description copied from class: LwCanvas
Invoked with validate method only if the component is not valid. The method should be overridden to calculate metrical characteristics of the component to minimize computation time of the preferred size for the component. For example, you can calculate a preferred size inside the method and just return it by calcPreferredSize method.
Overrides:
recalc in class LwCanvas

calcPreferredSize

protected java.awt.Dimension calcPreferredSize()
Description copied from class: LwCanvas
Gets the "pure" preferred size for this component. The method should be overridden to define the component preferred size. Don't use insets to calculate the preferred size, the insets will be added with getPreferredSize method.
Overrides:
calcPreferredSize in class LwCanvas
Following copied from class: org.zaval.lw.LwCanvas
Returns:
a "pure" preferred size.


: up