1 27 28 package org.nightlabs.editor2d.edit; 29 30 import java.beans.PropertyChangeEvent ; 31 32 import org.eclipse.ui.views.properties.IPropertySource; 33 34 import org.nightlabs.editor2d.TextDrawComponent; 35 import org.nightlabs.editor2d.model.TextPropertySource; 36 37 public class TextEditPart 38 extends ShapeDrawComponentEditPart 39 { 40 public TextEditPart(TextDrawComponent text) 41 { 42 super(text); 43 } 44 45 public TextDrawComponent getTextDrawComponent() { 46 return (TextDrawComponent) getModel(); 47 } 48 49 protected void propertyChanged(PropertyChangeEvent evt) 50 { 51 super.propertyChanged(evt); 52 String propertyName = evt.getPropertyName(); 53 if (propertyName.equals(TextDrawComponent.PROP_FONT)) { 54 LOGGER.debug(propertyName +" changed!"); 55 refreshVisuals(); 56 } 57 else if (propertyName.equals(TextDrawComponent.PROP_FONT_NAME)) { 58 LOGGER.debug(propertyName +" changed!"); 59 refreshVisuals(); 60 } 61 else if (propertyName.equals(TextDrawComponent.PROP_FONT_SIZE)) { 62 LOGGER.debug(propertyName +" changed!"); 63 refreshVisuals(); 64 } 65 else if (propertyName.equals(TextDrawComponent.PROP_TEXT)) { 66 LOGGER.debug(propertyName +" changed!"); 67 refreshVisuals(); 68 } 69 else if (propertyName.equals(TextDrawComponent.PROP_BOLD)) { 70 LOGGER.debug(propertyName +" changed!"); 71 refreshVisuals(); 72 } 73 else if (propertyName.equals(TextDrawComponent.PROP_ITALIC)) { 74 LOGGER.debug(propertyName +" changed!"); 75 refreshVisuals(); 76 } 77 } 78 79 82 protected IPropertySource getPropertySource() 83 { 84 if (propertySource == null) 85 { 86 propertySource = 87 new TextPropertySource(getTextDrawComponent()); 88 } 89 return propertySource; 90 } 91 92 134 159 } 160 | Popular Tags |