Return-Path: Delivered-To: apmail-myfaces-commits-archive@www.apache.org Received: (qmail 44694 invoked from network); 7 Apr 2008 23:00:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Apr 2008 23:00:35 -0000 Received: (qmail 30606 invoked by uid 500); 7 Apr 2008 23:00:35 -0000 Delivered-To: apmail-myfaces-commits-archive@myfaces.apache.org Received: (qmail 30518 invoked by uid 500); 7 Apr 2008 23:00:35 -0000 Mailing-List: contact commits-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list commits@myfaces.apache.org Received: (qmail 30507 invoked by uid 99); 7 Apr 2008 23:00:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Apr 2008 16:00:35 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Apr 2008 22:59:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 133421A9832; Mon, 7 Apr 2008 16:00:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r645727 [1/5] - in /myfaces/trinidad/trunk_1.2.x/trinidad-impl/src: main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/ main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ main/java/org/apache/myfaces/trinidadi... Date: Mon, 07 Apr 2008 22:59:45 -0000 To: commits@myfaces.apache.org From: gcrawford@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080407230001.133421A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gcrawford Date: Mon Apr 7 15:59:37 2008 New Revision: 645727 URL: http://svn.apache.org/viewvc?rev=645727&view=rev Log: TRINIDAD-921 Add/Fix Support for Windows Mobile 6/5 and BlackBerry Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/LabelAndMessageRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputNumberSpinboxRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputTextRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ColumnData.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/CellFormatRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/CellFormatRenderer.java myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/body-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/cellFormat-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/commandButton-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/commandLink-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/commandNavigationItem-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/editableTable-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/goButton-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-simple-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputDate-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputDate-simple-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputListOfValues-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputNumberSpinbox-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputText-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputText-rows-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelFormLayout-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelLabelAndMessage-facet-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/panelLabelAndMessage-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/resetButton-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanCheckbox-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectBooleanRadio-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyCheckbox-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectManyListBox-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneChoice-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneListbox-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/selectOneRadio-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/table-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectMany-minimalPPC-golden.xml myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/tableSelectOne-minimalPPC-golden.xml Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaRenderKit.java Mon Apr 7 15:59:37 2008 @@ -25,24 +25,33 @@ { public PdaRenderKit() { - addRenderer("org.apache.myfaces.trinidad.Table", - "org.apache.myfaces.trinidad.Table", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.PdaTableRenderer"); - addRenderer("org.apache.myfaces.trinidad.Process", - "org.apache.myfaces.trinidad.Train", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.TrainRenderer"); - addRenderer("org.apache.myfaces.trinidad.FrameBorderLayout", - "org.apache.myfaces.trinidad.FrameBorderLayout", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.PdaFrameBorderLayoutRenderer"); - addRenderer("org.apache.myfaces.trinidad.Frame", - "org.apache.myfaces.trinidad.Frame", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.FrameRenderer"); - addRenderer("org.apache.myfaces.trinidad.Panel", - "org.apache.myfaces.trinidad.ButtonBar", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.PanelButtonBarRenderer"); - addRenderer("org.apache.myfaces.trinidad.NavigationLevel", - "org.apache.myfaces.trinidad.Pane", - "org.apache.myfaces.trinidadinternal.renderkit.core.pda.PdaNavigationPaneRenderer"); + _addRenderer("Frame", + "Frame", "FrameRenderer"); + _addRenderer("Panel", + "ButtonBar", "PanelButtonBarRenderer"); + _addRenderer("Column", + "Column", "PdaColumnRenderer"); + _addRenderer("FrameBorderLayout", + "FrameBorderLayout", "PdaFrameBorderLayoutRenderer"); + _addRenderer("Messages", + "Messages", "PdaMessageBoxRenderer"); + _addRenderer("NavigationLevel", + "Pane", "PdaNavigationPaneRenderer"); + _addRenderer("Table", + "Table", "PdaTableRenderer"); + _addRenderer("Process", + "Train", "TrainRenderer"); + } + + private void _addRenderer( + String family, + String rendererType, + String rendererClassName) + { + + addRenderer(_trBase + family, + _trBase + rendererType, + _pdaBase + rendererClassName); } @Override @@ -51,4 +60,7 @@ return CoreRenderKit.BASE_RENDER_KIT_ID; } + static private final String _trBase = "org.apache.myfaces.trinidad."; + static private final String _pdaBase = + "org.apache.myfaces.trinidadinternal.renderkit.core.pda."; } Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/pda/PdaTableRenderer.java Mon Apr 7 15:59:37 2008 @@ -32,6 +32,8 @@ import org.apache.myfaces.trinidad.component.core.data.CoreColumn; import org.apache.myfaces.trinidad.component.core.data.CoreTable; import org.apache.myfaces.trinidad.context.RenderingContext; + +import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.OutputUtils; import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors; import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TableRenderer; import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants; @@ -52,6 +54,39 @@ super(CoreTable.TYPE); } + + /** + * renders attributes on the outermost table element. + * this includes width, cellpadding, cellspacing, border. + */ + @Override + protected void renderTableAttributes( + FacesContext context, + RenderingContext arc, + UIComponent component, + FacesBean bean, + Object cellPadding, + Object border + ) throws IOException + { + Object width = getWidth(bean); + + // On mobile devices, table width is set to full browser width unless + // the width is specified. + if (width == null || width == "") + { + width = "100%"; + } + + + OutputUtils.renderLayoutTableAttributes(context, + arc, + cellPadding, + "0", // cell spacing + border, + width); // table width + } + @Override protected final void renderControlBar( FacesContext context, Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnGroupRenderer.java Mon Apr 7 15:59:37 2008 @@ -401,7 +401,13 @@ boolean hasSortingIcon = (sortIcon != null) && !sortIcon.isNull(); // we do not want to wrap if there is an icon on the header: - isNoWrap = isNoWrap || hasSortingIcon; + // On PDA, where screen width is limited, we cannot afford not to + // wrap. isPDA check is used in several places in this class. + // PDA specific logic will be moved to PDA render kit in the future. + if (!isPDA(arc)) + { + isNoWrap = isNoWrap || hasSortingIcon; + } // || getRequired(bean); // || getMessageType(bean); Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ColumnRenderer.java Mon Apr 7 15:59:37 2008 @@ -322,7 +322,7 @@ writer.writeAttribute("style", userInlineStyle, null); - if (colData.getNoWrap(physicalIndex)) + if (colData.getNoWrap(physicalIndex) && !getShouldWrap()) writer.writeAttribute(XhtmlConstants.NOWRAP_ATTRIBUTE, Boolean.TRUE, null); CellUtils.renderSpan(context, true /*isRowSpan*/, rowSpan); @@ -367,6 +367,8 @@ UIComponent component, FacesBean bean) { + boolean shouldWrap = getShouldWrap(); + UIComponent header = getFacet(component, CoreColumn.HEADER_FACET); Object headerText = getHeaderText(bean); @@ -381,15 +383,16 @@ { colData.setSpecialColumnData(tContext, arc, - getNoWrap(bean), + getNoWrap(bean) && !shouldWrap, + shouldWrap, getFormatType(bean)); } else { colData.setColumnData(getWidth(bean), getFormatType(bean), - getNoWrap(bean), - getHeaderNoWrap(bean), + getNoWrap(bean) && !shouldWrap, + getHeaderNoWrap(bean) && !shouldWrap, getSeparateRows(bean), getRowHeader(bean)); } @@ -569,6 +572,11 @@ renderStyleClass(context, arc, cellClass); return cellClass; + } + + protected boolean getShouldWrap() + { + return false; } private ColumnGroupRenderer _columnGroupRenderer = Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/LabelAndMessageRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/LabelAndMessageRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/LabelAndMessageRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/LabelAndMessageRenderer.java Mon Apr 7 15:59:37 2008 @@ -229,6 +229,12 @@ // =-=AEW THIS DOESN'T SEEM RIGHT - IT SHOULD GO ON THE INPUT FIELD // ONLY, RIGHT? Matching UIX 2.2 behavior here. rw.writeAttribute("title", getShortDesc(bean), "title"); + if (!isDesktop(arc)) + { + // On PDA browsers label and message pair is always + // rendered in full width. + rw.writeAttribute("width", "100%", null); + } renderId(context, component); // put the outer style class here, like af_inputText, styleClass, @@ -367,7 +373,10 @@ rw.writeAttribute("valign", valign, null); if (isDesktop(arc)) + { + // On PDA browsers where width is limited, the label is allowed to wrap. rw.writeAttribute("nowrap", Boolean.TRUE, null); + } if (labelExists) { @@ -396,7 +405,12 @@ rw.startElement("td", null); rw.writeAttribute("valign", "top", null); - rw.writeAttribute("nowrap", Boolean.TRUE, null); + if (isDesktop(arc)) + { + // On PDA browsers where width is limited, the field data is + // allowed to wrap. + rw.writeAttribute("nowrap", Boolean.TRUE, null); + } renderStyleClass(context, arc, SkinSelectors.AF_CONTENT_CELL_STYLE_CLASS ); Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputLabelRenderer.java Mon Apr 7 15:59:37 2008 @@ -30,6 +30,7 @@ import org.apache.myfaces.trinidad.bean.PropertyKey; import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel; +import org.apache.myfaces.trinidad.context.Agent; import org.apache.myfaces.trinidad.context.FormData; import org.apache.myfaces.trinidad.context.RenderingContext; import org.apache.myfaces.trinidad.context.RequestContext; @@ -182,10 +183,7 @@ boolean isInline = (RequestContext.getCurrentInstance().getClientValidation() == RequestContext.ClientValidation.INLINE); - if ((null != messageType) && - !"none".equals(messageType) || - ((forId != null) && - isInline)) + if (_shouldRenderMessageSymbol(arc, messageType, isInline, forId)) { String vAlign = getDefaultValign(bean); String destination = getMessageDescUrl(bean); @@ -456,6 +454,40 @@ return null; } + private boolean _shouldRenderMessageSymbol( + RenderingContext arc, + String messageType, + boolean isInline, + String forId) + { + // BlackBerry does not support inline style "display:none". + // BlackBerry supports some inline styles and thus test by + // calling XhtmlRenderer.supportsStyleAttributes() is not + // sufficient. + // If rendering for BlackBerry and the span has inline style + // "display:none", do not render the span. If rendered, the + // message icon is always visible. + // If rendering for non-BlackBerry OR rendering BlackBerry + // but the condition + // (null == messageType || "none".equals(messageType)) + // does not meet, return true, so that caller renders the + // span element. + Agent agent = arc.getAgent(); + + if ((null != messageType) && + !"none".equals(messageType) || + ((forId != null) && + isInline)) + { + if ((agent != null) && + Agent.AGENT_BLACKBERRY.equals(agent.getAgentName()) && + (null == messageType || "none".equals(messageType))) + { + return false; + } + } + return true; + } private PropertyKey _accessKeyKey; private PropertyKey _forKey; Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputColorRenderer.java Mon Apr 7 15:59:37 2008 @@ -375,7 +375,6 @@ columnsInteger = _DEFAULT_COLUMNS; } - columnsInteger = getColumnsAdjustedForAgent(arc,bean,columnsInteger); return columnsInteger; } Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java Mon Apr 7 15:59:37 2008 @@ -436,8 +436,6 @@ columnsInteger = _DEFAULT_COLUMNS; } - columnsInteger = getColumnsAdjustedForAgent(arc,bean,columnsInteger); - return columnsInteger; } Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputNumberSpinboxRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputNumberSpinboxRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputNumberSpinboxRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputNumberSpinboxRenderer.java Mon Apr 7 15:59:37 2008 @@ -110,9 +110,7 @@ RenderingContext arc, FacesBean bean) { - Integer columnsInteger = - getColumnsAdjustedForAgent(arc,bean,_DEFAULT_COLUMNS); - return columnsInteger; + return _DEFAULT_COLUMNS; } @Override Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputTextRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputTextRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputTextRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputTextRenderer.java Mon Apr 7 15:59:37 2008 @@ -268,15 +268,9 @@ */ protected Integer getDefaultColumns(RenderingContext arc, FacesBean bean) { - - // for efficiency, since we know the logic in getColumnsAdjustedForAgent - // only applies to certain PDA's, we'll only call that method if the - // agent type is PDA if (isPDA(arc)) { - Integer toReturn = - getColumnsAdjustedForAgent(arc,bean,_DEFAULT_PDA_COLUMNS); - return toReturn; + return _DEFAULT_PDA_COLUMNS; } return _DEFAULT_COLUMNS; @@ -453,59 +447,6 @@ } } } - - /** - * A method to adjust the columns for the given agent. This may be used - * internally and by subclasses to get around quirks in certain agents if - * the subclass does not want to do any agent-specific detection on its own. - * In general this method should NOT be used to adjust user-specified - * columns. Rather, it is primarily used to adjust the default values that - * a renderer may specify. Its use is NOT mandatory by subclasses, but serves - * as a convenience. - * @return - */ - protected Integer getColumnsAdjustedForAgent( - RenderingContext arc, - FacesBean bean, - Integer columns) - { - - if(columns == null) - { - return null; - } - - Agent agent = arc.getAgent(); - - // for input type="text" on the BlackBerry Browser, the size attribute - // is not honored properly; it generally shows many more characters - // than specified; note that this only affects input type="text", not - // textareas - if(agent != null && Agent.AGENT_BLACKBERRY.equals(agent.getAgentName())) - { - boolean isTextArea = isTextArea(bean); - if(!isTextArea) - { - // the 1.7 factor provides a good approximation for various - // conditions on the BlackBerry--it won't be perfect in all situations - double colDouble = columns.doubleValue(); - double colAdjust = Math.round(colDouble / 1.7); - - // if the columns was specified, we want to leave it as specified, - // but at a minimum value - if(colDouble > 0 && colAdjust == 0) - { - colAdjust = 1; - } - - columns = (int) colAdjust; - } - } - - return columns; - - } - private void _writeTextWithBreaks( FacesContext context, Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java Mon Apr 7 15:59:37 2008 @@ -244,10 +244,26 @@ outBuilder.append("','"); _escapeSingleQuotes(outBuilder, evh2); - if ( shortCircuit ) - outBuilder.append("',this,event,true)"); + RenderingContext arc = RenderingContext.getCurrentInstance(); + boolean isDesktop = (arc.getAgent().getType().equals(Agent.TYPE_DESKTOP)); + + if (isDesktop) + { + if ( shortCircuit ) + outBuilder.append("',this,event,true)"); + else + outBuilder.append("',this,event)"); + } else - outBuilder.append("',this,event)"); + { + // Some mobile browsers do not support DOM Event object. + // If event is passed, the script crushes before the function gains + // control. + if ( shortCircuit ) + outBuilder.append("',this,null,true)"); + else + outBuilder.append("',this,null)"); + } return outBuilder.toString(); } Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ColumnData.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ColumnData.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ColumnData.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/ColumnData.java Mon Apr 7 15:59:37 2008 @@ -320,6 +320,7 @@ TableRenderingContext tContext, RenderingContext arc, boolean noWrap, + boolean allowHeaderWrap, String formatType) { // make sure that no-one called any of the get methods on this object, @@ -328,7 +329,7 @@ int physicalIndex = getPhysicalColumnIndex(); Data d = _create(physicalIndex); - d.headerNoWrap = true; + d.headerNoWrap = !allowHeaderWrap; d.noWrap = noWrap; _setDataFormat(d, formatType); d.width = _getSpecialWidth(tContext, arc); Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/CellFormatRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/CellFormatRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/CellFormatRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/html/CellFormatRenderer.java Mon Apr 7 15:59:37 2008 @@ -91,7 +91,13 @@ if (rowspan > 1) rw.writeAttribute("rowspan", rowspan, "rowSpan"); if (isWrappingDisabled(bean)) - rw.writeAttribute("nowrap", Boolean.TRUE, "wrappingDisabled"); + { + // On PDA browser where the width is limited, nowrap will not be set. + if (isDesktop(arc)) + { + rw.writeAttribute("nowrap", Boolean.TRUE, "wrappingDisabled"); + } + } encodeAllChildren(context, component); Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/CellFormatRenderer.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/CellFormatRenderer.java?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/CellFormatRenderer.java (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/pda/CellFormatRenderer.java Mon Apr 7 15:59:37 2008 @@ -48,12 +48,12 @@ // renderAttribute(context, node, "width", WIDTH_ATTR); renderAttribute(context, node, "height", HEIGHT_ATTR); - - - if ( supportsWrappingDisabled( context )) - { - renderAttribute(context, node, "nowrap", WRAPPING_DISABLED_ATTR); - } - + + + // nowrap in cell causes various display problems on PDA. + // On BlackBerry, rows wraps if a cell is wide and make it difficult read. + // On other PDA devices, horizontal scroll should be minimized. + // Do not add nowrap attribute. } + } Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Mon Apr 7 15:59:37 2008 @@ -17,8 +17,6 @@ * under the License. */ -var _pprUnsupported = false; - // Flag used by partial page rendering and the back issue // to indicate whether or not we need to restore the saved inline scripts. var _pprBackRestoreInlineScripts = false; @@ -210,31 +208,77 @@ // we do not currently specify the BlackBerry platform // because it is not necessary (if we decide to support // other browsers on the BlackBerry platform it may become necessary) - var isOpera = false; - var isIE = false; - var isNav = false; - var isGecko = false; - var isSafari = false; - var isPIE = false; - var isBlackBerry = false; - var kind = "unknown"; - var isWindows = false; - var isSolaris = false; - var isMac = false; + var isBlackBerry = false; + var isGecko = false; + var isIE = false; + var isMac = false; + var isNav = false; + var isOpera = false; + var isPIE = false; + var isSafari = false; + var isSolaris = false; + var isWindows = false; + var isWindowsMobile6 = false; + var kind = "unknown"; + + // Group IE and IE based browsers such as IE Mobile on WM5 and WM6 + var isIEGroup = false; + + // Indicate browser's PPR capability support + var pprUnsupported = false; + + // Flag to indicate that document object is sufficiently implemented to + // provide good level of access to HTML, XHTML and XML document. + // For example, Windows Mobile 5 and Blackberry does not implement + // document.body, document.forms or document.documentElement and this + // flag is set to false. Some features implemented in Core.js and + // Page.js are not executed for the browsers when it is set to false. + var supportsDomDocument = true; + + // Identifies browsers that do not support node.nodeType + var supportsNodeType = true; + + // Indicate browser's validation capability support + var supportsValidation = true; if (agentString.indexOf("msie") != -1) { // extract ie's version from the ie string var matches = agentString.match(/msie (.*);/); version = parseFloat(matches[1]); - if (agentString.indexOf("ppc") != -1 && - agentString.indexOf("windows ce") != -1 && - version >= 4.0) + isIEGroup = true; + + // All IE based mobile browsers + if (agentString.indexOf("windows ce") != -1) { - isPIE = true; - kind = "pie"; + supportsNodeType = false; + supportsDomDocument = false; + supportsValidation = false; + + // PPC200X and Windows Mobile 5 + if (agentString.indexOf("ppc") != -1 && + version >= 4.0) + { + // This user agent indicates the browser is WindowsMobile 5 or + // earlier version of PIE + isPIE = true; + + // Windows Mobile 5 DOM and XMLHttpRequest support are not + // sufficient to support PPR in this framework effectively. + pprUnsupported = true; + kind = "pie"; + } + else + { + // This user agent indicates the browser is WindowsMobile 6 PIE + isWindowsMobile6 = true; + // A new kind string was given to WM6 browser as the + // capability is significantly different from predecessors. + kind = "iemobile"; + } } - else { + else + { isIE = true; kind = "ie"; } @@ -257,20 +301,24 @@ version = 1.0; } else if(agentString.indexOf("blackberry") != -1) - { - // if we support non-BlackBerry Browser agents on blackberry - // devices in the future, we may need to revisit this because - // those agents may include "blackberry" in the User-Agent - // string; we can't just check if the User-Agent "starts with" - // blackberry because navigator.userAgent on BlackBery Browser 4.0 - // starts with Mozilla/4.0 (even though the User-Agent sent to the - // server starts with BlackBerry/) + { + // if we support non-BlackBerry Browser agents on blackberry + // devices in the future, we may need to revisit this because + // those agents may include "blackberry" in the User-Agent + // string; we can't just check if the User-Agent "starts with" + // blackberry because navigator.userAgent on BlackBery Browser 4.0 + // starts with Mozilla/4.0 (even though the User-Agent sent to the + // server starts with BlackBerry/) - // BlackBerry Browser 4.0+ supports navigator.appVersion, - // and earlier versions don't support script, so we can - // leave the version as defined above - isBlackBerry = true; - kind = "blackberry"; + // BlackBerry Browser 4.0+ supports navigator.appVersion, + // and earlier versions don't support script, so we can + // leave the version as defined above + pprUnsupported = true; + isBlackBerry = true; + kind = "blackberry"; + mobileBrowser = true; + supportsDomDocument = false; + supportsValidation = false; } else if ((agentString.indexOf('mozilla') != -1) && (agentString.indexOf('spoofer') == -1) && @@ -301,21 +349,27 @@ isSolaris = true; } - _agent.isIE = isIE; - _agent.isNav = isNav; - _agent.isOpera = isOpera; - _agent.isPIE = isPIE; - _agent.isGecko = isGecko; - _agent.isSafari = isSafari; - _agent.isBlackBerry = isBlackBerry; - _agent.version = version - _agent.kind = kind; - _agent.isWindows = isWindows; - _agent.isSolaris = isSolaris; - _agent.isMac = isMac; + _agent.isBlackBerry = isBlackBerry; + _agent.isGecko = isGecko; + _agent.isIE = isIE; + _agent.isIEGroup = isIEGroup; + _agent.isMac = isMac; + _agent.isNav = isNav; + _agent.isOpera = isOpera; + _agent.isPIE = isPIE; + _agent.isSafari = isSafari; + _agent.isSolaris = isSolaris; + _agent.isWindows = isWindows; + _agent.isWindowsMobile6 = isWindowsMobile6; + _agent.kind = kind; + _agent.pprUnsupported = pprUnsupported; + _agent.supportsDomDocument = supportsDomDocument; + _agent.supportsNodeType = supportsNodeType; + _agent.supportsValidation = supportsValidation; + _agent.version = version; - _agent.atLeast = _atLeast; - _agent.atMost = _atMost; + _agent.atLeast = _atLeast; + _agent.atMost = _atMost; } @@ -850,25 +904,28 @@ parentWindow.onfocus = null; - var parentBody = parentWindow.document.body; - - // release the ie mouse grab - if (_agent.atLeast("ie", 4)) + if (_agent.supportsDomDocument) { - if (_agent.atLeast("ie", 5) && _agent.isWindows) + var parentBody = parentWindow.document.body; + + // release the ie mouse grab + if (_agent.atLeast("ie", 4)) { - parentBody.onlosecapture = null; + if (_agent.atLeast("ie", 5) && _agent.isWindows) + { + parentBody.onlosecapture = null; - _removeModalCaptureIE(parentBody); + _removeModalCaptureIE(parentBody); + } + parentBody.style.filter = null; } - parentBody.style.filter = null; - } - if (_agent.isGecko) - { - if (parentBody != (void 0)) + if (_agent.isGecko) { - _removeModalCaptureGecko(parentWindow, parentBody); + if (parentBody != (void 0)) + { + _removeModalCaptureGecko(parentWindow, parentBody); + } } } } @@ -1155,6 +1212,14 @@ source ) { + // Blackberry does not set valiation script in the fields + // and it is not possible to execute validation. + // Return true if validation is not supported. + if (!_agent.supportsValidation) + { + return true; + } + var funcName = '_' + _getJavascriptId(_getFormName(form)) + 'Validator'; var formWind = window[funcName]; if (formWind) @@ -1551,7 +1616,7 @@ // timeout handler will cancel the event submission if the data no longer // exists. var pending = true; - if (_agent.isIE) + if (_agent.isIEGroup) { pending = false; // keep track of whether there was a pending event @@ -1675,7 +1740,10 @@ // reset any hidden form values before submitting TrPage.getInstance()._resetHiddenValues(form); - if (isPartial) + // While WM6 can support PPR, WM5 and PPC lacks enough support + // for DOM and/or HMLHTTP. Disable partial form post for PPC and + // WM5. + if (isPartial && _supportsPPR()) { TrPage.getInstance().sendPartialFormPost(form, parameters); } @@ -1707,8 +1775,7 @@ var hiddenField = form.elements[paramName]; if (_agent.isPIE) { - var element = form.elements[paramName]; - element.value = paramValue; + hiddenField.value = paramValue; } else { @@ -2300,7 +2367,7 @@ { for (var id in validators) { - if(document.getElementById(id) == null) + if(_getElementById(document, id) == null) { continue; } @@ -2539,7 +2606,7 @@ return false; // determine visibility from style information - if (_agent.isIE) + if (_agent.isIEGroup) { var node = input; @@ -2565,7 +2632,7 @@ return true; } - if (_agent.isGecko || _agent.isSafari) + if (_agent.isGecko || _agent.isSafari || _agent.BlackBerry) { // Radio buttons: it'll be an array if (!input.ownerDocument && input.length) @@ -3035,10 +3102,11 @@ return doc.getElementById(id); } - //PH:if agent is PIE get elements this way since getElementById is - //not supported - if(_agent.isPIE) + else if (typeof(doc.all) == 'undefined') { + // Browser does not support getElementById nor DOM documnet.all object. + // One example of such browser today is BlackBerry 4.0 browser. + //if element is not within a form if(doc.forms.length == 0) return window[id]; @@ -3054,9 +3122,12 @@ //element is not within the form but form(s) is(are) present. return window[id]; } - - return doc.all[id]; - + else + { + // Browser does not support getElementById but supports DOM documnet.all + // object. One example of such browser today is Windows Mobile browser. + return doc.all[id]; + } } // A recursive method which searches the entire DOM tree @@ -3193,7 +3264,14 @@ if (doc == (void 0)) return; - if (_agent.isIE) + // Some mobile browser do not support attaching event listner + // to document + if (!doc.attachEvent && !doc.addEventListener) + { + return; + } + + if (doc.attachEvent) // IE { var el = win._pprConsumeFirstClick; if (install) @@ -3319,7 +3397,7 @@ win._pprBlockingTimeout = win.setTimeout("_pprStopBlocking(window);", 8000); } - else if (_agent.isIE) + else if (_agent.isIEGroup) { // save off the element we'll return focus to _pprEventElement = window.document.activeElement; @@ -3366,7 +3444,7 @@ */ function _pprFocus(node, doc) { - if (_agent.isIE) + if (_agent.isIEGroup) { // If the node's parent has changed through a DOM update then // this node hasn't been fully added to the tree yet so we @@ -3541,8 +3619,7 @@ // Tests whether a partial submit should be performed function _supportsPPR() { - // TODO: handle platforms that do not support PPR - return !_pprUnsupported; + return !_agent.pprUnsupported; } @@ -3581,10 +3658,7 @@ parameters = _addFormParameter(parameters, "partial", "true"); // block all mouse clicks until the submit is done - if (!_agent.isPIE) - { _pprStartBlocking(window); - } // Submit the form var submitted = submitForm(form, doValidate, parameters, true); @@ -3592,10 +3666,7 @@ // If the form wasn't actually submitted, update the ref count if (!submitted) { - if (!_agent.isPIE) - { - _pprStopBlocking(window); - } + _pprStopBlocking(window); } } @@ -3832,8 +3903,10 @@ // IE too, but IE's implementation of eval() always executes // the script in the current context, even if some other // window is specified. - if (_agent.isIE) + if (_agent.isIEGroup) + { targetWindow.execScript(code); + } else targetWindow.eval(code); } @@ -3968,8 +4041,8 @@ function _checkLoadNoPPR() { if(_initialFocusID != null) - _setFocus(_getElementById(document,_initialFocusID)); - _pprUnsupported = true; + _setFocus(_getElementById(document,_initialFocusID)); + _agent.pprUnsupported = true; } /** @@ -4000,7 +4073,7 @@ // IE has a document.activeElement property. Most other // browsers do not (though Firefox 3.0 will). - if (!_agent.isIE && document.addEventListener) + if (!_agent.isIEGroup && document.addEventListener) { document.addEventListener("keyup", _trTrackActiveElement, false); document.addEventListener("mousedown", _trTrackActiveElement, false); @@ -4734,4 +4807,4 @@ .getPropertyValue(prop); } return ''; -} \ No newline at end of file +} Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js Mon Apr 7 15:59:37 2008 @@ -71,16 +71,23 @@ // code is returned as part of the HTTP prototcol. if (statusCode == 200) { - // TODO: clean this up - if (!_agent.isPIE) - { - _pprStopBlocking(window); - } + _pprStopBlocking(window); if (requestEvent.isPprResponse()) { var responseDocument = requestEvent.getResponseXML(); - this._handlePprResponse(responseDocument.documentElement); + + // Though not yet supported, Nokia browser sometimes fails to get + // XML content. (Currently being investigated.) When that happens, + // the function should simply return without calling + // _handlePprResponse rather than crushing the function with null + // pointer reference. + // This is a temporary workaround and should be revisited when + // Nokia browser is officially supported. + if (responseDocument != null) + { + this._handlePprResponse(responseDocument.documentElement); + } } else { @@ -92,15 +99,10 @@ // The RequestQueue logs these for us, so // we don't need to take action here. IMO, that's probably // wrong - we should do the handling here - - // TODO: clean this up - if (!_agent.isPIE) - { - _pprStopBlocking(window); - } - + _pprStopBlocking(window); } - } + + } } TrPage.prototype._handlePprResponse = function(documentElement) @@ -297,61 +299,109 @@ // Handles a single fragment node in a ppr response. TrPage.prototype._handlePprResponseFragment = function(fragmentNode) { - // Convert the content of the fragment node into an HTML node that - // we can insert into the document - var sourceNode = this._getFirstElementFromFragment(fragmentNode); - - // In theory, all fragments should have one element with an ID. - // Unfortunately, the PPRResponseWriter isn't that smart. If - // someone calls startElement() with the write component, but never - // passed an ID, we get an element with no ID. And, even - // worse, if someone calls startElement() with a that - // never gets any attributes on it, we actually strip that - // span, so we can get something that has no elements at all! - if (!sourceNode) - return; - - // Grab the id of the source node - we need this to locate the - // target node that will be replaced - var id = sourceNode.getAttribute("id"); - // As above, we might get a node with no ID. So don't crash - // and burn, just return. - if (!id) - return; - - // assert((id != null), "null id in response fragment"); - - // Find the target node var doc = window.document; - var targetNode = doc.getElementById(id); - var activeNode = _getActiveElement(); + var targetNode; + var activeNode; var refocusId = null; - if (activeNode && TrPage._isDomAncestorOf(activeNode, targetNode)) - refocusId = activeNode.id; - - if (targetNode == null) - { - // log.severe("unable to locate target node: " + id); + + // Due to the limitation of DOM implementation of WM6, + // a special code is needed here. + // Note: This code segment is a good candidate to be emcapsulated in to + // either WM6-specific agent or TrPage subclass. + if (_agent.isWindowsMobile6) + { + // Get the first child node in fragmentNote + var firstFragmenChildNode = fragmentNode.childNodes[0]; + if (!firstFragmenChildNode) + return; + + var outerHTML = firstFragmenChildNode.data; + + // Windows Mobile 6 requires the element to be a child of + // document.body to allow setting its innerHTML property. + tempDiv = doc.createElement("div"); + tempDiv.id = "tempDiv"; + tempDiv.hidden = "true"; + + var bodyElement = doc.body; + + // Temporarily append the new DIV element containing + // the data in the first child of the fragement to body + bodyElement.appendChild(tempDiv); + tempDiv.innerHTML = outerHTML; + + var sourceNode = TrPage._getFirstElementWithId(tempDiv); + + var targetNode = _getElementById(doc, sourceNode.id); + if (!targetNode) + { + return; + } + + activeNode = _getActiveElement(); + if (activeNode && TrPage._isDomAncestorOf(activeNode, targetNode)) + refocusId = activeNode.id; + + // Insert the new element + targetNode.parentNode.insertBefore(sourceNode, targetNode); + + // Remove the element to be replaced + // innderHTML needs to be reset to work around the problem + // of WM6 DOM. removeChild is not sufficient. + targetNode.innerHTML = ""; + targetNode.parentNode.removeChild(targetNode); + + // Remove the temporary element + tempDiv.innerHTML = ""; + bodyElement.removeChild(tempDiv); } else { + // Convert the content of the fragment node into an HTML node that + // we can insert into the document + var sourceNode = this._getFirstElementFromFragment(fragmentNode); + + // In theory, all fragments should have one element with an ID. + // Unfortunately, the PPRResponseWriter isn't that smart. If + // someone calls startElement() with the write component, but never + // passed an ID, we get an element with no ID. And, even + // worse, if someone calls startElement() with a that + // never gets any attributes on it, we actually strip that + // span, so we can get something that has no elements at all! + if (!sourceNode) + return; + + // Grab the id of the source node - we need this to locate the + // target node that will be replaced + var id = sourceNode.getAttribute("id"); + // As above, we might get a node with no ID. So don't crash + // and burn, just return. + if (!id) + return; + + // Find the target node + targetNode = _getElementById(doc, id); + activeNode = _getActiveElement(); + if (activeNode && TrPage._isDomAncestorOf(activeNode, targetNode)) + refocusId = activeNode.id; // replace the target node with the new source node - targetNode.parentNode.replaceChild(sourceNode, targetNode); - // Call all the DOM replace listeners - var listeners = this._domReplaceListeners; - if (listeners) + if (targetNode) + targetNode.parentNode.replaceChild(sourceNode, targetNode); + } + // Call all the DOM replace listeners + var listeners = this._domReplaceListeners; + if (listeners) + { + for (var i = 0; i < listeners.length; i+=2) { - for (var i = 0; i < listeners.length; i+=2) - { - var currListener = listeners[i]; - var currInstance = listeners[i+1]; - if (currInstance != null) - currListener.call(currInstance, targetNode, sourceNode); - else - currListener(targetNode, sourceNode); - } + var currListener = listeners[i]; + var currInstance = listeners[i+1]; + if (currInstance != null) + currListener.call(currInstance, targetNode, sourceNode); + else + currListener(targetNode, sourceNode); } - } + } // TODO: handle nodes that don't have ID, but do take the focus? if (refocusId) @@ -436,17 +486,22 @@ for (var i = 0; i < length; i++) { var childNode = childNodes[i]; - - // Check for ELEMENT nodes (nodeType == 1) - if (childNode.nodeType == 1) + if (childNode.id) { - if (childNode.id) + if (!_agent.supportsNodeType) + { return childNode; - - return TrPage._getFirstElementWithId(childNode); + } + // Check for ELEMENT nodes (nodeType == 1) if nodeType is + // supported + else if (childNode.nodeType == 1) + { + return childNode; + } } + return TrPage._getFirstElementWithId(childNode); } - + return null; } @@ -539,32 +594,47 @@ TrPage._collectLoadedLibraries = function() { - var loadedLibraries = new Object(); + if (!_agent.supportsDomDocument) + { + // There is not enough DOM support (e.g. document object does not + // implement essential properties/methods such as body, documentElement + // and firstChild) and it is not possible to implement this function. + return null; + } + else + { + var loadedLibraries = new Object(); // We use document.getElementsByTagName() to locate all scripts // in the page. In theory this could be slow if the DOM is huge, // but so far seems extremely efficient. - var domDocument = window.document; - var scripts = domDocument.getElementsByTagName("script"); - - for (var i = 0; i < scripts.length; i++) - { - // Note: we use node.getAttribute("src") instead of node.src as - // FF returns a fully-resolved URI for node.src. In theory we could - // fully resolve/normalize all script src values (both here and - // in rich responses), but this seems like overkill. Instead, we - // just use whatever value happens to show up in the HTML src attribute, - // whether it is fully resolved or not. In theory this could mean that - // we could evalute a library an extra time (if it appears once fully - // resolved and another time as a relative URI), but this seems like - // an unlikely case which does not warrant extra code. - var src = scripts[i].getAttribute("src"); + var domDocument = window.document; + var scripts = domDocument.getElementsByTagName("script"); - if (src) - loadedLibraries[src] = true; + if (scripts != null) + { + for (var i = 0; i < scripts.length; i++) + { + // Note: we use node.getAttribute("src") instead of node.src as + // FF returns a fully-resolved URI for node.src. In theory we could + // fully resolve/normalize all script src values (both here and + // in rich responses), but this seems like overkill. Instead, we + // just use whatever value happens to show up in the HTML src attribute, + // whether it is fully resolved or not. In theory this could mean that + // we could evalute a library an extra time (if it appears once fully + // resolved and another time as a relative URI), but this seems like + // an unlikely case which does not warrant extra code. + + var src = scripts[i].getAttribute("src"); + + if (src) + { + loadedLibraries[src] = true; + } + } + } + return loadedLibraries; } - - return loadedLibraries; } /** Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js Mon Apr 7 15:59:37 2008 @@ -158,6 +158,12 @@ */ TrRequestQueue.prototype._isMultipartForm = function(actionForm) { + // If there not enough DOM support, namely getElementsByTagName() being + // not supported, this function does not work. Return false for such case. + if (!_agent.supportsDomDocument) + { + return false; + } // Use enctype - supported on IE >= 6, Moz, and Safari. // encoding is not supported on Safari. if (actionForm.enctype.toLowerCase() != "multipart/form-data") Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js Mon Apr 7 15:59:37 2008 @@ -167,16 +167,27 @@ { var xmlhttp; - // TODO: for IE 7, use XMLHttpRequest - if (_agent.isIE) + if (window.XMLHttpRequest) { - xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + xmlhttp = new XMLHttpRequest(); } - else + else if (window.ActiveXObject) { - xmlhttp = new XMLHttpRequest(); + try + { + xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); + } + catch (e) + { + try + { + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + catch (e) + { + } + } } - return xmlhttp; } @@ -194,4 +205,5 @@ this.callback = null delete this.xmlhttp; } + Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/body-minimalPPC-golden.xml URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/body-minimalPPC-golden.xml?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/body-minimalPPC-golden.xml (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/body-minimalPPC-golden.xml Mon Apr 7 15:59:37 2008 @@ -191,7 +191,7 @@ @@ -335,7 +335,7 @@ Text Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/columnGroup-minimalPPC-golden.xml Mon Apr 7 15:59:37 2008 @@ -8,6 +8,7 @@ cellpadding="0" cellspacing="0" summary="" + width="100%" > @@ -56,6 +56,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -106,6 +106,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -156,6 +156,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -206,6 +206,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -256,6 +256,7 @@ class="af_inputColor p_AFDisabled" id="mainId__xc_" summary="" + width="100%" > @@ -307,6 +307,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -362,6 +362,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -412,6 +412,7 @@ class="af_inputColor p_AFReadOnly" id="mainId__xc_" summary="" + width="100%" > @@ -458,6 +458,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -508,6 +508,7 @@ class="af_inputColor p_AFRequired" id="mainId__xc_" summary="" + width="100%" > @@ -564,6 +564,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -614,6 +614,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -664,6 +664,7 @@ class="af_inputColor p_AFRequired" id="mainId__xc_" summary="" + width="100%" > @@ -720,6 +720,7 @@ class="af_inputColor p_AFRequired" id="mainId__xc_" summary="" + width="100%" > @@ -776,6 +776,7 @@ class="af_inputColor p_AFRequired" id="mainId__xc_" summary="" + width="100%" > @@ -832,6 +832,7 @@ class="af_inputColor p_AFRequired" id="mainId__xc_" summary="" + width="100%" > @@ -888,6 +888,7 @@ class="af_inputColor" id="test-id__xc_" summary="" + width="100%" > @@ -939,6 +939,7 @@ id="mainId__xc_" style="background-color:red" summary="" + width="100%" > @@ -990,6 +990,7 @@ id="mainId__xc_" summary="" title="test-shortDesc" + width="100%" > @@ -1041,6 +1041,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1061,7 +1061,7 @@ class="af_inputColor_content" id="mainId" name="mainId" - onblur="return _chain('_fixCFF(this);','test-onblur',this,event)" + onblur="return _chain('_fixCFF(this);','test-onblur',this,null)" size="11" type="text" > @@ -1091,6 +1091,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1142,6 +1142,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1193,6 +1193,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1244,6 +1244,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1295,6 +1295,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1346,6 +1346,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1397,6 +1397,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > @@ -1448,6 +1448,7 @@ class="af_inputColor" id="mainId__xc_" summary="" + width="100%" > Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-simple-minimalPPC-golden.xml URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-simple-minimalPPC-golden.xml?rev=645727&r1=645726&r2=645727&view=diff ============================================================================== --- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-simple-minimalPPC-golden.xml (original) +++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/inputColor-simple-minimalPPC-golden.xml Mon Apr 7 15:59:37 2008 @@ -210,7 +210,7 @@ class="af_inputColor_content" id="mainId" name="mainId" - onblur="return _chain('_fixCFF(this);','test-onblur',this,event)" + onblur="return _chain('_fixCFF(this);','test-onblur',this,null)" size="11" type="text" >