summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
commitaedc34d55462a75e329bbf342251ff6504cd117e (patch)
treebcc8f1f2352582717b484df302aeea6696b8f000 /projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java
Initial import from SVN
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java')
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java121
1 files changed, 121 insertions, 0 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java
new file mode 100644
index 0000000..9f0707d
--- /dev/null
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOBody.java
@@ -0,0 +1,121 @@
+/*
+Wotonomy: OpenStep design patterns for pure Java applications.
+Copyright (C) 2003 Intersect Software Corporation
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, see http://www.gnu.org
+*/
+
+package net.wotonomy.web;
+
+import net.wotonomy.foundation.NSArray;
+import net.wotonomy.foundation.NSData;
+import net.wotonomy.foundation.NSDictionary;
+
+/**
+* WOBody represents a page's "body" tag and is used to dynamically
+* set the background image for a page, and therefore works much like WOImage.
+*
+* Bindings are:
+* <UL>
+* <li>src: A static URL for the image source.</li>
+* <li>data: A NSData object with the image content. Must be used with mimeType.</li>
+* <li>mimeType: The MIME type for the image data. Can be used with filename or data bindings.</li>
+* <li>filename: The path to a file containing an image.</li>
+* <li>framework: The optional framework from whence the image should be retrieved (used in conjunction with filename).</li>
+* <li>key: A key under which this resource will be cached for repeated access.</li>
+*
+* @author michael@mpowers.net
+* @author $Author: cgruber $
+* @version $Revision: 905 $
+*/
+public class WOBody extends WOImage {
+
+ protected String src;
+ protected String filename;
+ protected String framework;
+ protected NSData data;
+ protected String mimeType;
+
+ protected WOBody() {
+ super();
+ }
+
+ public WOBody(String aName, NSDictionary aMap, WOElement template) {
+ super(aName, aMap, template);
+ }
+
+ void ensureAwakeInContext (WOContext aContext)
+ {
+ if ( rootElement != null )
+ {
+ rootElement.ensureAwakeInContext( aContext );
+ }
+ }
+
+ public void takeValuesFromRequest (WORequest aRequest, WOContext aContext)
+ {
+ if ( rootElement != null )
+ {
+ rootElement.takeValuesFromRequest( aRequest, aContext );
+ }
+ }
+
+ public WOActionResults invokeAction (WORequest aRequest, WOContext aContext)
+ {
+ if ( rootElement != null )
+ {
+ return rootElement.invokeAction( aRequest, aContext );
+ }
+ return null;
+ }
+
+ public void appendToResponse(WOResponse r, WOContext c)
+ {
+ r.appendContentString("<body background=\"");
+ r.appendContentString(sourceURL(c));
+ r.appendContentString("\"");
+ r.appendContentString(additionalHTMLProperties(c.component(), new NSArray(new Object[]{
+ "src", "filename", "framework", "data", "mimeType" })));
+ r.appendContentString(">");
+ if ( rootElement != null )
+ {
+ rootElement.appendToResponse( r, c );
+ }
+ r.appendContentString("</body>");
+ }
+
+}
+
+/*
+ * $Log$
+ * Revision 1.2 2006/02/19 01:44:02 cgruber
+ * Add xmlrpc files
+ * Remove jclark and replace with dom4j and javax.xml.sax stuff
+ * Re-work dependencies and imports so it all compiles.
+ *
+ * Revision 1.1 2006/02/16 13:22:22 cgruber
+ * Check in all sources in eclipse-friendly maven-enabled packages.
+ *
+ * Revision 1.4 2003/08/07 00:15:14 chochos
+ * general cleanup (mostly removing unused imports)
+ *
+ * Revision 1.3 2003/01/27 15:57:28 mpowers
+ * Now participates in all parts of request/response cycle.
+ *
+ * Revision 1.2 2003/01/27 15:08:23 mpowers
+ * Now appending to response.
+ *
+ *
+ */
+