Welcome to the TreeTable applet
treetable applet v.1.23 ©1998-2004 Scand LLC http://scand.com
TreeTable applet is a lightweight AWT applet implementing both Tree and Table (Grid) structures. It was designed and compiled using JDK 1.1.3 so works in all browsers without any Java plugins needed (and works with plugins as well).
We have developed this applet to provide a possibility to use in web applications nice looking and full-featured GUI element combining tree and grid structures. Because it was assumed that applet should work in most environments, we used only AWT and JDK 1.1, not Swing nor JFC. This makes possible for the applet to work in IE, Netscape and Opera, under Windows and Unix/Linux without problems. You don't even need extra Java plugin if your browser supports java internally. The applet is very light (80kb compressed jar file) and has a lot of usefull features.
Here we provide a list of most interesting features of TreeTable applet. If you think this is not enough for you, we can add the features you need, please contact us info@scand.com. The applet is always in development process so this list could be not full!
you can use the applet in Grid mode, without tree structure
you can define font & colors for any cell independently
you can put images in cells
you can put hyperlinks in cells
you can edit cell content - with input field or combobox
you can disable cell editing for some column
you can validate cell value after editing via event handler
you can define popup menu and fill it dynamically at runtime
you can load items dynamically from server when you expand subnodes
you can save memory - when you collaps subitems the applet could unload them from memory and read again next time you expand the item
you can save applet state upon page reloadin
you can save applet state in a string variable and restore it next time when user comes to your page
you can change cell content at runtime using JavaScript - to make some calculations
you can refresh data for some row, some subtree or the whole applet - it will read data from the server
you have a lot of event handlers, like onclick, ondoubleclick, onselect, onedit etc.
you can hide the header line
you can control graphical elements like showing of grid lines, plus/minus signs, tree line styles etc.
you can use your own icons in tree
you can use checkboxes in rows to make it easier to select some rows
you can turn on/off row multiselection (holding ctrl-key down you can select multiple rows)
you can sort by any column or disable sorting for some column
you can define sort mode - numeric or string
you can change column position and width simply by dragging it
you can programmaticaly select any row,expand/collapse subitems etc.
you can add/delete rows programmatically
you can copy row content from one row to another
you have a lot of usefull API methods to control the applet at runtime
...
Note: Features marked with ** are available in commercial version only (not in evaluation).
new cell method: setEditType(int type) {1 inputbox|2 combobox}
new cell method: setCombo(String labels, String values)
labels,values - separated by grid delimiter
...
Update date: 30 January 2004
Description of parameters and interface functions
Table structure:
JTreeTable can have tree structure or not, depending on selected base class: JGridApplet (simple grid) or JTreeGridApplet (tree grid).
Table structure gets into applet from HTML document as enumeration of parameters describing every row.
For single row the next parameters must be specified:
Note: i indicates index of the row in the initialization list.
Should be sequential integers beginning from 0.
Column "Use" specifies parameters which can be used in tree grid applet only , not in simple grid.
Name | Use | Possible values | Description |
ITEMi required | any value, but should be unique among of all other values | Identifier of the row. Used in all script functions to allocate the row. | |
TEXTi required | all values except $ char
IMAGES: you can define image as a cell conten simply by specifying CHECKBOX: you can place a checkbox in any
cell by specifying <checkbox state='0|1'> at the beginning of cell's
value. After this tag you can put some text as in a usual cell. |
The values of all cells in the row separated with $$ like <PARAM NAME=TEXT3 VALUE="cell1$$cell2$$next cell$$the last cell"> IMAGES: CHECKBOX: |
|
ACTIONi required | Valid parameters for script function | List of parameters taken by script function specified in
EVAL parameter. Can be: 1. Integer value 2. String value in inverted single or double quotes 3. Collection of (1) and (2) separated by commas |
|
LEVELi required | tree grid | Integer | Level of current row. Defines tree structure of the table. Must be from 0 to LEVEL(i-1) + 1 |
LINKi | Valid URL or valid parameters for script function | If you've specified this parameter, cell text will appear as
a Hyperlink (underlined, hand-cursor) and react on user click. There are 2
types of Hyperlink defined - URL or JavaScript function. 1. URL - you turn this type on if LINK_FRAME parameter specified, so link should be a valid URL and onclick it will be opened in a frame LINK_FRAME. Do not use quotes. 2. JavaScript function - the name of the function you should specify in LINK_FUNC parameter, and link should be a valid set of function parameters. Can be: 1. Integer value 2. String value in inverted single or double quotes 3. Collection of (1) and (2) separated by commas Use - sign to set no link for the cell, you cannot just leave it empty <PARAM NAME=LINK1 VALUE="-$$http://scbr.com$$-$$-"> |
|
IM0i, IM1i | tree grid | Integer, or file name | Index of icon for the row in icon list (see ICON parameters) for Opened and Closed states respectively. |
BGCOLORi | Any applicable color values like #C1A388 | Specifies background color for each cell of the row, values
separated by $$ like <PARAM NAME=BGCOLOR3 VALUE="#ffffff$$#ccccff$$#ffffff$$#ffffff"> |
|
TEXTCOLORi | Any applicable color values like #ff0033 | Specifies foreground (text) color for each cell of the row,
values separated by $$ like <PARAM NAME=TEXTCOLOR3 VALUE="#000000$$#ff0000$$#00ff00$$#000000"> |
|
FONTi | Font values in formats: Name-style-size, Name-style,
Name-size, Name style: {bold,italic,bolditalic} [ex. Courier-bold-12] |
Specifies font for each cell of the row,
values separated by $$ like <PARAM NAME=FONT3 VALUE="-$$Courier-bold-22$$-$$-"> Use - sign to set default font, you cannot just leave it empty |
|
BOLDi | any value | Shows if row values should be selected with bold font | |
SELECTi | any value | Shows if the row is selected | |
CHILDi** | tree grid | {0,1} | For dynamic tree only: if specified, means than
the row has subnodes, which should be dynamically loaded from the server
using document specified in GET_DOC. If no
childen, you should NOT specify this parameter. <PARAM NAME=CHILD39 VALUE="1"> |
CHECKi | tree grid | {0,1} | Initializes checkbox state for this row: 0 - unchecked, 1 - checked. Works only if CHECKBOXES parameter is specified. |
USERDATAi | any value | You can store for each row any extra data using this parameter. To get this data you should use String getUserData(String rowID) method. | |
USERDATAXi | comma separated key='value' pairs | You can store for each row any extra data using
this parameter. To get this data you should use String getUserData(String rowID,String key) method. <PARAM NAME=USERDATAX3 VALUE="id='55',name='John'"> <PARAM NAME=USERDATAX7 VALUE="quote='55\'99'"> here used \' to include quote sign inside value |
|
HEIGHTi | integer | To define row height in pixels | |
BGIMAGEi | filename | To define cell background images | |
UNDERLINEi | {0,1} | To make cell text underline (1-true,0-false) | |
STRIKETHROUGHi | {0,1} | To make cell text strike through (1-true,0-false) |
Name |
Use |
Description |
Example |
DELIM | You can define your own values delimiter for item specific parameters (TEXTi,LINKi,FONTi etc.). Default is $. Should be one character. | <param name="DELIM" value="|"> | |
SEL_BGCOLOR | Color of the selected row background This color will be ORed with each cell background color. So #ffffff will make white cells be black when selected. |
<param name="SEL_BGCOLOR" value="#ffff00"> This will set blue background for the selected row. |
|
SEL_TEXTCOLOR | Color of the selected row text This color will be ORed with each cell text color. So #ffffff will make black text be white when selected, and blue one be yellow. |
<param name="SEL_TEXTCOLOR" value="#ffffff"> | |
HEADER | Labels for the header separated with $$ This parameter is required. |
||
HEADER_FONT | Sets font for the header | <PARAM NAME="HEADER_FONT" VALUE="Courier-bolditalic-16$$-$$-$$-"> | |
HEADER_TEXTCOLOR | Sets text color for the header | <PARAM NAME="HEADER_TEXTCOLOR" VALUE="#0000ef$$#000000$$#000000$$#000000"> | |
HEADER_BGCOLOR | Sets background color for the header | ||
HEADER_ALIGNS | Horizontal alignments of header (r-right, l-left, c-center). | <param name="HEADER_ALIGNS" value="r$$l$$c"> | |
NOHEADER | If specified, the applet will not show header row. | <param name="NOHEADER" value="1"> | |
SUPERHEADERi** | Use this parameter to define super-header. It is a multi-line header that will be placed above the normal header line. This param defines text labels for super-header line. Here i means super-line number, it is sequential integer begins from 0. | <param name="SUPERHEADER0" value="Book
Store Super Catalogue$ $ $ $"> <param name="SUPERHEADER_COLSPAN0" value="4$1$1$1"> <param name="SUPERHEADER1" value="Book Name$Book Details$ $ $"> <param name="SUPERHEADER_COLSPAN1" value="1$3$1$1"> <param name="SUPERHEADER_HORALIGNS1" value="r$l$ $ $"> <param name="SUPERHEADER_TEXTCOLOR1" value="#ff0000$-$-$-$"> <param name="SUPERHEADER_FONT1" value="-$courier-bold-14$-$-$"> <param name="SUPERHEADER_BGCOLOR1" value="#cceecc$#ccccff$#cccccc$#cccccc$"> |
|
SUPERHEADER_FONTi | Sets font for the super-header line i | ||
SUPERHEADER_TEXTCOLORi | Sets text color for the super- header line i | ||
SUPERHEADER_BGCOLORi | Sets background color for the super- header line i | ||
SUPERHEADER_HORALIGNSi | Horizontal alignments of the super- header line (r-right, l-left, c-center) | ||
SUPERHEADER_HEIGHTi | The height of the super- header line i | ||
SUPERHEADER_COLSPANi | Colspan for each cell of super- header line i. It means how many of the following cells will be merged with this one. | ||
HIDEHEADERSPACE | If specified, the free space on the right of the grid will be filled with bgcolor rather than header color | <param name="HIDEHEADERSPACE" value="1"> | |
HEADER_FLAT | If specified, the header will be drawn with flat border | <param name="HEADER_FLAT" value="1"> | |
JUSTIFY** | If specified, cell content will be wrapped | <param name="JUSTIFY" value="1"> | |
COLUMN_COUNT | Defines the number of columns in grid. Should be specified if you use NOHEADER or if you haven't specified HEADER param. Default value is 1. Can be greather than number of elements in HEADER param - in this case remaining headers set to empty string (""). |
<param name="COLUMN_COUNT" value="7"> | |
Specify the initial widths of cells in %. |
<param name="INITWIDTHS" value="50$$20$$30"> | ||
INITWIDTHS_PIX | Defines initial column widths in pixels.
Use $ separated integer values. Has higher priority than INITWIDTHS . |
<param name="INITWIDTHS_PIX" value="87$120$5$90"> | |
HOR_ALIGNS | Horizontal alignments of values in cells. Can only be set for all columns (r-right, l-left, c-center). | <param name="HOR_ALIGNS" value="r$$l$$c"> | |
NOSORT | Makes grid non sortable | ||
EDITABLE | Makes cells of the grid editable | ||
COLUMN_DRAGGABLE | If this parameter is specified, you can drag a column to any new place. Column index is not changed, only visual feature. | <param name="COLUMN_DRAGGABLE" value="1"> | |
MULTISELECT | If this parameter is specified, rows multiselect is enabled (with ctrl-key down). | <param name="MULTISELECT" value="1"> | |
NOROWSELECT | Specifies not to select a row when it is clicked. Usefull in conjunction with LINK_ parameters. | <param name="NOROWSELECT" value="1"> | |
DRAW_GRID | If specified, the applet will draw vertical and horizontal grid lines. | <param name="DRAW_GRID" value="1"> | |
TREELINES | tree grid | Specifies the style of tree lines: 0 - hidden, 1 - dotted, 2 - solid. | <param name="TREELINES" value="1"> |
NOCROSSES | tree grid | If specified, hides crosses and lines from treetable. | <param name="NOCROSSES" value="1"> |
AUTOBOLDCONTROL | tree grid | If it is specified, then the bold selection of item depends on selection of its children and on its status(opened or closed) | |
ICON | tree grid | Specified names of images for tree items. Has structure
ICON0, ICON1, ... ,ICONn.
This numbers can be placed to IM0 and IM1 parameters. If IM0 and IM1 is not
specified for the item, then ICONn parameters are interpreted as follows: |
|
ICONCHK0 | tree grid | Specifies the name of the image for checkbox state 0 (unchecked). | |
ICONCHK1 | tree grid | Specifies the name of the image for checkbox state 1 (checked). | |
SORT_UP, SORT_DOWN | Specify the images to display in header cells to show sort direction | ||
ONSTART | JS function to call when applet is being started by browser. This happens after applet initialization (all params was read) and each time when user reloads applet's frame. | ||
ONSTOP | JS function to call when applet is being stopped by browser. This happens before applet destroying and each time when user closes applet's frame (or loads another document into the frame). | ||
ONCLICK | The name of script function, which will be called when any item in grid is clicked. | Example 1: function f(s){} <PARAM name="EVAL" VALUE="f"> <PARAM name="ACTION0" VALUE="0"> // f(0) will be called <PARAM name="ACTION1" VALUE="'test'"> // f('test') will be called Example 2: |
|
ONDOUBLECLICK | The name of script function, which will be called when any item in grid is doubleclicked | ||
ONROWSELECT | JS function to call just before any
row becomes selected. The function receives 2 parameters: onrowselect(rowID,multi) where String rowID - this row becomes selected; boolean multi - flag showing if multiselect is requested (via ctrl - key down or by user request). |
<param name="ONROWSELECT"
value="onrowselect">
function onrowselect(rowID,multi) |
|
ONOPENNODE | tree grid | JS function to call when node is opened | |
ONCLOSENODE | tree grid | JS function to call when node is closed | |
ONEDITCELL | JS function to call each time before cell is being edited
(type==0), each time cell value was
changed (type==1) and just after editing when the cell is being leaved
(type==2). The function receives 3 parameters:
oneditcell(type,rowid,col) You can access combobox via applet's getCombo() method: Choice getCombo(); Object Choice returned by this method is a standard Java AWT object. You can use its methods add("item"), remove(), removeAll(), getSelectedItem() to manipulate with data. If you want to fill the combobox by yourself, not from applet's LISTi parameter (see example on the right), you have to set cell's comboFilled variable to true, otherwise combobox will be filled automatically. For type==2 you can test if the cell was really edited by calling method boolean wasChanged() of this cell. |
<param name="ONEDITCELL" value="oneditcell">
function oneditcell(type,rowid,col) |
|
ONGETDOC_ERROR** | tree grid | JS function to call if any error happened while reading data with GET_DOC. The function receives one string argument specifying the error message. |
<param name="ONGETDOC_ERROR" value="onerr">
function onerr(err_msg) |
GET_DOC** | tree grid | Makes the treetable dynamically loadable from
the web server, so when some item should be expanded, the applet will
request this file from the server passing row identifier (specified in ITEMi
parameter) as "id" parameter in GET-request. This file should give information about subnodes for the current row in the next format: row-id@cells-text@row-action@has-children@row-bgcolor@im0@im1 Values separated with @, newline character at the end of each new row. example: 211@Text1$$10$$22.7$$33@action1@1@#ffffcc@1@2 212@Text2$$30$$77.0$$90@action2@0@#ffffff@3@3 Parameters row-bgcolor, im0, im1 are optional and could be omitted. See detailed information in respective parameter description: row-id = ITEMi cells-text = TEXTi row-action = ACTION has-children = CHILDi {0 - means no children, 1 - means has children} row-bgcolor = BGCOLORi im0 = IM0i im1 = IM1i Extended format: |
<param
name="GET_DOC" value="1.txt">
File 1.txt should contain something like |
REQ_PARAM | String that contains additional parameters which will be passed to GET_DOC request after "id" parameter. Should be standard url encoded. | <param name="REQ_PARAM" value="code=18&box=600">
So get requast will look like: |
|
LINK_FUNC | The name of script function, which will be called when any Hyperlink in grid is clicked. Makes to use function call rather than follow a Hyperlink. Has higher priority than LINK_FRAME. | <param name="LINK_FUNC" value="showLink"> | |
LINK_FRAME | The name of the frame where to show Hyperlink document when any Hyperlink in grid is clicked. Makes to follow a Hyperlink rather than call the function. | <param name="LINK_FRAME" value="frMain"> | |
MENU_ITEMS | Initializes popup menu. Menu items separated
with $$. To insert menu separator use "-" as item text.
This menu will be used for the whole table. To create cell- or row-specific menu use MENU_INIT parameter instead. |
<param name="MENU_ITEMS" value="Open$$Close$$Edit$-$Print"> | |
MENU_INIT | The name of script function, which will be called
before menu showing to initialize menu depending on current row/cell. The
script function takes 2 parameters: initmenu(rowID,columnIndex),
where rowID is String, columnIndex - int. In this function you can call applet's method menu() to get access to PopupMenu object. Then use PopupMenu's methods to clear menu / removeAll() or add new item /add("Item text"). |
<param name="MENU_INIT" value="initmenu">
function initmenu(r,c) |
|
MENU_ACTION | The name of script function, which will be called when menu item is clicked. The script function takes 3 parameters: onmenu(itemText,rowID,columnIndex). Use this function to perform some action depending on selected menu item and current row/column. | <param name="MENU_ACTION" value="onmenu">
function onmenu(item,r,c) |
|
CHECKBOXES | tree grid | If it is specified, then tree items will contain checkboxes near the text label. Then user can check/uncheck them by mouse clicks and you can manipulate them via API methods. Can be used as alternative for row selection. | <param name="CHECKBOXES" value="1"> |
ONCHECKBOX | tree grid | JS function to call when user clicks on a checkbox. The function receives 2 parameters: oncheckbox(rowID, checkState), where String rowID is the ID of the row which checkbox was clicked (can be different from selected row), int checkState shows the next state of the checkbox ( 0 - checkbox becomes unchecked, 1 - checked). | <param name="ONCHECKBOXES"
value="oncheckbox">
function oncheckbox(rowID, checkState) |
COLUMNi | Define some properties for any
column. Currently supported properties are: type={FIELD|COMBO|NOEDIT},
list={integer}, sortable={yes|no}, sorttype={string|numeric|date},
inputformat={format_string}, locale={locale_string}. Property name is case sensitive. Type NOEDIT menas this
column's cells will be non-editable. Type FIELD means cells will be
editable with input field as edit widget.Type COMBO means cells will be
editable with combobox as edit widget. For type=COMBO you should also
specify property list=j where j menas list ID (SEE LISTi
param below) to initialize combobox. You also can initialize combobox at
runtime using ONEDITCELL event handler. There
is also a possibility to insert checkbox in cell. See TEXTi
parameter description.
If sortable=no user cannot sort this column. Default is yes. Property sorttype=numeric should be defined for numeric column to
perform correct sorting. Default is string sorting. 0 <= i <= ColumnCount-1 You don't have to define all columns. By default column has type=FIELD. |
<param name="COLUMN0"
value="type=COMBO,list=1,sortable=no">
<param name="COLUMN3" value="sorttype=numeric"> <param name="COLUMN1" value="sorttype=date, inputformat={dd/MM/yy, hh:mm:ss},locale=enUS"> |
|
LISTi | Define value list for comboboxes
(see COLUMNi, type=COMBO). List valuse
separated with $$. You may use one list for several comboboxes. You may
define as much lists as you need.
0 <= i <= N (sequential integer from 0) |
<param name="LIST0" value="24 hours$$Next day$$2-3 days$$1 week$$3-4 weeks"> <param name="LIST1" value="Hardcover$$Paperback"> |
|
HIDE_ON_LOAD | If specified, the applet will not paint itself until you call applet's showContent() method. Usefull if you populate the applet from JavaScript at runtime. |
<param name="HIDE_ON_LOAD" value="1"> <param name="ONSTART" value="onstart"> function onstart() |
|
SAVEONRELOAD | If you define this parameter, applet will save its state after page reloading.
Parameter value should be unique on the whole site to identify the applet (this has sense if you use the applet in application
in different places or twice on the same page etc.) |
<param name="SAVEONRELOAD" value="id1"> | |
SAVE_MEM** | tree grid | If specified, the applet will
unload child items when you collapse the parent. This will reduce memory
used and makes applet even more dynamic - child nodes will be reloaded
each time you expand the parent. You can update any item subtree using updateItem() method as well. |
<param
name="SAVE_MEM" value="1"> |
EXPANDROOT | tree grid | Open root nodes on load (by default they are closed) | |
OPENITEMS | tree grid | Specifies the list of IDs of items that should be opened initially, delimited with $ or symbol defined in DELIM parameter. Items should be opened sequentially - first parent item, then child item etc. They will be loaded dynamically, if needed. You can use getOpenedItems() method to save current tree state and restore it later using this parameter. | <param name="DELIM" value="|"> <param name=OPENITEMS value="0,0|1,'BLONP'|2,10826|3,10826|1,'CONSH'"> |
SELECTITEM | Specifies ID of the item that should be selected initially, the applet will scroll this item to the visible area automatically. Usefull in conjunction with OPENITEMS param. | <PARAM NAME=SELECTITEM VALUE="3,10826"> | |
ROW_HEIGHT | Specifies the default row height in
pixels, you can adjust each row separately with HEIGHTi
parameter.
Default value is 20. It is a static variable, so all grids in a browser window will be affected. |
<PARAM NAME=ROW_HEIGHT VALUE=15> | |
FIXEDCOLS | Possibility to fix the first n columns, so they do not scroll (like row header). Must be integer > 0. | <PARAM NAME=FIXEDCOLS VALUE=1> | |
ONDRAG | Event handler: function
on_drag(type, rowID, columl, point) type: 0-start drag, 1-dragging, 2-drop(end drag). point - awt.Point object, where mouse is. |
||
ONREADY | Event handler, called after the first paint, so the applet is really ready to work with any JavaScript. | ||
ONSELECTIONCHANGE | Event handler,called when row selection was already changed. | ||
UPDATEROW | URL to the document to call for row updating. | ||
ENTERASTAB | {0,1} If specified (1), enter key will work as tab - move to the next column, otherwise (0) move to the next row same column. | ||
THINBORDER | If 1, cells have thin border, 0 - has visible white border. | ||
XMLDOC | To load applet's content from the specified XML document. | ||
BGCOLOR | The default cell bgcolor (white). | ||
HEADERBGCOLOR | The default header bgcolor (default is system menu color). | ||
TEXTCOLOR | The default text color (black). | ||
BORDERCOLOR | Cell border color (gray). | ||
FONT | The default text font. | ||
ZEBRA | Define 2 colors (comma separated), that will alternate from one row to the next one | <param name="Zebra" value="#ffffff,#e6e6e6"> | |
BG_INVERT | {0,1} Should selected row invert bg colors or not. | ||
INPUT_ROW | Define input row - one additional not-scrollable row above the header, you can use it as a filter or a search mask. | BGCOLOR TEXT | |
ONKEYPRESSED | Event handler called when a key pressed and the table is active (has focus). Passed one parameter - (java.awt.event.KeyEvent e) | ||
ONSORT | Event handler called when a column is sorted. Passed 2 parameters - (int columnIndex, boolean isAscending) | ||
ONXMLLOADED | Event handler called when a new XML content has been loaded | ||
COLUMN_RESIZABLE | {0,1} If columns can be resized with mouse | ||
LISTVALUESi | Define value list for comboboxes (see LISTi). If defined, then LISTi will be used as labels and LISTVALUESi as values for combobox items | ||
WIDGETi | You can define own widget component to handle cell editing. You should implement JWidget interface for this. WIDGETi has 2 comma separated elements: "class_name, parameter". This class will be instantiated and JWidget.setInitParam(param, this) will be called to initialize it | ||
HEADER_HEIGHT | The height of header row in pixels, 20 by default | ||
SORT_ON_INSERT | {0,1} If the table should be resorted on each new node insertion | ||
HIDEROOTLINES | tree grid | If defined, root nodes will not have lines | |
GET_DOC_DELIM | tree grid | Defines the delimiter for get_doc values, @ by default |
Simple Table - JGridApplet.class
public void addRow(String new_id, String text, String action)
adds a new row to the table. Do not use this method in TreeGrid.
public void deleteRow(String id)
deletes the row with the specified id
public String getSelectedId()
returns the id of the selected row
public void deleteSelectedItem()
deletes the selected row
public String getAction(String id)
returns the action of the specified row
public void setRowTextBold(String id)
sets the bold text for the specified row (against normal)
public void setRowTextNormal(String id)
sets the normal text for the specified row (against bold)
public boolean isItemExists(String id)
returns true if the row with specified id exists in the table, otherwise
false
public String getAllItemIds(String separator)
returns a list of all rows ids separated by specified separator
public int getRowsNum()
returns the total number of rows in the table
public int getRowIndex(String rowID)
returns sequential index of this row. Do not use this method in TreeGrid.
public void moveRowUp(String id)
moves the specified row up in the table. Do not use this method in TreeGrid.
public void moveRowDown(String id)
moves the specified row down in the table. Do not use this method in TreeGrid.
public void insertRowAt(int
index, String new_id, String text, String action)
adds a new row to the table at the specified position. Do not use this method in TreeGrid.
public JCell cells(String row_id, int col )
get cell object to manipulate directly with its properties
Special row ids: "header_row", "input_row".
public JCell cells2(Int
row_index, int col )
get cell object to manipulate directly with its properties.
Works faster than cells() because no need to lookup row by its id.
Do not use this method in TreeGrid.
public PopupMenu menu()
get popup menu object to manipulate directly with its properties
public String getSelectedItemIds(String separator)
returns a list of selected rows' ids separated by specified separator
public String getUserData(String rowID)
get extra row data stored by USERDATAi parameter for this row
(or by setUserData() method).
public void setUserData(String rowID, String data)
to set row level data. You can use this methods to store some extra data
or flags. You also can define this data via USERDATAi applet's param.
public boolean isEditable()
returns true if cell editing is enabled.
public void setEditable(boolean value)
enable/disable cell editing at runtime.
public void setSelectedRow(String rowID, boolean multi)
set selected row at runtime. If multi = = false new row becomes the only selected row.
If multi = = true new row becomes the selected and all previously selected rows
stay selected also. You should use next trick to deselect all rows:
setSelectedRow(some_rowID, false); setSelectedRow(some_rowID, true);
public Choice getCombo()
provides access to the combobox widget. Choice is a standard AWT combobox.
You can use its methods add("item"), remove(itemID), removeAll(), getSelectedItem()
etc. to manipulate with data at runtime.
public void copyRowContent(String from_rowID, String to_rowID)
use to copy content (cell values) of the whole row to any other row.
Example:
document.applets.a1.insertNewNext('112', '511','','');
document.applets.a1.copyRowContent('112', '511');
public void setInitWidthsP(String widths_in_percent)
defines initial widths of columns in percent. Use $ separated integer values.
Should be called before setHeader() or setColumnCount().
public void setInitWidths(String widths_in_pixels)
defines initial column widths in pixels at runtime. Use $ separated integer values.
Should be called before setHeader() or setColumnCount().
public void setHeader(String header)
defines header at runtime. Use $ separated labels.
Should be called before filling of the grid content.
public void setColumnCount(int i)
defines column count at runtime (if you do not want to use setHeader()
or if you have hidden header).
Should be called before filling of the grid content.
public void showContent()
forces repaint of the applet. Usefull in combination with HIDE_ON_LOAD param.
Should be called obligatory if this param is specified.
public String getHeaderCol(int column)
returns column header label.
public void setHeaderCol(int column, String label)
changes column header at runtime.
public void setSelectedRow(String rowID, boolean multi, boolean show)
selects this row at runtime [see public void setSelectedRow(String rowID, boolean multi)
for detais]
and scrolls this row to visible area if show==true.
public void showRow(String rowID)
scrolls this row to visible area
public String getUserData(String rowID, String key)
get extra row data stored by USERDATAXi parameter for this row
(or by setUserData() method).
public void setUserData(String rowID, String key, String data)
to set row level data. You can use this methods to store some extra data
or flags. You also can define this data via USERDATAXi applet's param.
public boolean isMultiselect()
returns true if multiselect is enabled
public void setMultiselect(boolean val)
enable/disable multiselect at runtime
(1.20)
public void clear()
clear all content of the grid, header and all other elements (as if a new
empty grid was created).
public void deselect()
deselect all selected rows.
public void editCell(String rowID, int
column)
move focus to this cell and switch it to the editable mode.
public void enablePopup(boolean flag)
enable/disable popup menu - usefull to prevent IE hangup while applet
initialization from JavaScript.
public String getAppletInfo()
get applet version and related information.
public String getCellValue(String
rowID, int column)
a shortcut to get this cell value.
public void setCellValue(String
rowID, int column, String newValue)
a shortcut to set this cell value.
public int getColumnAt(int x)
get column index for specified mouse x coordinate.
public String getRowAt(int y)
get row ID for specified mouse y coordinate.
public int getColumnCount()
get column count.
public int getColumnOrder(int column)
get this column order.
public void setColumnOrder(int
column, int newPosition)
set this column order.
public int getColWidth(int column)
get this column width.
public void setColWidth(int
column, int newWidth)
set this column width.
public String getRowId(int rowIndex)
get row ID by row index (zero based, from top to bottom).
public String getUserDataX(String rowID, String key)
get extra row data stored by USERDATAXi parameter for this row
(or by setUserDataX() method).
Some JRE cannot resolve overloaded methods so we defined this one with a new
name.
public void setUserDataX(String rowID, String key, String data)
to set row level data. You can use this methods to store some extra data
or flags. You also can define this data via USERDATAXi applet's param.
Some JRE cannot resolve overloaded methods so we defined this one with a new
name.
public String getXML()
get XML representation of the grid.
public void initXML(String xml)
load this XML string/url into the grid.
public void scrollToColumn(int column)
scroll the applet horizontally so this column is visible (be first from the
left, if possible).
public void updateRow(String
rowID, String urlParam)
reload this row from the server, sending urlParam as part of the url
request, with url from UPDATEROW param.
TreeTable - JTreeGridApplet.class
public void insertNewChild(String parent_id, String new_id, String text, String action,
[int icon0,int icon1])
inserts a new row as a child row for the specified parent row (parent_id)
public void insertNewNext(String parent_id, String new_id, String text, String action,
[int icon0,int icon1])
inserts a new row at the same level as the specified row (parent_id)
public void insertRoot(String new_id, String text, String action, [int icon0,int
icon1])
inserts a new row at the root level
public boolean isRowBold(String id)
returns boolean value indicating if the specified row is bold or not
public String getAllItemIds(String separator)
returns a list of all rows ids separated by specified separator
public void setRowIcons(String id, int icon1, int icon2)
sets the icons for the specified row, for Opened and Closed state
respectively
public String getCheckedItemIds(String separator)
returns a list of all checked rows ids separated by specified separator
public String getCheckedItemIds(String separator, String
parentID, boolean all)
returns a list of checked child rows ids separated by specified separator
parentID - specifies ID of parent row which children will be processed,
all - specifies if all children (including children of children) should be
processed
or only direct ones.
public boolean isChecked(String id)
get row's checked state: true means row's checkbox is checked, false
otherwise.
public void setChecked(String id, boolean value)
sets row's checked state: true means row's checkbox will be checked, false -
uncheck it.
public void setChecked(String id, boolean value, int
child)
sets row's and row's children checked state: true means row's checkbox will
be checked, false - uncheck it.
Parameter int child specifies: 1 - process all children, 2 - process only direct
children, 0 - don't process children.
public String getParentId(String id)
get the ID of the parent row for this row; null if no parent.
public String getChildId(String id)
get the ID of the first child row for this row; null if no child.
public String getPrevId(String id)
get the ID of the previous row (on the same chain and level) for this row;
null if no prev.
public String getNextId(String id)
get the ID of the next row (on the same chain and level) for this row; null
if no next.
public String getVisibleItemIds(String separator)
returns a list of all currently visible rows ids separated by specified separator.
public void updateItem(String id)**
reloads children of this item using GET_DOC. Use it to refresh data in the
applet.
You can reload the whole treetable if root item ID is specified.
public void openItem(String id)
opens (expands) this item's children programmatically (same as if user
double-clicks the item).
If the item is already opened, nothing happens.
public void closeItem(String id)
closes (collapses) this item's children programmatically.
If the item is already closed, nothing happens.
public String getOpenedItems(String delim)
returns the list of currently opened(expanded) items' IDs, delimited with
this delim.
You can use this method to save tree state in a string variable, and use this
value for OPENITEMS param later to restore tree state.
public String getValue()
public String getFont()
public String getTextColor()
public String getBgColor()
public String getHorAlign()
public void setValue(String val)
public void setFont(String val)
where val should be in format: Name-style-size,
style:{bold,italic,bolditalic}
[examples: Courier-bold-12,
Dialog-22]
public void setTextColor(String val)
examples: #00cc00, #0f1155
public void setBgColor(String val)
examples: #00cc00, #0f1155
public void setHorAlign(String val)
where val should be in format: "r" [right], "l" [left], "c" [center]
public boolean wasChanged()
returns true if cell's value was changed by user during the last editing of this
cell, false otherwise
public boolean isCheckbox()
returns true if this cell contains a checkbox
public boolean isChecked()
returns the state of this cell's checkbox
public void setChecked(boolean value)
sets the state of this cell's checkbox
(1.23)
public void setEditType(int editType)
sets the type of cell editor, either 1-inputbox or 2-combobox.
Used in the onEditCell event handler on type=0 event.
So you can use different editors in same column/cell.
public void setCombo(String labels, String values)
dynamically fills the combobox for current cell with labels and values (separated by grid delimiter).
Used in the onEditCell event handler on type=0 event.
public void add(String label)
adds a new item with the specified label to the end of this menu;
use "-" as itemText to add a menu separator
public int getItemCount()
returns a number of items in this menu
public void insert(String itemText, int index)
inserts a menu item with the specified label into this menu at the specified
position
public void remove(int index)
removes the specified menu item from this menu
public void removeAll()
removes all items from this menu