1 package com.nightlabs.editor2d.model; 2 3 import java.util.List ; 4 5 import com.nightlabs.editor2d.EditorPlugin; 6 import com.nightlabs.editor2d.EllipseDrawComponent; 7 import com.nightlabs.editor2d.properties.IntPropertyDescriptor; 8 9 public class EllipsePropertySource 10 extends ShapeDrawComponentPropertySource 11 { 12 public EllipsePropertySource(EllipseDrawComponent ellipse) { 13 super(ellipse); 14 } 15 16 protected EllipseDrawComponent getEllipseDrawComponent() { 17 return (EllipseDrawComponent) drawComponent; 18 } 19 20 protected List createPropertyDescriptors() 21 { 22 List descriptors = super.createPropertyDescriptors(); 23 descriptors.add(new IntPropertyDescriptor(EllipseDrawComponent.PROP_START_ANGLE, 25 EditorPlugin.getResourceString("property.startangle.label"))); 26 descriptors.add(new IntPropertyDescriptor(EllipseDrawComponent.PROP_END_ANGLE, 28 EditorPlugin.getResourceString("property.endangle.label"))); 29 30 return descriptors; 31 } 32 33 36 public void setPropertyValue(Object id, Object value) 37 { 38 super.setPropertyValue(id, value); 39 40 if (id.equals(EllipseDrawComponent.PROP_START_ANGLE)) { 41 getEllipseDrawComponent().setStartAngle(((Integer )value).intValue()); 42 } 43 else if (id.equals(EllipseDrawComponent.PROP_END_ANGLE)) { 44 getEllipseDrawComponent().setEndAngle(((Integer )value).intValue()); 45 } 46 } 47 48 51 public Object getPropertyValue(Object id) 52 { 53 Object o = super.getPropertyValue(id); 54 if (o != null) 55 return o; 56 else 57 { 58 if (id.equals(EllipseDrawComponent.PROP_START_ANGLE)) { 59 return new Integer (getEllipseDrawComponent().getStartAngle()); 60 } 61 else if (id.equals(EllipseDrawComponent.PROP_END_ANGLE)) { 62 return new Integer (getEllipseDrawComponent().getEndAngle()); 63 } 64 65 return null; 66 } 67 } 68 } 69 | Popular Tags |