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(); }
final void afterRender(MarkupWriter writer) { // TextArea will not have a template. if (value != null) writer.write(value); writer.end(); // textarea }
@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(); } }
@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(); }
void afterRender(MarkupWriter writer) { // If the Label element has a body that renders some non-blank output, that takes precendence // over the label string provided by the field. boolean bodyIsBlank = InternalUtils.isBlank(labelElement.getChildMarkup()); if (bodyIsBlank) writer.write(field.getLabel()); writer.end(); // label decorator.afterLabel(field); }
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; }
@AfterRender public void afterRender(MarkupWriter writer) { writer.end(); String id = field.getClientId(); if (options == null) options = new JSONObject(); JSONObject opt = new JSONObject(); opt.put("id", id); opt.put("params", options); javaScriptSupport.require("kawwa/productquantity").with(opt); }
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(); } }
/** 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); }
public void render(MarkupWriter writer, RenderQueue queue) { writer.end(); }
public void afterRender(MarkupWriter writer) { writer.end(); }
public boolean cleanupRender(FrameworkMixin mixin, MarkupWriter writer) { if (mixin.getRoot() != null) { writer.end(); } return bootstrapProvider.cleanupRender(mixin, writer); }
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) { 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); }