will(new CustomAction("returns first arg") { @Override public Object invoke(Invocation invocation) throws Throwable {
CustomAction ca = new CustomAction(action, viewKey, method.getName()); try { ca.methodArgTypes = validateActionParamTypes(method.getParameterTypes(), method.getName()); ca.setMethod(method); // store the method in the ca actions.add(ca); } else if (method.getName().endsWith(ActionsExecutable.ACTION_METHOD_SUFFIX)) { String action = method.getName().substring(0, method.getName().length() - ActionsExecutable.ACTION_METHOD_SUFFIX.length()); CustomAction ca = new CustomAction(action, EntityView.VIEW_SHOW, method.getName()); try { ca.methodArgTypes = validateActionParamTypes(method.getParameterTypes(), method.getName()); continue; ca.setMethod(method); // store the method in the ca actions.add(ca);
throw new IllegalStateException("The custom action must have the method name set, null is not allowed: " + customAction); Method method = customAction.getMethod(); if (method == null) { try { throw new RuntimeException("Fatal error trying to get custom action method: " + customAction, e1); customAction.setMethod(method); // cache the method
/** * @return a copy of this object */ public CustomAction copy() { return copy(this); }
if (name.equals(ca.methodName)) { ca.methodArgTypes = validateActionParamTypes(method.getParameterTypes(), ca.methodName); ca.setMethod(method); // store the method in the ca found = true; break;
throw new IllegalStateException("The custom action must have the method name set, null is not allowed: " + customAction); Method method = customAction.getMethod(); if (method == null) { try { throw new RuntimeException("Fatal error trying to get custom action method: " + customAction, e1); customAction.setMethod(method); // cache the method
public CustomAction[] defineActions() { return new CustomAction[] { new CustomAction("double", EntityView.VIEW_SHOW), // return the object with the number doubled new CustomAction("xxx", EntityView.VIEW_EDIT), // change all text fields to 3 x's new CustomAction("clear", EntityView.VIEW_LIST) // remove all items }; }
public CustomAction[] defineActions() { return new CustomAction[] { new CustomAction("double", EntityView.VIEW_SHOW, "doubleUp"), // return the object with the number doubled new CustomAction("xxx", EntityView.VIEW_EDIT, "xxxChange"), // change all text fields to 3 x's new CustomAction("clear", EntityView.VIEW_LIST, "clearAll") // remove all items }; }
public CustomAction[] defineActions() { return new CustomAction[] { new CustomAction("double", EntityView.VIEW_SHOW, "doubleUp"), // return the object with the number doubled new CustomAction("xxx", EntityView.VIEW_EDIT, "xxxChange"), // change all text fields to 3 x's new CustomAction("clear", EntityView.VIEW_LIST, "clearAll") // remove all items }; }
public CustomAction[] defineActions() { return new CustomAction[] { new CustomAction("double", EntityView.VIEW_SHOW), // return the object with the number doubled new CustomAction("xxx", EntityView.VIEW_EDIT), // change all text fields to 3 x's new CustomAction("clear", EntityView.VIEW_LIST) // remove all items }; }
/** * @param ca * @return a copy of the supplied object */ public static CustomAction copy(CustomAction ca) { if (ca == null) { throw new IllegalArgumentException("action to copy must not be null"); } CustomAction togo = new CustomAction(ca.action, ca.viewKey, ca.methodName); togo.methodArgTypes = ca.methodArgTypes; return togo; }
JMenuItem copy = new JMenuItem( new CustomAction() );
/** * puts the parameter array as elements in the list * @param parameters A mutable list, will be cleared when the Action is invoked. */ public static Action captureParameters(final List<Object> parameters) { return new CustomAction("captures parameters") { public Object invoke(Invocation invocation) throws Throwable { parameters.clear(); parameters.addAll(Arrays.asList(invocation.getParametersAsArray())); return null; } }; }
will(new CustomAction("returns previous arg") { @Override public Object invoke(Invocation invocation) throws Throwable {
will(new CustomAction("Returns new BusinessObj instance") { @Override public Object invoke(Invocation invocation) throws Throwable {