| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| WOBody |
|
| 1.8333333333333333;1.833 |
| 1 | /* |
|
| 2 | Wotonomy: OpenStep design patterns for pure Java applications. |
|
| 3 | Copyright (C) 2003 Intersect Software Corporation |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, see http://www.gnu.org |
|
| 17 | */ |
|
| 18 | ||
| 19 | package net.wotonomy.web; |
|
| 20 | ||
| 21 | import net.wotonomy.foundation.NSArray; |
|
| 22 | import net.wotonomy.foundation.NSData; |
|
| 23 | import net.wotonomy.foundation.NSDictionary; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * WOBody represents a page's "body" tag and is used to dynamically |
|
| 27 | * set the background image for a page, and therefore works much like WOImage. |
|
| 28 | * |
|
| 29 | * Bindings are: |
|
| 30 | * <UL> |
|
| 31 | * <li>src: A static URL for the image source.</li> |
|
| 32 | * <li>data: A NSData object with the image content. Must be used with mimeType.</li> |
|
| 33 | * <li>mimeType: The MIME type for the image data. Can be used with filename or data bindings.</li> |
|
| 34 | * <li>filename: The path to a file containing an image.</li> |
|
| 35 | * <li>framework: The optional framework from whence the image should be retrieved (used in conjunction with filename).</li> |
|
| 36 | * <li>key: A key under which this resource will be cached for repeated access.</li> |
|
| 37 | * |
|
| 38 | * @author michael@mpowers.net |
|
| 39 | * @author $Author: cgruber $ |
|
| 40 | * @version $Revision: 905 $ |
|
| 41 | */ |
|
| 42 | public class WOBody extends WOImage { |
|
| 43 | ||
| 44 | protected String src; |
|
| 45 | protected String filename; |
|
| 46 | protected String framework; |
|
| 47 | protected NSData data; |
|
| 48 | protected String mimeType; |
|
| 49 | ||
| 50 | protected WOBody() { |
|
| 51 | 0 | super(); |
| 52 | 0 | } |
| 53 | ||
| 54 | public WOBody(String aName, NSDictionary aMap, WOElement template) { |
|
| 55 | 0 | super(aName, aMap, template); |
| 56 | 0 | } |
| 57 | ||
| 58 | void ensureAwakeInContext (WOContext aContext) |
|
| 59 | { |
|
| 60 | 0 | if ( rootElement != null ) |
| 61 | { |
|
| 62 | 0 | rootElement.ensureAwakeInContext( aContext ); |
| 63 | } |
|
| 64 | 0 | } |
| 65 | ||
| 66 | public void takeValuesFromRequest (WORequest aRequest, WOContext aContext) |
|
| 67 | { |
|
| 68 | 0 | if ( rootElement != null ) |
| 69 | { |
|
| 70 | 0 | rootElement.takeValuesFromRequest( aRequest, aContext ); |
| 71 | } |
|
| 72 | 0 | } |
| 73 | ||
| 74 | public WOActionResults invokeAction (WORequest aRequest, WOContext aContext) |
|
| 75 | { |
|
| 76 | 0 | if ( rootElement != null ) |
| 77 | { |
|
| 78 | 0 | return rootElement.invokeAction( aRequest, aContext ); |
| 79 | } |
|
| 80 | 0 | return null; |
| 81 | } |
|
| 82 | ||
| 83 | public void appendToResponse(WOResponse r, WOContext c) |
|
| 84 | { |
|
| 85 | 0 | r.appendContentString("<body background=\""); |
| 86 | 0 | r.appendContentString(sourceURL(c)); |
| 87 | 0 | r.appendContentString("\""); |
| 88 | 0 | r.appendContentString(additionalHTMLProperties(c.component(), new NSArray(new Object[]{ |
| 89 | 0 | "src", "filename", "framework", "data", "mimeType" }))); |
| 90 | 0 | r.appendContentString(">"); |
| 91 | 0 | if ( rootElement != null ) |
| 92 | { |
|
| 93 | 0 | rootElement.appendToResponse( r, c ); |
| 94 | } |
|
| 95 | 0 | r.appendContentString("</body>"); |
| 96 | 0 | } |
| 97 | ||
| 98 | } |
|
| 99 | ||
| 100 | /* |
|
| 101 | * $Log$ |
|
| 102 | * Revision 1.2 2006/02/19 01:44:02 cgruber |
|
| 103 | * Add xmlrpc files |
|
| 104 | * Remove jclark and replace with dom4j and javax.xml.sax stuff |
|
| 105 | * Re-work dependencies and imports so it all compiles. |
|
| 106 | * |
|
| 107 | * Revision 1.1 2006/02/16 13:22:22 cgruber |
|
| 108 | * Check in all sources in eclipse-friendly maven-enabled packages. |
|
| 109 | * |
|
| 110 | * Revision 1.4 2003/08/07 00:15:14 chochos |
|
| 111 | * general cleanup (mostly removing unused imports) |
|
| 112 | * |
|
| 113 | * Revision 1.3 2003/01/27 15:57:28 mpowers |
|
| 114 | * Now participates in all parts of request/response cycle. |
|
| 115 | * |
|
| 116 | * Revision 1.2 2003/01/27 15:08:23 mpowers |
|
| 117 | * Now appending to response. |
|
| 118 | * |
|
| 119 | * |
|
| 120 | */ |
|
| 121 |