1 24 package org.riotfamily.riot.list.command.core; 25 26 import org.riotfamily.riot.editor.EditorDefinition; 27 import org.riotfamily.riot.list.command.CommandContext; 28 import org.riotfamily.riot.list.command.CommandResult; 29 import org.riotfamily.riot.list.command.result.ScriptResult; 30 31 34 public class ChooseCommand extends AbstractCommand { 35 36 public static final String ID = "choose"; 37 38 private EditorDefinition target; 39 40 public ChooseCommand(EditorDefinition target) { 41 this.target = target; 42 } 43 44 public String getId() { 45 return ID; 46 } 47 48 protected boolean isEnabled(CommandContext context, String action) { 49 return target.getBeanClass().isInstance(context.getBean()); 50 } 51 52 public CommandResult execute(CommandContext context) { 53 return new ScriptResult("parent.chosen('" + 54 context.getObjectId() + "')"); 55 } 56 57 } 58 | Popular Tags |