Skip to content

Instantly share code, notes, and snippets.

@greenlaw110
Created February 12, 2013 21:13
Show Gist options
  • Save greenlaw110/4773442 to your computer and use it in GitHub Desktop.
Save greenlaw110/4773442 to your computer and use it in GitHub Desktop.
A rythm generated java source file from a template source with only static content
import java.util.*;
import java.io.*;
public class templates_stocks_rythm_html__R_T_C__ extends com.greenlaw110.rythm.template.TagBase {
@Override public java.lang.String getName() {
return "templates_stocks_rythm_html__R_T_C__";
}
protected Map<String, Class> renderArgTypeMap() {
Map<String, Class> m = new HashMap<String, Class>();
return m;
}
@SuppressWarnings("unchecked")
public void setRenderArgs(java.util.Map<String, Object> args) {
if (null == args) throw new NullPointerException();
if (args.isEmpty()) return;
super.setRenderArgs(args);
}
@SuppressWarnings("unchecked") @Override public void setRenderArg(String name, Object arg) {
super.setRenderArg(name, arg);
}
@SuppressWarnings("unchecked") public void setRenderArg(int pos, Object arg) {
int _p = 0;
if(0 == pos) setRenderArg("arg", arg);
}
@Override public com.greenlaw110.rythm.utils.TextBuilder build(){
buffer().ensureCapacity(1227);
p("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n <title>Stock Prices - Rythm</title>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n <meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n <link rel=\"shortcut icon\" href=\"/images/favicon.ico\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"/css/style.css\" media=\"all\" />\n <script type=\"text/javascript\" src=\"/js/util.js\"></script>\n <style type=\"text/css\">\n /*<![CDATA[*/\n\nbody {\n color: #333333;\n line-height: 150%;\n}\n\nthead {\n font-weight: bold;\n background-color: #CCCCCC;\n}\n\n.odd {\n background-color: #FFCCCC;\n}\n\n.even {\n background-color: #CCCCFF;\n}\n\n.minus {\n color: #FF0000;\n}\n\n /*]]>*/\n </style>\n\n </head>\n\n <body>\n\n <h1>Stock Prices- Rythm</h1>\n\n <table>\n <thead>\n <tr>\n <th>#</th><th>symbol</th><th>name</th><th>price</th><th>change</th><th>ratio</th>\n </tr>\n </thead>\n <tbody>\n\n </tbody>\n </table>\n\n </body>\n</html>\n"); //line: 60
return this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment