1 18 19 package org.objectweb.jac.ide.diagrams; 20 21 import org.objectweb.jac.aspects.gui.FieldUpdate; 22 import org.objectweb.jac.aspects.gui.Utils; 23 import org.objectweb.jac.core.rtti.ClassRepository; 24 import org.objectweb.jac.core.rtti.FieldItem; 25 import org.objectweb.jac.ide.Class; 26 import java.awt.Color ; 27 28 public class ClassNameFigure extends TextFigure implements FieldUpdate { 29 30 Class substance; 31 ClassFigure parentFigure; 32 33 static FieldItem nameField = 34 ClassRepository.get().getClass(Class .class).getField("name"); 35 36 public ClassNameFigure(Class substance, ClassFigure parentFigure) { 37 this.substance = substance; 38 this.parentFigure = parentFigure; 39 super.setText(substance.getName()); 40 Utils.registerField(substance,nameField,this); 41 } 42 43 public Color getTextColor() { 44 return parentFigure.getColor(); 45 } 46 47 51 public Class getSubstance() { 52 return substance; 53 } 54 55 59 public void setSubstance(Class v) { 60 this.substance = v; 61 } 62 63 public String getName() { 64 return getText(); 65 } 66 67 public void setText(String s) { 68 super.setText(s); 69 if (substance != null && !DiagramView.init) { 70 substance.setName(s); 71 } 72 } 73 74 public void fieldUpdated(Object substance, FieldItem field, Object 76 value, Object param) { 77 super.setText((String )value); 78 } 79 } 80 | Popular Tags |