You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by an...@apache.org on 2006/05/16 19:49:21 UTC
svn commit: r407013 - in
/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry:
Framework.library dojo/html/ dojo/html/FloatingPane.html
dojo/html/FloatingPane.java dojo/html/FloatingPane.jwc
dojo/html/FloatingPane.script dojo/html/package.html
Author: andyhot
Date: Tue May 16 10:49:20 2006
New Revision: 407013
URL: http://svn.apache.org/viewcvs?rev=407013&view=rev
Log:
FloatingPane component
Added:
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.html
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.java
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.jwc
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.script
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/package.html
Modified:
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/Framework.library
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/Framework.library
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/Framework.library?rev=407013&r1=407012&r2=407013&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/Framework.library (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/Framework.library Tue May 16 10:49:20 2006
@@ -78,6 +78,8 @@
<component-type type="TextField" specification-path="form/TextField.jwc"/>
<component-type type="Upload" specification-path="form/Upload.jwc"/>
<component-type type="ValidField" specification-path="valid/ValidField.jwc"/>
+
+ <component-type type="FloatingPane" specification-path="dojo/html/FloatingPane.jwc"/>
<page name="StaleLink" specification-path="pages/StaleLink.page"/>
<page name="StaleSession" specification-path="pages/StaleSession.page"/>
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.html
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.html?rev=407013&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.html (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.html Tue May 16 10:49:20 2006
@@ -0,0 +1,3 @@
+<div jwcid="outerDiv">
+ <span jwcid="@RenderBody"/>
+</div>
\ No newline at end of file
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.java
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.java?rev=407013&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.java (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.java Tue May 16 10:49:20 2006
@@ -0,0 +1,132 @@
+// Copyright May 16, 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry.dojo.html;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.tapestry.BaseComponent;
+import org.apache.tapestry.IMarkupWriter;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.IScript;
+import org.apache.tapestry.PageRenderSupport;
+import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.dojo.DojoUtils;
+import org.apache.tapestry.dojo.IWidget;
+import org.apache.tapestry.json.JSONObject;
+
+/**
+ * Implementation of dojo's FloatingPane.
+ *
+ * @author andyhot
+ * @since 4.1
+ */
+public abstract class FloatingPane extends BaseComponent implements IWidget {
+
+ /** Title of the FloatingPane. */
+ public abstract String getTitle();
+
+ /** Min height of the FloatingPane. */
+ public abstract int getMinWidth();
+
+ /** Min width of the FloatingPane. */
+ public abstract int getMinHeight();
+
+ /** Has Shadow. */
+ public abstract boolean getHasShadow();
+
+ /** Has Tool bar. */
+ public abstract boolean getHasToolbar();
+
+ /** Allow resize. */
+ public abstract boolean isResizable();
+
+ /** Should persist position (with cookies). */
+ public abstract boolean getPersistPosition();
+
+ /** Should contrain to container. */
+ public abstract boolean getConstrainToContainer();
+
+ /** style. */
+ public abstract String getStyle();
+
+ /** id. */
+ public abstract String getIdParameter();
+
+ /** The taskBar this pane is connected to. */
+ public abstract Object getTaskBar();
+
+ /** Is this pane a taskBar? */
+ public abstract boolean getIsTaskBar();
+
+ /** More js options - JSON style. */
+ public abstract String getOptions();
+
+ /** Injected script. */
+ public abstract IScript getScript();
+
+ /** Get the id of the connected taskBar. */
+ public String getTaskBarId()
+ {
+ Object obj = getTaskBar();
+ if (obj == null)
+ return null;
+ else if (obj instanceof String)
+ return (String)obj;
+ else if (obj instanceof FloatingPane)
+ return ((FloatingPane)obj).getIdParameter();
+ else
+ throw new ApplicationRuntimeException("Parameter taskBar should either be a String or a FloatingPane");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ renderComponent(writer, cycle);
+ }
+
+ /**
+ * @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter,
+ * org.apache.tapestry.IRequestCycle)
+ */
+ protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ super.renderComponent(writer, cycle);
+
+ JSONObject obj = DojoUtils.parseJSONParameter(this, "options");
+
+ obj.put("title", getTitle());
+ obj.put("widgetId", getId());
+ obj.put("toggle", "fade");
+ obj.put("constrainToContainer", getConstrainToContainer());
+ obj.put("displayMaximizeAction", true);
+ obj.put("displayMinimizeAction", true);
+ obj.put("displayCloseAction", true);
+ obj.put("hasShadow", getHasShadow());
+ obj.put("resizable", isResizable());
+ obj.put("taskBarId", getTaskBarId());
+ //obj.put("contentNodeId", getId() + "ContentId");
+ //obj.put("persistenceWidgetPosition", getPersistPosition());
+
+ //Setup our script includes
+ Map scriptParms = new HashMap();
+ scriptParms.put("id", getIdParameter());
+ scriptParms.put("props", obj.toString());
+ PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);
+ getScript().execute(cycle, pageRenderSupport, scriptParms);
+ }
+}
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.jwc
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.jwc?rev=407013&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.jwc (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.jwc Tue May 16 10:49:20 2006
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2004, 2005, 2006 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE component-specification PUBLIC
+ "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
+ "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
+
+<component-specification class="org.apache.tapestry.dojo.html.FloatingPane"
+ allow-body="yes" allow-informal-parameters="yes">
+
+ <description>
+ Creates a FloatingPane - an independant window within an html document.
+ The FloatingPane can have shadow and title. It can be constraint
+ into its container, allow resizing, persist its size and position with
+ cookies and belong to a TaskBar.
+ A TaskBar can also be created from a FloatingPane if the isTaskBar parameter
+ is set to true. A TaskBar does not render its toolbar and automatically displays
+ the panes that are registered to it.
+ </description>
+
+ <parameter name="minHeight" default-value="literal:100">
+ <description></description>
+ </parameter>
+ <parameter name="minWidth" default-value="literal:200"/>
+
+ <parameter name="hasShadow" default-value="ognl:true">
+ <description>Add shadow to the pane.</description>
+ </parameter>
+ <parameter name="hasToolbar" default-value="ognl:true">
+ <description></description>
+ </parameter>
+
+ <parameter name="title" default-value="literal:Floating Pane">
+ <description>The title of the pane.</description>
+ </parameter>
+
+ <parameter name="constrainToContainer">
+ <description>If true, the pane cannot be moved outside its container.</description>
+ </parameter>
+ <parameter name="resizable" default-value="ognl:true">
+ <description>If true, a resize handle appears at the lower right of the pane.</description>
+ </parameter>
+ <parameter name="persistPosition" default-value="ognl:true">
+ <description>If true, the position and size of the pane are persisted with cookies.</description>
+ </parameter>
+
+ <parameter name="style"
+ default-value="literal:width: 600px; height: 480px; left: 100px; top: 100px; display: none">
+ <description>The css styles to apply to the div created by the pane.</description>
+ </parameter>
+
+ <parameter name="id" property="idParameter" default-value="id">
+ <description>
+ The html id of the div created by the pane. An additional html id is
+ created for the inner div, named ${id}ContentId.
+ </description>
+ </parameter>
+
+ <parameter name="taskBar">
+ <description>
+ The taskbar this pane belongs to. If specified, this can either be
+ the html id of the TaskBar or the FloatingPane instance representing
+ the TaskBar.
+ </description>
+ </parameter>
+ <parameter name="isTaskBar">
+ <description>
+ If true, this FloatingPane becomes a TaskBar.
+ </description>
+ </parameter>
+
+ <parameter name="options">
+ <description>Additional javascript options. Use JSON notation.</description>
+ </parameter>
+
+ <component id="outerDiv" type="Any" inherit-informal-parameters="true">
+ <binding name="id" value="idParameter"/>
+ </component>
+
+ <inject property="script" type="script" object="FloatingPane.script"/>
+
+</component-specification>
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.script
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.script?rev=407013&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.script (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/FloatingPane.script Tue May 16 10:49:20 2006
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE script PUBLIC
+ "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
+ "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
+<script>
+ <include-script resource-path="/org/apache/tapestry/dojo/Widget.js"/>
+ <input-symbol key="id" required="yes" />
+ <input-symbol key="props" required="yes" />
+ <body>
+ <unique>
+ dojo.require("dojo.widget.FloatingPane");
+ dojo.require("dojo.widget.LayoutContainer");
+ dojo.require("dojo.widget.ResizeHandle");
+ </unique>
+ </body>
+
+ <initialization>
+ tapestry.widget.synchronizeWidgetState("${id}", "FloatingPane", ${props});
+ </initialization>
+</script>
\ No newline at end of file
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/package.html
URL: http://svn.apache.org/viewcvs/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/package.html?rev=407013&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/package.html (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/dojo/html/package.html Tue May 16 10:49:20 2006
@@ -0,0 +1,15 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Tapestry: Web Application Framework</title>
+</head>
+<body>
+
+<p>
+Html related components that are wrapped by dojo widgets.
+</p>
+
+@author Andreas Andreou <a href="mailto:andyhot@apache.org">andyhot@apache.org</a>
+
+</body>
+</html>