/** Add the supplied parameter to the parameter list stored */ public UIParameterHolder addParameter(UIParameter param) { parameters.add(param); return this; }
public ParameterList(UIParameter single) { add(single); }
public int restore(WriteableBeanLocator target, String tokenid) { int restored = 0; for (Iterator keyit = requestmap.keySet().iterator(); keyit.hasNext();) { String key = (String) keyit.next(); IUPSMapping spec = (IUPSMapping) iupsspecs.get(key); if (spec != null) { String[] value = (String[]) requestmap.get(key); bma.setBeanValue(spec.beanpath, target, value, null, false); if (value != null) { outgoingparams.add(new UIParameter(key, value[0])); ++ restored; } } } return restored; }
public static ParameterList mapToParamList(Map toconvert) { ParameterList togo = new ParameterList(); for (Iterator entryit = toconvert.entrySet().iterator(); entryit.hasNext();) { Entry entry = (Entry) entryit.next(); String key = (String) entry.getKey(); Object value = entry.getValue(); if (value instanceof String) { togo.add(new UIParameter(key, (String) value)); } else if (value instanceof String[]) { String[] values = (String[]) value; for (int i = 0; i < values.length; ++ i) { togo.add(new UIParameter(key, values[i])); } } } return togo; }
public int preserve(BeanLocator source, String tokenid) { int preserved = 0; outgoingparams.clear(); for (Iterator specit = iupsspecs.values().iterator(); specit.hasNext();) { IUPSMapping spec = (IUPSMapping) specit.next(); String converted = (String) bma.getFlattenedValue(spec.beanpath, source, String.class, null); if (converted == null) continue; outgoingparams.add(new UIParameter(spec.urlkey, converted)); ++ preserved; } return preserved; }
/** Adds a "literal" resulting view binding to the supplied control. Rather than reading * a path in the final request context as in {@link #addResultingViewBinding(UIParameterHolder, String, String)}, * this supplies a constant, literal value into the outgoing state. * @param holder The control whose submission is to include the required binding. * @param viewParamsPath The path within the outgoing ViewParameters state for the * navigation which is to receive the deferred value. * @param value The value to be applied to the outgoing ViewParameters path. */ public static void addResultingViewBinding(UIParameterHolder holder, String viewParamsPath, Object value) { if (holder.parameters == null) { holder.parameters = new ParameterList(); } holder.parameters.add(new UIELBinding("ARIResult.resultingView."+viewParamsPath, value)); } /**
/** * Adds a binding to the supplied parameter list that will assign the EL * expression <code>source</code> to <code>transit</code> and then * <code>transit</code> to <code>dest</code>, a classic usage of * "whole-object validation through transit". */ public static void addTransitBinding(ParameterList paramlist, String source, String transit, String dest) { paramlist.add(new UIELBinding(transit, new ELReference(source))); paramlist.add(new UIELBinding(dest, new ELReference(transit))); }
/** * A convenience method that assumes the BasicFormModel (uses findBasicForm * above). Adds the supplied name/value pair to the nearest enclosing form * control. */ public static void addBasicFormParameter(UIContainer local, UIParameter toadd) { UIForm enclosing = findBasicForm(local); if (enclosing == null) { throw new AssertionException("Component " + local.getFullID() + " has no form parent!"); } enclosing.parameters.add(toadd); }
public void processComponent(UIComponent toprocess) { if (toprocess instanceof UICommand) { // add the notation explaining which control is submitting, when it does UICommand command = (UICommand) toprocess; if (!isFixed(command)) { command.parameters.add(new UIParameter( SubmittedValueEntry.SUBMITTING_CONTROL, toprocess.getFullID())); if (command.methodbinding != null) { command.parameters.add(new UIParameter( SubmittedValueEntry.FAST_TRACK_ACTION, command.methodbinding.value)); } } } if (toprocess instanceof UIParameterHolder) { processParameterList(((UIParameterHolder) toprocess).parameters); } } // Prevent this non-idempotent function of this fixer
/** Adds a "deferred resulting view" EL binding to the supplied UIComponent. * This will transfer a value from an EL path in the request context to a * particular path withing the outgoing ViewParameters state for the coming * action cycle, assuming that it completes without error. * @param holder The control whose submission is to include the required binding. * @param viewParamsPath The path within the outgoing ViewParameters state for the * navigation which is to receive the deferred value. * @param requestPath The path within the "final state" of the request context at the * end of the cycle from which the deferred value is to be read. */ public static void addResultingViewBinding(UIParameterHolder holder, String viewParamsPath, String requestPath) { if (holder.parameters == null) { holder.parameters = new ParameterList(); } ELReference vpp = new ELReference(viewParamsPath); holder.parameters.add(new UIELBinding("ARIResult.resultingView."+vpp.value, new ELReference(requestPath))); }
UIOutput.make(togo, "date-annotation", null, ttb + "shortFormat"); if (invalidDateKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidDateKey", invalidDateKey)); UIOutput.make(togo, "time-annotation", null, ttb + "timeFormat"); if (invalidTimeKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidTimeKey", invalidTimeKey)); form.parameters.add(new UIELBinding(toevolve.valuebinding.value, new ELReference(ttb + "date")));
UIOutput.make(togo, "date-annotation", null, ttb + "shortFormat"); if (invalidDateKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidDateKey", invalidDateKey)); UIOutput.make(togo, "time-annotation", null, ttb + "timeFormat"); if (invalidTimeKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidTimeKey", invalidTimeKey)); form.parameters.add(new UIELBinding(toevolve.valuebinding.value, new ELReference(ttb + "date")));
public UIJointContainer evolveDateInput(UIInput toEvolve, Date value) { // Pull in the template UIJointContainer togo = new UIJointContainer(toEvolve.parent, toEvolve.ID, COMPONENT_ID); // Remove the existing component from the tree toEvolve.parent.remove(toEvolve); String transitBean = transitBase + "." + togo.getFullID(); // Need ISO9601 support. ISO8601FieldDateTransit transit = (ISO8601FieldDateTransit) rbg.getBean(transitBean); if (value == null) { // The UIInput we're evolving must have a OTP bean for this to work. value = (Date) rbg.getBean(toEvolve.valuebinding.value); } if (value != null) { transit.setDate(value); } String ttb = transitBean + "."; UIOutput display = UIOutput.make(togo, "display"); UIInput field = UIInput.make(togo, "iso8601", ttb + "ISO8601", transit.getISO8601()); field.mustapply = true; // Bind the value back through to the transitBase. // This generates a custom hidden HTML UIForm form = RSFUtil.findBasicForm(togo); form.parameters.add(new UIELBinding(toEvolve.valuebinding.value, new ELReference(ttb + "date"))); UIInitBlock.make(togo, "init-date", "rsfDatePicker", new Object[] { display.getFullID(), field.getFullID(), // If we just supply a boolean it is output as a string // which doesn't work. (style.equals(DATE_TIME_INPUT) || style.equals(TIME_INPUT)) ? "1" : "0" }); return togo; }
form.parameters.add(new UIELBinding(toevolve.valuebinding.value, new ELReference(ttb + "date")));
form.parameters.add(new UIELBinding(toevolve.valuebinding.value, new ELReference(ttb + "date")));