1 29 30 package nextapp.echo2.app; 31 32 36 public class DerivedMutableStyle extends MutableStyle { 37 38 private Style parentStyle; 39 40 43 public DerivedMutableStyle() { 44 super(); 45 } 46 47 53 public DerivedMutableStyle(Style parentStyle) { 54 this.parentStyle = parentStyle; 55 } 56 57 62 public Style getParentStyle() { 63 return parentStyle; 64 } 65 66 69 public Object getIndexedProperty(String propertyName, int propertyIndex) { 70 if (super.isIndexedPropertySet(propertyName, propertyIndex)) { 71 return super.getIndexedProperty(propertyName, propertyIndex); 72 } else if (parentStyle != null) { 73 return parentStyle.getIndexedProperty(propertyName, propertyIndex); 74 } else { 75 return null; 76 } 77 } 78 79 82 public Object getProperty(String propertyName) { 83 if (super.isPropertySet(propertyName)) { 84 return super.getProperty(propertyName); 85 } else if (parentStyle != null) { 86 return parentStyle.getProperty(propertyName); 87 } else { 88 return null; 89 } 90 } 91 92 95 public boolean isIndexedPropertySet(String propertyName, int propertyIndex) { 96 return super.isIndexedPropertySet(propertyName, propertyIndex) 97 || (parentStyle != null && parentStyle.isIndexedPropertySet(propertyName, propertyIndex)); 98 } 99 100 103 public boolean isPropertySet(String propertyName) { 104 return super.isPropertySet(propertyName) || (parentStyle != null && parentStyle.isPropertySet(propertyName)); 105 } 106 107 113 public void setParentStyle(Style parentStyle) { 114 this.parentStyle = parentStyle; 115 } 116 } 117 | Popular Tags |