3magic GridApplet Version 1.2.10
September 15, 1999
©1997-1999 3magic, All Rights Reserved Worldwide.
This document provides important information on installing and using 3magic GridApplet. Please read this before reporting any problems. This document contains the following sections:
The following HTML shows how you can integrate the 3magic GridApplet into your webpage. It also shows how to access some applet information through the use of JavaScript:
<HTML>
<title>URL Test</title>
<BODY>
<hr>
<applet codebase="GridApplet" NAME="GridApplet" code="GridApplet.class" width=440
height=300>
<param name=archive value="GridApplet.zip">
<param name=cabbase value="GridApplet.cab">
<param name=numrows value=168>
<param name=numcols value=3>
<param name=rowheight value=-1>
<param name=colwidths value="90,150,160">
<param name=rowheaderwidth value=30>
<param name=colheaderheight value=-1>
<param name=linecolor value="RED">
<param name=highlightcolor value="BLUE">
<param name=sortcolumncolor value="FFFFB8">
<param name=gridattributes value="TimesRoman,PLAIN,12,BLACK,FFFFD8,LEFT">
<param name=headerattributes value="TimesRoman,BOLD,12,BLUE,LIGHTGRAY,LEFT">
<param name=col1attributes value="TimesRoman,BOLD,12,NULL,NULL,CENTER">
<param name=col2attributes value="NULL,NULL,NULL,NULL,NULL,LEFT_TRUNCSTRING">
<param name=col3attributes value="NULL,NULL,NULL,NULL,NULL,LEFT_WORDWRAP,EDITTEXT">
<param name=wraparound value="true">
<param name=ignorecase value="true">
<param name=findcolumns value="1,2,3,*">
<param name=sortcolumns value="1,2,3">
<param name=audioclip value="Droplet.au">
<param name=flags value="rowselection,
resizecolumns, resizerows,
resizemultiple, autoresizerows,
rowlines, collines,
rowheader, colheader,
useattributes, vscroll,
hscroll, doublebuffering,
dragselect, rownumbers,
autoresizecols, sortattributes,
sortrowheaders">
<param name=datafile value="areacodes.txt">
<param name=cellsreleasedfunction value="displaySelection">
<param name=doubleclickfunction value="doubleClickFunction">
</applet>
<FORM NAME="form1">
<INPUT TYPE="BUTTON" VALUE="Get Sel Row"
onClick='alert("Sel Row: "+document.GridApplet.getSelRow())'>
<INPUT TYPE="BUTTON" VALUE="Get Cell Text"
onClick='alert("CellText: "+document.GridApplet.getCellText(2, document.GridApplet.getSelRow()))'>
<INPUT TYPE="TEXT" NAME="SelText" VALUE="" SIZE=40>
<BR>
</FORM><hr>
</BODY>
<SCRIPT>
function displaySelection(col, row) {
document.form1.SelText.value = document.GridApplet.getCellText(2, document.GridApplet.getSelRow());
}
function doubleClickFunction(col, row) {
alert("DoubleClickFunction Col: "+col + " Row: " + row)
}
</SCRIPT>
</HTML>
<param name=archive value="GridApplet.zip"> (optional)
Class ZIP file for Netscape users.
<param name=cabbase value="GridApplet.cab"> (optional)
Class CAB file for MSIE users.
<param name=numrows value=168> (required)
<param name=numcols value=3> (required)
Number of rows and columns.
<param name=rowheight value=0> (optional)
-1 specifies font-height default values.
Other values will specify row height in pixels.
<param name=colwidths value="90,150,160"> (required)
Column widths in pixels.
<param name=rowheaderwidth value=30> (optional)
Size of the row headers in pixels.
<param name=colheaderheight value=0> (optional)
-1 specifies font-height default values.
0 specifies no column headers.
Other values will specify column header height in pixels.
<param name=linecolor value="RED">
Color of the grid lines.
<param name=highlightcolor value="BLUE">
Color of the hightlight.
<param name=sortcolumncolor value="LIGHTGRAY">
Color of the sorting hightlight.
<param name=colheadertext value=January,February,March,April,May,June>
(optional)
Comma delimited text to specify the column headers for the grid. Individual strings should be quoted if containing
commas. In addition, two double quotes should be insert to embed double quotes within strings.
<param name=rowNheadertext value=Row 1> (optional)
Text for a row header in the grid. Specify N for the row number. Individual strings should be quoted if containing
commas. In addition, two double quotes should be insert to embed double quotes within strings.
<param name=rowNtext value=$100.00,$250.00,$100.00,$120.00,$100.00>
(optional)
Comma delimited text to specify the cell text for a sigle row in the grid the grid. Specify N for the row number.
Individual strings should be quoted if containing commas. In addition, two double quotes should be insert to embed
double quotes within strings.
<param name=gridattributes value="TimesRoman,PLAIN,12,BLACK,FFFFD8,LEFT">
(required)
<param name=headerattributes value="TimesRoman,BOLD,12,BLUE,LIGHTGRAY,LEFT">
(required)
Font attributes for grid and headers.
<param name=colNattributes value="NULL,NULL,NULL,NULL,NULL,LEFT_WORDWRAP,EDITTEXT">
(optional)
Specify N for column number.
Font and options attributes for each column: Font Name, Font Style, Font Size, Text Color, BG Color, Justification,
Cell Type.
Unspecified columns will use the grid attributes.
NULL values will inherit the grid attributes.
Must specify "useattributes" flag (see below).
Justification values are: LEFT, CENTER, RIGHT (optionally append _TRUNCSTRING or _WORDWRAP)
Cell Type values are: TEXT, URL, MAIL, EDITTEXT
<param name=rowNattributes value="TimesRoman,BOLD,12,NULL,NULL,CENTER">
(optional)
Specify N for row number.
Font and options attributes for each column: Font Name, Font Style, Font Size, Text Color, BG Color, Justification,
Cell Type.
Unspecified columns will use the column or grid attributes.
NULL values will inherit the column or grid attributes.
Must specify "useattributes" flag (see below).
Justification values are: LEFT, CENTER, RIGHT (optionally append _TRUNCSTRING or _WORDWRAP)
Cell Type values are: TEXT, URL, MAIL, EDITTEXT
<param name=wraparound value="true"> (optional)
Sets wraparound checkbox to ON or OFF.
Not specifying this parameter will hide the wraparound checkbox.
<param name=ignorecase value="true">
Sets ignore case checkbox to ON or OFF.
Not specifying this parameter will hide the ignore case checkbox.
<param name=findcolumns value="1,2,3,*">
Specifies the columns you can search on.
Asterisk specifies an additional item for Any Column.
Not specifying this parameter will hide the Find Panel.
<param name=sortcolumns value="1,2,3">
Specifies the columns you can sort on.
Not specifying this parameter will disable sorting.
<param name=audioclip value="Droplet.au">
Specifies the sound to play if the search fails.
<param name=colresizemode value="resizenext">
Specifies how the other columns are adjusted when a column is resized while the autoresizecols flag is enabled.
Possible values are "resizenext" (default) to adjust the column immediately after the column being resize,
"resizelast" to adjust the width of the last column or "resizeall" to proportionally adjust
the widths of all other columns.
<param name=urlframe value="myframe">
Specifies the frame that URLs wil be opened in. You can specify the name of the frame or "" to display
in the same frame as the applet. Not specifying the value will cause the URL to be display in a new window.
<param name=clickfunction value="myClickFunction">
Specifies the JavaScript function that will be called when the user clicks in a cell. The function should have
two int parameters for the col and row index width the following interface:
function myClickFunction(col, row);
<param name=doubleclickfunction value="myDoubleClickFunction">
Specifies the JavaScript function that will be called when the user double-clicks in a cell. The function should
have two int parameters for the col and row index width the following interface:
function myDoubleClickFunction(col, row);
<param name=commiteditfunction value="myCommitEditFunction">
Specifies the JavaScript function that will be called when the user commits editing in a cell. The function should
have two int parameters for the col and row index width the following interface:
function myCommitEditFunction(col, row);
<param name=canceleditfunction value="myCancelEditFunction">
Specifies the JavaScript function that will be called when the user cancels editing in a cell. The function should
have two int parameters for the col and row index width the following interface:
function myCancelEditFunction(col, row);
<param name=cellsreleasedfunction value="myCellsReleasedFunction">
Specifies the JavaScript function that will be called when the user releases the mouse after clicking or dragging
in the grid. The function should have two int parameters for the col and row index width the following interface:
function myCellsReleasedFunction(col, row);
<param name=flags value="rowselection,resizecolumns,resizerows,rowlines,collines,rowheader,colheader,useattributes,vscroll,hscroll,doublebuffering,dragselect">
Grid feature flags:
cellselection - enable cell selection
columnselection - enable column selection
doublebuffering - use double-buffering for drawing
dragselect - enable drag-selection
forcevscroll,forcehscroll - force scroll bar
display
multiple - enable multiple cell/row/column selection
resizecolumns - enable column resizing
resizerows - enable row resizing
resizemultiple - resize all selected rows or columns simultaneously
autoresizerows - automatically resize row heights based on cell text and column
widths if WORD_WRAP is enabled
autoresizecols - automatically resize column widths to proportionally fit within
Grid's area
rowheader,colheader - enable drawing of row/column
headers
rowlines,collines - enable drawing of row/column lines
rownumbers - display row numbers
rowselection - enable row selection
sortattributes - move cell attributes along with cell data during sorting
sortrowheaders - move row headers along with cell data during sorting
threedborder - enable 3D borders
useattributes - enables column-level attributes parameter
vscroll,hscroll - enable scroll bars when needed
<param name=datafile value="areacodes.txt">
Specify tab-delimited text file.
The first line of this text file specifies the column headers.
Be sure this file contains one MORE line than the number of rows specified.
URLs can be specified by the format: Text<URL>
For example: "3magic Home Page<http://www.3magic.com>"
3magic GridApplet supports the following publically-accessible JavaScript methods:
// returns the cell text.
public String getCellText(int col, int row);
// sets the cell text, and repaints the cell.
public void setCellText(int col, int row, String cellText);
// sets the cell text.
public void setCellText(int col, int row, String cellText, boolean repaint);
// returns first selected row.
public int getSelRow();
// returns number of selected rows.
public int getNumSelRows();
// returns an array of ints specifying the selected rows.
public int[] getSelRows();
// returns the index of the Nth selected row
public int getNthSelRow(int i);
// returns the number of rows in the Grid
public int getNumRows();
// set the number of rows in the Grid
public void setNumRows(int numRows);
// returns the number of columns in the Grid
public int getNumCols();
// set the number of columns in the Grid
public void setNumCols(int numCols);
// set the width of a column in the Grid
public void setColWidth(int col, int colWidth);
// set the width of all columns in the Grid
public void setColWidths(int colWidth);
// set the width of all columns in the Grid using a comma-separated string
public void setColWidths(String colWidths);
// set the height of a row in the Grid
public void setRowHeight(int row, int rowHeight);
// set the height of all row in the Grid
public void setRowHeights(int rowHeight);
// insert new rows at the specified row in the Grid
public void insertRows(int row, int count);
// append new rows to the Grid
public void appendRows(int count);
// delete rows from the specified row in the Grid
public void deleteRows(int row, int count);
// insert new columns at the specified column in the Grid
public void insertColumns(int column, int count);
// append new columns to the Grid
public void appendColumns(int count);
// delete columns from the specified column in the Grid
public void deleteColumns(int column, int count);
// select a row in the Grid
public void selectRow(int row);
// select a column in the Grid
public void selectCol(int col);
// select a cell in the Grid
public void selectCell(int x, int y);
// select all cells in the Grid
public void selectAll();
// deselect a row in the Grid
public void deselectRow(int row);
// deselect a column in the Grid
public void deselectCol(int col);
// deselect a cell in the Grid
public void deselectCell(int x, int y);
// deselect all cells in the Grid
public void deselectAll();
// read set the Grid's data reading it from the text file
public void setGridData(String dataFile);
// search for text in the grid, selecting the row or cell found
// col - an int specifying the column to search in (1 based) or -1 for any column
// matchType - an int specifying the type of comparision: 1 - contains, 2 - startswith, 3 - endswith and 4 - equals
// findStr - the string to look for
// wrapAround - whether or not to do a wrapAround search
// ignoreCase - whether or not to do a case sensitive search
public void doFind(int col, int matchType, String findStr, boolean wrapAround, boolean ignoreCase);
You can learn more about JavaScript and applet integration at the Netscape DevEdge site.
The Scrollbar class behaves differently in all the Win32 implementations of the AWT (Netscape, Internet Explorer, Cafe etc). We have tried our best to work around these problems in our implementation and will continue to provide updates as available. The real fix will be when Sun reimplements the AWT for Win32, which is promised for the end of the year.
All intellectual property rights in the software and user documentation are owned by 3magic and are protected by United States copyright laws and other applicable copyright laws. You are bound by the terms stated in the End-User License Agreement found in the file LICENSE.TXT with your distribution, or on our website at:
http://www.3magic.com/products/coffeetable/Docs/license.html
Please report all bugs, comments and feature requests to support@3magic.com.