@BeginRender void beginRender(MarkupWriter writer) { if (checked) { writer.element("input", "type", "checkbox", "checked", "checked"); } else { writer.element("input", "type", "checkbox"); } resources.renderInformalParameters(writer); writer.end(); }
protected void generateResponseMarkup(MarkupWriter writer, List matches) { writer.element("ul"); for (Object o : matches) { Employee employee = (Employee) o; writer.element("li"); writer.attributes("id", employee.getId()); writer.write(employee.getFirstName() + " " + employee.getLastName()); writer.end(); } writer.end(); }
@AfterRender void afterRender(MarkupWriter writer) { value = temp; writer.element("div", "id", field.getClientId() + "_after_but_before"); writer.writeRaw(value + "-after"); writer.end(); }
boolean beginRender(MarkupWriter writer) { final Field field = this.field; decorator.beforeLabel(field); labelElement = writer.element("label"); resources.renderInformalParameters(writer); // Since we don't know if the field has rendered yet, we need to defer writing the for and id // attributes until we know the field has rendered (and set its clientId property). That's // exactly what Heartbeat is for. Runnable command = new Runnable() { public void run() { String fieldId = field.getClientId(); labelElement.forceAttributes("for", fieldId, "id", fieldId + ":label"); decorator.insideLabel(field, labelElement); } }; heartbeat.defer(command); return !ignoreBody; }
@BeginRender void beginRender(MarkupWriter writer) { writer.element("div", "id", field.getClientId() + "_before_but_after"); writer.writeRaw(value + "-before"); writer.end(); temp = value; value = "beginrender_for_mixinafter_isreally_justafter_corecomponent_render"; }
@BeginRender void beginRender(MarkupWriter writer) { if (tags == null) { return; } if (tags.getTitle() != null) { writer.element("meta", "property", "og:title", "content", tags.getTitle()); writer.end(); } if (tags.getType() != null) { writer.element("meta", "property", "og:type", "content", tags.getType()); writer.end(); } if (tags.getImageURL() != null) { writer.element("meta", "property", "og:image", "content", tags.getImageURL()); writer.end(); } if (tags.getUrl() != null) { writer.element("meta", "property", "og:url", "content", tags.getUrl()); writer.end(); } if (tags.getSiteName() != null) { writer.element("meta", "property", "og:site_name", "content", tags.getSiteName()); writer.end(); } if (tags.getApplicationID() != null) { writer.element("meta", "property", "fb:app_id", "content", tags.getApplicationID()); writer.end(); } if (tags.getAdmins() != null) { writer.element("meta", "property", "fb:admins", "content", tags.getAdmins()); writer.end(); } }
boolean beginRender(MarkupWriter writer) { clientId = javaScriptSupport.allocateClientId(resources); if (storage != null) { List<Alert> alerts = storage.getAlerts(); if (!alerts.isEmpty()) { for (Alert alert : alerts) { String alertType = alert.severity.name().toLowerCase(); String css = alertType; if ("info".equals(alertType)) { css = "success"; } css = "alert-" + css; writer.element("div", "id", clientId, "class", "alert " + css); { resources.renderInformalParameters(writer); String dismiss = resources.createEventLink("dismiss", alert.id).toURI(); if (alert.duration.persistent) { writer.element("a", "href", dismiss, "class", "close"); } else { writer.element("a", "href", "#", "class", "close", "data-dismiss", "alert"); } writer.write(dismissText); writer.end(); writer.write(alert.message); } writer.end(); } } storage.dismissNonPersistent(); } return false; }
private void writeTimeZone(MarkupWriter writer) { if (timeZone == TimeZoneVisibility.NONE) return; TimeZone tz = timeZoneTracker.getClientTimeZone(); writer.element("span", "class", "tx-datefield-timezone"); switch (timeZone) { case DISPLAY: writer.write(" "); writer.write(tz.getDisplayName(locale)); break; case SELECT: writer.element("select", "name", getControlName() + "$timezone"); for (TimeZone option : F.flow(TimeZone.getAvailableIDs()).map(ID_TO_TIME_ZONE).sort(timeZoneComparator)) { writer.element("option", "value", option.getID()); if (tz.equals(option)) writer.attributes("selected", "selected"); int offset = option.getRawOffset() / (1000 * 60 * 60); writer.write(String.format("UTC%+03d %s", offset, option.getID())); writer.end(); } writer.end(); default: break; } writer.end(); }
/** * Writes an icon for field after the field. The icon has the same id as the field, with ":icon" * appended. This is expected by the default client-side JavaScript. The icon's src is a blank * spacer image (this is to allow the image displayed to be overridden via CSS). The icon's CSS * class is "t-error-icon", with "t-invisible" added if the field is not in error when rendered. * If client validation is not enabled for the form containing the field and the field is not in * error, then the error icon itself is not rendered. * * @param field which just completed rendering itself */ @Override public void afterField(Field field) { boolean inError = inError(field); boolean clientValidationEnabled = getFormSupport().isClientValidationEnabled(); if (inError || clientValidationEnabled) { String iconId = field.getClientId() + "_icon"; String cssClass = inError ? "t-error-icon" : "t-error-icon t-invisible"; markupWriter.element( "img", "src", spacerAsset.toClientURL(), "alt", "", "class", cssClass, "id", iconId); markupWriter.end(); } }
@Override protected final void writeFieldTag(MarkupWriter writer, String value) { writer.element( "textarea", "name", getControlName(), "class", cssClass, "id", getClientId(), "cols", getWidth()); // Save until needed in after() this.value = value; }
/** * Render the upload tags. * * @param writer Writer to output markup */ protected void beginRender(MarkupWriter writer) { formSupport.setEncodingType(MULTIPART_ENCTYPE); writer.element( "input", "type", "file", "name", getControlName(), "id", getClientId(), "class", cssClass); validate.render(writer); resources.renderInformalParameters(writer); decorateInsideField(); // TAPESTRY-2453 if (request.isXHR()) { javaScriptSupport.require("t5/core/injected-upload").with(getClientId()); } }
/** Renders the options, including the blank option. */ @BeforeRenderTemplate void options(MarkupWriter writer) { selectedClientValue = tracker.getInput(this); // Use the value passed up in the form submission, if available. // Failing that, see if there is a current value (via the value parameter), and // convert that to a client value for later comparison. if (selectedClientValue == null) selectedClientValue = value == null ? null : encoder.toClient(value); if (showBlankOption()) { writer.element("option", "value", ""); writer.write(blankLabel); writer.end(); } SelectModelVisitor renderer = new Renderer(writer); model.visit(renderer); }
void beginRender(MarkupWriter writer) { writer.element("select", "name", getControlName(), "id", getClientId()); putPropertyNameIntoBeanValidationContext("value"); validate.render(writer); removePropertyNameFromBeanValidationContext(); resources.renderInformalParameters(writer); decorateInsideField(); // Disabled is via a mixin if (this.zone != null) { Link link = resources.createEventLink(CHANGE_EVENT); JSONObject spec = new JSONObject("selectId", getClientId(), "zoneId", zone, "url", link.toURI()); javascriptSupport.addInitializerCall("linkSelectToZone", spec); } }
@SetupRender public void setupRender(MarkupWriter writer) { writer.element("p", "class", "k-quantity"); }
void beginRender(MarkupWriter writer) { String clientId = getClientId(); writer.element("table", "id", clientId); writer.end(); writer.element("div", "id", "pager" + clientId); writer.end(); JSONObject setup = new JSONObject(); setup.put("field", clientId); /*url:'server.php?q=2', datatype: "json",*/ JSONObject jqgridParams = new JSONObject(); jqgridParams.put("url", resources.createEventLink("data").toAbsoluteURI()); jqgridParams.put("datatype", "json"); // colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], JSONArray colNames = new JSONArray(); List<String> names = getDataModel().getPropertyNames(); for (String name : names) colNames.put(name); jqgridParams.put("colNames", colNames); /*colModel:[ {name:'id',index:'id', width:55}, {name:'invdate',index:'invdate', width:90}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right"}, {name:'tax',index:'tax', width:80, align:"right"}, {name:'total',index:'total', width:80,align:"right"}, {name:'note',index:'note', width:150, sortable:false} ],*/ JSONArray colModel = new JSONArray(); for (String name : names) { JSONObject model = new JSONObject(); model.put("name", name); model.put("index", name); model.put("width", 100); colModel.put(model); // is this column sorted? if (sortAscending != null) { ColumnSort colSort = getSortModel().getColumnSort(name); if (colSort != ColumnSort.UNSORTED) { // sortname: 'id', jqgridParams.put("sortname", name); // sortorder: "desc", if (colSort == ColumnSort.ASCENDING) jqgridParams.put("sortorder", "asc"); else jqgridParams.put("sortorder", "dsc"); } } } jqgridParams.put("colModel", colModel); // rowNum:10, jqgridParams.put("rowNum", rowsPerPage); // rowList:[10,20,30], // pager: '#pager5', jqgridParams.put("pager", "#pager" + clientId); // viewrecords: true, // caption:"Simple data manipulation", jqgridParams.put("caption", "Simple data manipulation"); // editurl:"someurl.php" jqgridParams.put("editurl", resources.createEventLink("edit").toAbsoluteURI()); jqgridParams .put("sortable", true) .put("viewrecords", true) .put("rowList", new JSONLiteral("[5,10,15]")); JQueryUtils.merge(jqgridParams, additionalParams); setup.put("params", jqgridParams); if (request.getAttribute(LOCALIZATION_CONFIGURED_FLAG) == null) { JSONObject spec = new JSONObject(); request.setAttribute(LOCALIZATION_CONFIGURED_FLAG, true); } support.addInitializerCall("jqGrid", setup); }
public void beginRender(MarkupWriter writer) { String value = tracker.getInput(this); if (value == null) { value = formatCurrentValue(); } String clientId = getClientId(); String triggerId = clientId + "-trigger"; writer.element( "input", "type", hideTextField ? "hidden" : "text", "name", getControlName(), "id", clientId, "value", value); if (isDisabled()) { writer.attributes("disabled", "disabled"); } validate.render(writer); resources.renderInformalParameters(writer); decorateInsideField(); writer.end(); // Now the trigger icon. writer.element( "img", "id", triggerId, "class", "t-calendar-trigger", "src", icon.toClientURL(), "alt", "[Show]"); writer.end(); // img writeTimeZone(writer); JSONObject spec = new JSONObject( "clientId", clientId, "clientDateFormat", formatConverter.convertToClient(format)) .put("time", time) .put("singleClick", singleClick); if (max != null) { spec.put("max", convertDateToClientTimeZone(max).getTime()); } if (min != null) { spec.put("min", convertDateToClientTimeZone(min).getTime()); } javascriptSupport.addInitializerCall("tapxDateField", spec); }
void beginRender(MarkupWriter writer) { writer.element("img", "src", buildGravatarUrl()); }