use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class PropertyEditor method beginRender.
/**
* Returns a Block for rendering the property. The Block will be able to access the {@link PropertyEditContext} via
* the {@link Environmental} annotation.
*/
Block beginRender() {
Block override = overrides.getOverrideBlock(propertyModel.getId());
if (override != null) {
return override;
}
String dataType = propertyModel.getDataType();
if (dataType == null)
throw new RuntimeException(String.format("The data type for property '%s' of %s is null.", propertyModel.getPropertyName(), object));
try {
return beanBlockSource.getEditBlock(dataType);
} catch (RuntimeException ex) {
String message = messages.format("core-block-error", propertyModel.getPropertyName(), dataType, object, ex);
throw new TapestryException(message, resources.getLocation(), ex);
}
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class AbstractComponentEventLink method beginRender.
void beginRender(MarkupWriter writer) {
if (isDisabled())
return;
Link link = createLink(context);
writeLink(writer, link);
writer.attributes("data-update-zone", zone);
if (async) {
javaScriptSupport.require("t5/core/zone");
writer.attributes("data-async-trigger", true);
}
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class AbstractConditional method beginRender.
/**
* Returns null if the {@link #test()} is true, which allows normal rendering (of the body). If the test parameter
* is false, returns the else parameter (this may also be null).
*/
Object beginRender(MarkupWriter writer) {
boolean enabled = test();
Block toRender = enabled ? (thenBlock == null ? resources.getBody() : thenBlock) : elseBlock;
String elementName = resources.getElementName();
if (enabled && elementName != null) {
renderTag = true;
writer.element(elementName);
resources.renderInformalParameters(writer);
}
return toRender;
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class AjaxFormLoop method setupRender.
void setupRender(MarkupWriter writer) {
pushContext();
iterator = source == null ? Collections.EMPTY_LIST.iterator() : source.iterator();
Link removeRowLink = resources.createEventLink("triggerRemoveRow", context);
Link injectRowLink = resources.createEventLink("injectRow", context);
injectRowLink.addParameter(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId());
injectRowLink.addParameter(RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());
// Fix for TAP5-227 - AjaxFormLoop dont work well inside a table tag
Element element = writer.getElement();
this.wrapper = element.getAttribute("data-container-type") != null || element.getAttribute("data-remove-row-url") != null || element.getAttribute("data-inject-row-url") != null ? writer.element("div") : null;
writer.attributes("data-container-type", "core/AjaxFormLoop", "data-remove-row-url", removeRowLink, "data-inject-row-url", injectRowLink);
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class Select method beginRender.
void beginRender(MarkupWriter writer) {
writer.element("select", "name", getControlName(), "id", getClientId(), "class", cssClass);
putPropertyNameIntoBeanValidationContext("value");
validate.render(writer);
removePropertyNameFromBeanValidationContext();
resources.renderInformalParameters(writer);
decorateInsideField();
if (this.zone != null) {
javaScriptSupport.require("t5/core/select");
Link link = resources.createEventLink(CHANGE_EVENT, context);
writer.attributes("data-update-zone", zone, "data-update-url", link);
}
}
Aggregations