1 8 package com.nightlabs.editor2d.command; 9 10 import org.apache.log4j.Logger; 11 12 import com.nightlabs.editor2d.EditorPlugin; 13 import com.nightlabs.editor2d.LineDrawComponent; 14 import com.nightlabs.editor2d.ShapeDrawComponent; 15 import com.nightlabs.editor2d.j2d.GeneralShape; 16 17 18 public class CreateShapeCommand 19 extends CreateDrawComponentCommand 21 { 22 public static final Logger LOGGER = Logger.getLogger(CreateShapeCommand.class); 23 24 protected GeneralShape generalShape; 25 public void setGeneralShape(GeneralShape generalShape) { 26 this.generalShape = generalShape; 27 } 28 29 36 public CreateShapeCommand() 37 { 38 super(EditorPlugin.getResourceString("command_create_shape")); 39 } 40 41 44 public void execute() 45 { 46 if (generalShape != null) 47 getShapeDrawComponent().setGeneralShape(generalShape); 48 49 if (drawComponent instanceof LineDrawComponent) 50 getShapeDrawComponent().setFill(false); 51 52 super.execute(); 53 } 54 55 protected ShapeDrawComponent getShapeDrawComponent() { 56 return (ShapeDrawComponent) getChild(); 57 } 58 } 59 | Popular Tags |