You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2007/01/31 06:04:12 UTC
svn commit: r501740 - in
/incubator/adffaces/branches/panel-popup-branch/trinidad:
trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/
trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/...
Author: awiner
Date: Tue Jan 30 22:04:11 2007
New Revision: 501740
URL: http://svn.apache.org/viewvc?view=rev&rev=501740
Log:
Check in panelPopup and popup-dialog support, with some changes
- Move (almost) all of the popup dialog and panel popup JS code into
TrPanelPopup and TrPopupDialog wrapper objects
- Fix coding convention problems: no tabs allowed, braces on new lines
- Instead of removing the code that launched new windows for dialogs, hide
it behind a web.xml context init parameter
- Use resource bundle for translatable contents
- Load JS automatically
Plenty to do still:
- Implement sizing correctly
- Populate title of the popup based on the title of the dialog's content
- For popup-based dialogs, do not use a FRAMESET inside of the IFRAME; just
use the IFRAME
Added:
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelPopup.xml
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelPopup.xml
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js
Modified:
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/resources/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/javascriptmap.properties
incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts
Added: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelPopup.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelPopup.xml?view=auto&rev=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelPopup.xml (added)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelPopup.xml Tue Jan 30 22:04:11 2007
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
+ xmlns:mafp="http://myfaces.apache.org/maven-trinidad-plugin"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+ <component>
+ <description>
+ <![CDATA[The panelPopup is used to place ancillary information on a page,
+made visible via a clickable link.]]>
+ </description>
+ <icon>
+ <small-icon>/org/apache/myfaces/trinidad/metadata/icons/panelPopup.png</small-icon>
+ </icon>
+ <component-type>org.apache.myfaces.trinidad.CorePanelPopup</component-type>
+ <component-class>org.apache.myfaces.trinidad.component.core.layout.CorePanelPopup</component-class>
+ <xi:include href="includes/CommonAttrs.xml" xpointer="/faces-config/component/*"/>
+ <xi:include href="includes/CoreJSEvents.xml" xpointer="/faces-config/component/*"/>
+ <facet>
+ <description><![CDATA[Content to be rendered as a link to launch the popup panel. Use this facet
+ to define an icon or other content types to launch the popup. If this facet is not defined, then
+ the 'text' attribute must be specified.]]>
+ </description>
+ <facet-name>trigger</facet-name>
+ <facet-extension>
+ <mfp:facet-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:facet-metadata>
+ </facet-extension>
+ </facet>
+ <property>
+ <description><![CDATA[The text to render as a link to launch the popup panel. If the 'trigger'
+ facet is defined, then this attribute is ignored.]]>
+ </description>
+ <property-name>text</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[The title of the panel when visible. The titlebar is not rendered if this attribute
+ is not specified.]]>
+ </description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[The display mode of the panel. Defaults to "false" (non-modal).
+ Non-Modal panels will close when the user clicks off the panel. Modal popups are
+ rendered with a titlebar and close icon. Clicking the close icon will close the
+ modal popup.]]>
+ </description>
+ <property-name>modal</property-name>
+ <property-class>boolean</property-class>
+ <default-value>false</default-value>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[The position of the content container when visible. Defaults to
+ "none" (appears relative control), if not specified. Other values are "center" (centered on screen).]]>
+ </description>
+ <property-name>alignment</property-name>
+ <property-class>java.lang.String</property-class>
+ <default-value>none</default-value>
+ <property-extension>
+ <mfp:property-values>none center</mfp:property-values>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description>
+ <![CDATA[The inline style of the content region.]]>
+ </description>
+ <property-name>contentStyle</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <mfp:required>false</mfp:required>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <component-extension>
+ <mfp:component-supertype>org.apache.myfaces.trinidad.Panel</mfp:component-supertype>
+ <mfp:renderer-type>org.apache.myfaces.trinidad.Popup</mfp:renderer-type>
+ <mfp:tag-name>tr:panelPopup</mfp:tag-name>
+ <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.core.layout.CorePanelPopupTag</mfp:tag-class>
+ <mfp:long-description><![CDATA[
+<html:p>
+The panelPopup is used to place ancillary information on a page, made visible via a clickable link (e.g icon or link).
+</html:p>
+<html:p>
+The text attribute or 'trigger' facet is used to define the clickable area of the page. When clicked a floating panel is made visible
+containing the child components. If the title attribute is present, then a title bar (including the title) will be
+rendered for the popup panel.
+</html:p>
+<html:p>
+The alignment attribute of popupPanel can be used to control the location of the panel when visible.
+</html:p>
+<html:p>
+ You can make changes to the style of the content region of this component by
+ adding your custom styles to the contentStyle attribute.
+</html:p>
+<html:p>
+ Content containers will generally have only one child with the actual
+ contents as its children. This child will describe how the content should be
+ displayed. However, the content container can have multiple children, in
+ which case the children are displayed in a stack fashion, lined up
+ vertically.
+</html:p>]]>
+ </mfp:long-description>
+ <mfp:example>
+ <mfp:source-code>
+ <![CDATA[<tr:panelPopup text="Click Here!">
+ <tr:panelGroupLayout layout="vertical">
+ <tr:goLink text="point 1" destination="http://myfaces.apache.org"/>
+ <tr:goLink text="point 2" destination="http://myfaces.apache.org"/>
+ <tr:goLink text="point 3" destination="http://myfaces.apache.org"/>
+ <tr:goLink text="point 4" destination="http://myfaces.apache.org"/>
+ <tr:goLink text="point 5" destination="http://myfaces.apache.org"/>
+ </tr:panelGroupLayout>
+</tr:panelPopup>]]>
+ </mfp:source-code>
+ </mfp:example>
+ <mfp:author>Danny Robinson</mfp:author>
+ <mfp:component-metadata>
+ <mfp:group>${md:getTranslatedString("PALETTE_LAYOUT")}</mfp:group>
+ </mfp:component-metadata>
+ <mfp:java-constructor>
+ <mfp:property-name>icon</mfp:property-name>
+ </mfp:java-constructor>
+ <mfp:uix2-local-name>contentContainer</mfp:uix2-local-name>
+ <mfp:unsupported-agents>phone voice</mfp:unsupported-agents>
+ </component-extension>
+ </component>
+</faces-config>
Added: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelPopup.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelPopup.xml?view=auto&rev=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelPopup.xml (added)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelPopup.xml Tue Jan 30 22:04:11 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+ <render-kit>
+ <render-kit-id>org.apache.myfaces.trinidadinternal.core</render-kit-id>
+ <renderer>
+ <component-family>org.apache.myfaces.trinidad.Panel</component-family>
+ <renderer-type>org.apache.myfaces.trinidad.Popup</renderer-type>
+ <renderer-class>org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPopupRenderer</renderer-class>
+ <renderer-extension>
+ <mfp:component-type>org.apache.myfaces.trinidad.CorePanelPopup</mfp:component-type>
+ <mfp:unsupported-agents>phone voice</mfp:unsupported-agents>
+ </renderer-extension>
+ </renderer>
+ </render-kit>
+</faces-config>
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java Tue Jan 30 22:04:11 2007
@@ -220,7 +220,8 @@
DialogRequest request = new DialogRequest(targetRoot,
sourceId,
formId,
- windowProperties);
+ windowProperties,
+ _usePopup(context));
_getDialogList(context, true).add(request);
return true;
}
@@ -236,24 +237,38 @@
RequestContext afC = RequestContext.getCurrentInstance();
try
{
- String returnId = (String) afC.getPageFlowScope().get(_RETURN_ID);
-
- if (returnId == null)
- throw new IllegalStateException("No returnId is available for returning from the dialog; this usually means that you aren't in a dialog in the first place.");
+ boolean usePopup = _usePopup(context);
+ String returnId = null;
+ if (!usePopup)
+ {
+ returnId = (String) afC.getPageFlowScope().get(_RETURN_ID);
+
+ if (returnId == null)
+ throw new IllegalStateException("No returnId is available for returning from the dialog; this usually means that you aren't in a dialog in the first place.");
+ }
// Deliver callback in the context of the launching window
// This is required to work around problems in Mozilla
// with cross frame XmlHttpRequest invocation
Writer out = _getHtmlWriter(context);
out.write("<script>");
- out.write("var callback = 'ADFDialogReturn[" + returnId + "]()';");
- out.write("top.opener.setTimeout(callback, 1);");
- out.write("top.close()");
+ if (usePopup)
+ {
+ out.write("parent.parent.returnFromDialog();");
+ }
+ else
+ {
+ out.write("var callback = 'ADFDialogReturn[" + returnId + "]()';");
+ out.write("top.opener.setTimeout(callback, 1);");
+ out.write("top.close()");
+ out.write("parent.parent.setTimeout(callback, 1);");
+
+ _LOG.fine("Returning from dialog using return ID {0}", returnId);
+ }
+
out.write("</script>");
out.close();
context.responseComplete();
-
- _LOG.fine("Returning from dialog using return ID {0}", returnId);
}
catch (IOException ioe)
{
@@ -716,6 +731,17 @@
}
}
+ //
+ // Returns true if popups should be used to display dialogs
+ // (Currently defaults to off)
+ //
+ static private boolean _usePopup(FacesContext context)
+ {
+ String usePopup = context.getExternalContext().getInitParameter(
+ _USE_DIALOG_POPUP_INIT_PARAM);
+ return "true".equalsIgnoreCase(usePopup);
+ }
+
/**
* Returns the content type; this look-and-feel will choose
* the first of XHTML or HTML that is listed in the list
@@ -754,6 +780,10 @@
"org.apache.myfaces.trinidadinternal.renderkit.DialogList";
static private final String _SCRIPT_LIST_KEY =
"org.apache.myfaces.trinidadinternal.renderkit.ScriptList";
+
+
+ static private final String _USE_DIALOG_POPUP_INIT_PARAM =
+ "org.apache.myfaces.trinidadinternal.renderkit.USE_DIALOG_POPUP";
static private final TrinidadLogger _LOG =
TrinidadLogger.createTrinidadLogger(CoreRenderKit.class);
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java Tue Jan 30 22:04:11 2007
@@ -42,12 +42,13 @@
UIViewRoot targetRoot,
String clientId,
String formId,
- Map<String,Object> dialogProperties
+ Map<String,Object> dialogProperties,
+ boolean usePopup
)
{
_clientId = clientId;
_formId = formId;
-
+ _usePopup = usePopup;
if (dialogProperties == null)
dialogProperties = Collections.emptyMap();
@@ -77,11 +78,19 @@
String formName = _formId;
- out.writeText("_launchDialog(\"", null);
+ if (_usePopup)
+ out.writeText("TrPopupDialog._launchPopupDialog(\"", null);
+ else
+ out.writeText("_launchDialog(\"", null);
+
out.writeText(_url, null);
- out.writeText("\", '", null);
- out.writeText(_getDialogWindowName(), null);
- out.writeText("',{", null);
+ if (!_usePopup)
+ {
+ out.writeText("\", \"", null);
+ out.writeText(_getDialogWindowName(), null);
+ }
+
+ out.writeText("\", {", null);
// Get some default widths and heights out there in
// case they're omitted
@@ -136,6 +145,7 @@
+
//
// Return a new name for every dialog we ever raise.
// At a minimum, we just need to make sure that the user
@@ -151,6 +161,7 @@
private final String _clientId;
private final String _formId;
private final String _url;
+ private final boolean _usePopup;
private final Map<String,Object> _dialogProperties;
Added: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java?view=auto&rev=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java (added)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelPopupRenderer.java Tue Jan 30 22:04:11 2007
@@ -0,0 +1,335 @@
+/*
+ * 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.myfaces.trinidadinternal.renderkit.core.xhtml;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelPopup;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.skin.Icon;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.LibraryScriptlet;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.Scriptlet;
+
+/**
+ * @author Danny Robinson
+ */
+public class PanelPopupRenderer extends XhtmlRenderer
+{
+ public PanelPopupRenderer()
+ {
+ this(CorePanelPopup.TYPE);
+ }
+
+ protected PanelPopupRenderer(FacesBean.Type type)
+ {
+ super(type);
+ }
+
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ @Override
+ protected void findTypeConstants(FacesBean.Type type)
+ {
+ super.findTypeConstants(type);
+ _textKey = type.findKey("text");
+ _titleKey = type.findKey("title");
+ _alignmentKey = type.findKey("alignment");
+ _modalKey = type.findKey("modal");
+ _contentStyleKey = type.findKey("contentStyle");
+ }
+
+ protected String getText(FacesBean bean)
+ {
+ return toString(bean.getProperty(_textKey));
+ }
+
+ protected String getTitle(FacesBean bean)
+ {
+ return toString(bean.getProperty(_titleKey));
+ }
+
+ protected String getAlignment(FacesBean bean)
+ {
+ return toString(bean.getProperty(_alignmentKey));
+ }
+
+ protected String getContentStyle(FacesBean bean)
+ {
+ return toString(bean.getProperty(_contentStyleKey));
+ }
+
+ protected boolean getModal(FacesBean bean)
+ {
+ Object o = bean.getProperty(_modalKey);
+ if (o == null)
+ o = _modalKey.getDefault();
+
+ return Boolean.TRUE.equals(o);
+ }
+
+ @Override
+ protected String getOnclick(FacesBean bean)
+ {
+ String onclick = super.getOnclick(bean);
+
+ boolean centered = false;
+ String centeredString = getAlignment(bean);
+ if (centeredString != null)
+ centered = centeredString.equalsIgnoreCase("center");
+
+ //new TrinidadPanelPopup('splashContainer', 'trigger3', false, true, true).show(event);return false;
+ StringBuilder script = new StringBuilder();
+ script.append("new TrinidadPanelPopup(this.id + '");
+ script.append(_POPUP_CONTAINER_ID_SUFFIX);
+ script.append("', this.id, ");
+ script.append(getModal(bean));
+ script.append(", ");
+ script.append(centered);
+ script.append(", false).show(event); return false;");
+
+ return XhtmlUtils.getChainedJS(onclick, script.toString(), true);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void encodeAll(FacesContext context, RenderingContext arc,
+ UIComponent component, FacesBean bean) throws IOException
+ {
+ // Currently, we require scripting to render anything
+ if (!supportsScripting(arc))
+ {
+ _LOG.severe("Agent requires Script Support - unable to render.");
+ return;
+ }
+
+ ResponseWriter writer = context.getResponseWriter();
+ String clientId = getClientId(context, component);
+
+ // output the popup javascript library
+ _POPUP_LIB.outputScriptlet(context, arc);
+
+ _renderTrigger(context, arc, component, bean);
+
+ // render the outer div that is the actual popup container
+ writer.startElement(XhtmlConstants.DIV_ELEMENT, null);
+ writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, clientId
+ + _POPUP_CONTAINER_ID_SUFFIX, null);
+ writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE,
+ _POPUP_CONTAINER_DIV_STYLES, null);
+
+ writer.startElement(XhtmlConstants.TABLE_ELEMENT, null);
+ renderStyleClass(context, arc, AF_PANEL_POPUP_CONTAINER_STYLE_CLASS);
+ writer.writeAttribute("cellspacing", "0", null);
+
+ writer.startElement(XhtmlConstants.TABLE_BODY_ELEMENT, null);
+
+ _renderTitleBar(context, arc, component, bean);
+
+ writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
+
+ // table cell that contains the child components
+ writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
+ renderStyleClass(context, arc, AF_PANEL_POPUP_CONTENT_STYLE_CLASS);
+ // spans both the title and close-icon columns
+ writer.writeAttribute(XhtmlConstants.COLSPAN_ATTRIBUTE, "2", null);
+
+ // render custom styles for content area if specified
+ String style = getContentStyle(bean);
+ if(style != null)
+ {
+ writer.writeAttribute(XhtmlConstants.STYLE_ATTRIBUTE, style, null);
+ }
+
+ encodeAllChildren(context, component);
+
+ writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
+
+ writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
+
+ writer.endElement(XhtmlConstants.TABLE_BODY_ELEMENT);
+
+ writer.endElement(XhtmlConstants.TABLE_ELEMENT);
+
+ if (isIE(arc))
+ {
+ // insert an iframe if IE 6.5 or less. Critical for
+ // CSS fix for IE 'select' control z-index bug. Fixed in IE 7.
+ // CSS does the magic here, by hiding the iframe
+ writer.write("<!--[if lte IE 6.5]><iframe style=\""
+ + _POPUP_CONTAINER_IFRAME_STYLES + "\"></iframe><![endif]-->");
+ }
+
+ // close outer show/hide div
+ writer.endElement(XhtmlConstants.DIV_ELEMENT);
+ }
+
+ protected void _renderTrigger(FacesContext context, RenderingContext arc,
+ UIComponent component, FacesBean bean) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ UIComponent triggerFacet = getFacet(component,
+ CorePanelPopup.TRIGGER_FACET);
+
+ String text = getText(bean);
+
+ // start rendering 'control'
+ writer.startElement(XhtmlConstants.LINK_ELEMENT, null);
+
+ String id = getClientId(context, component);
+ writer.writeAttribute(XhtmlConstants.ID_ATTRIBUTE, id, null);
+ writer.writeAttribute(XhtmlConstants.HREF_ATTRIBUTE, "#", null);
+ renderAllAttributes(context, arc, bean);
+
+ // Note: render both the trigger facet and text attribute
+ // if they are both set - and if neither is set,
+ // leave the popup for display by JS
+
+ // Write out the trigger facet if it exists
+ if (triggerFacet != null)
+ {
+ // render 'control' facet
+ encodeChild(context, triggerFacet);
+ }
+
+ // Write out the "text" attribute if it exists
+ if (text != null)
+ {
+ // render 'text' attribute
+ writer.writeText(text, "text");
+ }
+
+ writer.endElement(XhtmlConstants.LINK_ELEMENT);
+ }
+
+ protected void _renderTitleBar(FacesContext context, RenderingContext arc,
+ UIComponent component, FacesBean bean) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ String title = getTitle(bean);
+ if (title == null)
+ return;
+
+ writer.startElement(XhtmlConstants.TABLE_ROW_ELEMENT, null);
+ renderStyleClass(context, arc, AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS);
+
+ writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
+ renderStyleClass(context, arc, AF_PANEL_POPUP_TITLE_STYLE_CLASS);
+
+ writer.writeText(title, "title");
+
+ writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
+
+ writer.startElement(XhtmlConstants.TABLE_DATA_ELEMENT, null);
+ writer.writeAttribute(XhtmlConstants.ALIGN_ATTRIBUTE, "right", null);
+
+ Icon icon = arc.getIcon(AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS);
+
+ if (getModal(bean) && icon != null && !icon.isNull())
+ {
+
+ writer.startElement(XhtmlConstants.LINK_ELEMENT, null);
+ writer.writeAttribute(XhtmlConstants.HREF_ATTRIBUTE, "#", null);
+
+ StringBuilder script = new StringBuilder();
+ script.append("_tppCurrent.hide(); return false;");
+
+ writer.writeAttribute(XhtmlConstants.ONCLICK_ATTRIBUTE, script,
+ null);
+
+ String closeText = arc.getTranslatedString("af_panelPopup.CLOSE");
+ OutputUtils.renderIcon(context, arc, icon, closeText, null);
+
+ writer.endElement(XhtmlConstants.LINK_ELEMENT);
+
+ }
+
+ writer.endElement(XhtmlConstants.TABLE_DATA_ELEMENT);
+
+ writer.endElement(XhtmlConstants.TABLE_ROW_ELEMENT);
+
+ }
+
+ private static final TrinidadLogger _LOG = TrinidadLogger
+ .createTrinidadLogger(PanelPopupRenderer.class);
+
+ private PropertyKey _textKey;
+
+ private PropertyKey _titleKey;
+
+ private PropertyKey _alignmentKey;
+
+ private PropertyKey _modalKey;
+
+ private PropertyKey _contentStyleKey;
+
+ static private final Scriptlet _POPUP_LIB =
+ new LibraryScriptlet("PanelPopup", null);
+
+ private static final String _POPUP_CONTAINER_ID_SUFFIX = "_popupContainer";
+
+ /**
+ * styles for container element that is shown/hidden. User can't style this
+ * element, but there's an inner element for skin styling (e.g border,
+ * padding, etc.).
+ */
+ private static final String _POPUP_CONTAINER_DIV_STYLES = "position: absolute; "
+ + "z-index: 201; "
+ + "top: 0px; "
+ + "left: 0px; "
+ + "visibility:hidden; " + "padding: 0px; " + "overflow:hidden;";
+
+ /**
+ * styles to workaround z-index bug for select input boxes showing through
+ * on IE 6.5 or earlier
+ */
+ private static final String _POPUP_CONTAINER_IFRAME_STYLES = "display:none;/*sorry for IE5*/ "
+ + "display/**/:block;/*sorry for IE5*/ "
+ + "position:absolute;/*must have*/ "
+ + "top:0;/*must have*/ "
+ + "left:0;/*must have*/ "
+ + "z-index:-1;/*must have*/ "
+ + "filter:mask();/*must have*/ "
+ + "width:3000px;/*must have for any big value*/ "
+ + "height:3000px/*must have for any big value*/ ";
+
+ // THE FOLLOWING BELONG IN SkinSelectors
+ public static final String AF_PANEL_POPUP_ROOT_STYLE_CLASS = "af|panelPopup";
+
+ public static final String AF_PANEL_POPUP_CONTAINER_STYLE_CLASS = AF_PANEL_POPUP_ROOT_STYLE_CLASS
+ + "::container";
+
+ public static final String AF_PANEL_POPUP_CONTENT_STYLE_CLASS = AF_PANEL_POPUP_ROOT_STYLE_CLASS
+ + "::content";
+
+ public static final String AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS = AF_PANEL_POPUP_ROOT_STYLE_CLASS
+ + "::titlebar";
+
+ public static final String AF_PANEL_POPUP_TITLE_STYLE_CLASS = AF_PANEL_POPUP_ROOT_STYLE_CLASS
+ + "::title-text";
+
+ public static final String AF_PANEL_POPUP_CLOSE_ICON_STYLE_CLASS = AF_PANEL_POPUP_ROOT_STYLE_CLASS
+ + "::close-icon";
+}
\ No newline at end of file
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java Tue Jan 30 22:04:11 2007
@@ -70,6 +70,8 @@
"META-INF/adf/jsLibs/ColorFieldFormat.js",
"META-INF/adf/jsLibs/ColorFormat.js",
"META-INF/adf/jsLibs/Shuttle.js",
+ "META-INF/adf/jsLibs/PanelPopup.js",
+ "META-INF/adf/jsLibs/PopupDialog.js",
};
// List of all libraries
@@ -90,6 +92,8 @@
"META-INF/adf/jsLibsDebug/ColorFieldFormat.js",
"META-INF/adf/jsLibsDebug/ColorFormat.js",
"META-INF/adf/jsLibsDebug/Shuttle.js",
+ "META-INF/adf/jsLibsDebug/PanelPopup.js",
+ "META-INF/adf/jsLibsDebug/PopupDialog.js",
};
static private final String _NEWLINE_SEPARATOR = "\n";
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js Tue Jan 30 22:04:11 2007
@@ -146,6 +146,25 @@
}
}
+function _returnPopupCalendarValue(
+ props,
+ value
+ )
+{
+ //callback method registered with the popup
+ //'props' contains the name of the target form & field to populate
+
+ if (value != (void 0))
+ {
+ var formName = props['formNameKey'];
+ var fieldName = props['fieldNameKey'];
+ var dateField = document.forms[formName][fieldName];
+
+ _dfsv(dateField, value);
+ }
+}
+
+
/**
* Provate function for launching the date picker
*/
@@ -231,25 +250,14 @@
{
destination += "&maxValue=" + maxValue;
}
-
- // Open the window; we used to name it "calendar", but
- // that's a common enough name that we hit bug 2807778
- var calWindow = openWindow(self,
- destination,
- 'uix_2807778',
- {width:350, height:370},
- true,
- void 0,
- _returnCalendarValue);
- // save the date field on the calendar window for access
- // from event handler
- calWindow._dateField = dateField;
-
- // And, for bug 1879034, stash it on a JS variable. It
- // seems that IE sometimes has already blown away the values
- // on "calWindow"!
- _savedField1879034 = dateField;
+ //
+ // initialize and open the dialog passing callback details
+ //
+ var popup = new TrPopupDialog(370, 350);
+ popup.callback = _returnPopupCalendarValue;
+ popup.callbackProps = { formNameKey:formName, fieldNameKey:nameInForm };
+ popup.launchDialog(destination);
}
// _dfgv(): Date Field Get Value function
@@ -416,16 +424,23 @@
function _doCancel()
{
- top.returnValue = (void 0);
- top.close();
+ var popup = top.TrPanelPopup.getCurrentPanelPopup();
+ popup.returnValue = (void 0);
+ popup.hide();
+// top.returnValue = (void 0);
+// top.close();
return false;
}
function _selectDate(dateTime)
{
- top.returnValue = dateTime;
- top._unloadADFDialog(window.event);
- top.close();return false;
+ var popup = top.TrPanelPopup.getCurrentPanelPopup();
+ popup.returnValue = dateTime;
+ popup.hide();
+// top.returnValue = dateTime;
+// top._unloadADFDialog(window.event);
+// top.close();return false;
+ return false;
}
Added: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js?view=auto&rev=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js (added)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js Tue Jan 30 22:04:11 2007
@@ -0,0 +1,345 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+//define the tpp object and methods
+function TrPanelPopup(modal, centered, container, trigger)
+{
+ //define object properties
+ this._modal = modal;
+ this._centered = centered;
+ this._container = container;
+ this._trigger = trigger;
+ this._visible = false;
+}
+
+//the currently visible popup (if any)
+TrPanelPopup._current = false;
+
+//the modal mask - shared by all instances
+TrPanelPopup._mask = false;
+
+// TOODO: only register this while a popup is visible
+//register the onclick handlers
+TrPanelPopup._addEvent(document, "click", TrPanelPopup._documentOnClick);
+
+//useful event registration function
+TrPanelPopup._addEvent = function(obj, evType, fn)
+{
+ // TODO: abstract onto Agent object
+ if (obj.addEventListener)
+ {
+ obj.addEventListener(evType, fn, false);
+ return true;
+ }
+ else if (obj.attachEvent)
+ {
+ var r = obj.attachEvent("on"+evType, fn);
+ return r;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+TrPanelPopup._documentOnClick = function(event)
+{
+ //use document level onclick so we know when to hide non-modals
+ //defer hiding logic to current popup
+ if (TrPanelPopup._current)
+ return TrPanelPopup._current.handleEvent(event);
+}
+
+//sizes/resizes the modal mask if the window size changes
+TrPanelPopup._setMaskSize = function()
+{
+ //only bother if mask is inited
+ if (!TrPanelPopup._mask)
+ return;
+
+ if (window.innerHeight!=window.undefined)
+ fullHeight = window.innerHeight;
+ else if (document.compatMode=='CSS1Compat')
+ fullHeight = document.documentElement.clientHeight;
+ else if (document.body)
+ fullHeight = document.body.clientHeight;
+
+ if (window.innerWidth!=window.undefined)
+ fullWidth = window.innerWidth;
+ else if (document.compatMode=='CSS1Compat')
+ fullWidth = document.documentElement.clientWidth;
+ else if (document.body)
+ fullWidth = document.body.clientWidth;
+
+ // Determine what's bigger, scrollHeight or fullHeight / width
+ if (fullHeight > document.body.scrollHeight)
+ {
+ popHeight = fullHeight;
+ }
+ else
+ {
+ popHeight = document.body.scrollHeight
+ }
+
+ TrPanelPopup._mask.style.height = popHeight + "px";
+ TrPanelPopup._mask.style.width = document.body.scrollWidth + "px";
+}
+
+//public functions
+
+/**
+ * Returns the currently active popup object, or false if none active.
+ **/
+TrPanelPopup.getCurrentPanelPopup = function()
+{
+ return TrPanelPopup._current;
+}
+
+/**
+ * Close the currently active popup (if any).
+ **/
+TrPanelPopup.closeCurrentPanelPopup = function()
+{
+ if (TrPanelPopup._current)
+ TrPanelPopup._current.hide();
+}
+
+//BEGIN PUBLIC PROPERTIES
+
+/**
+ * Set the popup to appear centered.
+ **/
+TrPanelPopup.prototype._centered = false;
+
+/**
+ * Holds the return value of the dialog. Check this property after the
+ * popup has closed.
+ **/
+TrPanelPopup.prototype.returnValue = false;
+
+/**
+ * Attach a callback function that will be invoked when the popup
+ * has been closed. The callbackProps and returnValue properties will be
+ * passed as parameters (e.g. function myCallback(props, value);).
+ **/
+TrPanelPopup.prototype.callback = false;
+
+/**
+ * Attach properties to the popup that will be passed to the callback function
+ * (e.g. a component target to populate with the returnValue).
+ **/
+TrPanelPopup.prototype.callbackProps = false;
+
+/**
+ * Make the popup visible
+ **/
+TrPanelPopup.prototype.show = function(event)
+{
+ //already visible
+ if (this.isVisible())
+ return;
+
+ //ignore if same same instance
+ if (this == TrPanelPopup._current)
+ return;
+
+ //if already another instance showing, then hide it
+ if (TrPanelPopup._current)
+ TrPanelPopup._current.hide();
+
+ this._calcPosition(event);
+
+ if (this.isModal()) {
+ this._showMask();
+ }
+
+ this.getContainer().style.visibility = "visible";
+
+ TrPanelPopup._current = this;
+
+ this._visible = true;
+}
+
+//hide the popup
+TrPanelPopup.prototype.hide = function()
+{
+ TrPanelPopup._current = false;
+ if (this.isModal())
+ {
+ this._hideMask();
+ }
+ this.getContainer().style.visibility = "hidden";
+ //move popup back to top left so it won't affect scroll size if window resized
+ this.getContainer().style.left = "0px";
+ this.getContainer().style.top = "0px";
+
+ //call the callback function if attached
+ if (this.callback)
+ {
+ //alert('callback function attached: ' + this.callback + ', callbackProps:' + this.callbackProps + ', returnValue:' + this.returnValue);
+ this.callback(this.callbackProps, this.returnValue);
+ }
+
+ this._visible = false;
+
+}
+
+//tests the event and hides the popup if appropriate
+TrPanelPopup.prototype.handleEvent = function(event)
+{
+ if (!this.isVisible() || this.isModal())
+ return;
+
+ var currElement = false;
+ if (_agent.isIE)
+ {
+ currElement = event.srcElement;
+ }
+ else
+ {
+ currElement = event.target;
+ }
+
+ //loop through element stack where event occurred
+ while (currElement)
+ {
+ //if clicked on trigger or popup
+ if (currElement == this.getContainer() ||
+ currElement == this.getTrigger()) {
+ break;
+ }
+ currElement = currElement.parentNode;
+ }
+ if (!currElement) {
+ //if click was on something other than the popupContainer
+ this.hide();
+ }
+}
+
+TrPanelPopup.prototype.getContainer = function()
+{
+ return this._container;
+}
+
+TrPanelPopup.prototype.getTrigger = function()
+{
+ return this._trigger;
+}
+
+TrPanelPopup.prototype.isModal = function()
+{
+ return this._modal;
+}
+
+TrPanelPopup.prototype.isVisible = function()
+{
+ return this._visible;
+}
+
+/**
+ * Show the popup mask that blocks clicks in modal mode. Initialize it
+ * if not already.
+ **/
+TrPanelPopup.prototype._showMask = function()
+{
+ //initialise mask only once
+ if (!TrPanelPopup._mask)
+ {
+ //create mask for modal popups
+
+ TrPanelPopup._mask = document.createElement('div');
+ TrPanelPopup._mask.name = "TrPanelPopup._BlockingModalDiv";
+ TrPanelPopup._mask.style.cssText = "display:none;position: absolute; z-index: 200;top: 0px;left: 0px;cursor: not-allowed;background-color: #6a74cb;filter:alpha(opacity=5);-moz-opacity:0.05;opacity: 0.05;";
+ TrPanelPopup._mask.innerHTML = " <!--[if lte IE 6.5]><iframe style='display:none;/*sorry for IE5*/ display/**/:block;/*sorry for IE5*/ position:absolute; top:0; left:0; z-index:-1; filter:mask(); width:3000px; height:3000px; cursor: not-allowed;'></iframe><![endif]-->";
+
+ //consume all events
+ TrPanelPopup._addEvent(TrPanelPopup._mask, "click", TrPanelPopup._consumeMaskEvent);
+
+ //handle window resize events
+ TrPanelPopup._addEvent(window, "resize", TrPanelPopup._setMaskSize);
+
+ //set initial mask size
+ TrPanelPopup._setMaskSize();
+
+ //add mask to body
+ document.body.appendChild(TrPanelPopup._mask);
+ }
+
+ TrPanelPopup._mask.style.display = "block";
+
+}
+
+TrPanelPopup.prototype._hideMask = function()
+{
+ TrPanelPopup._mask.style.display = "none";
+}
+
+/**
+ * Position the popup
+ **/
+TrPanelPopup.prototype._calcPosition = function(event)
+{
+ //position the popup
+ var left = 0;
+ var top = 0;
+
+ var isIE = _agent.isIE;
+
+ //bring some sanity to the cross browser measurements
+ var xOffset = isIE ? document.body.scrollLeft : window.pageXOffset;
+ var yOffset = isIE ? document.body.scrollTop : window.pageYOffset;
+ var scrollWidth = document.body.scrollWidth;
+ var scrollHeight = document.body.scrollHeight;
+ var bodyWidth = isIE ? document.body.clientWidth : window.innerWidth;
+ var bodyHeight = isIE ? document.body.clientHeight : window.innerHeight;
+ var containerWidth = this.getContainer().clientWidth;
+ var containerHeight = this.getContainer().clientHeight;
+
+ if (this._centered)
+ {
+ left = xOffset + ((bodyWidth - containerWidth) / 2);
+ top = yOffset + ((bodyHeight - containerHeight) / 2);
+ }
+ else
+ {
+ var eventX = isIE ? window.event.clientX : event.clientX;
+ var eventY = isIE ? window.event.clientY : event.clientY;
+
+ //ensure we keep popup within current page width
+ if (xOffset + eventX + containerWidth > document.body.scrollWidth)
+ left = document.body.scrollWidth - containerWidth;
+ else
+ left = xOffset + eventX;
+
+ //ensure we keep popup within current page height
+ if (yOffset + eventY + containerHeight > document.body.scrollHeight)
+ top = document.body.scrollHeight - containerHeight;
+ else
+ top = document.body.scrollTop + eventY;
+ }
+
+ this.getContainer().style.left = left + "px";
+ this.getContainer().style.top = top + "px";
+}
+
+TrPanelPopup._consumeMaskEvent = function(event)
+{
+ return false;
+}
+
Added: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js?view=auto&rev=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js (added)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js Tue Jan 30 22:04:11 2007
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+function TrPopupDialog(height, width)
+{
+ var div = document.createElement("div");
+ div.style.cssText = "visibility:hidden; position: absolute; z-index: 201;";
+
+ //setup the content iframe
+ var iframe = document.createElement("iframe");
+ iframe.name = "_blank";
+ iframe.height = "200px";
+ if (height)
+ iframe.height = height;
+ iframe.width = "200px";
+ if (width)
+ iframe.width = width;
+
+ //hold the iframe so we can set the 'src' as needed.
+ this._iframe = iframe;
+
+ div.appendChild(iframe);
+ document.body.appendChild(div);
+
+ this.base = TrPanelPopup;
+ this.base(true, true, div, false);// modal, the div, no trigger
+}
+
+TrPopupDialog.prototype = TrPanelPopup.prototype;
+
+TrPopupDialog.prototype.launchDialog = function(url)
+{
+ this.show(false); //no event to pass as we're centered anyway
+
+ this._iframe.src = url;
+ this._iframe.focus();
+
+ return this._iframe;
+}
+
+TrPopupDialog.prototype.returnFromDialog = function()
+{
+ this.hide();
+ //blank the iframe so we don't see old content next time.
+ // TODO: AdamWiner: this will result in "mixed content"
+ // warnings on IE 6 in an SSL connection. The workaround
+ // is using a transparent .gif (like t.gif)
+ this._iframe.src = "about:blank";
+}
+
+TrPopupDialog.prototype.resize = function(height, width)
+{
+ this._iframe.height = height;
+ this._iframe.width = width;
+}
+
+function returnFromDialog()
+{
+ var dialog = TrPanelPopup.getCurrentPanelPopup();
+ if (dialog instanceof TrPopupDialog)
+ {
+ dialog.returnFromDialog();
+ }
+ else
+ {
+ alert("returnFromDialog(): Error - Current popup is not a dialog");
+ }
+}
+
+TrPopupDialog._returnFromDialogAndSubmit = function(props, value)
+{
+ if (props)
+ {
+ var formName = props['formNameKey'];
+ var postbackId = props['postbackKey'];
+ var partial = props['partialKey'];
+
+ if (partial)
+ _submitPartialChange(formName, 0, {rtrn:postbackId});
+ else
+ submitForm(formName, 0, {rtrn:postbackId});
+ }
+}
+
+TrPopupDialog._launchPopupDialog = function(
+ srcURL,
+ features,
+ formName,
+ postbackId,
+ partial)
+{
+ var dialog = TrPopupDialog.DIALOG;
+ if (!dialog)
+ dialog = TrPopupDialog.DIALOG = new TrPopupDialog();
+
+ dialog.callback = TrPopupDialog._returnFromDialogAndSubmit;
+ dialog.callbackProps = { formNameKey:formName, postbackKey:postbackId, partialKey:partial };
+ dialog.resize(features['height'], features['width']);
+ dialog.launchDialog(srcURL);
+}
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js Tue Jan 30 22:04:11 2007
@@ -527,6 +527,8 @@
params
)
{
+ // TODO: turn this on for dialogs in popup windows
+ return;
var isGecko = _agent.isGecko;
var isIE = _agent.isIE;
var isSafari = _agent.isSafari;
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/resources/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/javascriptmap.properties
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/resources/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/javascriptmap.properties?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/resources/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/javascriptmap.properties (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/resources/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/javascriptmap.properties Tue Jan 30 22:04:11 2007
@@ -46,6 +46,9 @@
Shuttle=Common
RichTextEditor=Common
Poll=Common
+PanelPopup=Common
+PopupDialog=Common
+
# Support for WMLPatternFormat is removed. We will see if any one asks for
# this and then add it.
#WMLPatternFormat=Uncommon
Modified: incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts?view=diff&rev=501740&r1=501739&r2=501740
==============================================================================
--- incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts (original)
+++ incubator/adffaces/branches/panel-popup-branch/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts Tue Jan 30 22:04:11 2007
@@ -345,6 +345,8 @@
<resource key="af_panelTip.TIP">TIP</resource>
+ <resource key="af_panelPopup.CLOSE">Close</resource>
+
<!--QuickLinks-->
<!--Alt tag for returning to the top-->
<!-- =-=jmw also used in af_page. @todo fix this. -->