You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by an...@apache.org on 2006/08/17 05:44:48 UTC
svn commit: r432135 -
/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
Author: andyhot
Date: Wed Aug 16 20:44:48 2006
New Revision: 432135
URL: http://svn.apache.org/viewvc?rev=432135&view=rev
Log:
TAPESTRY-274: Allow adding inline styles in a document
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java?rev=432135&r1=432134&r2=432135&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java Wed Aug 16 20:44:48 2006
@@ -110,7 +110,11 @@
List relations = getRelations();
if (relations != null)
- writeRelations(writer, relations);
+ writeRelations(writer, relations);
+
+ StringBuffer inlineStyle = getStyleBuffer();
+ if (inlineStyle != null)
+ writeInlineStyle(writer, inlineStyle.toString());
IAsset stylesheet = getStylesheet();
@@ -228,6 +232,19 @@
writer.println();
}
+ private void writeInlineStyle(IMarkupWriter writer, String style)
+ {
+ writer.begin("style");
+ writer.attribute("type", "text/css");
+ writer.println();
+
+ writer.printRaw(style);
+ writer.println();
+
+ writer.end();
+ writer.println();
+ }
+
private void writeAttributeIfNotNull(IMarkupWriter writer, String name, String value)
{
if (value != null)
@@ -270,7 +287,14 @@
*/
public void addInlineStyle(String style)
{
- // TODO TAPESTRY-274: Implement this similar to Body.addBodyScript
+ if (HiveMind.isBlank(style))
+ return;
+ StringBuffer buffer = getStyleBuffer();
+ if (buffer == null)
+ buffer = new StringBuffer();
+
+ buffer.append(style);
+ setStyleBuffer(buffer);
}
public abstract boolean isDisableCaching();
@@ -321,5 +345,13 @@
/** @since 4.1.1 */
public abstract void setRelations(List relations);
+
+ /** @since 4.1.1 */
+
+ public abstract StringBuffer getStyleBuffer();
+
+ /** @since 4.1.1 */
+
+ public abstract void setStyleBuffer(StringBuffer buffer);
}