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


Java MacroParameter.getLength方法代码示例

本文整理汇总了Java中org.radeox.macro.parameter.MacroParameter.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java MacroParameter.getLength方法的具体用法?Java MacroParameter.getLength怎么用?Java MacroParameter.getLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.radeox.macro.parameter.MacroParameter的用法示例。


在下文中一共展示了MacroParameter.getLength方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.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

示例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(version);
  } else {
    throw new IllegalArgumentException("Number of arguments does not match");
  }
}
 
开发者ID:thinkberg,项目名称:snipsnap,代码行数:9,代码来源:VersionMacro.java

示例6: 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

示例7: 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

示例8: 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

示例9: 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.getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。