1 27 28 package org.nightlabs.editor2d.model; 29 30 import java.util.List ; 31 32 import org.nightlabs.base.property.IntPropertyDescriptor; 33 import org.nightlabs.editor2d.EditorPlugin; 34 import org.nightlabs.editor2d.EllipseDrawComponent; 35 36 public class EllipsePropertySource 37 extends ShapeDrawComponentPropertySource 38 { 39 public EllipsePropertySource(EllipseDrawComponent ellipse) { 40 super(ellipse); 41 } 42 43 protected EllipseDrawComponent getEllipseDrawComponent() { 44 return (EllipseDrawComponent) drawComponent; 45 } 46 47 protected List createPropertyDescriptors() 48 { 49 List descriptors = super.createPropertyDescriptors(); 50 descriptors.add(new IntPropertyDescriptor(EllipseDrawComponent.PROP_START_ANGLE, 52 EditorPlugin.getResourceString("property.startangle.label"))); 53 descriptors.add(new IntPropertyDescriptor(EllipseDrawComponent.PROP_END_ANGLE, 55 EditorPlugin.getResourceString("property.endangle.label"))); 56 57 return descriptors; 58 } 59 60 63 public void setPropertyValue(Object id, Object value) 64 { 65 super.setPropertyValue(id, value); 66 67 if (id.equals(EllipseDrawComponent.PROP_START_ANGLE)) { 68 getEllipseDrawComponent().setStartAngle(((Integer )value).intValue()); 69 } 70 else if (id.equals(EllipseDrawComponent.PROP_END_ANGLE)) { 71 getEllipseDrawComponent().setEndAngle(((Integer )value).intValue()); 72 } 73 } 74 75 78 public Object getPropertyValue(Object id) 79 { 80 Object o = super.getPropertyValue(id); 81 if (o != null) 82 return o; 83 else 84 { 85 if (id.equals(EllipseDrawComponent.PROP_START_ANGLE)) { 86 return new Integer (getEllipseDrawComponent().getStartAngle()); 87 } 88 else if (id.equals(EllipseDrawComponent.PROP_END_ANGLE)) { 89 return new Integer (getEllipseDrawComponent().getEndAngle()); 90 } 91 92 return null; 93 } 94 } 95 } 96 | Popular Tags |