Revision: 4107 http://vexi.svn.sourceforge.net/vexi/?rev=4107&view=rev Author: mkpg2 Date: 2011-04-11 23:40:46 +0000 (Mon, 11 Apr 2011)
Log Message: ----------- Improve look of launcher web page. Centred, added logo image and applet border image. Modified Paths: -------------- trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/VexiDeploymentAssembler.java trunk/org.vexi-launcher.testdeploy/meta/module.xml trunk/org.vexi-launcher.testdeploy/meta/product-assembly.xml Added Paths: ----------- trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/BasicTemplate.java trunk/org.vexi-launcher.testdeploy/src/main/files/images/ trunk/org.vexi-launcher.testdeploy/src/main/files/images/appletbg.png trunk/org.vexi-launcher.testdeploy/src/main/files/images/vexi-logo192.png trunk/org.vexi-launcher.testdeploy/src/main/files/index.html trunk/org.vexi-launcher.testdeploy/src/unused/ trunk/org.vexi-launcher.testdeploy/src/unused/files/ trunk/org.vexi-launcher.testdeploy/src/unused/files/appletbg.xcf trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.css trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.html trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.t trunk/org.vexi-launcher.testdeploy/src/unused/files/splashless.html Removed Paths: ------------- trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.png trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.xcf trunk/org.vexi-launcher.testdeploy/src/main/files/splash.css trunk/org.vexi-launcher.testdeploy/src/main/files/splash.html trunk/org.vexi-launcher.testdeploy/src/main/files/splashless.html trunk/org.vexi-launcher.testdeploy/src/splash.t trunk/org.vexi-launcher.testdeploy/src_dev/ Added: trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/BasicTemplate.java =================================================================== --- trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/BasicTemplate.java (rev 0) +++ trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/BasicTemplate.java 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,30 @@ +package org.vexi.build.deployment; + +import java.io.IOException; +import java.util.Map; +import java.util.Set; + +public class BasicTemplate { + static public String checkVars(String text, Set<String> model){ + // SHOULD make this more efficient ... + for(String k: model){ + String kname = "$"+k+"$"; + if(!text.contains(kname)){ + return "Expected variable: "+kname; + } + } + return null; + } + + static public String apply(String text, Map<String,String> model) throws IOException{ + // SHOULD make this more efficient ... + for(String k: model.keySet()){ + String v = model.get(k); + String kname = "$"+k+"$"; + + String text0 = text; + text = text0.replace(kname, v); + } + return text; + } +} \ No newline at end of file Property changes on: trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/BasicTemplate.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/VexiDeploymentAssembler.java =================================================================== --- trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/VexiDeploymentAssembler.java 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-build.deployment/src/main/java/org/vexi/build/deployment/VexiDeploymentAssembler.java 2011-04-11 23:40:46 UTC (rev 4107) @@ -3,6 +3,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -11,6 +12,7 @@ import ebuild.api.IAssemblerArgument; import ebuild.api.IEBuild; +import ebuild.api.IInput; import ebuild.api.IInputMap; import ebuild.api.log.ILogger; import ebuild.api.plugin.AbstractAssembler; @@ -48,11 +50,14 @@ } - - String launcherPage = props.getString("launcher-page"); - if(launcherPage!=null){ - File file = new File(output, launcherPage); - IOUtil.stringToFile(generateLaunchHtml(props, core, launcher, vexis), file); + IInput launcherPageInput = inputs.getInput("launcher-page"); + if(launcherPageInput!=null){ + for(File f: launcherPageInput.getArtifacts()){ + FileUtil.mergeCopy(f, output); + } + File file = new File(output, props.getString("launcher-page", "index.html")); + if(!file.isFile()) throw new BuildPluginException("Expected launcher-page template file: "+ebuild.formatAsDisplayPath(file)); + IOUtil.stringToFile(generateLaunchHtml(file, props, core, launcher, vexis), file); } String launcherJson = props.getString("launcher-json"); @@ -68,22 +73,24 @@ } - public String generateLaunchHtml(IPropertyMap props, File core, File launcher, Collection<String> vexis) throws Exception{ - String mainClass = props.expectString("applet-class"); + public String generateLaunchHtml(File templateFile, IPropertyMap props, File core, File launcher, Collection<String> vexis) throws Exception{ + String template = IOUtil.fileToString(templateFile); + String ROOT = props.expectString("root"); + Map<String,String> model = new HashMap(); + model.put("applet-params", generateParams(props, core, vexis)); + model.put("applet-jar", ROOT+"/"+launcher.getName()); + model.put("applet-class",props.expectString("applet-class")); + + String error = BasicTemplate.checkVars(template, model.keySet()); + if(error!=null) throw new BuildPluginException("Problem with launch template '"+templateFile.getName()+"': " +error); + return BasicTemplate.apply(template, model); + } + + private String generateParams(IPropertyMap props, File core, Collection<String> vexis) throws Exception{ String ROOT = props.expectString("root"); StringBuilder sb = new StringBuilder(); sb.append( - "<html>\n"+ - "<body>\n"+ - " <p>Launcher for <strong>"+props.expectString("title")+"</strong></p>\n"+ - " <p>\n"+ - " \n"+ - " <applet\n"+ - " code='"+mainClass+"'\n"+ - " archive='"+ROOT+"/"+launcher.getName()+"'\n"+ - " height='20' width='600'></p>\n"+ - " <param name='core' value='"+ROOT+"/"+core.getName()+"'/>\n"+ " <param name='option0' value='-t'/>\n"+ " <param name='option1' value='"+props.getString("main-template","main")+"'/>\n"); @@ -92,13 +99,6 @@ sb.append( " <param name='vexi"+(i++)+"' value='"+ROOT+"/"+v+"'/>\n"); } - sb.append( - " </applet>\n"+ - " \n"+ - " </p>\n"+ - " \n"+ - " </body>\n"+ - " </html>"); return sb.toString(); } @@ -110,21 +110,4 @@ m.put("vexis", vexis); return m; } - - -// REMARK actually nonsensical - the main class is a standalone jar concept. No such -// similar concept for applets ... -// -// private String readMainClass(File launcher) throws IOException{ -// JarFile launcherJar = new JarFile(launcher); -// Attributes attrs =launcherJar.getManifest().getMainAttributes(); -// System.err.println("Jar"); -// System.err.println(" "+launcher.getAbsolutePath()); -// for(Object a: attrs.keySet()){ -// System.err.println(a+": "); -// System.err.println(" "+attrs.get(a)); -// } -// return attrs.getValue("Main-Class"); -// } - } Modified: trunk/org.vexi-launcher.testdeploy/meta/module.xml =================================================================== --- trunk/org.vexi-launcher.testdeploy/meta/module.xml 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/meta/module.xml 2011-04-11 23:40:46 UTC (rev 4107) @@ -1,5 +1,6 @@ <ebuild-module ebuild-version="0.8"> - <artifact name="java_classes.jar" /> + <artifact name="java_classes.jar" /> + <artifact name="files" /> <dependencies> <system name="java.jre" tag="1.4"/> <dependency source="local" name="launcher" /> Modified: trunk/org.vexi-launcher.testdeploy/meta/product-assembly.xml =================================================================== --- trunk/org.vexi-launcher.testdeploy/meta/product-assembly.xml 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/meta/product-assembly.xml 2011-04-11 23:40:46 UTC (rev 4107) @@ -3,6 +3,12 @@ <target name="root"> <assembler source="local" name="build.deployment"> + <!-- DUMMY input. Get eclipse setup to work for module --> + <input name="dummy"> + <module-selection artifact="vexi.vexi"> + <our-module/> + </module-selection> + </input> <input name="vexis"> <module-selection artifact="vexi.vexi"> <include source="local" name="vexi.demo"/> @@ -15,9 +21,12 @@ <input name="launcher"> <product source="local" name="launcher.vexi_org" /> <!--conf-mapping="->noshrink"--> </input> - <property key="launcher-page" value="index.html"/> + <input name="launcher-page"> + <module-selection artifact="files"> + <our-module/> + </module-selection> + </input> <property key="applet-class" value="org.vexi.launcher.VexiLauncher"/> - <property key="title" value="Vexi Demo" /> <property key="root" value="http://localhost:7070/" /> <property key="main-template" value="org.vexi.demo.main" /> </assembler> Deleted: trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.png =================================================================== (Binary files differ) Deleted: trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.xcf =================================================================== (Binary files differ) Copied: trunk/org.vexi-launcher.testdeploy/src/main/files/images/appletbg.png (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.png) =================================================================== (Binary files differ) Property changes on: trunk/org.vexi-launcher.testdeploy/src/main/files/images/appletbg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/org.vexi-launcher.testdeploy/src/main/files/images/vexi-logo192.png =================================================================== (Binary files differ) Property changes on: trunk/org.vexi-launcher.testdeploy/src/main/files/images/vexi-logo192.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/org.vexi-launcher.testdeploy/src/main/files/index.html =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/main/files/index.html (rev 0) +++ trunk/org.vexi-launcher.testdeploy/src/main/files/index.html 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,26 @@ +<html> +<body> + <div style="width: 620; margin: 0 auto; text-align: center;"> + <div style="margin: 20 auto;"> + <img src="./include/vexi-logo192.png" alt="Vexi" align="middle" border="0"/> + </div> + + <p>Launcher page for the <strong>Vexi Demo</strong></p> + + <div style="position: relative; margin: 20 0; height: 40;"> + <img + style="position: absolute; top: 0; left: 0; " + src="./include/appletbg.png" align="middle" border="0"/> + + <applet + style="position: absolute; top: 9; left: 9; height: 20; width: 600;" + code='$applet-class$' + archive='$applet-jar$'> + $applet-params$ + </applet> + </div> + + <p>Not working? <a href="http://vexi.sourceforge.net">Contact us</a></p> + </div> + </body> +</html> \ No newline at end of file Property changes on: trunk/org.vexi-launcher.testdeploy/src/main/files/index.html ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: trunk/org.vexi-launcher.testdeploy/src/main/files/splash.css =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/main/files/splash.css 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/src/main/files/splash.css 2011-04-11 23:40:46 UTC (rev 4107) @@ -1,8 +0,0 @@ -body { text-align:center; } - -#appletbox { - background-image: url(appletbg.png); - width: 618px; - height: 38px; - padding: 9px; -} \ No newline at end of file Deleted: trunk/org.vexi-launcher.testdeploy/src/main/files/splash.html =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/main/files/splash.html 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/src/main/files/splash.html 2011-04-11 23:40:46 UTC (rev 4107) @@ -1,18 +0,0 @@ -<html> -<body> - <p>Launcher for <strong>Demo (has splash)</strong></p> - <p> - - <applet code="org.vexi.launcher.VexiLauncher" - archive="launcher.jar" - height="30" width="300"></p> - <param name="core" value="vexi.jar"/> - <param name="option0" value="-t"/> - <param name="option1" value="splash"/> - <param name="vexi0" value="http://localhost:7070/splash.vexi"></param> - </applet> - - </p> - -</body> -</html> Deleted: trunk/org.vexi-launcher.testdeploy/src/main/files/splashless.html =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/main/files/splashless.html 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/src/main/files/splashless.html 2011-04-11 23:40:46 UTC (rev 4107) @@ -1,22 +0,0 @@ -<html> -<body> - <p>Launcher for <strong>Demo (splashless)</strong></p> - <p> - - <applet - code="org.vexi.launcher.VexiLauncher" - archive="http://localhost:7070/vexilauncher.jar" - height="30" width="300"></p> - <param name="core" value="http://localhost:7070/vexi3_b3665.jar.signed"/> - <param name="option0" value="-t"/> - <param name="option1" value="org.vexi.demo.main"/> - <param name="vexi0" value="http://localhost:7070/vera_mono.vexi.install"/> - <param name="vexi1" value="http://localhost:7070/vexi_icons_b3665.vexi.signed"/> - <param name="vexi2" value="http://localhost:7070/vexi_widgets_b3665.vexi.signed"/> - <param name="vexi3" value="http://localhost:7070/vexi_demo.vexi.unversioned"/> - </applet> - - </p> - -</body> -</html> Deleted: trunk/org.vexi-launcher.testdeploy/src/splash.t =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/splash.t 2011-04-11 23:09:54 UTC (rev 4106) +++ trunk/org.vexi-launcher.testdeploy/src/splash.t 2011-04-11 23:40:46 UTC (rev 4107) @@ -1,64 +0,0 @@ -<!-- Copyright 2006 - see COPYING for details [LGPL] --> - -<vexi xmlns:ui="vexi://ui"> - <ui:box fontsize="40" fill="white" text="SPLASH"> - <ui:box align="bottom" orient="vertical" rows="2" vshrink="true"> - <ui:box text="blah" id="currentDL" align="bottomright" hshrink="true" height="20"/> - <ui:box fill="gray" id="meter" vshrink="true"> - <ui:box fill="green" width="0" id="progress" align="left" height="10"/> - </ui:box> - </ui:box> - - var open = false; - - // Clone the vexi object - var loaded = false; - - vexi.thread = function() { - var vexi_world = vexi.clone(vexi); - - var ss = vexi.stream.multiple( - vexi.cache(vexi.stream.url("http://localhost:7070/demo.vexi")), - vexi.cache(vexi.stream.url("http://localhost:7070/widgets.vexi"))); - - var currentLength; - ss.start ++= function(v){ - if(!open) { - vexi.ui.window = thisbox; - open = true; - } - - currentLength = v.length; - $currentDL.text = v.name; - vexi.trace("archive : " + v.name); - vexi.trace("content-length: " + v.length); - vexi.trace("last modified: " + v.lastModified); - return; - }; - - ss.progress ++= function(v){ - vexi.trace("progress: " + v); - var progressWidth = ((v/currentLength) * $meter.width); - $progress.width = progressWidth; - //thisbox.text = v; - return; - }; - - - // Fetch the resource - var rr = vexi_world.bless(ss); - - // Trap on resource root on new vexi - vexi_world[""] ++= rr; - - loaded = true; - // Launch program - vexi_world..main(vexi_world.box); - vexi.log.info("loaded remote example!"); - - thisbox.Close = true; - } - //vexi.ui.frame = thisbox; - - </ui:box> -</vexi> Copied: trunk/org.vexi-launcher.testdeploy/src/unused/files/appletbg.xcf (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/main/files/appletbg.xcf) =================================================================== (Binary files differ) Property changes on: trunk/org.vexi-launcher.testdeploy/src/unused/files/appletbg.xcf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.css (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/main/files/splash.css) =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.css (rev 0) +++ trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.css 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,8 @@ +body { text-align:center; } + +#appletbox { + background-image: url(appletbg.png); + width: 618px; + height: 38px; + padding: 9px; +} \ No newline at end of file Copied: trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.html (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/main/files/splash.html) =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.html (rev 0) +++ trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.html 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,18 @@ +<html> +<body> + <p>Launcher for <strong>Demo (has splash)</strong></p> + <p> + + <applet code="org.vexi.launcher.VexiLauncher" + archive="launcher.jar" + height="30" width="300"></p> + <param name="core" value="vexi.jar"/> + <param name="option0" value="-t"/> + <param name="option1" value="splash"/> + <param name="vexi0" value="http://localhost:7070/splash.vexi"></param> + </applet> + + </p> + +</body> +</html> Property changes on: trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.html ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.t (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/splash.t) =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.t (rev 0) +++ trunk/org.vexi-launcher.testdeploy/src/unused/files/splash.t 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,64 @@ +<!-- Copyright 2006 - see COPYING for details [LGPL] --> + +<vexi xmlns:ui="vexi://ui"> + <ui:box fontsize="40" fill="white" text="SPLASH"> + <ui:box align="bottom" orient="vertical" rows="2" vshrink="true"> + <ui:box text="blah" id="currentDL" align="bottomright" hshrink="true" height="20"/> + <ui:box fill="gray" id="meter" vshrink="true"> + <ui:box fill="green" width="0" id="progress" align="left" height="10"/> + </ui:box> + </ui:box> + + var open = false; + + // Clone the vexi object + var loaded = false; + + vexi.thread = function() { + var vexi_world = vexi.clone(vexi); + + var ss = vexi.stream.multiple( + vexi.cache(vexi.stream.url("http://localhost:7070/demo.vexi")), + vexi.cache(vexi.stream.url("http://localhost:7070/widgets.vexi"))); + + var currentLength; + ss.start ++= function(v){ + if(!open) { + vexi.ui.window = thisbox; + open = true; + } + + currentLength = v.length; + $currentDL.text = v.name; + vexi.trace("archive : " + v.name); + vexi.trace("content-length: " + v.length); + vexi.trace("last modified: " + v.lastModified); + return; + }; + + ss.progress ++= function(v){ + vexi.trace("progress: " + v); + var progressWidth = ((v/currentLength) * $meter.width); + $progress.width = progressWidth; + //thisbox.text = v; + return; + }; + + + // Fetch the resource + var rr = vexi_world.bless(ss); + + // Trap on resource root on new vexi + vexi_world[""] ++= rr; + + loaded = true; + // Launch program + vexi_world..main(vexi_world.box); + vexi.log.info("loaded remote example!"); + + thisbox.Close = true; + } + //vexi.ui.frame = thisbox; + + </ui:box> +</vexi> Copied: trunk/org.vexi-launcher.testdeploy/src/unused/files/splashless.html (from rev 4105, trunk/org.vexi-launcher.testdeploy/src/main/files/splashless.html) =================================================================== --- trunk/org.vexi-launcher.testdeploy/src/unused/files/splashless.html (rev 0) +++ trunk/org.vexi-launcher.testdeploy/src/unused/files/splashless.html 2011-04-11 23:40:46 UTC (rev 4107) @@ -0,0 +1,22 @@ +<html> +<body> + <p>Launcher for <strong>Demo (splashless)</strong></p> + <p> + + <applet + code="org.vexi.launcher.VexiLauncher" + archive="http://localhost:7070/vexilauncher.jar" + height="30" width="300"></p> + <param name="core" value="http://localhost:7070/vexi3_b3665.jar.signed"/> + <param name="option0" value="-t"/> + <param name="option1" value="org.vexi.demo.main"/> + <param name="vexi0" value="http://localhost:7070/vera_mono.vexi.install"/> + <param name="vexi1" value="http://localhost:7070/vexi_icons_b3665.vexi.signed"/> + <param name="vexi2" value="http://localhost:7070/vexi_widgets_b3665.vexi.signed"/> + <param name="vexi3" value="http://localhost:7070/vexi_demo.vexi.unversioned"/> + </applet> + + </p> + +</body> +</html> Property changes on: trunk/org.vexi-launcher.testdeploy/src/unused/files/splashless.html ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Forrester Wave Report - Recovery time is now measured in hours and minutes not days. Key insights are discussed in the 2010 Forrester Wave Report as part of an in-depth evaluation of disaster recovery service providers. Forrester found the best-in-class provider in terms of services and vision. Read this report now! http://p.sf.net/sfu/ibm-webcastpromo _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn