当前位置: 首页>>代码示例>>Java>>正文


Java MacroParameter类代码示例

本文整理汇总了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");
  }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:12,代码来源:ParameterHelloWorldMacro.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:10,代码来源:UserCountMacro.java

示例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;
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:12,代码来源:AnnotationMacro.java

示例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.");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:9,代码来源:SnipPreserved.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:9,代码来源:SnipCountMacro.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:9,代码来源:VersionMacro.java

示例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())}));
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:9,代码来源:OnlineTimeMacro.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:14,代码来源:LastVisitMacro.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:14,代码来源:LastLoginMacro.java

示例10: execute

import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
  throws IllegalArgumentException, IOException {
  writer.write("hello " + params.getContent());
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:5,代码来源:ContentHelloWorldMacro.java

示例11: execute

import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
  throws IllegalArgumentException, IOException {
  writer.write("hello world");
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:5,代码来源:HelloWorldMacro.java

示例12: execute

import org.radeox.macro.parameter.MacroParameter; //导入依赖的package包/类
public void execute(Writer writer, MacroParameter params)
  throws IllegalArgumentException, IOException {
  writer.write("hello "+name);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:5,代码来源:InitialRenderContextHelloWorldMacro.java

示例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>");
}
 
开发者ID:huihoo,项目名称:olat,代码行数:54,代码来源:MovieViewerMacro.java

示例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");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:54,代码来源:SnipTreeMacro.java

示例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");
    }
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:44,代码来源:HotSnipMacro.java


注:本文中的org.radeox.macro.parameter.MacroParameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。