[hmath-commits] org.hmath.server/WEB-INF/src/org/hartmath/server/macro AppletMacro.java,NONE,1.1
Status: Pre-Alpha
Brought to you by:
jsurfer
|
From: Klaus H. <js...@us...> - 2004-03-28 17:36:29
|
Update of /cvsroot/hmath/org.hmath.server/WEB-INF/src/org/hartmath/server/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25985/WEB-INF/src/org/hartmath/server/macro Added Files: AppletMacro.java Log Message: parser changes --- NEW FILE: AppletMacro.java --- package org.hartmath.server.macro; import java.io.IOException; import java.io.Writer; import org.radeox.macro.parameter.MacroParameter; import org.snipsnap.app.Application; /* * An applet macro. This Macro displays applets * * @author jsurfer */ public class AppletMacro extends HMathMacro { private String[] paramDescription = { }; public AppletMacro() { } public String getName() { return "applet"; } public String getDescription() { return "Insert an applet."; } public String[] getParamDescription() { return paramDescription; } public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { if (params.getLength() == 0) { String copy = params.getContent(); // de-escape tag delimiters copy = copy.replaceAll("<", "<"); copy = copy.replaceAll(">", ">"); copy = copy.replaceAll("\n", " "); copy = copy.replaceAll("\r", " "); writer.write( "<center><applet code=\""+params.getContent()+".class\" " + "codebase=\"" + Application.get().getConfiguration().getUrl("/lib/m14_jar") +"\" " + "width=\"600\" height=\"500\" " + "alt=\"Applet © Walter Fendt\" " + "archive=\""+params.getContent()+".jar, M14English.jar\" id=\"f1\">\n"); writer.write("</applet></center><center><a href=\"http://www.walter-fendt.de\">© Walter Fendt 1997 - 2004</a></center>"); // <applet code="Kugelvolumen.class" // archive="Kugelvolumen.jar, M14English.jar" // codebase="../m14_jar" width=480 height=400> // </applet> } else { throw new IllegalArgumentException("Number of arguments does not match"); } } } |