ColumnListShadow.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (C) 1996 Active Software, Inc.
* All rights reserved.
*
* @(#) ColumnListShadow.java 1.39 - last change made 08/12/97
*/
/**
* Wraps an AWT widget. The attributes available for this
* class are listed below. In the type column, type names beginning
* with "sunsoft.jws.visual.rt" have been abbreviated to begin with
* "rt".
*
* < pre>
name type default value
-----------------------------------------------------------------------
autoWidth java.lang.Boolean true
visibleChars java.lang.Integer 0
visibleRows java.lang.Integer 5
headers [Ljava.lang.String; header1, header2, header3
formats java.lang.String lll
highlightItems java.lang.Boolean false
selectable java.lang.Boolean true
editable java.lang.Boolean true
showHeaders java.lang.Boolean true
showVerticalLines java.lang.Boolean false
showHorizontalLines java.lang.Boolean false
sortColumns [Ljava.lang.String; null
* < /pre>
*
* headers: An array of Strings. The size of this array determines the
* number of columns in the list. There will be one additional, hidden
* column that can be used for any Object. The length of the header
* string defines the initial width of the column. To make it wider,
* add spaces to the end of the string. If a header field is of the
* form "name=header", then only the "header" part will actually be
* used for the visible header. The "name" part is available through
* getNames() or getNameColumn() interfaces on the ColumnList widget.
* If the "name" part is started with a '*', then that column is
* considered a "key column." When addItem() is used to add a new row
* of data to the column list, a check is made to see if the key
* columns of data in the new item exactly match all of the key
* columns in any of the current rows. If there is a match, the new
* data replaces what was in the matched row, rather than the new data
* being added to the end in a new row.
* < p>
* formats: A string with format characters for each column. The default
* is to left justify each column. 'l' left justifies, 'c' centers,
* and 'r' right justifies.
* < p>
* selectable: If true, records(rows) can be selected with the
* mouse. A LIST_EVENT gets posted.
* < p>
* editable: If true, records can be edited with the mouse. Columns
* containing a checkbox are currently the only editable columns.
* < p>
* highlight_items: If true, new entries will be highlighted in
* orange, slowly fading out.
* < p>
* showHeaders: If set to false, the headers will not be shown.
* < p>
* showVerticalLines: If set to true, columns will be separated by lines
* < p>
* showHorizontalLines: If set to true, rows will be separated by lines
* < p>
* sortColumns: an array of column names(see headers), optionally
* preceded with a '+' f o r ascending(default) or '-' for descending
* sort. Affects where new entries will be added.
* < p>
* autoWidth: when set to true, a column will automatically become
* wider to accomodate a new piece of data in that column that doesn't
* fit within the current width of the column.
* < p>
* Check the super class for additional attributes.
*
* @see ColumnList
* @version 1.39, 08/12/97
*/
public class ColumnListShadow extends CanvasShadow {
public ColumnListShadow() {
/* NOI18N */"header2",
/* NOI18N */"header3"};
/* NOI18N */"java.lang.String",
/* NOI18N */"lll", 0);
/* NOI18N */"java.lang.Boolean",
/* NOI18N */"java.lang.Integer",
/* NOI18N */"java.lang.Integer",
GBConstraints c =
/* NOI18N */"sunsoft.jws.visual.rt.awt.GBConstraints", c);
// This is a work around for JDK color bug.
// The defaults are not correctly set
/* NOI18N */"java.awt.Color",
}
/* NOI18N */"java.awt.Color",
/* NOI18N */"java.awt.Color",
}
}
else
}
{
// check if the string consists only of
// l, c, r characters..
for (int i = 0; i < s.length(); i++)
{
char c = s.charAt(i);
if ((c == /* NOI18N */ 'c') ||
(c == /* NOI18N */ 'l') ||
(c == /* NOI18N */ 'r'))
continue;
else
/* BEGIN JSTYLED */
throw new VJException(Global.getMsg("sunsoft.jws.visual.rt.shadow.ColumnListShadow.Column__Format"));
}
}
{
}
/* END JSTYLED */
else
}
public void createBody() {
body = new ColumnList(
/* BEGIN JSTYLED */
((ColumnList) body).setVisibleChars(((Integer) getFromTable(/* NOI18N */"visibleChars")).intValue());
((ColumnList) body).setShowHeaders(((Boolean) getFromTable(/* NOI18N */"showHeaders")).booleanValue());
((ColumnList) body).setShowHorizontalLines(((Boolean) getFromTable(/* NOI18N */"showHorizontalLines")).booleanValue());
((ColumnList) body).setShowVerticalLines(((Boolean) getFromTable(/* NOI18N */"showVerticalLines")).booleanValue());
/* END JSTYLED */
}
}