Return-Path: X-Original-To: apmail-attic-general-archive@minotaur.apache.org Delivered-To: apmail-attic-general-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 929E718CF6 for ; Wed, 19 Aug 2015 15:32:14 +0000 (UTC) Received: (qmail 45830 invoked by uid 500); 19 Aug 2015 15:32:13 -0000 Delivered-To: apmail-attic-general-archive@attic.apache.org Received: (qmail 45784 invoked by uid 500); 19 Aug 2015 15:32:13 -0000 Mailing-List: contact general-help@attic.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@attic.apache.org Delivered-To: mailing list general@attic.apache.org Received: (qmail 45769 invoked by uid 99); 19 Aug 2015 15:32:12 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Aug 2015 15:32:12 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id C3214AC006B for ; Wed, 19 Aug 2015 15:32:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1696614 - in /jakarta/site/docs/ecs: ./ index.html Date: Wed, 19 Aug 2015 15:32:12 -0000 To: general@attic.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150819153212.C3214AC006B@hades.apache.org> Author: sebb Date: Wed Aug 19 15:32:12 2015 New Revision: 1696614 URL: http://svn.apache.org/r1696614 Log: Fetched ECS from https://web.archive.org/web/20140321141522/http://jakarta.apache.org/ecs/ Added: jakarta/site/docs/ecs/ jakarta/site/docs/ecs/index.html (with props) Added: jakarta/site/docs/ecs/index.html URL: http://svn.apache.org/viewvc/jakarta/site/docs/ecs/index.html?rev=1696614&view=auto ============================================================================== --- jakarta/site/docs/ecs/index.html (added) +++ jakarta/site/docs/ecs/index.html Wed Aug 19 15:32:12 2015 @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Jakarta ECS - Element Construction Set + + + + + + + + + +
+ + +Element Construction Set +
+ + + + + + + + + + + + +
+
+
+ + + +

Jakarta ECS

+ +
+ + + + + + + + +
ECS is Retired
+
+

+ As of 2010-09-01, the ECS project is retired. This is an archived site. +

+

+ Due to a lack of development activity, the Jakarta ECS project has been + retired and moved to the Apache Attic. + No further ECS development or releases will happen at Jakarta. +

+

+ Users are encouraged to switch to other techniques for markup generation. +

+

+ This site is kept online for archiving purposes only. +

+
+
+ + + + + + + +
+ + What is it? + +
+
+

+The Element Construction Set is a Java API for generating +elements for various markup languages it directly supports HTML 4.0 and XML, but +can easily be extended to create tags for any markup language. It is designed +and implemented by Stephan Nagy and Jon S. Stevens. +

+
+

+

+ + + + +
+ + What does it do? + +
+
+

+The Element Construction Set allows you to use Java +Objects to generate markup code. Gone is the need for writing code that looks +like the following: +

+
+ + + + + + + + + + + + + + + + +
+out.println("<HTML>");
+out.println("<HEAD><TITLE>Demo<TITLE><HEAD>");
+out.println("<BODY>");
+out.println("<H1>Demo Header<H1>");
+out.println("<H3>Sub Header:<H3>");
+out.println("<FONT SIZE=\"+1\" FACE=\"Times\" COLOR=\"#FFFFFF">);
+out.println("The big dog &amp; the little cat chased each other.");
+out.println("<FONT>");
+out.println("<BODY>");
+out.println("<HTML>");
+
+
+

+You can do this instead: +

+
+ + + + + + + + + + + + + + + + +
+Html html = new Html()
+              .addElement(new Head()
+                  .addElement(new Title("Demo")))
+              .addElement(new Body()
+              .addElement(new H1("Demo Header"))
+              .addElement(new H3("Sub Header:"))
+              .addElement(new Font().setSize("+1")
+                         .setColor(HtmlColor.WHITE)
+                         .setFace("Times")
+                         .addElement("The big dog & the little cat chased each other.")));
+out.println(html.toString()); 
+// or write to the outputstream directly
+output(out);
+
+
+

+This creates the HTML: +

+
+ + + + + + + + + + + + + + + + +
+<html><head><title>Demo</title></head><body><h1>Demo Header</h1><h3>Sub Header:</h3>
+<font size="+1" color="#FFFFFF" face="Times">The big dog &#38; the little cat chased
+ each other.</font></body></html>
+
+
+

+Or even easier, use the Document object: +

+
+ + + + + + + + + + + + + + + + +
+Document doc = (Document) new Document()
+              .appendTitle("Demo")
+              .appendBody(new H1("Demo Header"))
+              .appendBody(new H3("Sub Header:"))
+              .appendBody(new Font().setSize("+1")
+                         .setColor(HtmlColor.WHITE)
+                         .setFace("Times")
+                         .addElement("The big dog & the little cat chased each other."));
+out.println(doc.toString()); 
+// or write to the outputstream directly
+output(out);
+
+
+

+This creates the same HTML as above. +

+

+There are some subtleties in the above code that are worth commenting on. +

+

+

    +
  1. You don't need to know the Hex value of the color you want. HtmlColor is an +interface that defines more than 200 colors.
  2. +
  3. You don't need to replace & ' " with their entity counterparts, it is +done for you (this is configurable of course). ECS gives you the +ability to define filters that are applied to the element when you call +the addElement() methods.
  4. +
  5. You can write directly to an elements output stream. output() is a +method that can be overridden to provide custom rendering of elements.
  6. +
+

+

+ECS also gives you the ability to create your own elements on the fly +using the XML element. So you can do the following: +

+
+ + + + + + + + + + + + + + + + +
+XML my_element = new XML("my_element");
+
+produces:
+
+<my_element></my_element>
+
+
+
+

+

+ + + + +
+ + Documentation + +
+
+

+The javadoc documentation and a TestBed.java file +comes with the distribution download. Both resources combined give example code usage +that covers every single element. The TestBed.java file is located in +the ecs/example directory. +

+
+

+

+ + + + +
+ + Source + +
+
+

+ECS uses the Turbine coding conventions. +

+
+

+

+
+
+
+
+ Copyright © 1999-2004, The Apache Software Foundation +
+
+ + + Propchange: jakarta/site/docs/ecs/index.html ------------------------------------------------------------------------------ svn:eol-style = native