Added locale xidyn demo.

This commit is contained in:
Christian P. MOMON 2016-09-21 16:02:21 +02:00
parent dcb5fb5601
commit 5f45babbe8
9 changed files with 79 additions and 4 deletions

View file

@ -33,9 +33,9 @@
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/devinsy-utils-0.3.2-sources.zip"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/devinsy-utils-0.3.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xidyn-1.1.0-sources.zip"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xidyn-1.1.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/kiss4web-0.3.0-sources.zip"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/kiss4web-0.3.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xidyn-1.1.3-sources.zip"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xidyn-1.1.3.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

View file

@ -3,8 +3,6 @@
<name>Kiss4web-demo</name>
<comment></comment>
<projects>
<project>kiss4web</project>
<project>xidyn</project>
</projects>
<buildSpec>
<buildCommand>

View file

@ -37,6 +37,7 @@
<li><a href="/xidyn/index.xhtml#repeat_tag_wo">&#160;&#160;Repeat tag (w/o index)</a></li>
<li><a href="/xidyn/index.xhtml#fill_table">&#160;&#160;Fill Table</a></li>
<li><a href="/xidyn/index.xhtml#iteration_strategies">&#160;&#160;Iteration strategies</a></li>
<li><a href="/xidyn/index.xhtml#languages">&#160;&#160;Languages</a></li>
</ul>
</div>
</div>

View file

@ -19,6 +19,7 @@
package fr.devinsy.kiss4web.demo.website.xidyn;
import java.io.IOException;
import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@ -32,6 +33,7 @@ import fr.devinsy.util.strings.StringList;
import fr.devinsy.xidyn.data.SimpleTagData;
import fr.devinsy.xidyn.pages.Page;
import fr.devinsy.xidyn.pages.PageFactory;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
*
@ -351,6 +353,46 @@ public class Index_xhtml extends HttpServlet
}
}
// Step #06.
{
try
{
System.out.println("----------------------------");
Page defaultPage = new Page("/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html");
Page frenchPage = new Page("/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html", Locale.FRENCH);
Page germanPage = new Page("/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html", Locale.GERMAN);
String defaultHtml = XidynUtils.extractBodyContent(defaultPage.dynamizeToString());
String frenchHtml = XidynUtils.extractBodyContent(frenchPage.dynamizeToString());
String germanHtml = XidynUtils.extractBodyContent(germanPage.dynamizeToString());
StringList display = new StringList();
display.appendln("<h3>No locale set</h3>");
display.append("new Page(\"/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html\");").appendln("<br/>");
display.append("=>").appendln("<br/>");
display.append(StringEscapeUtils.escapeXml(defaultHtml)).appendln("<br/>").appendln("<br/>");
display.appendln("<br/>");
display.appendln("<h3>French locale set</h3>");
display.append("new Page(\"/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html\", Locale.FRENCH);").appendln("<br/>");
display.append("=>").appendln("<br/>");
display.append(StringEscapeUtils.escapeXml(frenchHtml)).appendln("<br/>");
display.appendln("<br/>");
display.appendln("<h3>German locale set without associated file</h3>");
display.append("new Page(\"/fr/devinsy/kiss4web/demo/website/xidyn/languages_demo.html\", Locale.GERMAN);").appendln("<br/>");
display.append("=>").appendln("<br/>");
display.append(StringEscapeUtils.escapeXml(germanHtml)).appendln("<br/>");
demoPage.setContent("demo6", display.toString());
}
catch (Exception exception)
{
demoPage.setContent("demo6", exception.getMessage());
}
}
//
Page charter = PageFactory.instance().create("/fr/devinsy/kiss4web/demo/website/charter/charter.html");
charter.include("content_container", demoPage);

View file

@ -85,5 +85,9 @@
<p id="demo5.4">n/a</p>
<p id="demo5.5">n/a</p>
<h2 id="languages">Languages</h2>
<p id="demo6">n/a</p>
</body>
</html>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Kiss4web</title>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="kiss4web.css" />
<link rel="stylesheet" type="text/css" href="kiss4web-demo.css" />
<meta name="keywords" content="kiss4web, devinsy" />
</head>
<body>
Bonjour, Xidyn vous souhaite une bonne journée.
</body>
</html>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Kiss4web</title>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="kiss4web.css" />
<link rel="stylesheet" type="text/css" href="kiss4web-demo.css" />
<meta name="keywords" content="kiss4web, devinsy" />
</head>
<body>
Hello, Xidyn wish you a good day.
</body>
</html>