Author: nbelaevski
Date: 2008-11-11 14:51:34 -0500 (Tue, 11 Nov 2008)
New Revision: 11093
Modified:
trunk/sandbox/ui/queue/src/main/config/component/queue.xml
trunk/sandbox/ui/queue/src/main/java/org/richfaces/component/UIQueue.java
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java
Log:
Queue: discovery services & renderer updated
Modified: trunk/sandbox/ui/queue/src/main/config/component/queue.xml
===================================================================
--- trunk/sandbox/ui/queue/src/main/config/component/queue.xml 2008-11-11 19:51:05 UTC
(rev 11092)
+++ trunk/sandbox/ui/queue/src/main/config/component/queue.xml 2008-11-11 19:51:34 UTC
(rev 11093)
@@ -35,7 +35,7 @@
<property>
<name>name</name>
<classname>java.lang.String</classname>
- <defaultvalue>GLOBAL_QUEUE_NAME</defaultvalue>
+ <defaultvalue>""</defaultvalue>
</property>
<property>
Modified: trunk/sandbox/ui/queue/src/main/java/org/richfaces/component/UIQueue.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/richfaces/component/UIQueue.java 2008-11-11
19:51:05 UTC (rev 11092)
+++ trunk/sandbox/ui/queue/src/main/java/org/richfaces/component/UIQueue.java 2008-11-11
19:51:34 UTC (rev 11093)
@@ -25,7 +25,6 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIForm;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
/**
@@ -48,22 +47,36 @@
return COMPONENT_FAMILY;
}
- @Override
- public void setParent(UIComponent parent) {
- if (parent != null && !(parent instanceof UIViewRoot) && !(parent
instanceof UIForm)) {
- throw new IllegalArgumentException("Queue component:" +
getClientId(getFacesContext()) +
- " should have UIViewRoot or UIForm as its immediate parent");
+ private UIComponent findParentForm() {
+ UIComponent component = getParent();
+ while (component != null && !(component instanceof UIForm)) {
+ component = component.getParent();
}
- super.setParent(parent);
+ return component;
}
public String getClientName(FacesContext context) {
- UIComponent parent = getParent();
- if (parent instanceof UIForm) {
- return parent.getClientId(context) + NamingContainer.SEPARATOR_CHAR + getName();
+ UIComponent form = findParentForm();
+ String name = getName();
+ String clientName;
+
+ if (form != null) {
+ String formClientId = form.getClientId(context);
+
+ if (name != null && name.length() != 0) {
+ clientName = formClientId + NamingContainer.SEPARATOR_CHAR + name;
+ } else {
+ clientName = formClientId;
+ }
} else {
- return context.getExternalContext().encodeNamespace(getName());
+ if (name == null || name.length() == 0) {
+ name = UIQueue.GLOBAL_QUEUE_NAME;
+ }
+
+ clientName = context.getExternalContext().encodeNamespace(name);
}
+
+ return clientName;
}
}
Modified:
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java
===================================================================
---
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java 2008-11-11
19:51:05 UTC (rev 11092)
+++
trunk/sandbox/ui/queue/src/main/java/org/richfaces/renderkit/html/QueueRegistry.java 2008-11-11
19:51:34 UTC (rev 11093)
@@ -51,7 +51,7 @@
if (!registryMap.containsKey(clientName)) {
registryMap.put(clientName, data);
} else {
- throw new IllegalArgumentException("Queue with name '" + clientName +
"' has already been registered");
+ context.getExternalContext().log("Queue with name '" + clientName +
"' has already been registered");
}
}
Show replies by date