public boolean collectParameters() { // TODO use new promptForParameters method instead of all this final int expectedNoParameters = action.isContributed() ? 1 : 0; return action.getParameterCount() == expectedNoParameters; } }
public boolean collectParameters() { // TODO use new promptForParameters method instead of all this final int expectedNoParameters = action.isContributed() ? 1 : 0; return action.getParameterCount() == expectedNoParameters; } }
/** * TODO: this is not ideal, because we can only populate the array for single argument, rather than the * entire argument set. Instead, we ought to do this in two passes, one to build up the argument set as a * single unit, and then validate each in turn. * * @param proposedValue * @return */ private NakedObject[] arguments(final NakedObject proposedValue) { final int parameterCount = getAction().getParameterCount(); final NakedObject[] arguments = new NakedObject[parameterCount]; arguments[getNumber()] = proposedValue; return arguments; }
/** * TODO: this is not ideal, because we can only populate the array for single argument, rather than the * entire argument set. Instead, we ought to do this in two passes, one to build up the argument set as a * single unit, and then validate each in turn. * * @param proposedValue * @return */ private NakedObject[] arguments(final NakedObject proposedValue) { final int parameterCount = getAction().getParameterCount(); final NakedObject[] arguments = new NakedObject[parameterCount]; arguments[getNumber()] = proposedValue; return arguments; }
public static ImmediateObjectOption createServiceOption(final NakedObjectAction action, final NakedObject object) { Assert.assertTrue("Only suitable for 1 param methods", action.getParameterCount() == 1); if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) { return null; } final ImmediateObjectOption option = new ImmediateObjectOption(action, object); return option; }
public static ImmediateObjectOption createOption(final NakedObjectAction action, final NakedObject object) { Assert.assertTrue("Only suitable for 0 param methods", action.getParameterCount() == 0); if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) { return null; } final ImmediateObjectOption option = new ImmediateObjectOption(action, object); return option; }
public static DialoggedObjectOption createOption(final NakedObjectAction action, final NakedObject object) { final int paramCount = action.getParameterCount(); Assert.assertTrue("Only for actions taking one or more params", paramCount > 0); if (!action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed() || !action.isVisible(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) { return null; } final DialoggedObjectOption option = new DialoggedObjectOption(action, object); return option; }
public static ActionHelper createInstance(final NakedObject target, final NakedObjectAction action) { final int numberParameters = action.getParameterCount(); final NakedObject[] parameters = new NakedObject[numberParameters]; final NakedObjectActionParameter[] parameterSpecs = action.getParameters();
if (action.getParameterCount() == 0) { collectParameters = false; } else if (action.getParameterCount() == 1 && action.isContributed() && target.getSpecification().isOfType(action.getParameters()[0].getSpecification())) { collectParameters = false;
if (action.getParameterCount() == 0) { collectParameters = false; } else if (action.getParameterCount() == 1 && action.isContributed() && target.getSpecification().isOfType(action.getParameters()[0].getSpecification())) { collectParameters = false;
if (action.getParameterCount() == 0) { executeImmediately = true; } else if (action.getParameterCount() == 1 && isContributedMethod && target.getSpecification().isOfType(action.getParameters()[0].getSpecification())) { executeImmediately = true;
private static void menuOptions(final NakedObjectAction[] actions, final NakedObject target, final UserActionSet menuOptionSet) { for (int i = 0; i < actions.length; i++) { UserAction option = null; if (actions[i].getActions().length > 0) { option = new UserActionSet(actions[i].getName(), menuOptionSet); menuOptions(actions[i].getActions(), target, (UserActionSet) option); } else { final int noOfParameters = actions[i].getParameterCount(); if (noOfParameters == 0) { option = ImmediateObjectOption.createOption(actions[i], target); } else if (actions[i].isContributed() && noOfParameters == 1 && target != null && target.getSpecification().isOfType(actions[i].getParameters()[0].getSpecification())) { option = ImmediateObjectOption.createServiceOption(actions[i], target); } else { option = DialoggedObjectOption.createOption(actions[i], target); } } if (option != null) { menuOptionSet.add(option); } } } }
if (action.getParameterCount() == 0) { executeImmediately = true; } else if (action.getParameterCount() == 1 && isContributedMethod && target.getSpecification().isOfType(action.getParameters()[0].getSpecification())) { executeImmediately = true;
protected MethodTask(final Context context, final NakedObject target, final NakedObjectAction action) { super(context, action.getName(), action.getDescription(), target, action.getParameterCount()); this.action = action;
protected MethodTask(final Context context, final NakedObject target, final NakedObjectAction action) { super(context, action.getName(), action.getDescription(), target, action.getParameterCount()); this.action = action;