use of org.apache.tapestry5.services.Core in project tapestry-5 by apache.
the class GridPager method writePageLink.
private void writePageLink(MarkupWriter writer, int pageIndex) {
if (pageIndex < 1 || pageIndex > maxPages)
return;
if (pageIndex <= lastIndex)
return;
final boolean isBootstrap4 = isBootstrap4();
if (pageIndex != lastIndex + 1) {
writer.element("li", "class", isBootstrap4 ? "disabled page-item" : "disabled");
writer.element("a", "href", "#", "aria-disabled", "true");
addClassAttributeToPageLinkIfNeeded(writer, isBootstrap4);
writer.write(" ... ");
writer.end();
writer.end();
}
lastIndex = pageIndex;
if (pageIndex == currentPage) {
writer.element("li", "aria-current", "page", "class", isBootstrap4 ? "active page-item" : "active");
writer.element("a", "href", "#", "aria-disabled", "true");
addClassAttributeToPageLinkIfNeeded(writer, isBootstrap4);
writer.write(Integer.toString(pageIndex));
writer.end();
writer.end();
return;
}
writer.element("li");
if (isBootstrap4) {
writer.getElement().attribute("class", "page-item");
}
Link link = resources.createEventLink(EventConstants.ACTION, pageIndex);
if (zone != null) {
link.addParameter("t:inplace", "true");
}
writer.element("a", "href", link, "data-update-zone", zone, "title", messages.format("core-goto-page", pageIndex));
addClassAttributeToPageLinkIfNeeded(writer, isBootstrap4);
writer.write(Integer.toString(pageIndex));
writer.end();
// li
writer.end();
}
use of org.apache.tapestry5.services.Core in project tapestry-5 by apache.
the class Label method updateAttributes.
@HeartbeatDeferred
private void updateAttributes() {
String fieldId = field.getClientId();
if (!productionMode && fieldId == null) {
// TAP5-2500
String warningText = "The Label component " + resources.getCompleteId() + " is linked to a Field that failed to return a clientId. The 'for' attibute will not be rendered.";
javaScriptSupport.require("t5/core/console").invoke("warn").with(warningText);
}
String id = clientId != null ? clientId : javaScriptSupport.allocateClientId(fieldId + "-label");
labelElement.attribute("id", id);
labelElement.forceAttributes("for", fieldId);
if (fieldId != null) {
Element input = labelElement.getDocument().getElementById(field.getClientId());
if (input != null) {
input.attribute("aria-labelledby", id);
}
}
decorator.insideLabel(field, labelElement);
}
use of org.apache.tapestry5.services.Core in project tapestry-5 by apache.
the class Autocomplete method afterRender.
@Import(stylesheet = "typeahead-bootstrap3.css")
void afterRender() {
Link link = resources.createEventLink(EVENT_NAME, context);
JSONObject spec = new JSONObject("id", field.getClientId(), "url", link.toString()).put("minChars", minChars).put("limit", maxSuggestions);
jsSupport.require("t5/core/autocomplete").with(spec);
}
use of org.apache.tapestry5.services.Core in project tapestry-5 by apache.
the class TriggerFragment method beginRender.
@HeartbeatDeferred
void beginRender() {
String fragmentId = fragment.getClientId();
if (fragmentId == null) {
throw new IllegalStateException("The fragment has returned a null client-side ID");
}
JSONObject spec = new JSONObject("triggerId", container.getClientId(), "fragmentId", fragmentId);
if (invert) {
spec.put("invert", true);
}
javascriptSupport.require("t5/core/form-fragment").invoke("linkTrigger").with(spec);
}
use of org.apache.tapestry5.services.Core in project tapestry-5 by apache.
the class DashboardModule method defaultTabs.
@Contribute(DashboardManager.class)
public static void defaultTabs(OrderedConfiguration<DashboardTab> configuration) {
configuration.add("Pages", new DashboardTab("Pages", "core/PageCatalog"));
configuration.add("Services", new DashboardTab("Services", "core/ServiceStatus"));
configuration.add("Libraries", new DashboardTab("ComponentLibraries", "core/ComponentLibraries"));
}
Aggregations