public class ComponentsNotInTemplateDemo { @Component private BeanEditForm form; }
public class EmbeddedComponentTypeConflict { @Component(type = "textfield") private Field input; }
public class BadPublishUnknown { @Component(publishParameters = "xyzzyx") private Publish1 publish1; }
public class Publish1 { @Component(publishParameters = "value", parameters = "number=6") private Publish2 publish2; }
public class ParameterConflict { @SuppressWarnings("unused") @Component(parameters = "value=literal:ClassValue") private Echo echo; }
public class Publish2 { @Component(publishParameters = "value,number") private Publish3 publish3; }
public class CleanCacheDemo { @Component private Zone aZone; Object onActionFromUpdateZone() { return aZone; } @Cached public long getTimeNanos() { return System.nanoTime(); } }
/** * @since 5.3 */ public class InvalidFormalParameterDemo { // This has to be done using @Component, because non-matching attributes // in the template are quietly dropped. By placing it here, in the @Component annotation, // there's no ambiguity ... the developer expects there to be a parameter with the given name. @Component(parameters = { "start=5", "end=100", "value=var:index", "step=5" // not a formal parameter }) private Count counter; }
public class Countdown { @SuppressWarnings("unused") @Component(parameters = { "start=10", "end=1", "value=countValue" }) private Count count; private int countValue; public int getCountValue() { return countValue; } public void setCountValue(int countValue) { this.countValue = countValue; } }
/** * Page containing <i>kaptcha</i> edit blocks contributed into the * {@link org.apache.tapestry5.services.BeanBlockSource} service configuration. * * @see org.apache.tapestry5.services.BeanBlockContribution * @see org.apache.tapestry5.corelib.components.BeanEditForm * @since 5.3 */ public class KaptchaEditBlocks { @Environmental @Property(write = false) private PropertyEditContext context; @Component private KaptchaImage kaptchaImage; @Component(parameters = { "label=prop:context.label", "clientId=prop:context.propertyId", "image=kaptchaImage"}) private KaptchaField kaptchaField; }
@SupportsInformalParameters public class OuterAny { // Also, leave a few parameters here and there in the old naming style, with a // leading underscore. @Component(inheritInformalParameters = true) private Any innerAny; }
public class BeanEditorBeanEditContext { @Component private Form form; @Component(parameters = { "object=registrationData" }) private BeanEditor editor; @SessionState private RegistrationData data; public RegistrationData getRegistrationData() { return data; } Object onSuccess() { return ViewRegistration.class; } void onActionFromClear() { data = null; form.clearErrors(); } }
public class BeanEditorOverride { @Component private Form form; @Component(parameters = { "object=registrationData" }) private BeanEditor editor; @SessionState private RegistrationData data; public RegistrationData getRegistrationData() { return data; } Object onSuccess() { return ViewRegistration.class; } void onActionFromClear() { data = null; form.clearErrors(); } }
public class BaseLayoutPage { @Inject private ComponentResources resources; @Component(parameters = "to=titleRenderer") private Delegate titleDelegate; public Renderable getTitleRenderer() { return new Renderable() { public void render(MarkupWriter writer) { writer.write(TapestryInternalUtils.toUserPresentable(resources.getPageName())); } }; } }
public abstract class BaseGenericLoopDemo<T> { @Property @Component private Loop<T> inheritedLoop; @Property private List<T> inheritedLoopSource; @BeginRender void setupLoop() { inheritedLoopSource = initInheritedLoop(); } abstract List<T> initInheritedLoop(); }
public class RadioGroupWithValidation { @Component(parameters = { "value=bean.number", "validate=prop:beanValidator" }) private RadioGroup group2; /* */ @Persist private BeanForTAP1981 bean; /* */ @Environmental private PropertyEditContext context; public BeanForTAP1981 getBean() { if (bean == null) { bean = new BeanForTAP1981(); } return bean; } public FieldValidator getBeanValidator() { return context.getValidator(group2); } }
public class KaptchaBeanEditFormDemo { @Component(parameters = {"object=registrationData", "clientValidation=none"}) private BeanEditForm form; @Property @Kaptcha private RegistrationData registrationData; @Property @Persist(PersistenceConstants.FLASH) private String message; void onSuccessFromForm() { message = "Kaptcha passed."; } }
private boolean subscribeToEmail, codeVisible, subVisible = true; @Component(parameters = {"clientValidation=none"}) private Form form;