Author: vbaranov
Date: 2008-04-17 08:07:30 -0400 (Thu, 17 Apr 2008)
New Revision: 7888
Modified:
trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-1653
Modified: trunk/ui/contextMenu/src/main/config/component/contextMenu.xml
===================================================================
--- trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-17 11:07:47 UTC
(rev 7887)
+++ trunk/ui/contextMenu/src/main/config/component/contextMenu.xml 2008-04-17 12:07:30 UTC
(rev 7888)
@@ -46,7 +46,9 @@
<name>attached</name>
<classname>boolean</classname>
<description>
- DEPRECATED(use attachTo)If the value of the "attached"
attribute is true, component is attached to parent component
+ If the value of the "attached" attribute is true,
component is attached to component,
+ specified in the "attachTo" attribute or to the parent
component,
+ if "attachTo" is not defined.
</description>
<defaultvalue>true</defaultvalue>
</property>
@@ -91,8 +93,8 @@
Client identifier of the component or id of the existing DOM element that is a
source
for given event. If attachTo is defined, the event is attached on the client
according
to the AttachTiming attribute.
- If attachTo is not defined, the event is attached on the server to the closest in
the
- component tree parent component (deprecated "attached" attribute is used).
+ If both attached and attachTo attributes are defined, and attribute attached has
value
+ 'false', it is considered to have higher priority.
</description>
<defaultvalue>""</defaultvalue>
</property>
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
===================================================================
---
trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-17
11:07:47 UTC (rev 7887)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-04-17
12:07:30 UTC (rev 7888)
@@ -30,10 +30,8 @@
public abstract class UIContextMenu extends UIComponentBase implements MenuComponent {
public static final String COMPONENT_TYPE = "org.richfaces.ContextMenu";
- @Deprecated
public abstract boolean isAttached();
- @Deprecated
public abstract void setAttached(boolean b);
public abstract String getAttachTo();
Modified:
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
===================================================================
---
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-04-17
11:07:47 UTC (rev 7887)
+++
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-04-17
12:07:30 UTC (rev 7888)
@@ -160,6 +160,11 @@
}
private String getClientAttachmentOptions(FacesContext context, UIContextMenu
contextMenu) {
+ // if contextMenu is not attached (it can be called by JS API)
+ if(!contextMenu.isAttached()) {
+ return "";
+ }
+
String attachTo = contextMenu.getAttachTo();
String attachTiming = contextMenu.getAttachTiming();
@@ -182,13 +187,10 @@
}
}
- if((attachToIds.size() == 0) && !contextMenu.isAttached()) {
- return "";
- }
-
String baseJSFucntionName = "contextMenu.attachToElementById";
- // compatibility with @Deprecated attribute "attached"
+ // if attribute "attachTo" is not defined,
+ // attach contextMenu to the parent component
if(attachToIds.size() == 0) {
UIComponent parentComponent = contextMenu.getParent();
String clientId = parentComponent.getClientId(context);