本文整理汇总了Java中org.radeox.macro.parameter.MacroParameter类的典型用法代码示例。如果您正苦于以下问题:Java MacroParameter类的具体用法?Java MacroParameter怎么用?Java MacroParameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MacroParameter类属于org.radeox.macro.parameter包,在下文中一共展示了MacroParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params != null && params.getLength() == 1) {
writer.write("Hello <b>");
writer.write(params.get("0"));
writer.write("</b>");
} else {
throw new IllegalArgumentException(
"Number of arguments does not match");
}
}
示例2: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 0) {
UserManager um = (UserManager)Components.getComponent(UserManager.class);
writer.write(Integer.toString(um.getUserCount()));
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例3: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 1) {
writer.write("<footnote>");
writer.write(params.get("0"));
writer.write("</footnote>");
} else {
throw new IllegalArgumentException("footnote needs exactly one argument");
}
return;
}
示例4: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException {
if (params instanceof SnipMacroParameter) {
execute(writer, (SnipMacroParameter) params);
return;
} else {
throw new IllegalArgumentException("Macro must be called in a SnipSnap enviroment.");
}
}
示例5: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 0) {
writer.write(Integer.toString(SnipSpaceFactory.getInstance().getSnipCount()));
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例6: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 0) {
writer.write(version);
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例7: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
snipsnap.api.snip.Snip snip = SnipSpaceFactory.getInstance().load(snipsnap.api.app.Application.get().getConfiguration().getStartSnip());
MessageFormat mf = new MessageFormat(ResourceManager.getString("i18n.messages", "macro.onlinetime.age"),
ResourceManager.getLocale("i18n.messages"));
writer.write(mf.format(new Object[]{Modified.getNiceTime(snip.getModified().getcTime())}));
}
示例8: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 1) {
User user = UserManagerFactory.getInstance().load(params.get("0"));
writer.write("<b>");
writer.write(ResourceManager.getString("i18n.messages", "macro.lastvisit.lastvisit"));
writer.write("</b> ");
writer.write(Modified.getNiceTime(user.getLastLogout()));
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例9: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
if (params.getLength() == 1) {
User user = UserManagerFactory.getInstance().load(params.get("0"));
writer.write("<b>");
writer.write(ResourceManager.getString("i18n.messages", "macro.lastlogin.lastlogin"));
writer.write("</b> ");
writer.write(Modified.getNiceTime(user.getLastLogin()));
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例10: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
writer.write("hello " + params.getContent());
}
示例11: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
writer.write("hello world");
}
示例12: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
writer.write("hello "+name);
}
示例13: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
/**
* @see org.radeox.macro.Macro#execute(java.io.Writer, org.radeox.macro.parameter.MacroParameter)
*/
@Override
public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException {
String name = params.get(NAME);
String address = params.get(ADDRESS);
String height = params.get(HEIGHT);
String width = params.get(WIDTH);
String displayduration = params.get(DISPLAYDURATION);
String displayname = params.getContent();
if (address == null) {
writer.write("<p>movieViewer: illegal format: missing attribute " + ADDRESS + "</p>");
return;
}
// default values for unset optional parameter
if (name == null) name = "remotelyControlled";
if (width == null) width = Integer.toString(DEFAULT_WIDTH);
if (height == null) height = Integer.toString(DEFAULT_HEIGHT);
try {
int iHeigt = Integer.parseInt(height);
height = Integer.toString(iHeigt + CONTROLLER_HEIGHT);
} catch (NumberFormatException e) {
// using default values
width = Integer.toString(DEFAULT_WIDTH);
height = Integer.toString(DEFAULT_HEIGHT + CONTROLLER_HEIGHT);
}
writer.write("<span class=\"b_wiki_timemarker_viewer\">");
// show popup link
writer.write("<a href=\"javascript:void(");
// open window a bit bitter than the movie size itself
String args = "width=" + (Integer.parseInt(width) + WIDTH_OFFSET) + ",height=" + (Integer.parseInt(height) + HEIGHT_OFFSET) + ",resizable=yes,scrollbars=yes";
writer.write("window.open(o_info.o_baseURI + '/movie/popup.html?maddress=' + encodeURIComponent('" + address + "') + '&mname=' + encodeURIComponent('" + name
+ "') + '&displayname=' + encodeURIComponent('" + displayname + "') + '&displayduration=' + encodeURIComponent('" + displayduration + "') + '&width="
+ width + "&height=" + height + "', '" + name + "', '" + args + "')");
writer.write(")\">Open movie player");
if (displayname != null) {
writer.write(": ");
writer.write(displayname);
if (displayduration != null) {
writer.write(": ");
}
}
if (displayduration != null) {
writer.write(displayduration);
}
writer.write("</a>");
writer.write("</span>");
}
示例14: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
// Names from the namespace look like
// [0] = foo/
// [1] = foo/bar
// [2] = foo/barbar
// [3] = foo/barbar/boing
if (params.getLength() < 3) {
Snip[] snips = space.match(params.get("0"));
int maxDepth = -1;
if (params.getLength() == 2) {
try {
maxDepth = Integer.parseInt(params.get("1"));
} catch (NumberFormatException e) {
// silently ignore wrong number
}
}
Node root = new Node("root", false);
for (int i = 0; i < snips.length; i++) {
Snip snip = snips[i];
String elements[] = snip.getName().split("/");
// Create all nodes till leaf
Node lastNode = root;
for (int j = 0; j < elements.length; j++) {
String name = elements[j];
if (!lastNode.hasChild(name)) {
boolean isSnip = (j == elements.length - 1);
Node node = new Node(name, isSnip);
if (isSnip) {
node.setSnipName(snip.getName());
}
lastNode.addChild(node);
lastNode = node;
} else {
lastNode = lastNode.getChild(name);
}
}
}
writer.write("<div class=\"snip-tree\">");
writeTree(writer, root, 1, maxDepth);
writer.write("</div>");
} else if (params.getLength() == 3) {
writer.write("<img src=\"/exec/namespace?name=" + params.get(0) + "\"/>");
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
示例15: execute
import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
throws IllegalArgumentException, IOException {
RenderContext context = params.getContext();
if (context instanceof SnipRenderContext) {
SnipSpace space = ((SnipRenderContext) context).getSpace();
int length = 10;
boolean showSize = false;
if (params.getLength() > 0) {
try {
length = Integer.parseInt(params.get("0"));
} catch (NumberFormatException e) {
Logger.warn("HotnessMacro: illegal parameter count='" + params.get("0") + "'");
}
}
if (params.getLength() <= 1) {
Collection c = space.getHot(length);
Iterator iterator = c.iterator();
writer.write("<div class=\"list\"><div class=\"list-title\">");
ResourceManager.getString("i18n.messages", "macro.hotsnip.viewed");
if (showSize) {
writer.write(" (");
writer.write("" + length);
writer.write(")");
}
writer.write("</div><ul>");
while (iterator.hasNext()) {
snipsnap.api.snip.Snip hotSnip = (Snip) iterator.next();
writer.write("<li><span class=\"count\">");
writer.write("" + hotSnip.getViewCount());
writer.write("</span>");
writer.write("<span class=\"content\">");
SnipLink.appendLink(writer, hotSnip);
writer.write("</span></li>");
}
writer.write("</ul></div>");
} else {
throw new IllegalArgumentException("Number of arguments does not match");
}
}
}