xref: /titanic_41/usr/src/cmd/krb5/kadmin/gui/visualrt/sunsoft/jws/visual/rt/awt/CLComponent.java (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * ident	"%Z%%M%	%I%	%E% SMI"
24  *
25  * Copyright (c) 2000 by Sun Microsystems, Inc.
26  * All rights reserved.
27  */
28 
29 /**
30  * Copyright 1996 Active Software Inc.
31  *
32  * @version @(#)CLComponent.java 1.6 96/11/08
33  */
34 
35 package sunsoft.jws.visual.rt.awt;
36 
37 import java.awt.*;
38 
39 public abstract class CLComponent {
40     protected ColumnListCanvas canvas;
41     protected int row, column;
42     protected String text;
43     private boolean editable;
44 
CLComponent(String text)45     public CLComponent(String text) {
46         setText(text);
47         this.editable = true;
48     }
49 
setCanvas(ColumnListCanvas canvas, int row, int column)50     void setCanvas(ColumnListCanvas canvas, int row, int column) {
51         this.canvas = canvas;
52         this.row = row;
53         this.column = column;
54     }
55 
setText(String text)56     public void setText(String text) {
57         setText(text, true);
58     }
59 
setText(String text, boolean update)60     public void setText(String text, boolean update) {
61         this.text = text;
62         if (canvas != null) {
63             canvas.adjustColumnWidths(this, column);
64             if (update)
65                 canvas.updateView();
66         }
67     }
68 
getText()69     public String getText() {
70         return text;
71     }
72 
setEditable(boolean value)73     public void setEditable(boolean value) {
74         this.editable = value;
75     }
76 
getEditable()77     public boolean getEditable() {
78         return editable;
79     }
80 
toString()81     public String toString() {
82         return text;
83     }
84 
textX()85     public abstract int textX();
textY()86     public abstract int textY();
size()87     public abstract Dimension size();
paint(Graphics g, int x, int y, int width, int height, int ascent, int alignment)88     public abstract void paint(Graphics g, int x, int y, int width,
89 			       int height, int ascent, int alignment);
90 
mouseDown(Event evt)91     public boolean mouseDown(Event evt) {
92         return false;
93     }
94 }
95