INTRODUCTION
This java table enables you to display data in rows and columns in your java or web applications. The users can interactively search the data, sort the data, and filter out rows at run time. Navigate the rows with the following keys; up, down, page up, page down, home, end, left, and right. |
data | |
Instead of loading the data from the applet parameters, you can
specify a url to load the data from. The data in the url has to be
in the format parameter1=value1 parameter2=value2 parameter3=value3 The parameters in the applet tag will override any parameters with the same name loaded from the url. You can also press F5 to update the table data at runtime. |
<param name=data value=customers.asp> Hashtable parameters = new Hashtable(); table.loadURLParameters("customers.asp", parameters); table.setParameters(parameters); table.setParameter("data", "customers.asp"); table.updateData(); |
dataInterval | |
You can make the table applet load the data from the currently specified URL at a specific interval. The interval is specified in seconds. If reset is specified in the data interval, the table data is cleared before read again. |
<param name=dataInterval value=10> <param name=dataInterval value=10,reset> |
loadingMessageOn | |
If this is turned on, the table will display a message (loading data...) and a progress indicator while initializing the applet and loading the data. | <param name=loadingMessageOn value="true"> |
loadingDataMessage | |
The default message displayed when loading the data is 'loading data...'. Use this parameter to change the message displayed. The parameter has to be set in the applet tag to work. | <param name=loadingDataMessage value="please wait..."> |
updateWhileLoadingURLData | |
This will update the table display at the same time as loading the data from a URL. | <param name=updateWhileLoadingURLData value="none"> |
rowCellParameters | |
If you have thousands of rows, the applet's initialization time will be longer due to all the parameter_row_cell parameter names it needs to construct and check. Use this parameter to avoid this processing, or to limit it to the parameters you now will be in the applet tag. |
<param name=rowCellParameters value="none"> <param name=rowCellParameters value="rowFont_0,rowFont_5,rowFont_9"> |
labelCacheOn | |
Turns on the label cache for textual columns. This will save memory space if you have many repeating labels in your cells. The label cache is static and is shared across all instances of the table component within the same java VM. |
<param name=labelCacheOn value="true"> setLabelCacheOn(true); |
columnCount | |
Sets the number of columns in the table.
The default number of |
<param name=columnCount value=3> setColumnCount(3); |
row_N | |
Adds a row to the table. Rows are added starting from row_0, row_1 and
upwards. If the row_N parameters are set throught the applet tag, the
row indexes must be sequential |
<param name=row_0 value="this is row 0"> <param name=row_1 value="this is row 1"> <param name=row_0 value="this is, row 0, multiple columns"> setRow(0, new String[] {"this is row 0"); setRow(1, new String[] {"this is row 1"); setRow(0, new String[] {"this is","row 0","multiple columns"); |
header | |
Sets the header labels of the table. There is one label per column field. If you want a comma in your header label, use the fieldSeparator parameter. |
<param name=header value="this is the header"> <param name=header value="this is, the header"> setHeader(0, "this is the header"); setHeader(new String[] {"this is", "the header"}); setHeader(0, "this is"); setHeader(1, "the header"); |
headerFont | |
Sets the font used for the header labels. |
<param name=headerFont value="Arial,plain,12"> <param name=headerFont value="Arial,bold,14"> <param name=headerFont value="Courier,italic,11"> <param name=headerFont value="Serif,bolditalic,16"> setFont("headerFont", new Font("Arial", Font.PLAIN, 12)); |
headerFontColor | |
Sets the color used for the header labels. |
<param name=headerFontColor value="blue"> <param name=headerFontColor value="#333333"> setFontColor("headerFontColor", Color.blue); setFontColor("headerFontColor", new Color(0x333333)); |
headerBackground | |
Sets the background color of each header field. |
<param name=headerBackground value=",orange, ,pink"> setHeaderBackground(1, Color.orange); setHeaderBackground(3, Color.pink); |
headerOff | |
Turns off the header. The header is turned on by default. |
<param name=headerOff value="true"> setHeaderOn(false); |
tooltipHeader | |
Adds a tooltip label for the header fields. There is one label per header field where tooltipHeader_N is used for each field. Use tooltipDelay, tooltipDelayHeader, and tooltipBackground to configure the tooltip delay time and background color. |
<param name=tooltipHeader_0 value="tooltip one"> <param name=tooltipHeader_1 value="tooltip two"> setTooltip("tooltipHeader_0", "tooltip one"); setTooltip("tooltipHeader_1", "tooltip two"); |
tooltipDelay | |
Sets the time it takes before a tooltip label is displayed. The time is specified in milliseconds, and the default is 1500 (1.5 seconds). |
<param name=tooltipDelay value="500"> <param name=tooltipDelayHeader value="1000"> <param name=tooltipDelayFilter value="100"> setTooltipDelay("tooltipDelay", 500); setTooltipDelay("tooltipDelayHeader", 1000); setTooltipDelay("tooltipDelayFilter", 100); |
tooltipBackground | |
Sets the background color of the tooltip labels. |
<param name=tooltipBackground value="yellow"> <param name=tooltipBackground value="#d6d87f"> setTooltipBackground(Color.yellow); setTooltipBackground(new Color(0xd6d87f)); |
fieldSeparator | |
Uses another field separator than the default comma. Use this if you need commas in the header, filter, or row_N parameters. |
<param name=fieldSeparator value=":"> <param name=row_0 value="100,00 : 200,00 : 300,00 : 400,00"> |
columnWidth | |
Sets the width of each column. Use a comma separated list of integer numbers to set the width of each column. The default width is 100. |
<param name=columnWidth value="100,100,50,200"> setColumnWidth(0, 100); setColumnWidth(1, 100); setColumnWidth(2, 50); setColumnWidth(3, 200); |
columnStretchOn | |
If this is turned on, the columns will stretch out to occupy the entire table width. The width values set by columnWidth will be relative to each other and the total table width. |
<param name=columnWidth value="25,15,20,40"> <param name=columnStretchOn value="true"> setColumnStretchOn(true); |
columnAlignment | |
Sets the alignment of each column to left, center, or right. Use a comma separated list of left, center, or right to set the alignment for each column. The default alignment is right. |
<param name=columnAlignment value="left, left, center, right"> setColumnAlignment(0, Table.ALIGN_LEFT); setColumnAlignment(1, Table.ALIGN_LEFT); setColumnAlignment(2, ALIGN_CENTER); setColumnAlignment(3, ALIGN_RIGHT); |
columnType | |
The table supports text, numerical, currency, date, and IP address column types. The text type sorts the data (if sorted by the user) in lexical order, the numerical and currency types sorts the data in numerical order, the date column sorts the rows by time, and the IP column type sorts the IP addresses by "numerical" value. Numerical and date type will display the number with the current locale and the currency type will add the correct currency symbol to the number. |
<param name=columnType value="text,currency,number,date,ip"> setColumnType(0, Table.COLUMN_TEXT); setColumnType(1, Table.COLUMN_CURRENCY); setColumnType(2, Table.COLUMN_NUMBER); setColumnType(3, Table.COLUMN_DATE); setColumnType(4, Table.COLUMN_IP); |
columnCollapsable | |
Each individual column can be collapsed by the user at runtime by clicking a collapse button in the header field for the column. Turn on collapsable columns using this parameter. |
<param name=columnCollapsable value="1,3"> setColumnCollapsable(1, true); setColumnCollapsable(3, true); |
columnCollapsed | |
This parameter controls which collumns are collapsed when the applet initially loads. Collapsed collumns can also be set during runtime. |
<param name=columnCollapsed value="1,3"> setColumnCollapsed(1, true); setColumnCollapsed(3, false); |
columnOff | |
This parameter enables you to turn on or off individual columns. |
<param name=columnOff value="1,3"> setColumnOn(1, false); setColumnOn(3, false); |
mouseOverCellOn | |
You can display hidden cells or hidden parts of a cell by turning this parameter on and moving the mouse over the cell you want to display in full. |
<param name=mouseOverCellOn value="true"> setMouseOverCellOn(true); |
prefix_N | |
Adds a prefix to the labels in |
<param name=prefix_0 value="$"> <param name=prefix_1 value="£"> setPrefix(0, "$"); setPrefix(1, "£"); |
postfix_N | |
Adds a postfix to the labels in |
<param name=postfix_0 value="MB"> <param name=postfix_1 value="KB"> setPostfix(0, "MB"); setPostfix(1, "KB"); |
decimalCount_N | |
Sets the number of decimals to be displayed for column N. This works only for numerical and currency type columns. |
<param name=decimalCount_0 value="2"> <param name=decimalCount_2 value="3"> setDecimalCount(0, 2); setDecimalCount(2, 3); |
locale | |
Sets the locale of the table. The locale affects the display of numbers (thousend delimiters and decimal separators) as well as the currency symbol if the column type is set to currency and the date columns. The locale is set to the default set in the clients PC. The locale parameter is divided in two, a language code, and a country code, separated by a comma. If you want the ˆ sign to be displayed as the currentcy simbol you should use f.eks. value="fr, eu" for applets and setLocalE(new Locale("FR", "FR", "EURO")) for applications. |
<param name=locale value="en, gb"> <param name=locale value="en, us"> <param name=locale value="fr, eu"> setLocale(new Locale("EN", "GB"); setLocale(new Locale("EN", "US"); setLocale(new Locale("FR", "FR", "EURO"); Language codes Country codes |
thousandsDelimiter | |
Sets the character to be used for the thousands delimiter. A value of true uses the default for the current locale, a value of false turns off thousands grouping. |
<param name=thousandsDelimiter value="."> <param name=thousandsDelimiter value="false"> setThousandsDelimiter("."); setThousandsDelimiter("false"); |
dateFormat | |
The dateFormat parameter controls the format of the displayed dates. It also sets the default format in which the dates must be parsed (dateFormatInput overrides this). Use dateFormat_N to specify the pattern for a specific column. Check here for the date pattern documentation. |
<param name=dateFormat value="dd.MM.yyyy HH:mm:ss"> <param name=dateFormat_0 value="dd.MMM.yy HH:mm"> <param name=dateFormat_1 value="dd MMMM yyyy"> // set default formatter SimpleDateFormat formatter = new SimpleDateFormat(); formatter.applyPattern("dd.MM.yyyy HH:mm:ss"); table.setDateFormatter(-1, formatter); // set formatter for column 1 formatter = new SimpleDateFormat(); formatter.applyPattern("dd.MMMM.yyyy HH:mm"); table.setDateFormatter(1, formatter); |
dateFormatInput | |
The dateFormatInput parameter controls the pattern of how dates are read into the table. Use dateFormatInput_N to specify the pattern for a specific column. Check here for the date pattern documentation. |
<param name=dateFormatInput value="hh.MM.yyyy HH:mm:ss"> <param name=dateFormatInput_0 value="HH:mm:ss"> <param name=dateFormatInput_1 value="dd.MMM.yyyy"> for java use Date() objects in the rows. |
dateFormatInputLocale | |
Sets the locale of the input dates (such as month and day names) used when reading the dates using the pattern set with the dateFormatInput_N parameter. The locale is set to the default set in the clients PC. |
<param name=dateFormatInputLocale value="en"> <param name=dateFormatInputLocale value="fr"> Language codes |
headerImage_N | |
Adds an image to the header field where N is the column index (0-based). |
<param name=headerImage_0 value="images/folder.gif"> <param name=headerImage_3 value="images/computer.gif"> // load images... table.setHeaderImage(0, folder_image); table.setHeaderImage(3, computer_image); |
image_N | |
Adds an image to all the fields in a column. The image is displayed at the left edge of the table cell. |
<param name=image_0 value="images/folder.gif"> <param name=image_3 value="images/computer.gif"> // load images... table.setImage(0, -1, folder_image); table.setImage(3, -1, computer_image); |
cellImage_N_M | |
Adds an image to a specified field in a row. The first index (N) is the row, the second index (M) is the column. |
<param name=cellImage_0_0 value="images/folder.gif"> <param name=cellImage_0_3 value="images/computer.gif"> // load images... table.setImage(0, 0, folder_image); table.setImage(0, 3, computer_image); |
selectionMode | |
Sets the row selection mode. The different selection modes are no selection, single row selection, and multiple row selection. Default is no selection. |
<param name=selectionMode value="none"> <param name=selectionMode value="single"> <param name=selectionMode value="multiple"> setSelectionMode(SELECT_NONE); setSelectionMode(SELECT_SINGLE); setSelectionMode(SELECT_MULTIPLE); |
selectionBackground | |
Sets the background color of selected rows. |
<param name=selectionBackground value="#7f0000"> <param name=selectionBackground value="default"> setSelectionBackground(new Color(0x7f0000)); setSelectionBackground(null); |
selectionForeground | |
Sets the font color of selected rows. |
<param name=selectionForeground value="yellow"> <param name=selectionForeground value="default"> setSelectionForeground(Color.yellow); setSelectionForeground(null); |
selectionCellBackground | |
Sets the background color of selected cells. |
<param name=selectionCellBackground value="#7f7f00"> <param name=selectionCellBackground value="default"> setSelectionCellBackground(new Color(0x7f0000)); setSelectionCellBackground(null); |
defaultSortOrder | |
Sets the default sort order for each column (ascending by default). |
<param name=defaultSortOrder value="asc,asc,desc"> setDefaultSortOrder(0, Table.SORT_ASCENDING); setDefaultSortOrder(1, Table.SORT_ASCENDING); setDefaultSortOrder(2, Table.SORT_DESCENDING); |
sortedColumn | |
Sets which column should initially be sorted when the applet is loaded. | <param name=sortedColumn value="2"> |
sortingOff | |
Turns off sorting entirely or for individual columns. |
<param name=sortingOff value="true"> <param name=sortingOff value="0,2,3"> setSortingOn(0, false); setSortingOn(2, false); setSortingOn(3, false); |
filterBarOn | |
Turns on the filter bar to allow interactive row searching and filtering. |
<param name=filterBarOn value="true"> setFilterBarOn(true); |
filter | |
Sets the initial filter when the applet loads. Use a comma to separate each field in the filter. Use fieldSeparator if you need comma in the filter labels. | <param name=filter value="field1, ,field3"> |
filterOn | |
Activates the filter fields when the applet initially loads. Each value is the filter index (0-based). | <param name=filterOn value="1,2"> |
filterEnabled | |
Enabled or disables the filter fields for user input and interaction. Each value is the filter index (0-based). All filter fields are enabled by default. |
<param name=filterEnabled value="1,2"> setFilterEnabled(1, true); setFilterEnabled(2, true); |
filterBarPosition | |
Sets the position of the filter bar. The default position is at the bottom of the table, but it can also be placed at the top, below the table header. |
<param name=filterBarPosition value="bottom"> <param name=filterBarPosition value="top"> setFilterBarPosition(Table.TOP); setFilterBarPosition(Table.BOTTOM); |
filterWildCard | |
Sets the filter wild card. The default wild card is asterisk (*). Set the wild card to nothing "" to have the wild card effect without using the wildcard. |
<param name=filterWildCard value="%"> <param name=filterWildCard value=""> setFilterWildCard("%"); setFilterWildCard(null); |
progressiveFilterOn | |
If this is turned on, the table will filter out rows as the user types the text in the filter bar. Use this in combination with an empty filterWildCard. |
<param name=filterWildCard value=""> <param name=progressiveFilterOn value="true"> setProgressiveFilterOn(true); |
tooltipFilter | |
Adds a tooltip to the filter fields. Use \n for multiline labels. Use tooltipDelay or tooltipDelayFilter to configure the delay before the tooltip appears. Use tooltipBackground to set the tooltip background color. |
<param name=tooltipFilter value="search or\nfilter rows"> <param name=tooltipFilter_0 value="filter one"> <param name=tooltipFilter_1 value="filter two"> setTooltip("tooltipFilter", "search or\nfilter rows"); setTooltip("tooltipFilter_0", "filter one"); setTooltip("tooltipFilter_1", "filter two"); |
filterBarFont | |
Sets the font used for the labels in the filter bar. |
<param name=filterBarFont value="Arial,plain,12"> <param name=filterBarFont value="Arial,bold,14"> <param name=filterBarFont value="Courier,italic,11"> <param name=filterBarFont value="Serif,bolditalic,16"> setFont("filterBarFont", new Font("Arial", Font.PLAIN, 12)); |
filterBarFontColor | |
Sets the color used for the labels in the filter bar. |
<param name=filterBarFontColor value="blue"> <param name=filterBarFontColor value="#333333"> setFontColor("filterBarFontColor", Color.blue); setFontColor("filterBarFontColor", new Color(0x333333)); |
filterBarOnFontColor | |
Sets the color used for the labels in the filter bar when the filter field is activated. |
<param name=filterBarOnFontColor value="white"> <param name=filterBarOnFontColor value="#333333"> setFontColor("filterBarOnFontColor", Color.white); setFontColor("filterBarOnFontColor", new Color(0x333333)); |
filterBarBackground | |
Sets the color used for the filter field background. |
<param name=filterBarBackground value="yellow"> <param name=filterBarBackground value="#cceecc"> setFilterBarBackground(Color.yellow); setFilterBarBackground(new Color(0xcceecc)); |
filterBarOnBackground | |
Sets the color used for the filter field background when the filter field is activated. |
<param name=filterBarOnBackground value="black"> <param name=filterBarOnBackground value="#333333"> setFilterBarOnBackground(Color.black); setFilterBarOnBackground(new Color(0x333333)); |
totalRowOn | |
Displays totals for all the columns or for individual columns. The sum of the rows is displayed for numerical columns, the total number of rows is shown for text columns. |
<param name=totalRowOn value="true"> <param name=totalRowOn value="0,2,3"> setTotalRowOn(-1, true); // all rows setTotalRowOn(0, true); setTotalRowOn(2, true); setTotalRowOn(3, true); |
totalRowFont | |
Sets the font used for the labels in the total row. |
<param name=totalRowFont value="Arial,plain,12"> <param name=totalRowFont value="Arial,bold,14"> <param name=totalRowFont value="Courier,italic,11"> <param name=totalRowFont value="Serif,bolditalic,16"> setFont("totalRowFont", new Font("Arial", Font.PLAIN, 12)); |
totalRowFontColor | |
Sets the color used for the labels in the total row. |
<param name=totalRowFontColor value="blue"> <param name=totalRowFontColor value="#333333"> setFontColor("totalRowFontColor", Color.blue); setFontColor("totalRowFontColor", new Color(0x333333)); |
background | |
Sets the color of the table component background (header, border, and filter bar). The colors are black, blue, cyan, darkgray, gray, green, lightgray, magenta, orange, pink, red, white, or yellow. You can also set the color using the hexadecimal color code. |
<param name=background value="red"> <param name=background value="#ff99c0"> setBackground(Color.red); setBackground(new Color(0xff99c0)); |
foreground | |
Sets the color of the header and filter bar labels. |
<param name=foreground value="yellow"> <param name=foreground value="#ff99c0"> setForeground(Color.yellow); setForeground(new Color(0xff99c0)); |
rowBackground | |
Sets the background color of the table rows. If an index is specified in the parameter, the background for that row is set. |
<param name=rowBackground value="yellow"> <param name=rowBackground_0 value="gray"> <param name=rowBackground value="#ff99c0"> setRowBackground(-1, yellow); // all rows setRowBackground(-1, new Color(0xff99c0)); // all rows setRowBackground(1, Color.gray); // row 1 |
rowForeground | |
Sets the label color of the table rows. If an index is specified in the parameter, the label color for that row is set. |
<param name=rowForeground value="blue"> <param name=rowForeground_0 value="red"> <param name=rowForeground value="#ff99c0"> setRowForeground(-1, red); // all rows setRowForeground(-1, new Color(0xff99c0)); // all rows setRowForeground(1, Color.blue); // row 1 |
alternateRowBackground | |
The alternateRowBackground enables you to set alternating colors for the rows and the row backgrounds will not move when the row order changes. The first value is the color (name or hex code), the second value is the count (1 and 1, 2 and 2 and so on). The third value is the index where the alternating color should start. |
<param name=alternateRowBackground value="gray"> <param name=alternateRowBackground value="gray,2"> <param name=alternateRowBackground value="gray,3,5"> setAlternateRowBackground(Color.gray, 2, -1); setAlternateRowBackground(Color.gray, 3, 5); |
rowFont | |
Sets the font used for the rows. You can also specify a font for individual rows using the row index. |
<param name=rowFont value="Arial,plain,12"> <param name=rowFont value="Arial,bold,14"> <param name=rowFont value="Courier,italic,11"> <param name=rowFont value="Serif,bolditalic,16"> <param name=rowFont_3 value="Arial,plain,8"> setFont("rowFont", new Font("Arial", Font.PLAIN, 12)); setRowFont(3, new Font("Arial", Font.PLAIN, 12)); |
gridOn | |
Turns on the grid. The grid will paint a square around each table cell. |
<param name=gridOn value="true"> setGridOn(true); |
gridColor | |
Sets the color of the grid. The default color is the background color. |
<param name=gridColor value="black"> <param name=gridColor value="#c0c0c0"> setGridColor(Color.black); setGridColor(new COlor(0xc0c0c0)); |
url_N_M | |
Sets a URL or javascript method call for a table cell, where N is the row index, and M is the cell index. The cell index is optional. If url_N is used, the url is active for the entire row. |
<param name=url_0 value="http://objectplanet.com/comp/Table"> <param name=url_2_1 value="index.html"> <param name=url_2_1 value="javascript:helloWorld();"> |
urltarget_N_M | |
Sets the name of the window where the url should be opened. urltarget - sets the default target. urltarget_N - sets the target for the specified row. urltarget_N_M - sets the target for the specified cell. |
_self: Open new page in same window or frame. _parent: Open in the parent window. _top: Open in the top-level window. _blank:Open in a new blank window. name:Open in the frame or window with the specified name. <param name=urltarget value="myframe"> <param name=urltarget_2 value="_parent"> <param name=urltarget_3_0 value="_blank"> |
urlColor | |
Sets the color of the url links. | <param name=urlColor value="red"> |
urlStyle | |
Sets the style of the url links. Different styles are line and noline. |
<param name=urlStyle value="line"> <param name=urlStyle value="noline"> |
exportFrameIcon | |
Sets the icon used in the frame border for a data export window. |
<param name=exportFrameIcon value="icon_network.gif" setExportFrameIcon(image); |
2. INSTALLATION
Unzip the table distribution file onto a directory on your system. The files will be unzipped into a directory named \Table. Applets are small java programs embedded and executed in web pages. An applet tag tells the web browser to download a set of java classes from the web server and execute the applet. To run the java table applet, do the following:
All the table parameters are defined using the applet param tag
See the parameter list for details. If you can not or do not want to have the com.objectplanet.gui.Table.jar file in the same directory as your applet files you can put them in another directory on your web server (needs to be accessible to the clients) and use a relative (or absolute) path in your archive tag.
archive="../../classes/com.objectplanet.gui.Table.jar" The table consist of a TableData, Table, TableEvent, and TableListener class.
TableData
- contains the table data, rows of String[] data. When you compile and run a java application the compiler or java runtime needs to know where the Table's java classes are. If you are using the Java Developers Kit (JDK) version 1.1 add the com.objectplanet.gui.Table.jar file to your CLASSPATH. set CLASSPATH=%CLASSPATH%;c:\Table\com.objectplanet.gui.Table.jar If you are using JDK 1.2 or newer place the com.objectplanet.gui.Table.jar file in the jre\lib\ext directory of the JDK directory. If you are using Microsoft Visual J++ or any other development environment, import the com.objectplanet.gui.Table.jar file into the environment so the compiler and runtime will find it. Then you need to import the table package in your java application.
Now compile the java program and run it (JDK).
All the table's parameters are accessed using setter and getter methods pairs in the following general format
See the parameter list for details. The table's data can be added in two ways, either through the applet parameters or loading it from a specified url that deliveres the data. In java the setRow() method is used to add the data. 3.1 loading data through the applet parameters If you use the applet parameters for loading data, the data is added row by row, using the row_N parameter where the N is the row index and the first row has index 0.
<applet code=com.objectplanet.gui.Table
In java you use the setRow() method to add or update rows. An index of -1 adds a new row, a non negative index updates or sets the specified row.
Use the header parameter to set the table header label or labels.
<applet code=com.objectplanet.gui.Table
In java you use the setHeader() method to set the header labels.
You can have multiline headers by using \n in the label.
<applet code=com.objectplanet.gui.Table
You can add a tooltip for the header by using the tooltipHeader_0 parameter. The delay before the tooltip is displayed can be configured with the tooltipDelay or tooltipDelayHeader parameter. The tooltip background color is controlled with the tooltipBackground parameter.
<applet code=com.objectplanet.gui.Table
If you want to load the applet data and parameters from a url, you can specify the url in the data parameter in your applet tag as below
<applet code=com.objectplanet.gui.Table
Only an applet can load the data from a URL. The parameters.data file looks like this:
header=this is the header The data url can point to a script that produces the data as long as the format returned is as in the example above. The table can refresh the data from the URL periodically by using the dataInterval parameter. The applet below will read the data from the specified URL every 20 seconds.
<applet code=com.objectplanet.gui.Table This applet will remove all rows before reading the new data.
<applet code=com.objectplanet.gui.Table For table applets with lots of data that takes some time to load, you can display a message and a progress indicator while it is loading. This is done with the loadingMessageOn parameter. You can also configure the message displayed with the loadingDataMessage parameter.
<param name=loadingMessageOn value="true"> You can also update the table at runtime, by calling the updateData() method or hitting the F5 key. The updateData() method loads the data from the URL specified in the data parameter. You can update the data parameter before calling updateData().
You can also call the loadURLParameters() method directly.
The table can consist of multiple columns. Use the columnCount parameter to control the number of columns. Use comma (,) as a field separator when adding rows and setting the header for a multicolumn table.
<applet code=com.objectplanet.gui.Table
In java the number of columns is set in the Table constructor. When adding a row with multiple fields you use a string array with one string per field.
You can also set individual header fields.
Use the tooltipHeader_N parameter to set a tooltip label for each header.
<applet code=com.objectplanet.gui.Table
In java use the setTooltip() method.
You can set the background color for each header field.
<applet code=com.objectplanet.gui.Table
If your data contain a comma (,) you can control the field separator using the fieldSeparator parameter. The field separator is only needed in applets and affects the header, filter, and row_N parameters.
<applet code=com.objectplanet.gui.Table
You can get the data in CSV format calling the getExportData(separator) method. You can open a window with the export data using the exportData(width, height, separator) method. You can then use copy & paste to export the data. See the DataExportTable example that adds a popup menu for exporting the data. You can control the icon used for the export windows using the exportFrameIcon parameter or the setExportFrameIcon(Image) method.
You can control the width and data type of each column. You can also add prefix and postfix labels for each column and control the number of decimals to be displayed for numerical columns. 4.1 setting the column width You can control the width of each column using the columnWidth parameter. This parameter takes a comma separated list of positive integer values.
<applet code=com.objectplanet.gui.Table
In java you use the setColumnWidth() method to control the column width.
You can also set the column width relative to the table width and the other columns. If you turn on the columnStretchOn parameter, the columns will always stretch to the full width of the table even if the user adjusts the width at runtime.
<applet code=com.objectplanet.gui.Table
In java you use the setColumnStretchOn() method.
You can double click on a column edge to auto-adjust the column to the width of the widest label. 4.2 setting the column alignment You can set the alignment of the labels in the columns by using the columnAlignment parameter. This parameter takes a comma separated list of the values "left", "center", or "right". The default alignment is left.
<applet code=com.objectplanet.gui.Table
In java you use the setColumnAlignment() method.
4.3 collapsing columns In addition to being able to adjust the column width at runtime, the user can collapse entire columns by clicking a collapse-button in each headerfield for the respective columns. The column that can be collapsed is configured using the columnCollapsable parameter.
<applet code=com.objectplanet.gui.Table
You can also configure columns to be collapsed when the applet initially loads using the columnCollapsed parameter.
<applet code=com.objectplanet.gui.Table
In java you use the setColumnCollapsable() and setColumnCollapsed() methods.
The columns can either contain textual, numerical, ip addresses, or date and time data. If you want to sort numerical rows correctly, you must set the column type to numerical. To display currency data, the column type should be set to currency.
<applet code=com.objectplanet.gui.Table
In java you use the setColumnType method.
4.5 setting the column prefix and postfix You can add a prefix and postfix label to the labels in each column. To add a prefix label to a column, use the prefix_N parameter, where N is the column number (0-based). To add a postfix label to a column, use the postfix_N parameter, where N is the column number.
<applet code=com.objectplanet.gui.Table
In java you use the setPrefix() and setPostfix() methods.
4.6 setting the column decimal count You can control the number of decimals displayed for floating point values in each column by setting the decimalCount_N parameter where N is the column number and 0 is the first column.
<applet code=com.objectplanet.gui.Table
In java you use the setDecimalCount() method.
4.7 setting locale and internationalization Numeric columns display numbers with the format used by the locale (country+language) set in the client's browser or operating system environment. You can control the display of numbers by using the locale parameter. The locale also controls the currency symbol in currency columns. <param name=locale value="en,us"> The first value parameter (en) is the language, the second is the country.
<applet code=com.objectplanet.gui.Table
<param name=header value="British Pounds">
<param name=header value="Euro">
In java you use the setLocale() method.
You can also control the thousands delimiter explisitly using the thousandsDelimiter parameter. You can turn off thousands grouping (nice for ID numbers) by setting it to false.
<param name=thousandsDelimiter value="."> table.setThousandsDelimiter("."); 4.8 loading and displaying dates A date type column displays dates in the current locale that has been set and sorts them in correct order. For an applet to read the date parameters correctly a pattern string is used to specify the pattern of the input dates. The dateFormat parameter is used to specify the format in which dates are displayed. To specify a format for a specific column, use dateFormat_N where N is the column index. The dateFormatInput parameter is used to specify the pattern in which the dates are read. To specify a format for a specific column, use dateFormatInput_N where N is the column index. If this parameter is not specified the pattern of the dateFormat parameter is used as the default pattern. The dateFormatInputLocale parameter is used to specify the language of the dates that are read. Check here for the date pattern documentation.
<applet code=com.objectplanet.gui.Table
In the applet above, the input dates are specified in english with named months (just for complexity:). The input pattern specifies MMM meaning the three first letters of the month name is used, and the input locale is set to 'en' specifying the english language. The dates are displayed with the comlete name of the month specified with the MMMM pattern, the output language is set to Norwegian. In java you use a Date object for the values in the row. Then you can use a DateFormat or SimpleDateFormat object to format the display of the date. Use the setDateFormatter(column, formatter) method to set the date formatter used for each column, or use -1 for the column index to set the default date formatter.
4.9 loading and displaying images You can display an image in the header fields using the headerImage_N parameter.
<param name=headerImage_0 value="folder.gif">
In java use the setHeaderImage(column, image) method.
You can display an image in the table cells using the image_N and cellImage_N_M parameters. The first one displays an image for the entire column, while the latter one sets a image for a single cell.
<param name=image_0 value="folder.gif">
In java use the setImage(column, row, image) method. If you use -1 for the row, the image is set for the entire column.
<param name=cellImage_1_0 value="folder.gif">
In java use the setImage(column, row, image) method.
The user can interactively sort, search, and filter the table data by using the filter bar. 5.1 setting the selection mode By default the user can not select any rows. By setting the selection mode the user can select either single rows or multiple rows at a time. Use the selectionMode parameter to control the selection type. In multiple selection mode, holding down shift will select multiple rows while using the up and down buttons.
<param name=selectionMode value="none">
<applet code=com.objectplanet.gui.Table
<applet code=com.objectplanet.gui.Table
In java you use the setSelectionMode() method.
Use the selectionBackground, selectionForeground, and selectionCellBackground parameters to control the colors of a selected row and cell. The user can search for rows by typing in the text to search for in the filter bar. Turn the filter bar on by using the filterBarOn parameter. You navigate the filter field with home, end, left, right, backspace, and delete. Tab and Shift+Tab moves between the filter fields.
<applet code=com.objectplanet.gui.Table
Left click a field in the filter bar at the bottom and start typing in any of the names found in the table's data. The row with the text will automatically be selected. In java you use the setFilterBarOn() method to turn on the filter bar.
The user can sort the rows by clicking the column headers. The rows are first sorted in their default sort order (set using the defaultSortOrder parameter) then if clicked again, they are flipped in the opposite order. You must set the columnType parameter to number or currency to sort numerical data correctly, and the column type to date if you want to sort date columns correctly.
<applet code=com.objectplanet.gui.Table
Click the column headers to sort the rows. In the applet above, the last column is sorted in ascending order by default. To sort the column in descending order, use the defaultSortOrder parameter.
<applet code=com.objectplanet.gui.Table
By default the rows are sorted by the sequence they are added. Use the sortedColumn to sort a specific column when the applet is loaded. The applet below is sorted by the third column.
<applet code=com.objectplanet.gui.Table
You can turn off sorting by setting the sortingOff parameter to true.
<applet code=com.objectplanet.gui.Table
Clicking the column headers now will not sort the rows. You can also control the sorting for individual columns by setting the column indices in the sortingOff parameter.
<applet code=com.objectplanet.gui.Table
The second column in the above example can not be sorted. In java you use the setSortingOn() method to control sorting behavior.
The user can interactively filter out the rows in the table by using the filter bar. When a row is selected, the filter bar is filled out with the row data. If you right click the filter field, the filter is activated and only rows that matches the filter are displayed. Another right-click will release the filter. You can also filter out rows by typing text in the filter field. The filter field gets the keyboard focus when you left click the field. Enter will activate the filter. You navigate the filter field with home, end, left, right, backspace, and delete. Tab and Shift+Tab moves between the filter fields.
filter* - display only strings that start with filter Turn on the filter bar with the filterBarOn parameter.
<applet code=com.objectplanet.gui.Table
By selecting a row, the text from the row is set in the fields of the filter bar. You can then push the filter bar field to display only rows with the same text in that column. You can also filter out rows by typing in text, and activating the filter by typing enter or clicking the left mouse button. In java you use the setFilterBarOn() method to turn on the filter bar.
You can set the initial value of the filter bar when the applet loads using the filter and filterOn parameters.
<applet code=com.objectplanet.gui.Table
You can enable or diable filter fields to control user interaction by usin the setFilterEnabled() method or filterEnabled parameter.
<applet code=com.objectplanet.gui.Table
6.2 setting the filter wild card You can filter out fields that start with, end with, or contain the typed text. This is done using the filter wild card which is an asterisk (*) by default.
If you type in B* in the first column and activate the filter, 4 rows with BarChartApplet and Border will be displayed. If you type in *applet in the first field and activate the filter, all the rows with applet will be shown. If you type in *chart* all the chart products will be displayed. You can control the wildcard to be used by setting the filterWildCard parameter. <param name=filterWildCard value="%">
Now try using % instead of * when filtering. In java you use the setFilterWildCard() method.
If you set the filter wild card to "" (empty) to table will sort out rows including the text in the filter field (as in *filter*).
<param name=filterWildCard value="">
Type in chart in the leftmost filter field and then enter. This will display all the chart products. 6.3 using progressive filtering You can configure the table to filter out rows as you type by using the progressiveFilterOn parameter and the filterWildCard parameter in combination.
<param name=filterWildCard value="">
Activate the leftmost filter field by moving the mouse pointer over it and typing enter or clicking the left mouse button. Then start typing; for example chart and the table will automatically display all the chart products. If you continue and type charts the table will only display the EasyCharts rows. In java you use the setProgressiveFilterOn() method.
6.4 setting tooltip filter labels You can add tooltip labels for the filter fields by using the tooltipFilter parameter. The tooltip labels appear after 1.5 seconds of entering the filter field. This delay can be set using the tooltipDelay parameter. Use \n for multiline tooltip labels.
<param name=filterBarOn value=true>
Move the mouse over a filter field to display the tooltip label. You can set tooltip labels per filter field by using the tooltipFilter_N parameters where N is the field index.
<param name=filterBarOn value=true>
The table can display the total sum for numerical columns, and total number of rows displayed for text columns. You can turn on totalling for all columns by using the totalRowOn parameter. <param name=totalRowOn value=true>
By filtering out rows, the totals per column will change. You can also control the totals per column: <param name=totalRowOn value="0,2">
In java you use the setTotalRowOn() method.
You can control the background color, foreground color, row label color, row background color, and the table grid. 7.1 setting the background and foreground color You set the background and foreground color of the table using the background and foreground parameters. The colors that can be set are black, blue, cyan, darkgray, gray, green, lightgray, magenta, orange, pink, red, white, and yellow as well as customized colors using url hex codes.
<param name=background value="#ff7070">
The background color is the color of the table border, header fields, and filter fields. The foreground color is the color of the header and field labels. In java you use the setForeground() and setBackground() methods.
You can set the background and label color of the rows by using the rowBackground and rowForeground paramters.
<param name=rowBackground value="black">
In java you use the setRowForeground() and setRowBackground() methods.
You can set the color for individual rows by adding an index to the parameters.
<param name=rowBackground value="gray">
You can set rows to have alternating background colors using the alternateRowBackground parameter. Try and sort the rows in the applets below.
<param name=alternateRowBackground value="lightgray">
The parameter value consists of three fields, the color, the row count, and the row start. The color can be the color name or the color hex code. The count is the number of succesive rows with the same color. The start field is the position where the alternating color should start. The count and start fields are optional.
<param name=alternateRowBackground value="lightgray,3,1">
7.3 setting the table cell grid You can display a cell grid by turning on the gridOn parameter. The color of the grid is the same as the table background, but can be set using the gridColor parameter.
<param name=gridOn value=true>
In java you use the setGridOn() and setGridColor() methods.
You can set the default font used for the table using the font parameter. The font type is specified by the font name, the style, and the size.
<param name=font value="Arial,plain,14">
In java you use the setFont() method.
7.5 setting the header font and color You can set the header font and color using the headerFont and headerFontColor parameters. The font type is specified by the font name, the style, and the size. The color is specified by the color name or a hex color code.
<param name=headerFont value="Arial,bold,14">
In java you use the setFont("headerFont", Font) and setFontColor("headerFontColor", Color) methods.
You can set the default row font using the rowFont parameter. You can also set the font for individual rows by specifying the index of the row. The font type is specified by the font name, the style, and the size.
<param name=rowFont value="Courier,plain,11">
In java you use the setFont("rowFont", Font) or setRowFont() method.
7.7 setting the total row font and color You can set the font and font color used in the total row using the totalRowFont and totalRowFontColor parameters. The font type is specified by the font name, the style, and the size. The color is specified by the color name or a hex color code.
<param name=totalRowOn value="true">
In java you use the setFont("totalRowFont", Font) and setFontColor("totalRowFontColor", Color) methods.
7.8 setting the filter bar font and color You can set the font and color of the filter bar using the filterBarFont, filterBarFontColor, filterBarBackground, filterBarOnFontColor, and filterBarBackground parameters. The font type is specified by the font name, the style, and the size. The color is specified by the color name or a hex color code.
<param name=filterBarOn value="true">
Select one of the rows in the applet above to set the filter bar values. In java you use the setFont("filterBarFont", Font) and setFontColor("filterBarFontColor", Color) methods.
7.9 setting the filter bar position You can control the position of the filter bar by using the filterBarPosition parameter. The default position is at the bottom of the table, but it can also be placed at the top.
<param name=filterBarOn value="true">
Select one of the rows in the applet above to set the filter bar values. In java you use the setFilterBarPosition(Table.TOP) and setFilterBarPosition(Table.BOTTOM) methods.
You can add a URL to each row or individual cell. The URL can be a web page, file, or any valid URL type as well as a javascript function on the applet page. Add a url link for the rows in the table using the url_N_M parameter, where N is the row index and M is the cell index. The cell index is optional.
<param name="url_0_0" value="http://objectplanet.com/EasyCharts">
Click on the links to open web page. You can also set the link directly from the row parameter using the following format <param name=row_0 value="<url:http://objectplanet.com>ObjectPlanet website">
8.2 setting the url target window By default the new web page is opened in the same window as the applet. This can be controlled using the urlTarget_N_M parameter, where N is the row index and M is the cell index.
urlTarget - sets the default target. The value of the urlTarget parameter can be one of the following:
_self: Open new page in same window or frame.
<param name="urlTarget" value="main">
8.3 calling javascript methods You can call javascript methods when a row or cell is selected. Remember to include the MAYSCRIPT parameter in your applet tag.
<html>
The style of the links can be set. You can set the color of the label and link line using the urlColor parameter. You can set the style of the url link using the urlStyle paramter.
<param name="urlColor" value="red">
You can turn off the link line.
<param name="urlColor" value="red">
|