/** @since 3.0 * */ public void setPageName(String pageName) { if (_pageName != null) throw new ApplicationRuntimeException(Tapestry .getMessage("AbstractPage.attempt-to-change-name")); _pageName = pageName; }
public PropertyPersistenceStrategy getStrategy(String name) { if (!_strategies.containsKey(name)) throw new ApplicationRuntimeException(RecordMessages .unknownPersistenceStrategy(name)); return (PropertyPersistenceStrategy) _strategies.get(name); }
private ApplicationRuntimeException createBodylessComponentException(IComponent component) { return new ApplicationRuntimeException(ImplMessages.bodylessComponent(), component, null, null); } }
public void claimProperty(String propertyName) { Defense.notNull(propertyName, "propertyName"); if (_claimedProperties.contains(propertyName)) throw new ApplicationRuntimeException(EnhanceMessages.claimedProperty(propertyName)); _claimedProperties.add(propertyName); }
public Object getObject() { try { return _propertySource.getComponentProperty(_component, _key); } catch (Exception ex) { throw new ApplicationRuntimeException(ex.getMessage(), getLocation(), ex); } }
public void setBeanProperty(IBeanProvider provider, Object bean) { try { PropertyUtils.configureProperties(bean, _initializer); } catch (Exception ex) { throw new ApplicationRuntimeException(ex.getMessage(), getLocation(), ex); } }
private Object parse(String expression) { try { return Ognl.parseExpression(expression); } catch (Exception ex) { throw new ApplicationRuntimeException(ImplMessages.unableToParseExpression(expression, ex), ex); } }
public InputStream getStream() { try { return _fileItem.getInputStream(); } catch (IOException ex) { throw new ApplicationRuntimeException(MultipartMessages .unableToOpenContentFile(this, ex), ex); } }
/** @since 4.0 */ public final void setContainedComponent(IContainedComponent containedComponent) { Defense.notNull(containedComponent, "containedComponent"); if (_containedComponent != null) throw new ApplicationRuntimeException(TapestryMessages .attemptToChangeContainedComponent(this)); _containedComponent = containedComponent; }
/** @since 3.0 * */ public static ApplicationRuntimeException createNoSuchComponentException(IComponent component, String id, Location location) { return new ApplicationRuntimeException(format("no-such-component", component.getExtendedId(), id), component, location, null); }
/** @since 4.0 */ public final void setContainedComponent(IContainedComponent containedComponent) { Defense.notNull(containedComponent, "containedComponent"); if (_containedComponent != null) throw new ApplicationRuntimeException(TapestryMessages .attemptToChangeContainedComponent(this)); _containedComponent = containedComponent; }
public void validateProperty(String name, Class expectedType) { Defense.notNull(name, "name"); Defense.notNull(expectedType, "expectedType"); PropertyDescriptor pd = getPropertyDescriptor(name); if (pd == null) return; Class propertyType = pd.getPropertyType(); if (propertyType.equals(expectedType)) return; throw new ApplicationRuntimeException(EnhanceMessages.propertyTypeMismatch(_baseClass, name, propertyType, expectedType)); }
protected Validator getDelegate() { Object bean = _component.getBeans().getBean(_name); if (bean instanceof Validator) return (Validator) bean; throw new ApplicationRuntimeException(ValidatorMessages.beanNotValidator(_name), bean, null, null); }
private Class findTypeInClassResolver(String type) { Class result = _resolver.checkForClass(type); if (result == null) result = _resolver.checkForClass(_packageName + "." + type); if (result == null) throw new ApplicationRuntimeException(ImplMessages.unableToConvertType( type, _packageName)); return result; } }
public void invokeListenerMethod(Object target, IRequestCycle cycle) { Object[] listenerParameters = cycle.getListenerParameters(); if (listenerParameters == null) listenerParameters = new Object[0]; if (searchAndInvoke(target, cycle, listenerParameters)) return; throw new ApplicationRuntimeException(ListenerMessages.noListenerMethodFound(_name, listenerParameters, target), target, null, null); }
private Validator extractValidatorBean(IComponent component, String validatorName, String value, String message) { String beanName = validatorName.substring(1); if (HiveMind.isNonBlank(value) || HiveMind.isNonBlank(message)) throw new ApplicationRuntimeException(ValidatorMessages .noValueOrMessageForBean(beanName)); return new BeanValidatorWrapper(component, beanName); }
/** * @see org.apache.tapestry.AbstractComponent#prepareForRender(org.apache.tapestry.IRequestCycle) */ protected void prepareForRender(IRequestCycle cycle) { super.prepareForRender(cycle); if (cycle.getAttribute(ATTRIBUTE_NAME) != null) throw new ApplicationRuntimeException(Tapestry.getMessage("Select.may-not-nest"), this, null, null); cycle.setAttribute(ATTRIBUTE_NAME, this); _rendering = true; _nextOptionId = 0; }
/** * @see org.apache.tapestry.AbstractComponent#prepareForRender(org.apache.tapestry.IRequestCycle) */ protected void prepareForRender(IRequestCycle cycle) { super.prepareForRender(cycle); if (cycle.getAttribute(ATTRIBUTE_NAME) != null) throw new ApplicationRuntimeException(Tapestry.getMessage("Select.may-not-nest"), this, null, null); cycle.setAttribute(ATTRIBUTE_NAME, this); _rendering = true; _nextOptionId = 0; }
/** * @see org.apache.tapestry.AbstractComponent#prepareForRender(org.apache.tapestry.IRequestCycle) */ protected void prepareForRender(IRequestCycle cycle) { IComponent outer = (IComponent) cycle.getAttribute(ATTRIBUTE_NAME); if (outer != null) throw new ApplicationRuntimeException(FormMessages.linkSubmitMayNotNest(this, outer), this, getLocation(), null); cycle.setAttribute(ATTRIBUTE_NAME, this); }
public void addField(String name, Class type) { CtClass ctType = convertClass(type); try { CtField field = new CtField(ctType, name, getCtClass()); field.setModifiers(Modifier.PRIVATE); getCtClass().addField(field); } catch (CannotCompileException ex) { throw new ApplicationRuntimeException(EnhanceMessages.unableToAddField(name, getCtClass(), ex), ex); } }