本文整理汇总了Java中org.apache.tapestry5.MarkupWriter类的典型用法代码示例。如果您正苦于以下问题:Java MarkupWriter类的具体用法?Java MarkupWriter怎么用?Java MarkupWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MarkupWriter类属于org.apache.tapestry5包,在下文中一共展示了MarkupWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: after
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@AfterRender
void after(MarkupWriter writer){
Resource res;
Asset asset;
if(!isListEmpty())
{
for (String script : scriptList){
try{
res=moduleManager.findResourceForModule(script);
asset=assetSource.getUnlocalizedAsset(res.toString());
String url = asset.toClientURL();
writer.element("script", "type", "text/javascript", "src", url);
writer.end();}
catch(Exception ex)
{
logger.error("Script not found:"+ ex.getMessage());
}
}
}
}
示例2: prepareHTMLPageOnRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@Contribute(MarkupRenderer.class)
public static void prepareHTMLPageOnRender(final OrderedConfiguration<MarkupRendererFilter> configuration,
final RequestGlobals requestGlobals, final PageRenderLinkSource pageRenderLinkSource) {
configuration.add("AddPageName", new MarkupRendererFilter() {
@Override
public void renderMarkup(final MarkupWriter writer, final MarkupRenderer renderer) {
renderer.renderMarkup(writer);
Element html = writer.getDocument().find("html");
if (html != null) {
Link link = pageRenderLinkSource.createPageRenderLinkWithContext(requestGlobals.getActivePageName());
for (String parameterName : link.getParameterNames()) {
link = link.removeParameter(parameterName);
}
String url = link.toURI();
html.attributes("data-page-base-url", url);
}
}
});
}
示例3: beginRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
void beginRender(MarkupWriter writer) {
clientId = resources.isBound("id") ? idParameter : javaScriptSupport.allocateClientId(resources);
Element e = writer.element("ul",
"id", clientId);
resources.renderInformalParameters(writer);
if (className != null) {
e.addClassName(className);
}
environment.push(MenuContext.class, new MenuContext() {
public boolean isActive(String itemId) {
return active != null && active.equalsIgnoreCase(itemId);
}
});
}
示例4: afterRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@AfterRender
void afterRender(MarkupWriter writer) {
String id = clientElement.getClientId();
String clientID = javaScriptSupport.allocateClientId(id);
String formID = formSupport.getClientId();
Date date = coercer.coerce(value, Date.class);
String formatedDate = "";
if ( date != null ) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
formatedDate = format.format(date);
}
Element dateField = element.elementBefore("input",
"value",formatedDate,"type","hidden","class","form-control","id",clientID);
if (clientElement.isDisabled()) {
dateField.attribute("disabled", "disabled");
}
javaScriptSupport.require("datepicker/datepicker").with(new JSONObject("id", id, "clientID", clientID,"formID",formID));
if ( ! DatePickerConstants.NULL.equals(css)) {
javaScriptSupport.importStylesheet(assetSource.getExpandedAsset(css));
}
if ( ! DatePickerConstants.NULL.equals(javascript)) {
javaScriptSupport.importJavaScriptLibrary(assetSource.getExpandedAsset(javascript));
}
}
示例5: afterRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
void afterRender(final MarkupWriter writer) {
writer.end();
JSONObject parameters = new JSONObject();
for (String informalParameterName : componentResources.getInformalParameterNames()) {
parameters.put(informalParameterName,
componentResources.getInformalParameter(informalParameterName, Object.class));
}
javaScriptSupport.require("angular2/js/a2component").with(module, clientId, parameters);
}
示例6: beforeRenderBody
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@BeforeRenderBody
boolean beforeRenderBody(MarkupWriter writer) {
TabGroupModel tabModel = (TabGroupModel) request.getAttribute(TabGroup.ATTRIBUTE_MODEL);
if (tabModel == null) {
throw new IllegalStateException("Tab must be nested inside a TabGroup");
}
tabModel.addTab(name, label, resources.getBody());
// don't render the body, it will be rendered by the TabGroup
return false;
}
示例7: afterRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
void afterRender(final MarkupWriter writer) {
writer.end();
JSONObject parameters = new JSONObject();
for (String informalParameterName : componentResources.getInformalParameterNames()) {
parameters.put(informalParameterName,
componentResources.getInformalParameter(informalParameterName, Object.class));
}
javaScriptSupport.require("eddyson/react/components/reactcomponent").with(module, clientId, parameters);
}
示例8: beginRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
public void beginRender(MarkupWriter writer) {
if (assetCount > 0) {
double[] limits = { 1, 2 };
String[] assets = {
messages.get("assets.one"),
messages.format("assets.multiple", assetCount) };
String[] items = { messages.get("items.one"), messages.format("items.multiple", itemCount) };
ChoiceFormat cfa = new ChoiceFormat(limits, assets);
ChoiceFormat cfi = new ChoiceFormat(limits, items);
writer.write(messages.format("in-stock", cfa.format(assetCount), cfi.format(itemCount)));
}
else {
writer.write(none);
}
}
示例9: beginRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
public void beginRender(MarkupWriter writer) {
if (date != null) {
synchronized (dateFormat) {
writer.write(dateFormat.format(date));
}
}
}
示例10: contributeMarkupRenderer
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration,
final Environment environment) {
MarkupRendererFilter bootstrapValidationDecorator = new MarkupRendererFilter() {
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) {
environment.push(ValidationDecorator.class, new BootstrapValidationDecorator(environment, writer));
renderer.renderMarkup(writer);
environment.pop(ValidationDecorator.class);
}
};
configuration.override("ValidationDecorator", bootstrapValidationDecorator);
}
示例11: writeFieldTag
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@Override
protected final void writeFieldTag(MarkupWriter writer, String value) {
writer.element("input",
"type", "password",
"name", getControlName(),
"id", getClientId(),
"value", value,
"size", getWidth());
}
示例12: setJS
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
@AfterRender
public void setJS(MarkupWriter writer){
// resources.renderInformalParameters(writer);
writer.end();
javascript.addInitializerCall(this.getInitializerName(), this.opts);
}
示例13: beginRender
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
boolean beginRender(MarkupWriter writer)
{
hiddenInputElement =
writer.element("input", "type", "hidden", "name", name, "value", tokenManager.getSessionToken().getToken());
resources.renderInformalParameters(writer);
writer.end();
return false;
}
示例14: afterRenderBody
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
/**
* Adds the CSS classes.
* @param writer a {@link MarkupWriter}.
*/
void afterRenderBody(MarkupWriter writer) {
if (enable && tags.size() > 0) {
addCssClasses();
addCss(writer);
}
}
示例15: addCss
import org.apache.tapestry5.MarkupWriter; //导入依赖的package包/类
private void addCss(MarkupWriter writer) {
String tagName;
Tag tag;
for (int i = tags.size() - 1; i >= 0; i--) {
tagName = tags.get(i);
tag = tagController.findByName(tagName);
if (tag != null && tag.getCss() != null && tag.getCss().trim().length() > 0) {
final Link link = pageRenderLinkSource.createPageRenderLinkWithContext(Css.class, tagName);
javaScriptSupport.importStylesheet(new LinkAsset(link));
}
}
}