1 8 package com.nightlabs.editor2d.edit; 9 10 import java.beans.PropertyChangeEvent ; 11 12 import org.eclipse.ui.views.properties.IPropertySource; 13 14 import com.nightlabs.editor2d.TextDrawComponent; 15 import com.nightlabs.editor2d.model.TextPropertySource; 16 17 public class TextEditPart 18 extends ShapeDrawComponentEditPart 19 { 20 public TextEditPart(TextDrawComponent text) 21 { 22 super(text); 23 } 24 25 public TextDrawComponent getTextDrawComponent() { 26 return (TextDrawComponent) getModel(); 27 } 28 29 protected void propertyChanged(PropertyChangeEvent evt) 30 { 31 super.propertyChanged(evt); 32 String propertyName = evt.getPropertyName(); 33 if (propertyName.equals(TextDrawComponent.PROP_FONT)) { 34 LOGGER.debug(propertyName +" changed!"); 35 refreshVisuals(); 36 } 37 else if (propertyName.equals(TextDrawComponent.PROP_FONT_NAME)) { 38 LOGGER.debug(propertyName +" changed!"); 39 refreshVisuals(); 40 } 41 else if (propertyName.equals(TextDrawComponent.PROP_FONT_SIZE)) { 42 LOGGER.debug(propertyName +" changed!"); 43 refreshVisuals(); 44 } 45 else if (propertyName.equals(TextDrawComponent.PROP_TEXT)) { 46 LOGGER.debug(propertyName +" changed!"); 47 refreshVisuals(); 48 } 49 else if (propertyName.equals(TextDrawComponent.PROP_BOLD)) { 50 LOGGER.debug(propertyName +" changed!"); 51 refreshVisuals(); 52 } 53 else if (propertyName.equals(TextDrawComponent.PROP_ITALIC)) { 54 LOGGER.debug(propertyName +" changed!"); 55 refreshVisuals(); 56 } 57 } 58 59 62 protected IPropertySource getPropertySource() 63 { 64 if (propertySource == null) 65 { 66 propertySource = 67 new TextPropertySource(getTextDrawComponent()); 68 } 69 return propertySource; 70 } 71 72 114 139 } 140 | Popular Tags |