Author: jwaldman
Date: Mon Feb 18 15:24:14 2008
New Revision: 628919
URL: http://svn.apache.org/viewvc?rev=628919&view=rev
Log:
TRINIDAD-936 changed the partialTrigger syntax so '::' pops out of
naming container.
added test cases
changed RenderUtils's getRelativeId to work the same way.
Added:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/test/java/org/apache/myfaces/trinidad/render/
- copied from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-api/src/test/java/org/apache/myfaces/trinidad/render/
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/test/java/org/apache/myfaces/trinidad/render/RenderUtilsTest.java
- copied unchanged from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-api/src/test/java/org/apache/myfaces/trinidad/render/RenderUtilsTest.java
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java
- copied unchanged from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/FindRelativeComponentTest.java
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TestRelativePartialTriggers.java
- copied unchanged from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TestRelativePartialTriggers.java
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx
- copied, changed from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggersPrevRelease.jspx
- copied unchanged from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggersPrevRelease.jspx
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java
- copied unchanged from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/context/PartialTriggersTest.java
Modified:
myfaces/trinidad/trunk_1.2.x/src/site/xdoc/devguide/ppr.xml
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
myfaces/trinidad/trunk_1.2.x/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/includes/CommonAttrs.xml
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/pprDemos.jspx
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
Modified: myfaces/trinidad/trunk_1.2.x/src/site/xdoc/devguide/ppr.xml
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/src/site/xdoc/devguide/ppr.xml?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/src/site/xdoc/devguide/ppr.xml
(original)
+++ myfaces/trinidad/trunk_1.2.x/src/site/xdoc/devguide/ppr.xml Mon
Feb 18 15:24:14 2008
@@ -155,21 +155,17 @@
<P>
Also, if you've got JSF NamingContainers (e.g., f:subview) between
the trigger and its target,
-you'll need to incorporate that into the partialTriggers definition:
+you'll need to incorporate that into the partialTriggers definition.
The syntax is:
<ul>
<li>If you need to go down through a naming container to get to the
trigger, include the naming container's ID with a colon (e.g.,
partialTriggers="theSubform:theLink"</li>
<li>If you need to start at the root of the page to get the trigger
component, start with a single colon (e.g.,
partialTriggers=":someRootComponent"</li>
-<li>If you need to go up and out of a parent naming container to get
the trigger component, start with multiple colons. - <ul>
- <li>If the target component is not a NamingContainer, then the
trigger is relative to the target component. To find it relative to
the parent naming
- container, start with two colons (e.g,
partialTriggers="::myTrigger"). To find it relative to the
grandparent naming container,
- start with three colons (e.g., partialTriggers=":::myTrigger"),
and so forth.
- </li>
- <li>If the target component is a NamingContainer, then the
trigger is relative to the target component's parent, not the
component itself.
- </li>
- </ul>
-</li>
+<li>If you need to go up and out of a naming container to get the
trigger component, start with two colons. (e.g.,
partialTriggers="::someComponentOutsideNamingContainer")
+This includes the current component if the component is a
NamingContainer. (e.g., tr:table
partialTriggers="::mySiblingComponent" pops out of the table to get
to the sibling)</li>
+<li>If you need to go up and out of two naming containers to get the
trigger component, start with three colons.
+To pop out of three naming containers, start with four colons, and
so on. (e.g., partialTriggers=":::someOtherComponent" pops out of two
naming containers)</li>
</ul>
+
+Here are some examples:
</P>
<source>
<![CDATA[
@@ -189,23 +185,22 @@
</f:subview>
</f:subview>
- <!-- Button 2 has four colons. Two to get it to
button2WrapperB, three to get it to buttons2WrapperA,
- and four to get it to wrapperAroundEverything. It will
find the trigger from there. + <!-- Button 2's
partialTrigger starts with ':::'. + Two colons to pop it
out of button2WrapperB, another colon to pop it out of buttons2WrapperA.
commandButton is not a NamingContainer -->
<f:subview id="button2WrapperA">
<f:subview id="button2WrapperB">
<tr:commandButton
-
partialTriggers="::::button1WrapperA:button1WrapperB:button1"
+
partialTriggers=":::button1WrapperA:button1WrapperB:button1"
partialSubmit="true"
id="button2"
text="button 2"/>
</f:subview>
</f:subview>
....
- <!-- table is a NamingContainer, so finding the trigger
starts
- with the parent component -- the panelGroupLayout.. If
the - parent is a NamingContainer (like if you take the
panelGroupLayout
- away) then there would only be three colons. -->
+ <!-- table is a NamingContainer. Two colons pop out of
the table.
+ Two more to pop it out of the two subviews.
+ -->
<f:subview id="table7WrapperA">
<f:subview id="table7WrapperB">
<tr:panelGroupLayout layout="vertical">
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/RenderUtils.java
Mon Feb 18 15:24:14 2008
@@ -27,6 +27,8 @@
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.component.UIXForm;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.util.ComponentUtils;
/**
* Generic utilities for rendering.
@@ -102,67 +104,193 @@
}
/**
- * Returns a relative ID for use at rendering time, e.g. "for"
- * attributes on components. It does not assume that the target
- * component can be located. A relative ID starting with
+ * Given a 'from' component and a relativeId, + * return the
clientId for use at rendering time that will identify the
+ * id of the component you are referencing on the client.
+ * This is used for attributes like e.g. "for" and "chooseId".
+ * + * <p>
+ * e.g., given this hierarchy
+ * <br/>
+ * <f:subview id="aaa"><f:subview id="xxx"><br/>
+ <tr:chooseColor id="cp1" .../><br/>
+ <f:subview id="yyy"><br/>
+ <tr:inputColor id="sic1" chooseId="::cp1"
.../><br/>
+ </f:subview><br/>
+ </f:subview></f:subview><br/>
+ </p>
+ <p>
+ * The 'from' component is the inputColor component.
+ * The 'relativeId' is "::cp1". ('::' pops up one naming container)
+ * The return value is 'aaa:xxx:cp1' when
+ * the clientId of the 'xxx' component is 'aaa:xxx'.
+ * + * </p>
+ * <p>
+ * It does not assume that the target component can be located,
although it does
+ * check. If it can't be found, returns the correct relativeId
anyway.
+ * </p>
+ * <p>
+ * A relativeId starting with
* NamingContainer.SEPARATOR_CHAR (that is, ':') will be
* treated as absolute (after dropping that character).
+ * A relativeId with no colons means it is within the same naming
container
+ * as the 'from' component (this is within the 'from' component if
'from'
+ * is a naming container).
+ * A relativeId starting with '::' pops out of the 'from' component's
+ * naming container. If the 'from' component is a naming
container, then
+ * '::' will pop out of the 'from' component itself. A relativeId
with ':::' pops up two naming containers, etc.
+ * ComponentUtils.findRelativeComponent finds and returns the
component, whereas
+ * this method returns a relativeId that can be used during
renderering + * so the component can be found in javascript on the
client.
+ * </p>
+ * @param context
+ * @param from the component to search relative to
+ * @param relativeId the relative path from the 'from' component
+ * to the component to find
+ * @return the clientId for the 'relative' component.
+ @see ComponentUtils.findRelativeComponent(from, relativeId)
+
*/
public static String getRelativeId(
FacesContext context,
UIComponent from,
String relativeId)
{
+ if (from == null)
+ return null;
+ if ((relativeId == null) || (relativeId.length() == 0))
return null;
+
+ // Figure out how many colons
+ int colonCount = _getColonCount(relativeId);
+
+ // colonCount == 0: fully relative
+ // colonCount == 1: absolute + // colonCount > 1: for each
extra colon after 1, pop out of
+ // the naming container (to the view root, if naming containers
run out)
- UIComponent parentNC;
- if (relativeId.charAt(0) == NamingContainer.SEPARATOR_CHAR)
+ if (colonCount == 1)
+ return relativeId.substring(1);
+ + // + // We need to make it backward compatible, and +
// the only way is to use the findRelativeComponent code.
+ // This way we'll have a hint that the syntax is 'old' if +
// it can't be found. Plus, findRelativeComponent code has + //
backward compatibilty built in.
+ UIComponent component = +
ComponentUtils.findRelativeComponent(from, relativeId);
+ if (component == null && from instanceof NamingContainer)
{
- if (relativeId.length() > 1 && relativeId.charAt(1)
- == NamingContainer.SEPARATOR_CHAR)
+ component =
ComponentUtils.findRelativeComponent(from.getParent(), relativeId);
+ if (component != null)
{
- parentNC = _getParentNamingContainer(from.getParent());
- int index = 2;
- for (; index < relativeId.length() &&
relativeId.charAt(index) - == NamingContainer.SEPARATOR_CHAR
&& parentNC != null; ++index)
- {
- parentNC = _getParentNamingContainer(parentNC.getParent());
- }
- if (parentNC == null || index >= relativeId.length())
- {
- // TODO: would it be better to return null from here?
- return relativeId;
- }
- relativeId = relativeId.substring(index);
- }
- else
- {
- return relativeId.substring(1);
+ // TODO Log warning
+ _LOG.warning("DEPRECATED_RELATIVE_ID_SYNTAX", + new
Object[] {relativeId, from});
}
}
+ + // the component wasn't found, but go ahead and return
something smart
+ if (component == null)
+ {
+ // TODO LOG warning
+ _LOG.warning("RELATIVE_ID_NOT_FOUND", + new Object[]
{relativeId, from});
+ return _getRelativeId(context, from, relativeId, colonCount);
+ }
else
{
- parentNC = _getParentNamingContainer(from.getParent());
- if (parentNC == null)
- {
- return relativeId;
- }
+ return component.getClientId(context);
}
- return (parentNC.getClientId(context) +
- NamingContainer.SEPARATOR_CHAR + relativeId);
}
- private static UIComponent _getParentNamingContainer(UIComponent
from)
+
+ // This does NOT use findComponent
+ // ComponentUtils.findRelativeComponent finds the component, whereas
+ // this method returns a relativeId that can be used during
renderering + // so the component can be found in javascript on the
client.
+ // This code is faster because it doesn't have to find the component.
+ // It is used when the getRelativeId's findRelativeComponent
cannot find + // the component. This way we can return the
relativeId anyway.
+ private static String _getRelativeId(
+ FacesContext context,
+ UIComponent from,
+ String relativeId,
+ int colonCount)
{
- while (from != null)
+
+
+ if (colonCount == 1)
+ return relativeId.substring(1);
+ else if (colonCount > 1)
+ {
+ relativeId = relativeId.substring(colonCount);
+ }
+ + // if the component is not a NamingContainer, then we
need to + // get the component's naming container and set this as
the 'from'.
+
+ if (!(from instanceof NamingContainer))
{
+ from = _getParentNamingContainer(from);
+ }
+ // pop out of the naming containers if there are multiple colons
+ // from will be null if there are no more naming containers
+ for (int j = 1; j < colonCount; j++)
+ {
+ from = _getParentNamingContainer(from);
+ }
+
+
+ if (from == null)
+ return relativeId;
+ else
+ {
+ return (from.getClientId(context) +
+ NamingContainer.SEPARATOR_CHAR + relativeId);
+ }
+
+
+ }
+
+
+ // Given a component, get its naming container. If the component
+ // is a naming container, it will get its naming container.
+ // This is different than the one in ComponentUtils. This one
+ // returns null if there are no more NamingContainers. The other one
+ // returns the ViewRoot.
+ private static UIComponent _getParentNamingContainer (
+ UIComponent from)
+ {
+
+ while (from != null && from.getParent() != null)
+ {
+ from = from.getParent();
if (from instanceof NamingContainer)
return from;
- from = from.getParent();
}
return null;
}
+ + // Figure out how many colons
+ private static int _getColonCount(String relativeId)
+ {
+ int idLength = relativeId.length();
+ int colonCount = 0;
+ while (colonCount < idLength)
+ {
+ if (relativeId.charAt(colonCount) !=
NamingContainer.SEPARATOR_CHAR)
+ break;
+ colonCount++;
+ }
+ return colonCount;
+ }
+ static private final TrinidadLogger _LOG =
+ TrinidadLogger.createTrinidadLogger(RenderUtils.class);
+
}
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ComponentUtils.java
Mon Feb 18 15:24:14 2008
@@ -25,6 +25,8 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
/**
* Utility functions used by the Apache Trinidad components.
* <p>
@@ -319,24 +321,119 @@
return t;
}
+
/**
* Find a component relative to another.
* <p>
* The relative ID must account for NamingContainers. If the
component is already inside
* of a naming container, you can use a single colon to start the
search from the root, - * or multiple colons to move up through the
NamingContainers - "::" will search from - * the parent naming
container, ":::" will search from the grandparent - * naming
container, etc.
+ * or multiple colons to move up through the NamingContainers -
"::" will + * pop out of the current naming container, ":::" will
pop out of two
+ * naming containers, etc.
* </p>
* * @param from the component to search relative to
* @param relativeId the relative path to the component to find
* @return the component if found, null otherwise
+ * @see RenderUtils.getRelativeId(from, relativeId)
*/
public static UIComponent findRelativeComponent(
UIComponent from,
String relativeId)
{
+ if (from == null)
+ return null;
+ UIComponent originalFrom = from;
+ String originalRelativeId = relativeId;
+ + int idLength = relativeId.length();
+ // Figure out how many colons
+ int colonCount = 0;
+ while (colonCount < idLength)
+ {
+ if (relativeId.charAt(colonCount) !=
NamingContainer.SEPARATOR_CHAR)
+ break;
+ colonCount++;
+ }
+
+ // colonCount == 0: fully relative
+ // colonCount == 1: absolute (still normal findComponent syntax)
+ // colonCount > 1: for each extra colon after 1, pop out of
+ // the naming container (to the view root, if naming containers
run out)
+ if (colonCount > 1)
+ {
+ relativeId = relativeId.substring(colonCount);
+ + // if the component is not a NamingContainer, then we
need to + // get the component's naming container and set this
as the 'from'.
+ // this way we'll pop out of the component's + // naming
container if there is are multiple colons.
+ if (!(from instanceof NamingContainer))
+ {
+ from = _getParentNamingContainer(from);
+ }
+ + // pop out of the naming containers if there are
multiple colons
+ for (int j = 1; j < colonCount; j++)
+ {
+ from = _getParentNamingContainer(from);
+ }
+ }
+
+ UIComponent found = from.findComponent(relativeId);
+ if (found != null)
+ return found;
+ else
+ {
+ // try the old way for backward compatability as far as it
differed,
+ // which is only if the 'from' was not a NamingContainer.
+ if (!(originalFrom instanceof NamingContainer))
+ return _findRelativeComponentDeprecated(originalFrom,
originalRelativeId);
+ else
+ return null;
+ }
+ + }
+ + // given a component, get its naming container. If the component
+ // is a naming container, it will get its naming container.
+ // if no parent naming containers exist, it stops at the ViewRoot.
+ private static UIComponent _getParentNamingContainer (
+ UIComponent from)
+ {
+ while (from.getParent() != null)
+ {
+ from = from.getParent();
+ if (from instanceof NamingContainer)
+ break;
+ }
+ return from;
+ }
+
+ /**
+ * Find a component relative to another.
+ * This method is the same as the 'old' public
findRelativeComponent.
+ * This method is around so that the
+ * new findRelativeComponent method is backward compatibility.
+ * <p>
+ * The relative ID must account for NamingContainers. If the
component is already inside
+ * of a naming container, you can use a single colon to start the
search from the root, + * or multiple colons to move up through
the NamingContainers - "::" will search from + * the parent naming
container, ":::" will search from the grandparent + * naming
container, etc.
+ * </p>
+ * + * @param from the component to search relative to
+ * @param relativeId the relative path to the component to find
+ * @return the component if found, null otherwise
+ */
+ private static UIComponent _findRelativeComponentDeprecated(
+ UIComponent from,
+ String relativeId)
+ { + UIComponent originalFrom = from;
+ String originalRelativeId = relativeId;
+
int idLength = relativeId.length();
// Figure out how many colons
int colonCount = 0;
@@ -365,7 +462,15 @@
}
}
- return from.findComponent(relativeId);
+ UIComponent found = from.findComponent(relativeId);
+ if (found != null)
+ {
+ _LOG.warning("DEPRECATED_RELATIVE_ID_SYNTAX", + new
Object[] {originalRelativeId, originalFrom});
+ }
+ return found;
}
-
+ + static private final TrinidadLogger _LOG =
+ TrinidadLogger.createTrinidadLogger(ComponentUtils.class);
}
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
Mon Feb 18 15:24:14 2008
@@ -396,4 +396,10 @@
<!-- RESOURCE_PATH_CONTAINS_DOTS -->
<resource key="RESOURCE_PATH_DOTS">The resource path {0} contains
"..". Browsers resolve out the "..", so this is a suspicious
path.</resource>
+<!-- DEPRECATED_RELATIVE_ID_SYNTAX -->
+<resource key="DEPRECATED_RELATIVE_ID_SYNTAX">Could not find the
component with relative id {0} from {1} with the supported syntax.
The component was found with the deprecated syntax. Please use the
supported syntax.</resource>
+
+<!-- RELATIVE_ID_NOT_FOUND -->
+<resource key="RELATIVE_ID_NOT_FOUND">Could not find the component
with relative id {0} from {1}. This method will return the relative
id anyway. Please double-check the syntax and make sure the component
exists.</resource>
+
</resources>
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/includes/CommonAttrs.xml
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/includes/CommonAttrs.xml?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/includes/CommonAttrs.xml
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/includes/CommonAttrs.xml
Mon Feb 18 15:24:14 2008
@@ -58,20 +58,22 @@
</property-extension>
</property>
<property>
- <description><![CDATA[<p>the IDs of the components that should
trigger a partial update.
+ <description><![CDATA[the IDs of the components that should
trigger a partial update.
+ <p>
This component will listen on the trigger components. If one
of the
trigger components receives an event that will cause it to
update
in some way, this component will request to be updated too.</p>
<p>
- Separate multiple triggers with a space.
- Trigger identifiers are relative to the source component for
non-NamingContainer components and relative to the parent component
for NamingContainer components. + Separate multiple triggers
with a space. e.g., partialTriggers="cmp1 cmp2"
+ </p>
+ <p>
Identifiers must account for NamingContainers. You can use
a single colon to start the search from the root,
or use multiple colons to move up through the
NamingContainer. For example,
- for a non-NamingContainer component, "::" will
- search from the parent naming container, ":::" will search
- from the grandparent naming container, etc. For a
NamingContainer component,
- "::" will search from the parent component's parent naming
container. ":::" will
- search from the parent component's grandparent naming
container.</p>]]>
+ "::" will pop out of this component's naming container (it
pops out of itself if it is a naming container), + ":::" will
pop out of two naming containers, etc. The search for
+ the partialTrigger begins from there. e.g.,
partialTriggers=":::commandButton1" the search begins for the
+ component with id = commandButton1 after popping out of two
naming containers relative to this component.
+ To go into naming containers, you separate the naming
containers with ':', e.g.,partialTriggers=
"nc1:nc2:nc3:componentId".</p>]]>
</description>
<property-name>partialTriggers</property-name>
<property-class>java.lang.String[]</property-class>
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
Mon Feb 18 15:24:14 2008
@@ -3056,4 +3056,10 @@
<managed-bean-class>org.apache.myfaces.trinidaddemo.DemoShowDetailDisclosureBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>testTriggers</managed-bean-name>
+
<managed-bean-class>org.apache.myfaces.trinidaddemo.TestRelativePartialTriggers</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+
<!--oracle-jdev-comment:managed-bean-jsp-link:1demos/testRelativePartialTriggers.jspx-->
+ </managed-bean>
</faces-config>
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/pprDemos.jspx
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/pprDemos.jspx?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/pprDemos.jspx
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/pprDemos.jspx
Mon Feb 18 15:24:14 2008
@@ -245,10 +245,9 @@
<tr:panelHeader text="Naming container tests; partial
triggers are the previous command components with partialSubmit">
<tr:panelGroupLayout layout="vertical">
<f:subview id="sub">
- <!-- use '::' in front of the identifier to get to the
parent naming
- container, add ':::' to get to the grandparent naming
container, etc.
- This works for non-Naming Container components. -->
- <tr:outputFormatted partialTriggers=":::pSub_link
:::pSub_button"
+ <!-- use '::' in front of the identifier to pop out of
the current naming container.
+ Additional colons continue to pop. -->
+ <tr:outputFormatted partialTriggers="::pSub_link
::pSub_button"
styleUsage="instruction"
value="#{partialDemoUtil.status.linkUpdate}">
<f:convertDateTime pattern="HH:mm:ss"/>
@@ -259,7 +258,7 @@
This works for non-Naming Container components. -->
<f:subview id="sub2">
<f:subview id="sub3">
- <tr:outputFormatted partialTriggers="::::pSub_link
::::pSub_button"
+ <tr:outputFormatted partialTriggers=":::pSub_link
:::pSub_button"
styleUsage="instruction"
value="#{partialDemoUtil.status.linkUpdate}">
<f:convertDateTime pattern="HH:mm:ss"/>
@@ -284,6 +283,10 @@
<tr:selectItem label="Index" value="/index.jspx"/>
<tr:selectItem label="Component Demos"
value="/componentDemos.jspx"/>
</tr:selectOneChoice>
+ </tr:panelHeader>
+ <tr:panelHeader text="More ppr demos showing partialTriggers
syntax with regard to NamingContainers.">
+ <tr:goLink text="Relative Partial Triggers Demo"
+ destination="testRelativePartialTriggers.jspx"
/> </tr:panelHeader>
</tr:panelGroupLayout>
</tr:panelHeader>
Copied:
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx
(from r628838,
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx)
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx?p2=myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx&p1=myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx&r1=628838&r2=628919&rev=628919&view=diff
==============================================================================
---
myfaces/trinidad/branches/jwaldman_1.2-issue936/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-examples/trinidad-demo/src/main/webapp/demos/testRelativePartialTriggers.jspx
Mon Feb 18 15:24:14 2008
@@ -139,7 +139,8 @@
<tr:inputText partialTriggers=":::::::autosf:inputText5"
label="value submitted" id="xxxxxz" readOnly="true"
value="#{testTriggers.inputText5Value}"/>
</tr:subform>
- + <tr:inputText
partialTriggers="autosf:inputText5" label="value submitted out of
subform" id="xxxxxza" readOnly="true"
+
value="#{testTriggers.inputText5Value}"/>
</tr:panelPage>
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
Mon Feb 18 15:24:14 2008
@@ -537,37 +537,24 @@
for (int i = 0; i < triggers.length; i++)
{
String trigger = triggers[i];
+
- // Look for the master component. Note that if the listener
is itself - // a naming container, we don't want to restrict
ourselves to looking
- // inside - we want to look outside instead (at least, that was
- // the old ADF Faces rules, and now we should stick with it for
- // backwards compatibility even within Trinidad)
+ UIComponent master =
ComponentUtils.findRelativeComponent(listener, trigger);
- // The rule is "if the component is a naming container,
search relative - // to the parent; otherwise, search relative
to the component." In the
- // non-naming container case, if it fails, then search
relative to the - // parent, for backwards compatibility only,
since we were always - // searching relative to the parent.
- UIComponent from;
- boolean isNamingContainer = false;
boolean deprecatedFind = false;
- if (listener instanceof NamingContainer)
- {
- from = listener.getParent();
- isNamingContainer = true;
- }
- else
- from = listener;
- - UIComponent master =
ComponentUtils.findRelativeComponent(from, trigger);
- - if (master == null && !isNamingContainer)
+ + if (master == null)
{
- // for backwards compatibility, look from the parent.
- from = listener.getParent();
- master = ComponentUtils.findRelativeComponent(from, trigger);
- deprecatedFind = true;
+ UIComponent from = listener;
+ // backward compatible code
+ // The old rule is "if the component is a naming container,
search relative + // to the parent; otherwise, search relative
to the component." + if (listener instanceof NamingContainer)
+ {
+ from = listener.getParent();
+ master = ComponentUtils.findRelativeComponent(from, trigger);
+ deprecatedFind = true;
+ } }
if (master == null)
@@ -576,11 +563,11 @@
}
else
{
- // if we found this with the deprecated method of searching
relative to
- // the component's parent, then warn the user to change
their syntax.
+ // if we found this with the deprecated method, + //
then warn the user to change their syntax.
if (deprecatedFind)
{
- _LOG.warning("DEPRECATED_PARTIAL_TRIGGER_SYNTAX",
+ _LOG.warning("DEPRECATED_TRIGGER_SYNTAX", new
Object[] {trigger, listener});
}
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
URL:
http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts?rev=628919&r1=628918&r2=628919&view=diff
==============================================================================
---
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
(original)
+++
myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
Mon Feb 18 15:24:14 2008
@@ -1044,8 +1044,8 @@
<!-- INVALID_TIMEZONE_IN_CONFIG -->
<resource key="INVALID_TIMEZONE_IN_CONFIG">The trinidad-config.xml
contains an invalid value for time-zone ({0}). The default timezone
will be used instead.</resource>
-<!-- DEPRECATED_PARTIAL_TRIGGER_SYNTAX -->
-<resource key="DEPRECATED_PARTIAL_TRIGGER_SYNTAX">Could not find
partial trigger {0} from {1} searching relative to the component. The
partial trigger was found relative to the component's parent but this
is deprecated. Change the partial trigger to be relative to
component, not relative to parent.</resource>
+<!-- DEPRECATED_TRIGGER_SYNTAX -->
+<resource key="DEPRECATED_TRIGGER_SYNTAX">Could not find partial
trigger {0} from {1} with the supported partialTriggers syntax. The
partial trigger was found with the deprecated syntax. Please use the
supported syntax.</resource>
<!-- DATETIMERANGEVALIDATOR_REQUIRES_VALUEHOLDER -->
<resource
key="DATETIMERANGEVALIDATOR_REQUIRES_EDITABLEVALUEHOLDER">The
DateTimeRangeValidator requires the component to be an
EditableValueHolder for client validation to work. Client validation
will be disabled for component {0}.</resource>