JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.table
Class CellAreaHandler

java.lang.Object
  |
  +--com.klg.jclass.table.CellAreaHandler
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PrintCellAreaHandler

public class CellAreaHandler
extends Object
implements Serializable

CellAreaHandler controls the creation and removal of CellAreas within the table.

See Also:
Serialized Form

Field Summary
protected  Vector areas
           
protected  com.klg.jclass.table.CellArea cellArea
           
protected  com.klg.jclass.table.CellAreaRenderer cellAreaRenderer
           
protected  com.klg.jclass.table.TableCellInfoModel cellInfo
           
protected  Point cellOrigin
           
protected  Rectangle cellRect
           
protected  com.klg.jclass.table.CellArea columnLabelArea
           
protected  Rectangle columnLabelRect
           
protected  int drag_column
           
protected  int[] drag_columns
           
protected  int drag_row
           
protected  int[] drag_rows
           
protected  boolean DRAGGING
           
protected  int drop_column
           
protected  int drop_row
           
protected  com.klg.jclass.table.CellArea frozenCellArea
           
protected  com.klg.jclass.table.CellArea frozenColumnArea
           
protected  com.klg.jclass.table.CellArea frozenColumnLabelArea
           
protected  com.klg.jclass.table.CellArea frozenRowArea
           
protected  com.klg.jclass.table.CellArea frozenRowLabelArea
           
protected  boolean isStandardLayout
           
protected  com.klg.jclass.table.CellArea rowLabelArea
           
protected  Rectangle rowLabelRect
           
protected  com.klg.jclass.table.JCTable table
           
 
Constructor Summary
CellAreaHandler(com.klg.jclass.table.JCTable table)
          Creates a new controller for Areas.
 
Method Summary
protected  void cancelDrag()
          Resets drag variables when the drag process is cancelled.
protected  com.klg.jclass.table.CellArea contains(int x, int y)
          Returns the CellArea that contains the given coordintates.
 com.klg.jclass.table.CellArea createCellArea(int type)
          Creates a new CellArea of the specified type.
 void createRequiredCellAreas()
          Ensures that all required Areas exist.
protected  int determineThinSides(int row, int column)
          Determines whether additional sides are needed for the thin border of the specified cell.
protected  int determineThinSides(int row, int column, int end_row, int end_column)
          Determines whether additional sides are needed for the thin border of the specified cell.
protected  void endDrag()
          Resets drag variables at the end of the drag process.
 com.klg.jclass.table.CellArea find(int row, int column)
          Finds the Area by row/column
 com.klg.jclass.table.CellArea findByType(int type)
          Find the Area of the specified type
 Rectangle getBounds(int row, int column)
          Returns the bounds of the cell accounting for the position of the CellArea that manages the cell.
 Rectangle getBounds(int start_row, int start_column, int end_row, int end_column)
          Returns the bounds of a cell range.
 Rectangle getBounds(int row, int column, Rectangle r)
          Returns the bounds of the cell accounting for the position of the CellArea the manages the cell.
 com.klg.jclass.table.CellArea getCellArea()
          Returns the scrollable cell area.
 com.klg.jclass.table.CellAreaRenderer getCellAreaRenderer()
          Returns the AreaRenderer.
 Vector getCellAreas()
          Returns a Vector containing the areas of the table.
 Point getCellOrigin()
          Returns the scrollbar cell origin.
 int getColumn(int x, int y)
          Returns the column containing the given coordinates.
 Rectangle getDragBounds(int row, int column)
          Returns the bounds of a cell during a drag process.
 int getRow(int x, int y)
          Returns the row containing the given coordinates.
 com.klg.jclass.table.JCTable getTable()
          Returns the table controlled by the AreaHandler.
 com.klg.jclass.table.TableCellInfoModel getTableCellInfo()
          Returns the TableCellInfoModel object that acts as an intermediary between CellStyleModel objects and CellEditors/CellRenderers.
protected  int getTransposedX(int column, int drag_column, int drop_column)
          Gets the x position of a column during a column drag.
protected  int getTransposedY(int row, int drag_row, int drop_row)
          Gets the y position of a row during a row drag.
 com.klg.jclass.table.JCCellRange getVisibleCells()
          Returns the cell range of visible, scrollable cells.
 boolean isContentClipped(int row, int column)
          Returns true if the full content of the cell is not displayed because of the size of the cell.
 boolean isStandardLayout()
          Returns true if the table is in standard layout (label, frozen, cell)
protected  void performDrag(int drag_row, int drag_column, int drop_row, int drop_column)
          Remaps rows/columns during the drag process and forces appropriate cell repainting.
 void setAreaCellRange(com.klg.jclass.table.CellArea area)
          Sets the range of cells associated with the Area.
 void setCellOrigin(int x, int y)
          Sets the scrollable cell origin based on an x and y value.
 void setCellOrigin(Point p)
          Sets the scrollable cell orgin.
 void setCellOriginX(int x)
          Sets the x coordinate for the cell origin.
 void setCellOriginY(int y)
          Sets the y coordinate for the cell origin.
 void setStandardLayout(boolean value)
          Set true if table is in standard layout (label, frozen, cell)
 void setTableCellInfo(com.klg.jclass.table.TableCellInfoModel cellInfo)
          Sets the TableCellInfoModel object that acts as an intermediary between CellStyleModel objects and CellEditors/CellRenderers.
protected  int[] shiftArray(int[] array, int item1, int item2)
          Repositions a row or column to a new location in the mapped array.
protected  void updateCellArea(int type, boolean isNeeded)
          Update the CellArea to which the type refers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected com.klg.jclass.table.JCTable table

cellArea

protected com.klg.jclass.table.CellArea cellArea

frozenRowArea

protected com.klg.jclass.table.CellArea frozenRowArea

columnLabelArea

protected com.klg.jclass.table.CellArea columnLabelArea

frozenColumnArea

protected com.klg.jclass.table.CellArea frozenColumnArea

frozenCellArea

protected com.klg.jclass.table.CellArea frozenCellArea

frozenColumnLabelArea

protected com.klg.jclass.table.CellArea frozenColumnLabelArea

rowLabelArea

protected com.klg.jclass.table.CellArea rowLabelArea

frozenRowLabelArea

protected com.klg.jclass.table.CellArea frozenRowLabelArea

areas

protected Vector areas

cellAreaRenderer

protected com.klg.jclass.table.CellAreaRenderer cellAreaRenderer

cellInfo

protected com.klg.jclass.table.TableCellInfoModel cellInfo

cellOrigin

protected Point cellOrigin

isStandardLayout

protected boolean isStandardLayout

rowLabelRect

protected Rectangle rowLabelRect

columnLabelRect

protected Rectangle columnLabelRect

cellRect

protected Rectangle cellRect

DRAGGING

protected boolean DRAGGING

drag_row

protected int drag_row

drag_column

protected int drag_column

drop_row

protected int drop_row

drop_column

protected int drop_column

drag_columns

protected int[] drag_columns

drag_rows

protected int[] drag_rows
Constructor Detail

CellAreaHandler

public CellAreaHandler(com.klg.jclass.table.JCTable table)
Creates a new controller for Areas.

Method Detail

getCellAreaRenderer

public com.klg.jclass.table.CellAreaRenderer getCellAreaRenderer()
Returns the AreaRenderer.


getTable

public com.klg.jclass.table.JCTable getTable()
Returns the table controlled by the AreaHandler.


createCellArea

public com.klg.jclass.table.CellArea createCellArea(int type)
Creates a new CellArea of the specified type. Valid types are:

Only one CellArea can exist of any type. If one already exists, it is returned rather than creating a new one.


findByType

public com.klg.jclass.table.CellArea findByType(int type)
Find the Area of the specified type


find

public com.klg.jclass.table.CellArea find(int row,
                                          int column)
Finds the Area by row/column


getCellAreas

public Vector getCellAreas()
Returns a Vector containing the areas of the table.


updateCellArea

protected void updateCellArea(int type,
                              boolean isNeeded)
Update the CellArea to which the type refers. If the CellArea is needed, get it reading for viewing. Otherwise, make sure its removed from view.

Parameters:
type - The type of the CellArea to update.
isNeeded - Is the CellArea needed based on the current table paramters?

createRequiredCellAreas

public void createRequiredCellAreas()
Ensures that all required Areas exist.


setAreaCellRange

public void setAreaCellRange(com.klg.jclass.table.CellArea area)
Sets the range of cells associated with the Area. The range of cells associated with an Area is dependent on the existence of a cell in that area and not on whether the area is visible or the size of the cells that the area would contain.


getCellOrigin

public Point getCellOrigin()
Returns the scrollbar cell origin.


setCellOrigin

public void setCellOrigin(Point p)
Sets the scrollable cell orgin.


setCellOrigin

public void setCellOrigin(int x,
                          int y)
Sets the scrollable cell origin based on an x and y value.


setCellOriginX

public void setCellOriginX(int x)
Sets the x coordinate for the cell origin.


setCellOriginY

public void setCellOriginY(int y)
Sets the y coordinate for the cell origin.


isStandardLayout

public boolean isStandardLayout()
Returns true if the table is in standard layout (label, frozen, cell)


setStandardLayout

public void setStandardLayout(boolean value)
Set true if table is in standard layout (label, frozen, cell)


getTableCellInfo

public com.klg.jclass.table.TableCellInfoModel getTableCellInfo()
Returns the TableCellInfoModel object that acts as an intermediary between CellStyleModel objects and CellEditors/CellRenderers.


setTableCellInfo

public void setTableCellInfo(com.klg.jclass.table.TableCellInfoModel cellInfo)
Sets the TableCellInfoModel object that acts as an intermediary between CellStyleModel objects and CellEditors/CellRenderers.


getRow

public int getRow(int x,
                  int y)
Returns the row containing the given coordinates.


getColumn

public int getColumn(int x,
                     int y)
Returns the column containing the given coordinates.


contains

protected com.klg.jclass.table.CellArea contains(int x,
                                                 int y)
Returns the CellArea that contains the given coordintates.


getBounds

public Rectangle getBounds(int row,
                           int column)
Returns the bounds of the cell accounting for the position of the CellArea that manages the cell.


getBounds

public Rectangle getBounds(int row,
                           int column,
                           Rectangle r)
Returns the bounds of the cell accounting for the position of the CellArea the manages the cell. This method uses the given rectangle rather than creating a new one.


getBounds

public Rectangle getBounds(int start_row,
                           int start_column,
                           int end_row,
                           int end_column)
Returns the bounds of a cell range.


getDragBounds

public Rectangle getDragBounds(int row,
                               int column)
Returns the bounds of a cell during a drag process.


isContentClipped

public boolean isContentClipped(int row,
                                int column)
Returns true if the full content of the cell is not displayed because of the size of the cell.


getVisibleCells

public com.klg.jclass.table.JCCellRange getVisibleCells()
Returns the cell range of visible, scrollable cells.


performDrag

protected void performDrag(int drag_row,
                           int drag_column,
                           int drop_row,
                           int drop_column)
Remaps rows/columns during the drag process and forces appropriate cell repainting. This simulates the drag process without modifying the internal state of table. When the process is complete (on mouse release), the internal modifications are made through dragRow or dragColumn.


cancelDrag

protected void cancelDrag()
Resets drag variables when the drag process is cancelled.


endDrag

protected void endDrag()
Resets drag variables at the end of the drag process.


getTransposedY

protected int getTransposedY(int row,
                             int drag_row,
                             int drop_row)
Gets the y position of a row during a row drag.


getTransposedX

protected int getTransposedX(int column,
                             int drag_column,
                             int drop_column)
Gets the x position of a column during a column drag.


shiftArray

protected int[] shiftArray(int[] array,
                           int item1,
                           int item2)
Repositions a row or column to a new location in the mapped array.


getCellArea

public com.klg.jclass.table.CellArea getCellArea()
Returns the scrollable cell area.


determineThinSides

protected int determineThinSides(int row,
                                 int column)
Determines whether additional sides are needed for the thin border of the specified cell. (Thin borders traditionally draw just the top and the left but there are some cases where we need to draw the bottom and the right hand sides too.)

Parameters:
row - the cell's row
column - the cell's column
Returns:
integer containing flags JCCellBorder.BORDERSIDE_THIN_BOTTOM and JCCellBorder.BORDERSIDE_THIN_RIGHT if either of those are needed.

determineThinSides

protected int determineThinSides(int row,
                                 int column,
                                 int end_row,
                                 int end_column)
Determines whether additional sides are needed for the thin border of the specified cell. (Thin borders traditionally draw just the top and the left but there are some cases where we need to draw the bottom and the right hand sides too.)

Parameters:
row - the cell's row
column - the cell's column
end_row - the end row where we need bottom sides
end_column - the end column where we need right sides
Returns:
integer containing flags JCCellBorder.BORDERSIDE_THIN_BOTTOM and JCCellBorder.BORDERSIDE_THIN_RIGHT if either of those are needed.

Copyright © 2004 Quest Software Inc..
All rights reserved.