/** * Returns all the field trackings as an unmodifiable List. */ public List getFieldTracking() { if (Tapestry.size(_trackings) == 0) return null; return Collections.unmodifiableList(_trackings); }
/** * Returns all the field trackings as an unmodifiable List. */ public List getFieldTracking() { if (Tapestry.size(_trackings) == 0) return null; return Collections.unmodifiableList(_trackings); }
static String noListenerMethodFound(String name, Object[] serviceParameters, Object target) { return _formatter.format("no-listener-method-found", name, new Integer(Tapestry .size(serviceParameters)), target); }
static String noListenerMethodFound(String name, Object[] serviceParameters, Object target) { return _formatter.format("no-listener-method-found", name, new Integer(Tapestry .size(serviceParameters)), target); }
static String instantiationFailure(Constructor c, Object[] parameters, String classFab, Throwable cause) { int count = Tapestry.size(parameters); StringBuffer buffer = new StringBuffer("["); for (int i = 0; i < count; i++) { if (i > 0) buffer.append(", "); buffer.append(parameters[i]); } buffer.append("]"); return _formatter.format("instantiation-failure", new Object[] { c.getDeclaringClass().getName(), c, buffer.toString(), classFab, cause }); }
static String instantiationFailure(Constructor c, Object[] parameters, String classFab, Throwable cause) { int count = Tapestry.size(parameters); StringBuffer buffer = new StringBuffer("["); for (int i = 0; i < count; i++) { if (i > 0) buffer.append(", "); buffer.append(parameters[i]); } buffer.append("]"); return _formatter.format("instantiation-failure", new Object[] { c.getDeclaringClass().getName(), c, buffer.toString(), classFab, cause }); }
/** * Returns a {@link List}of {@link IFieldTracking}s. This is the master * list of trackings, except that it omits and trackings that are not * associated with a particular field. May return an empty list, or null. * <p> * Order is not determined, though it is likely the order in which * components are laid out on in the template (this is subject to change). */ public List getAssociatedTrackings() { int count = Tapestry.size(_trackings); if (count == 0) return null; List result = new ArrayList(count); for(int i = 0; i < count; i++) { IFieldTracking tracking = (IFieldTracking) _trackings.get(i); if (tracking.getFieldName() == null) continue; result.add(tracking); } return result; }
/** * Returns all the values stored in the map, excluding those whose id has been marked deleted, * in the order in which values were added to the map using {@link #add(Object, Object)}. */ public List getValues() { int deletedCount = Tapestry.size(_deletedKeys); if (deletedCount == 0) return getAllValues(); int count = _keys.size(); List result = new ArrayList(count - deletedCount); for (int i = 0; i < count; i++) { Object key = _keys.get(i); if (_deletedKeys.contains(key)) continue; Object value = _map.get(key); result.add(value); } return result; }
/** * Returns a {@link List}of {@link IFieldTracking}s. This is the master * list of trackings, except that it omits and trackings that are not * associated with a particular field. May return an empty list, or null. * <p> * Order is not determined, though it is likely the order in which * components are laid out on in the template (this is subject to change). */ public List getAssociatedTrackings() { int count = Tapestry.size(_trackings); if (count == 0) return null; List result = new ArrayList(count); for(int i = 0; i < count; i++) { IFieldTracking tracking = (IFieldTracking) _trackings.get(i); if (tracking.getFieldName() == null) continue; result.add(tracking); } return result; }
/** * Returns all the values stored in the map, excluding those whose id has been marked deleted, * in the order in which values were added to the map using {@link #add(Object, Object)}. */ public List getValues() { int deletedCount = Tapestry.size(_deletedKeys); if (deletedCount == 0) return getAllValues(); int count = _keys.size(); List result = new ArrayList(count - deletedCount); for (int i = 0; i < count; i++) { Object key = _keys.get(i); if (_deletedKeys.contains(key)) continue; Object value = _map.get(key); result.add(value); } return result; }
/** * Like {@link #getAssociatedTrackings()}, but returns only the * unassociated trackings. Unassociated trackings are new (in release * 1.0.9), and are why interface {@link IFieldTracking}is not very well * named. * <p> * The trackings are returned in an unspecified order, which (for the * moment, anyway) is the order in which they were added (this could change * in the future, or become more concrete). */ public List getUnassociatedTrackings() { int count = Tapestry.size(_trackings); if (count == 0) return null; List result = new ArrayList(count); for(int i = 0; i < count; i++) { IFieldTracking tracking = (IFieldTracking) _trackings.get(i); if (tracking.getFieldName() != null) continue; result.add(tracking); } return result; }
/** * A convienience, as most pages just show the first error on the page. * <p> * As of release 1.0.9, this returns an instance of {@link IRender}, not a * {@link String}. */ public IRender getFirstError() { if (Tapestry.size(_trackings) == 0) return null; Iterator i = _trackings.iterator(); while(i.hasNext()) { IFieldTracking tracking = (IFieldTracking) i.next(); if (tracking.isInError()) return tracking.getErrorRenderer(); } return null; }
/** * A convienience, as most pages just show the first error on the page. * <p> * As of release 1.0.9, this returns an instance of {@link IRender}, not a * {@link String}. */ public IRender getFirstError() { if (Tapestry.size(_trackings) == 0) return null; Iterator i = _trackings.iterator(); while(i.hasNext()) { IFieldTracking tracking = (IFieldTracking) i.next(); if (tracking.isInError()) return tracking.getErrorRenderer(); } return null; }
public void walkComponentTree(IComponent component) { // Invoke visitors for (int i = 0; i < _visitors.length; i++) { IComponentVisitor visitor = _visitors[i]; visitor.visitComponent(component); } // Recurse into the embedded components Collection components = component.getComponents().values(); if (Tapestry.size(components) == 0) return; for (Iterator it = components.iterator(); it.hasNext();) { IComponent embedded = (IComponent) it.next(); walkComponentTree(embedded); } } }
public void walkComponentTree(IComponent component) { // Invoke visitors for (int i = 0; i < _visitors.length; i++) { IComponentVisitor visitor = _visitors[i]; visitor.visitComponent(component); } // Recurse into the embedded components Collection components = component.getComponents().values(); if (Tapestry.size(components) == 0) return; for (Iterator it = components.iterator(); it.hasNext();) { IComponent embedded = (IComponent) it.next(); walkComponentTree(embedded); } } }
private void writeExternalScripts(IMarkupWriter writer, IRequestCycle cycle) { int count = Tapestry.size(_externalScripts); for (int i = 0; i < count; i++) { Resource scriptLocation = (Resource) _externalScripts.get(i); IAsset asset = _assetFactory.createAsset(scriptLocation, null); String url = asset.buildURL(); // Note: important to use begin(), not beginEmpty(), because browser don't // interpret <script .../> properly. _builder.writeExternalScript(writer, url, cycle); } }
private void writeExternalScripts(IMarkupWriter writer, IRequestCycle cycle) { int count = Tapestry.size(_externalScripts); for (int i = 0; i < count; i++) { Resource scriptLocation = (Resource) _externalScripts.get(i); IAsset asset = _assetFactory.createAsset(scriptLocation, null); String url = asset.buildURL(); // Note: important to use begin(), not beginEmpty(), because browser don't // interpret <script .../> properly. _builder.writeExternalScript(writer, url, cycle); } }
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); } }
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); } }