KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > ide > diagrams > MemberFigure


1 /*
2   Copyright (C) 2003 Laurent Martelli <laurent@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 */

18
19 package org.objectweb.jac.ide.diagrams;
20
21 import java.awt.Color JavaDoc;
22 import org.objectweb.jac.ide.ModelElement;
23
24 public abstract class MemberFigure extends TextFigure
25    implements ModelElementFigure
26 {
27    ClassFigure parentFigure;
28
29    public MemberFigure(ClassFigure parentFigure) {
30       this.parentFigure = parentFigure;
31    }
32
33    public Color JavaDoc getTextColor() {
34       return parentFigure.getColor();
35    }
36
37    public String JavaDoc getType() {
38       String JavaDoc text = getText();
39       int sep = text.indexOf(':');
40       if (sep == -1) {
41          return "";
42       } else {
43          return text.substring(sep+1).trim();
44       }
45    }
46
47    public String JavaDoc getName() {
48       String JavaDoc text = getText();
49       int sep = text.indexOf(':');
50       if (sep == -1) {
51          return text.trim();
52       } else {
53          return text.substring(0,sep).trim();
54       }
55    }
56
57    public abstract ModelElement getSubstance();
58 }
59
Popular Tags