1 24 package org.riotfamily.riot.editor; 25 26 import org.riotfamily.common.i18n.MessageResolver; 27 import org.riotfamily.riot.editor.ui.CustomEditorController; 28 import org.riotfamily.riot.editor.ui.EditorReference; 29 30 31 public class CustomEditorDefinition extends AbstractObjectEditorDefinition { 32 33 protected static final String TYPE_CUSTOM = "custom"; 34 35 private String url; 36 37 private String target; 38 39 40 public String getEditorType() { 41 return TYPE_CUSTOM; 42 } 43 44 public void setTarget(String target) { 45 this.target = target; 46 } 47 48 public void setUrl(String url) { 49 this.url = url; 50 } 51 52 public EditorReference createReference(String objectId, 53 MessageResolver messageResolver) { 54 55 EditorReference ref = super.createReference(objectId, messageResolver); 56 ref.setTargetWindow(target); 57 return ref; 58 } 59 60 public String getTargetUrl(String objectId, String parentId) { 61 return url; 62 } 63 64 public String getEditorUrl(String objectId, String parentId) { 65 if (target != null) { 66 return getTargetUrl(objectId, parentId); 67 } 68 return super.getEditorUrl(objectId, parentId); 69 } 70 71 protected String getEditorUrlWithinServlet(String objectId, String parentId) { 72 return CustomEditorController.getUrl(getId(), objectId, parentId); 73 } 74 75 } 76 | Popular Tags |