/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) _parts.add(updateParts[i].toString()); }
/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ protected void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) _parts.add(updateParts[i].toString()); }
/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ protected void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) _parts.add(updateParts[i].toString()); }
/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) { _parts.add(updateParts[i].toString()); } }
/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) _parts.add(updateParts[i].toString()); }
/** * Grabs the incoming parameters needed for json responses, most notable the * {@link ServiceConstants#UPDATE_PARTS} parameter. * * @param cycle * The request cycle to parse from */ void parseParameters(IRequestCycle cycle) { Object[] updateParts = cycle.getParameters(ServiceConstants.UPDATE_PARTS); if (updateParts == null) return; for(int i = 0; i < updateParts.length; i++) { _parts.add(updateParts[i].toString()); } }
/** * Returns a list of the values stored as Hidden fields in the form. A conversion is performed * if the primary key of the value is stored. * * @param cycle * The current request cycle * @param name * The name of the HTTP parameter whether the values * @return an iterator with the values stored in the provided Hidden fields */ protected Iterator getStoredData(IRequestCycle cycle, String name) { String[] stringReps = cycle.getParameters(name); if (stringReps == null) return null; updatePrimaryKeysParameter(stringReps); return new ReadSourceDataIterator(stringReps); }
/** * Returns a list of the values stored as Hidden fields in the form. A conversion is performed * if the primary key of the value is stored. * * @param cycle * The current request cycle * @param name * The name of the HTTP parameter whether the values * @return an iterator with the values stored in the provided Hidden fields */ protected Iterator getStoredData(IRequestCycle cycle, String name) { String[] stringReps = cycle.getParameters(name); if (stringReps == null) return null; updatePrimaryKeysParameter(stringReps); return new ReadSourceDataIterator(stringReps); }
public Object[] extractListenerParameters(IRequestCycle cycle) { String[] squeezed = cycle.getParameters(ServiceConstants.PARAMETER); if (Tapestry.size(squeezed) == 0) return _empty; try { return _dataSqueezer.unsqueeze(squeezed); } catch (Exception ex) { throw new ApplicationRuntimeException(ex); } }
public Object[] extractListenerParameters(IRequestCycle cycle) { String[] squeezed = cycle.getParameters(ServiceConstants.PARAMETER); if (Tapestry.size(squeezed) == 0) return _empty; try { return _dataSqueezer.unsqueeze(squeezed); } catch (Exception ex) { throw new ApplicationRuntimeException(ex); } }
/** * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, * org.apache.tapestry.IRequestCycle) */ protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle) { String[] values = cycle.getParameters(getName()); this.render(writer, cycle, (Iterator) getValueConverter().coerceValue( values, Iterator.class)); }
/** * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, * org.apache.tapestry.IRequestCycle) */ protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle) { String[] values = cycle.getParameters(getName()); this.render(writer, cycle, (Iterator) getValueConverter().coerceValue( values, Iterator.class)); }
/** * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle) */ protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle) { _selections = null; _rewinding = true; String[] parameters = cycle.getParameters(getName()); try { if (parameters != null) { int length = parameters.length; _selections = new HashSet((length > 30) ? 101 : 7); for (int i = 0; i < length; i++) _selections.add(parameters[i]); } renderBody(writer, cycle); // This is atypical validation - since this component does not explicitly bind to an object getValidatableFieldSupport().validate(this, writer, cycle, parameters); } catch (ValidatorException e) { getForm().getDelegate().record(e); } }
/** * @see org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle) */ protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle) { _selections = null; _rewinding = true; String[] parameters = cycle.getParameters(getName()); try { if (parameters != null) { int length = parameters.length; _selections = new HashSet((length > 30) ? 101 : 7); for (int i = 0; i < length; i++) _selections.add(parameters[i]); } renderBody(writer, cycle); // This is atypical validation - since this component does not explicitly bind to an object getValidatableFieldSupport().validate(this, writer, cycle, parameters); } catch (ValidatorException e) { getForm().getDelegate().record(e); } }
public void service(IRequestCycle cycle) throws IOException { String pageName = cycle.getParameter(ServiceConstants.PAGE); String componentId = cycle.getParameter(ServiceConstants.COMPONENT); IPage componentPage = cycle.getPage(pageName); IComponent component = componentPage.getNestedComponent(componentId); if (!(component instanceof IXTile)) throw new ApplicationRuntimeException("Incorrect component type: was " + component.getClass() + " but must be " + IXTile.class, component, null, null); IXTile xtile = (IXTile) component; String[] params = cycle.getParameters(ServiceConstants.PARAMETER); cycle.setListenerParameters(params); xtile.trigger(cycle); // do not squeeze on output either Object[] args = cycle.getListenerParameters(); String strArgs = generateOutputString(args); if (strArgs != null) { OutputStream output = _response.getOutputStream(new ContentType("text/xml")); output.write(strArgs.getBytes("utf-8")); } }
protected void rewindFormComponent(IMarkupWriter writer, IRequestCycle cycle) { String[] values = cycle.getParameters(getName()); int count = Tapestry.size(values); List selected = new ArrayList(count); IPropertySelectionModel model = getModel(); for (int i = 0; i < count; i++) { String value = values[i]; Object option = model.translateValue(value); selected.add(option); } setSelected(selected); try { getValidatableFieldSupport().validate(this, writer, cycle, selected); } catch (ValidatorException e) { getForm().getDelegate().record(e); } }
String[] optionValues = cycle.getParameters(getName());
/** * Creates a new browser event that will extract its own * parameters. * * @param cycle * The request cycle to extract parameters from. */ public BrowserEvent(IRequestCycle cycle) { Defense.notNull(cycle, "cycle"); _name = cycle.getParameter(NAME); _type = cycle.getParameter(TYPE); _keys = cycle.getParameters(KEYS); _charCode = cycle.getParameter(CHAR_CODE); _pageX = cycle.getParameter(PAGE_X); _pageY = cycle.getParameter(PAGE_Y); _layerX = cycle.getParameter(LAYER_X); _layerY = cycle.getParameter(LAYER_Y); _componentId = cycle.getParameter(COMPONENT_ID); _componentIdPath = cycle.getParameter(COMPONENT_ID_PATH); Map props = new HashMap(); _target = new EventTarget(props); String targetId = cycle.getParameter(TARGET + "." + TARGET_ATTR_ID); if (targetId != null) { props.put(TARGET_ATTR_ID, targetId); } _methodArguments = cycle.getParameter(METHOD_ARGUMENTS); }
/** * Creates a new browser event that will extract its own * parameters. * * @param cycle * The request cycle to extract parameters from. */ public BrowserEvent(IRequestCycle cycle) { Defense.notNull(cycle, "cycle"); _name = cycle.getParameter(NAME); _type = cycle.getParameter(TYPE); _keys = cycle.getParameters(KEYS); _charCode = cycle.getParameter(CHAR_CODE); _pageX = cycle.getParameter(PAGE_X); _pageY = cycle.getParameter(PAGE_Y); _layerX = cycle.getParameter(LAYER_X); _layerY = cycle.getParameter(LAYER_Y); _componentId = cycle.getParameter(COMPONENT_ID); _componentIdPath = cycle.getParameter(COMPONENT_ID_PATH); Map props = new HashMap(); _target = new EventTarget(props); String targetId = cycle.getParameter(TARGET + "." + TARGET_ATTR_ID); if (targetId != null) { props.put(TARGET_ATTR_ID, targetId); } _methodArguments = cycle.getParameter(METHOD_ARGUMENTS); }