: 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 LwGrid

java.lang.Object
  |
  +--org.zaval.lw.LwCanvas
        |
        +--org.zaval.lw.LwPanel
              |
              +--org.zaval.lw.grid.LwGrid
All Implemented Interfaces:
java.util.EventListener, Layoutable, LayoutContainer, LwChildrenListener, LwComponent, LwContainer, LwGridMetrics, LwKeyListener, LwLayout, LwMouseListener, MatrixListener, PosInfo, PosListener, ScrollObj, Validationable
Direct Known Subclasses:
LwTreeGrid

public class LwGrid
extends LwPanel
implements MatrixListener, ScrollObj, LwMouseListener, LwKeyListener, PosInfo, PosListener, LwLayout, LwGridMetrics, LwChildrenListener

This is lightweight grid component. The component is a composite component that is built basing on MVC-model:

  • Model. The component is bound with MatrixModel. Use the setModel and getModel methods to set and get the model.
  • View. The cell rendering process is defined by the special view provider interface. Use the setViewProvider and getViewProvider methods to customize it. Using the interface it is possible to define a background color for the specified cell, a view to render the cell data and horizontal and vertical alignments.
  • Controller. The grid component controls painting, event handling and validation processes.

The component supports cells editing and provides ability to customize editors set by the editor provider interface. Use the setEditorProvider and getEditorProvider methods to set and get the editor provider interface. Actually the interface defines two things:

  • A lightweight component that will be used to edit the specified cell data.
  • How to fetch the edited data from the editor component to update the grid model.

The grid component supports two metric types:

  • Custom metric. In this case the rows heights and columns widths can be defined by the setRowHeight and setColWidth methods, the painting process uses horizontal and vertical alignments (provided by the view provider interface) to align cells views.
  • Preferred size metric. In this case the rows heights and columns widths are calculated basing on the cells views preferred sizes. The setRowHeight and setColWidth methods have no effect. The painting process doesn't use horizontal and vertical alignments (provided by view a provider interface) to align cells views.
To set appropriate metric type use the usePsMetric method.

The component sets special layout manager that should not be changed. The layout manager defines TOP_CAPTION_EL constraint that can be used to add top grid caption component as follow:

   ...
   LwGrid        grid       = new LwGrid();
   LwGridCaption topCaption = new LwGridCaption(grid);
   grid.add (LwGrid.TOP_CAPTION_EL, topCaption);
   ...
 

The layout manager defines LEFT_CAPTION_EL constraint that can be used to add left grid caption component as follow:

   ...
   LwGrid        grid        = new LwGrid();
   LwGridCaption leftCaption = new LwGridCaption(grid, LwToolkit.VERTICAL);
   grid.add (LwGrid.LEFT_CAPTION_EL, leftCaption);
   ...
 

To control selection state use the PosController that can be got by the getPosController method. The component supports single row selection. It is possible to disable rows selection by the setting the pos controller to the null. Use the setPosController method for this purpose.

Use the setColor method to customize the selection marker and net lines color.

The component implements the ScrollObj interface, so the grid component can be used inside the LwScrollPan component.


Field Summary
protected  int[] colWidths
           
static int DEF_COLWIDTH
          The default column width.
static int DEF_ROWHEIGHT
          The default row height.
static int DRAW_HLINES
          Draw horizontal lines bit mask.
static int DRAW_VLINES
          Draw vertical lines bit mask.
protected  int dx
           
protected  int dy
           
static java.lang.Integer EDITOR_EL
          Cell editor component layout constraint.
static java.lang.Integer LEFT_CAPTION_EL
          Left caption component layout constraint.
static int NET_COLOR
          Defines the grid net lines color type.
protected  int psHeight_
           
protected  int psWidth_
           
protected  int[] rowHeights
           
static int SEL1_COLOR
          Defines the selection marker color type for the grid component that has the focus.
static int SEL2_COLOR
          Defines the selection marker color type for the grid component that doesn't have the focus.
static java.lang.Integer STUB_EL
          The stub component constraint.
static java.lang.Integer TOP_CAPTION_EL
          Top caption component layout constraint.
 
Fields inherited from class org.zaval.lw.LwPanel
children
 
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
LwGrid()
          Constructs the component with the default data model.
LwGrid(MatrixModel data)
          Constructs the component with the specified data model.
 
Method Summary
 java.awt.Dimension calcPreferredSize(LayoutContainer target)
          Calculates the preferred size dimension for the layout container.
 boolean canHaveFocus()
          Specifies if the component can have focus.
 java.awt.Point cellByLocation(int x, int y)
          Finds and returns grid cell row and column at the specified location.
 void cellModified(java.lang.Object target, int row, int col, java.lang.Object prevValue)
          Invoked when a cell of the matrix model has been updated.
 void childPerformed(LwVCLEvent e)
          Invoked whenever the child event has been performed.
protected  int colWidth(int col)
          Returns the specified column width.
 void componentAdded(java.lang.Object id, Layoutable lw, int index)
          Invoked when the specified layoutable component was added to the layout container (that uses the layout manager).
 void componentRemoved(Layoutable lw, int index)
          Invoked when the specified layoutable component was removed from the layout container, that uses the layout manager.
protected  java.lang.Object dataToPaint(int row, int col)
          Invoked whenever the component paints the specified cell to fetch data from the grid data model.
 java.awt.Insets getCellInsets()
          Gets the grid cells insets.
 CellsVisibility getCellsVisibility()
          Gets the grid visibility.
 java.awt.Color getColor(int type)
          Gets the color for the specified element.
 int getColPSWidth(int col)
          Gets the specified column preferred width.
 int getColWidth(int col)
          Gets the specified column width.
 int getColX(int col)
          Gets the x coordinate of the specified grid column.
protected  java.lang.Object getDataToEdit(int row, int col)
          Invoked whenever the component wants fetch data from the data model for the specified cell editing.
protected  LwLayout getDefaultLayout()
          Gets the default layout manager that is set with the container during initialization.
 int getGridCols()
          Gets the number of the grid columns.
 int getGridRows()
          Gets the number of the grid rows.
 LwComponent getLeftCaption()
          Gets the grid left caption component.
protected  int getLeftCaptionWidth()
          Gets the grid left caption component width.
 int getLines()
          Gets the number of lines.
 int getLineSize(int line)
          Gets the line size for the specified line number.
 int getMaxOffset()
          Gets the maximal offset.
 MatrixModel getModel()
          Gets the data model.
 int getNetGap()
          Gets the gap.
 int getNetMask()
          Gets the net mask.
 java.awt.Point getOrigin()
          Returns an origin of the component.
 PosController getPosController()
          Gets the position controller.
protected  int getPSSize(int rowcol, boolean b)
           
 int getRowHeight(int row)
          Gets the specified row height.
 int getRowPSHeight(int row)
          Gets the specified row preferred height.
 int getRowY(int row)
          Gets the y coordinate of the specified grid row.
 java.awt.Point getSOLocation()
          Gets the scroll object location.
 java.awt.Dimension getSOSize()
          Gets the scroll object size.
 LwComponent getTopCaption()
          Gets the grid top caption component.
protected  int getTopCaptionHeight()
          Gets the grid top caption component height.
 LwGridViewProvider getViewProvider()
          Gets the view provider.
 int getXOrigin()
          Returns an x origin of the grid component.
 int getYOrigin()
          Returns an y origin of the grid component.
protected  void iColVisibility(int off)
          Invalidates columns visibility properties.
 void invalidate()
          Invalidates this object.
protected  void iRowVisibility(int off)
          Invalidates rows visibility properties.
 boolean isInvalidatedByChild(LwComponent c)
          Invoked by a child component whenever the child invalidates itself.
 boolean isUsePsMetric()
          Tests if the grid uses preferred size to set columns widths and rows heights.
 void keyPressed(LwKeyEvent e)
          Invoked when a key has been pressed.
 void keyReleased(LwKeyEvent e)
          Invoked when a key has been released.
 void keyTyped(LwKeyEvent e)
          Invoked when a key has been typed.
protected  void laidout()
          Invoked whenever the container layouting procedure has been finished.
 void layout(LayoutContainer target)
          Lays out the child layoutable components inside the layout container.
 void matrixResized(java.lang.Object target, int prevRows, int prevCols)
          Invoked when a dimension of the matrix model (number of rows or number of columns) has been changed.
 void mouseClicked(LwMouseEvent e)
          Invoked when the mouse button has been clicked on a light weight component.
 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 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.
 boolean moveContent()
          Tests if the scrolled component performs scrolling by changing its location or moving view.
protected  int pageSize(int d)
          Returns the page size for the specified direction.
 void paint(java.awt.Graphics g)
          Paints this component.
protected  void paintData(java.awt.Graphics g)
          Paints the grid cells.
protected  void paintMarker(java.awt.Graphics g)
          Paints the grid marker.
protected  void paintNet(java.awt.Graphics g)
          Paints the grid lines.
 void paintOnTop(java.awt.Graphics g)
          Paints additional elements (for example marker) after the container and its child components have been rendered.
 void posChanged(java.lang.Object target, int prevOffset, int prevLine, int prevCol)
          Invoked when a virtual position has been changed.
protected  void rCustomMetric()
          Invoked by vMetric method to calculate custom metric type.
protected  void recalc()
          Invoked with validate method only if the component is not valid.
protected  int rowHeight(int row)
          Returns the specified row height.
protected  void rPsMetric()
          Invoked by vMetric method to calculate preferred size metric type.
 void setCellInsets(int t, int l, int b, int r)
          Sets the grid cells insets.
 void setColor(int type, java.awt.Color c)
          Sets the specified color to render the given element.
 void setColWidth(int col, int w)
          Sets the specified width for the given column.
protected  void setEditedData(int row, int col, java.lang.Object value)
          Invoked whenever the component wants applies the edited value (for the specified cell) to the grid data model.
 void setEditorProvider(LwEditorProvider p)
          Sets the editor provider.
 void setModel(MatrixModel d)
          Sets the data model.
 void setNetMask(int mask)
          Sets the specified net mask.
 void setPosController(PosController p)
          Sets the position controller.
 void setRowHeight(int row, int h)
          Sets the specified height for the given row.
 void setScrollMan(ScrollMan m)
          Sets the specified scroll manager for the scroll object.
 void setSOLocation(int x, int y)
          Sets the specified scroll object location.
 void setViewProvider(LwGridViewProvider p)
          Sets the view provider.
 void startEditing(int row, int col)
          Starts editing of the specified grid cell.
 void stopEditing(boolean applyData)
          Stops the cell editing.
 void usePsMetric(boolean b)
          Sets the specified grid metric type.
 
Methods inherited from class org.zaval.lw.LwPanel
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, getPreferredSize, indexOf, insert, insert, remove, remove, removeAll, setBackground, setLwLayout, setOpaque, setSize, toFront, updateCashedPs, validate
 
Methods inherited from class org.zaval.lw.LwCanvas
calcInsets, customize, cvp, getBackground, getBottom, getBounds, getHeight, getInsets, getLeft, getLocation, getLwParent, getPSImpl, getRight, getSize, getTop, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isValid, isVisible, repaint, repaint, repaint, requestFocus, setEnabled, setInsets, setLocation, setLwParent, setPSSize, setViewMan, setVisible, update, viewManChanged, vrp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zaval.lw.LwComponent
getBackground, getLwParent, getViewMan, getVisiblePart, isEnabled, isOpaque, repaint, repaint, repaint, setEnabled, setInsets, setLwParent, setViewMan, setVisible, update
 
Methods inherited from interface org.zaval.lw.Layoutable
getBounds, getHeight, getInsets, getLocation, getSize, getWidth, getX, getY, isVisible, setLocation
 
Methods inherited from interface org.zaval.util.Validationable
isValid
 

Field Detail

TOP_CAPTION_EL

public static final java.lang.Integer TOP_CAPTION_EL
Top caption component layout constraint.

EDITOR_EL

public static final java.lang.Integer EDITOR_EL
Cell editor component layout constraint.

LEFT_CAPTION_EL

public static final java.lang.Integer LEFT_CAPTION_EL
Left caption component layout constraint.

STUB_EL

public static final java.lang.Integer STUB_EL
The stub component constraint.

DRAW_HLINES

public static final int DRAW_HLINES
Draw horizontal lines bit mask.

DRAW_VLINES

public static final int DRAW_VLINES
Draw vertical lines bit mask.

DEF_COLWIDTH

public static final int DEF_COLWIDTH
The default column width.

DEF_ROWHEIGHT

public static final int DEF_ROWHEIGHT
The default row height.

SEL1_COLOR

public static final int SEL1_COLOR
Defines the selection marker color type for the grid component that has the focus.

SEL2_COLOR

public static final int SEL2_COLOR
Defines the selection marker color type for the grid component that doesn't have the focus.

NET_COLOR

public static final int NET_COLOR
Defines the grid net lines color type.

colWidths

protected int[] colWidths

rowHeights

protected int[] rowHeights

dx

protected int dx

dy

protected int dy

psWidth_

protected int psWidth_

psHeight_

protected int psHeight_
Constructor Detail

LwGrid

public LwGrid()
Constructs the component with the default data model.

LwGrid

public LwGrid(MatrixModel data)
Constructs the component with the specified data model.
Parameters:
data - the specified data model
Method Detail

canHaveFocus

public boolean canHaveFocus()
Description copied from interface: LwComponent
Specifies if the component can have focus.
Overrides:
canHaveFocus in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Returns:
true if the component can have the focus.

setEditorProvider

public void setEditorProvider(LwEditorProvider p)
Sets the editor provider. The provider is used to define how the specified cell should be edited.
Parameters:
p - the specified editor provider.

getNetMask

public int getNetMask()
Gets the net mask.
Returns:
a net mask.

setNetMask

public void setNetMask(int mask)
Sets the specified net mask. The net mask is a bit mask that defines what grid lines should be painted. There are four ways to paint grid lines:
  • To paint only horizontal lines. Use DRAW_HLINES bit mask.
  • To paint only vertical lines. Use DRAW_VLINES bit mask.
  • To paint vertical and horizontal lines. Use DRAW_VLINES | DRAW_HLINES bit mask.
  • To paint no lines. Use zero bits mask.
The default net mask is DRAW_VLINES | DRAW_HLINES.
Parameters:
mask - the specified net mask.

usePsMetric

public void usePsMetric(boolean b)
Sets the specified grid metric type. There are two metric types:
  • Preferred size metric type.
  • Custom metric type.
The default metric type is custom metric type.
Parameters:
b - use true to set preferred size metric type; false to set custom metric type.

isUsePsMetric

public boolean isUsePsMetric()
Tests if the grid uses preferred size to set columns widths and rows heights.
Specified by:
isUsePsMetric in interface LwGridMetrics
Returns:
true if the grid uses preferred size to set columns widths and rows heights.

getPosController

public PosController getPosController()
Gets the position controller.
Returns:
a position controller.

setPosController

public void setPosController(PosController p)
Sets the position controller. The controller can be set to null, in this case it will be impossible to navigate over the grid component rows.
Parameters:
p - the specified position controller.

getModel

public MatrixModel getModel()
Gets the data model.
Returns:
a data model.

getViewProvider

public LwGridViewProvider getViewProvider()
Gets the view provider.
Returns:
a view provider.

setViewProvider

public void setViewProvider(LwGridViewProvider p)
Sets the view provider.
Parameters:
p - the view provider.

setModel

public void setModel(MatrixModel d)
Sets the data model.
Parameters:
d - the data model.

setColor

public void setColor(int type,
                     java.awt.Color c)
Sets the specified color to render the given element. Use the SEL1_COLOR, SEL2_COLOR or NET_COLOR constant as the type value.
Parameters:
type - the specified element type.
c - the specified color.

getColor

public java.awt.Color getColor(int type)
Gets the color for the specified element.
Parameters:
type - the specified element type.
Returns:
a color.

getCellInsets

public java.awt.Insets getCellInsets()
Gets the grid cells insets. The insets specifies the top, left, bottom and right indents.
Specified by:
getCellInsets in interface LwGridMetrics
Returns:
a grid cells insets.

setCellInsets

public void setCellInsets(int t,
                          int l,
                          int b,
                          int r)
Sets the grid cells insets.
Parameters:
t - the top cell indent.
l - the left cell indent.
b - the bottom cell indent.
r - the right cell indent.

matrixResized

public void matrixResized(java.lang.Object target,
                          int prevRows,
                          int prevCols)
Description copied from interface: MatrixListener
Invoked when a dimension of the matrix model (number of rows or number of columns) has been changed.
Specified by:
matrixResized in interface MatrixListener
Following copied from interface: org.zaval.data.event.MatrixListener
Parameters:
target - the target matrix model.
prevRows - the previous number of rows that the matrix model had before.
prevCols - the previous number of columns that the matrix model had before.

cellModified

public void cellModified(java.lang.Object target,
                         int row,
                         int col,
                         java.lang.Object prevValue)
Description copied from interface: MatrixListener
Invoked when a cell of the matrix model has been updated.
Specified by:
cellModified in interface MatrixListener
Following copied from interface: org.zaval.data.event.MatrixListener
Parameters:
target - the target matrix model.
row - the row of the matrix model cell that has been updated.
col - the column of the matrix model cell that has been updated.
prevValue - the previous value of the modified cell.

paint

public void paint(java.awt.Graphics g)
Description copied from interface: LwComponent
Paints this component.
Overrides:
paint in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Parameters:
g - the graphics context to be used for painting.

paintOnTop

public void paintOnTop(java.awt.Graphics g)
Description copied from interface: LwContainer
Paints additional elements (for example marker) after the container and its child components have been rendered.
Overrides:
paintOnTop in class LwPanel
Following copied from interface: org.zaval.lw.LwContainer
Parameters:
g - the graphics context.

laidout

protected void laidout()
Description copied from class: LwPanel
Invoked whenever the container layouting procedure has been finished.
Overrides:
laidout in class LwPanel

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

invalidate

public void invalidate()
Description copied from interface: Validationable
Invalidates this object.
Overrides:
invalidate in class LwPanel

setRowHeight

public void setRowHeight(int row,
                         int h)
Description copied from interface: LwGridMetrics
Sets the specified height for the given row.
Specified by:
setRowHeight in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
row - the specified row.
h - the specified height.

isInvalidatedByChild

public boolean isInvalidatedByChild(LwComponent c)
Description copied from interface: LwContainer
Invoked by a child component whenever the child invalidates itself. Usually a child component invalidate its parent. The method provides ability to control container invalidation by the specified child component. The child asks the container if it should be invalidated by the calling the method.
Overrides:
isInvalidatedByChild in class LwPanel
Following copied from interface: org.zaval.lw.LwContainer
Parameters:
c - the child component that wants to invalidate the container.
Returns:
true if the container should be invalidated by the child component; false otherwise.

setColWidth

public void setColWidth(int col,
                        int w)
Description copied from interface: LwGridMetrics
Sets the specified width for the given column.
Specified by:
setColWidth in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
col - the specified column.
w - the specified width.

getOrigin

public java.awt.Point getOrigin()
Description copied from interface: LwComponent
Returns an origin of the component. The origin defines an offset of the component view relatively the component point of origin. The method can be implemented to organize scrolling of the component view.
Overrides:
getOrigin in class LwCanvas
Following copied from interface: org.zaval.lw.LwComponent
Returns:
an origin of the component.

getSOLocation

public java.awt.Point getSOLocation()
Description copied from interface: ScrollObj
Gets the scroll object location.
Specified by:
getSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object location.

setSOLocation

public void setSOLocation(int x,
                          int y)
Description copied from interface: ScrollObj
Sets the specified scroll object location. The method defines a mechanism that will be used to scrool the object.
Specified by:
setSOLocation in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
x - the specified x coordinate.
y - the specified y coordinate.

getSOSize

public java.awt.Dimension getSOSize()
Description copied from interface: ScrollObj
Gets the scroll object size. The size is a size that the scroll object wants to have.
Specified by:
getSOSize in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
a scroll object size.

moveContent

public boolean moveContent()
Description copied from interface: ScrollObj
Tests if the scrolled component performs scrolling by changing its location or moving view.
Specified by:
moveContent in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Returns:
true if the scroll component organizes scrolling by moving its view; otherwise false.

setScrollMan

public void setScrollMan(ScrollMan m)
Description copied from interface: ScrollObj
Sets the specified scroll manager for the scroll object. The manager reference should be stored and used by the scrolled object to move itself inside the scrolled area.
Specified by:
setScrollMan in interface ScrollObj
Following copied from interface: org.zaval.misc.ScrollObj
Parameters:
m - the specified scroll manager.

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.

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.

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.

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.

getLines

public int getLines()
Description copied from interface: PosInfo
Gets the number of lines.
Specified by:
getLines in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Returns:
a number of lines.

getLineSize

public int getLineSize(int line)
Description copied from interface: PosInfo
Gets the line size for the specified line number.
Specified by:
getLineSize in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Parameters:
line - the specified line number.
Returns:
a size of the line.

getMaxOffset

public int getMaxOffset()
Description copied from interface: PosInfo
Gets the maximal offset. The method can return -1 as the result, in this case the pos controller that uses the pos info will try to calculate the maximal offset itself basing on the line number and the lines sizes.
Specified by:
getMaxOffset in interface PosInfo
Following copied from interface: org.zaval.misc.PosInfo
Returns:
a maximal offset.

posChanged

public void posChanged(java.lang.Object target,
                       int prevOffset,
                       int prevLine,
                       int prevCol)
Description copied from interface: PosListener
Invoked when a virtual position has been changed.
Specified by:
posChanged in interface PosListener
Following copied from interface: org.zaval.misc.event.PosListener
Parameters:
target - the specified pos controller.
prevOffset - the previous offset.
prevLine - the previous line.
prevColumn - the previous column.

keyPressed

public void keyPressed(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been pressed.
Specified by:
keyPressed in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

keyReleased

public void keyReleased(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been released.
Specified by:
keyReleased in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

keyTyped

public void keyTyped(LwKeyEvent e)
Description copied from interface: LwKeyListener
Invoked when a key has been typed.
Specified by:
keyTyped in interface LwKeyListener
Following copied from interface: org.zaval.lw.event.LwKeyListener
Parameters:
e - the specified key event.

layout

public void layout(LayoutContainer target)
Description copied from interface: LwLayout
Lays out the child layoutable components inside the layout container.
Specified by:
layout in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
target - the layout container.

componentAdded

public void componentAdded(java.lang.Object id,
                           Layoutable lw,
                           int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component was added to the layout container (that uses the layout manager). The specified constraints, layoutable component and child index are passed as arguments into the method.
Specified by:
componentAdded in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
id - the layoutable component constraints.
lw - the layoutable component that has been added.
index - the child index.

componentRemoved

public void componentRemoved(Layoutable lw,
                             int index)
Description copied from interface: LwLayout
Invoked when the specified layoutable component was removed from the layout container, that uses the layout manager.
Specified by:
componentRemoved in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
lw - the layoutable component that has been removed.
index - the child component index.

calcPreferredSize

public java.awt.Dimension calcPreferredSize(LayoutContainer target)
Description copied from interface: LwLayout
Calculates the preferred size dimension for the layout container. The method has to calculate "pure" preferred size, it means that container insets should not be taken into account.
Specified by:
calcPreferredSize in interface LwLayout
Following copied from interface: org.zaval.lw.LwLayout
Parameters:
target - the layout container.
Returns:
a "pure" preferred size.

getGridRows

public int getGridRows()
Description copied from interface: LwGridMetrics
Gets the number of the grid rows.
Specified by:
getGridRows in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
a number of the grid rows.

getGridCols

public int getGridCols()
Description copied from interface: LwGridMetrics
Gets the number of the grid columns.
Specified by:
getGridCols in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
a number of the grid columns.

getRowHeight

public int getRowHeight(int row)
Description copied from interface: LwGridMetrics
Gets the specified row height.
Specified by:
getRowHeight in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
row - the specified grid row.
Returns:
a height of the specified row.

getColWidth

public int getColWidth(int col)
Description copied from interface: LwGridMetrics
Gets the specified column width.
Specified by:
getColWidth in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
col - the specified grid column.
Returns:
a width of the specified column.

getCellsVisibility

public CellsVisibility getCellsVisibility()
Description copied from interface: LwGridMetrics
Gets the grid visibility.
Specified by:
getCellsVisibility in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
a grid visibility.

getNetGap

public int getNetGap()
Description copied from interface: LwGridMetrics
Gets the gap. The gap defines size of area that is used to paint horizontal and vertical grid lines.
Specified by:
getNetGap in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
a gap.

getColX

public int getColX(int col)
Description copied from interface: LwGridMetrics
Gets the x coordinate of the specified grid column.
Specified by:
getColX in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
col - the specified column.
Returns:
a x coordinate of the specified grid column.

getRowY

public int getRowY(int row)
Description copied from interface: LwGridMetrics
Gets the y coordinate of the specified grid row.
Specified by:
getRowY in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
row - the specified row.
Returns:
an y coordinate of the specified grid row.

childPerformed

public void childPerformed(LwVCLEvent e)
Description copied from interface: LwChildrenListener
Invoked whenever the child event has been performed.
Specified by:
childPerformed in interface LwChildrenListener
Following copied from interface: org.zaval.lw.event.LwChildrenListener
Parameters:
e - the child event.

startEditing

public void startEditing(int row,
                         int col)
Starts editing of the specified grid cell. The method initiates editing process if the editor provider has been defined for the grid component and the editor component exists.
Parameters:
row - the specified cell row.
col - the specified cell column.

stopEditing

public void stopEditing(boolean applyData)
Stops the cell editing. The method has effect if the editing process has been initiated before.
Parameters:
applyData - use true value if the edited data should be applied to data model, use false otherwise.

getTopCaption

public LwComponent getTopCaption()
Gets the grid top caption component.
Returns:
a grid top caption component.

getLeftCaption

public LwComponent getLeftCaption()
Gets the grid left caption component.
Returns:
a grid left caption component.

getXOrigin

public int getXOrigin()
Description copied from interface: LwGridMetrics
Returns an x origin of the grid component. The origin defines an offset of the component view relatively the component point of origin.
Specified by:
getXOrigin in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
an origin of the component.

getYOrigin

public int getYOrigin()
Description copied from interface: LwGridMetrics
Returns an y origin of the grid component. The origin defines an offset of the component view relatively the component point of origin.
Specified by:
getYOrigin in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Returns:
an origin of the component.

getColPSWidth

public int getColPSWidth(int col)
Description copied from interface: LwGridMetrics
Gets the specified column preferred width.
Specified by:
getColPSWidth in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
col - the specified grid column.
Returns:
a preferred width of the specified column.

getRowPSHeight

public int getRowPSHeight(int row)
Description copied from interface: LwGridMetrics
Gets the specified row preferred height.
Specified by:
getRowPSHeight in interface LwGridMetrics
Following copied from interface: org.zaval.lw.grid.LwGridMetrics
Parameters:
row - the specified grid row.
Returns:
a preferred height of the specified row.

colWidth

protected int colWidth(int col)
Returns the specified column width. The method is used by all other methods (except recalculation) to get the actual column width.
Parameters:
col - the specified column.
Returns:
the specified column width.

rowHeight

protected int rowHeight(int row)
Returns the specified row height. The method is used by all other methods (except recalculation) to get the actual row height.
Parameters:
row - the specified row.
Returns:
the specified row height.

getDataToEdit

protected java.lang.Object getDataToEdit(int row,
                                         int col)
Invoked whenever the component wants fetch data from the data model for the specified cell editing.
Parameters:
row - the specified row.
col - the specified column.
Returns:
data model value to edit.

setEditedData

protected void setEditedData(int row,
                             int col,
                             java.lang.Object value)
Invoked whenever the component wants applies the edited value (for the specified cell) to the grid data model.
Parameters:
row - the specified row.
col - the specified column.
value - the specified edited value.

dataToPaint

protected java.lang.Object dataToPaint(int row,
                                       int col)
Invoked whenever the component paints the specified cell to fetch data from the grid data model.
Parameters:
row - the specified row.
col - the specified column.
Returns:
data to be painted.

paintNet

protected void paintNet(java.awt.Graphics g)
Paints the grid lines.
Parameters:
g - the specified graphics context.

paintData

protected void paintData(java.awt.Graphics g)
Paints the grid cells.
Parameters:
g - the specified graphics context.

paintMarker

protected void paintMarker(java.awt.Graphics g)
Paints the grid marker.
Parameters:
g - the specified graphics context.

getDefaultLayout

protected LwLayout getDefaultLayout()
Description copied from class: LwPanel
Gets the default layout manager that is set with the container during initialization. This implementation of the method returns LwRastLayout as the default layout manager, the layout manager is got as a static object by "def.lay" key.
Overrides:
getDefaultLayout in class LwPanel
Following copied from class: org.zaval.lw.LwPanel
Returns:
a layout manager.

cellByLocation

public java.awt.Point cellByLocation(int x,
                                     int y)
Finds and returns grid cell row and column at the specified location. The result is presented with java.awt.Point class where x field corresponds to row and y field corresponds to column.
Parameters:
x - the specified x coordinate.
y - the specified y coordinate.
Returns:
a cell at the specified location.

rPsMetric

protected void rPsMetric()
Invoked by vMetric method to calculate preferred size metric type.

getPSSize

protected int getPSSize(int rowcol,
                        boolean b)

rCustomMetric

protected void rCustomMetric()
Invoked by vMetric method to calculate custom metric type.

pageSize

protected int pageSize(int d)
Returns the page size for the specified direction.
Parameters:
d - the specified direction. Use -1 value to specify bottom-up direction and 1 value to specify up-bottom direction.
Returns:
a page size.

iColVisibility

protected void iColVisibility(int off)
Invalidates columns visibility properties.

iRowVisibility

protected void iRowVisibility(int off)
Invalidates rows visibility properties.

getTopCaptionHeight

protected int getTopCaptionHeight()
Gets the grid top caption component height.
Returns:
a grid top caption component height.

getLeftCaptionWidth

protected int getLeftCaptionWidth()
Gets the grid left caption component width.
Returns:
a grid left caption component width.


: up