本文整理汇总了Java中org.apache.tapestry5.MarkupWriter.element方法的典型用法代码示例。如果您正苦于以下问题:Java MarkupWriter.element方法的具体用法?Java MarkupWriter.element怎么用?Java MarkupWriter.element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tapestry5.MarkupWriter
的用法示例。
在下文中一共展示了MarkupWriter.element方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
});
}
示例3: 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());
}
示例4: 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;
}
示例5: beforeRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
/**
* Renders the wrapping element if such.
* @param writer a {@link MarkupWriter}.
* @return <code>false</code>.
*/
boolean beforeRender(MarkupWriter writer) {
elementName = resources.getElementName();
if (elementName != null) {
writer.element(elementName);
resources.renderInformalParameters(writer);
}
return false;
}
示例6: beginRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
/**
* Writes the RSS document
* @param writer a {@link MarkupWriter}.
*/
boolean beginRender(MarkupWriter writer) {
writer.element("rss", "version", "2.0", "xmlns:atom", "http://www.w3.org/2005/Atom");
writer.element("channel");
write(writer, "title", channel.getTitle());
write(writer, "link", channel.getLink());
write(writer, "description", channel.getDescription());
writer.element("atom:link", "href", channel.getLink(), "rel", "self", "type", "application/rss+xml");
writer.end(); // atom:link
for (Item item : channel.getItems()) {
writer.element("item");
write(writer, "title", item.getTitle());
write(writer, "description", item.getDescription());
write(writer, "author", item.getAuthor());
write(writer, "pubDate", item.getPublicationDate());
write(writer, "link", item.getLink());
write(writer, "guid", item.getGuid());
writer.end(); // item
}
writer.end(); // channel
writer.end(); // rss
return false;
}
示例7: beginRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
boolean beginRender(final MarkupWriter writer) {
writer.element(elementName, "id", clientId);
return false;
}
示例8: beginRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
boolean beginRender(final MarkupWriter writer) {
writer.element(elementName, "id", clientId);
return true;
}
示例9: addDivElement
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
@BeginRender
public void addDivElement(MarkupWriter writer){
writer.element("div", "id", clientId);
}
示例10: beginRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
/**
* Renders the tags.
*
* @param writer a {@link MarkupWriter}.
* @return <code>false</code> so the component body isn't rendered.
*/
boolean beginRender(MarkupWriter writer) {
if (tags.size() > 0) {
Tag tag;
String tagTitle;
writer.element("ol", "class", "tag-list");
// TagController.findByName() will be heavily cached, so we can do this loop this way,
// instead of trying to load all tags from the database at once.
for (String tagName : tags) {
writer.element("li");
tag = tagController.findByName(tagName);
tagTitle = tag != null ? tag.getTitle() : tagName;
final Link link = pageRenderLinkSource.createPageRenderLinkWithContext(Index.class, tagName);
final Element a = writer.element("a", "href", link.toAbsoluteURI(), "class", "tag-link");
a.text(tagName);
if (!tagName.equals(tagTitle)) {
a.attribute("title", tagTitle);
}
writer.end(); // li
writer.end(); // a
}
writer.end(); // ol
}
return false;
}
示例11: beginRender
import org.apache.tapestry5.MarkupWriter; //导入方法依赖的package包/类
void beginRender(MarkupWriter writer) {
List<String> itemClass = CollectionFactory.newList();
Element e = writer.element("li");
if (itemCssClass != null) {
itemClass.add(itemCssClass);
}
if (menuContext.isActive(name)) {
itemClass.add("active");
}
//TODO: FIXME
// Hack to handle just sub-menus
if (page != null && page.startsWith("admin") && page.contains(resources.getPageName().toLowerCase())) {
itemClass.add("active");
}
if (!itemClass.isEmpty()) {
e.addClassName(TapestryInternalUtils.toClassAttributeValue(itemClass));
}
Element href = writer.element("a",
"id", name,
"href", getUrl(),
"title", title
);
if (style != null) {
href.attribute("style", style);
}
resources.renderInformalParameters(writer);
writer.write(title);
writer.end(); //a
}