1 4 package org.oddjob.designer.model; 5 6 import java.util.Observable ; 7 8 14 abstract public class SimpleAttribute extends Observable 15 implements DesignAttribute { 16 17 18 private String attribute; 19 20 24 public String attribute() { 25 return attribute; 26 } 27 28 32 public void attribute(String value) { 33 if ("".equals(value)) { 34 attribute = null; 35 } 36 else { 37 attribute = value; 38 } 39 setChanged(); 40 notifyObservers(DEObservable.attributeChanged(attribute)); 41 } 42 43 47 public boolean hasDetail() { 48 try { 49 getClass().getDeclaredMethod("detail", new Class [0]); 50 return true; 51 } catch (NoSuchMethodException e) { 52 return false; 53 } 54 } 55 56 59 public DesignDefinition detail() { 60 throw new IllegalStateException ("Call hasDetail first!"); 61 } 62 63 64 68 public void clear() { 69 attribute(null); 70 } 71 72 } 73 | Popular Tags |