-
1. Re: [rich:tree] advisenodeopened alter regular comportement
nbelaevski May 7, 2009 7:57 PM (in response to eligriv)Hello,
Can you please post page code? -
2. Re: [rich:tree] advisenodeopened alter regular comportement
eligriv May 11, 2009 5:28 AM (in response to eligriv)Richfaces 3.3.0.GA
Seam 2.1.1.GA
Here's the tree and a node :<r:tree id="arbre_general" switchType="ajax" value="#{structureItem.getStructureTree()}" var="stru" nodeFace="#{stru.type}" ajaxSubmitSelection="true" nodeSelectListener="#{structureTreeListener.processSelection}" reRender="zone_details" selectedClass="struct_tree_selected" adviseNodeOpened="#{structureStateListener.adviseNodeOpened}" toggleOnClick="true"> <r:treeNode type="root_tso"> <h:outputText value="#{stru.name}" styleClass="struct_tree_root" /> <r:contextMenu event="oncontextmenu" submitMode="none"> <r:menuItem value="Something"> <a4j:support event="onclick" action="#{structureFormsListener.nouvelleForm(0)}" reRender="zone_details" /> </r:menuItem> </r:contextMenu> </r:treeNode>
And the treestateadvisor implementation@Scope(ScopeType.SESSION) @Name("structureStateListener") public class StructureStateListener implements Serializable, TreeStateAdvisor { private static final long serialVersionUID = -4387459139643144233L; private Map<Long, Boolean> noeudOuverts; @In(scope = ScopeType.PAGE, required = false, value = "structureTreeForm") private StructureTreeForm structureTreeForm; public StructureStateListener() { super(); noeudOuverts = new HashMap<Long, Boolean>(); } @Create public void init() { } @SuppressWarnings("unchecked") public Boolean adviseNodeOpened(UITree arg0) { Boolean res = null; TreeNode<TreeBean> node = arg0.getTreeNode(); TreeBean ti = node.getData(); if (noeudOuverts.containsKey(ti.getNodeId())) { if (structureTreeForm != null) { res = !noeudOuverts.get(ti.getNodeId()); } else { res = noeudOuverts.get(ti.getNodeId()); } noeudOuverts.put(ti.getNodeId(), res); } else { res = ti.getNodeId() >= 10; noeudOuverts.put(ti.getNodeId(), res); } return res; } public Boolean adviseNodeSelected(UITree arg0) { return null; } @Destroy public void end() { } }
The "TreeBean" class is mine, it describes the node (id, type, label, face etc..)
the "noeudsOuverts" (= nodesOpened) attribute is a map<node, state> wich stores the last state of the node.
The problem :
On a right-click, the "adviseNodeOpened" event is fired, i want to prevent that, or being able to recognize a rightclick and filter it in the adviseNodeOpened function.
What do you think ?
ps : again, sorry for my poor english -
3. Re: [rich:tree] advisenodeopened alter regular comportement
ilya_shaikovsky May 11, 2009 8:12 AM (in response to eligriv)rightClickSelection = false should helps.
-
4. Re: [rich:tree] advisenodeopened alter regular comportement
eligriv May 12, 2009 10:33 AM (in response to eligriv)rightClickSelection is a richfaces 3.3.1 feature, i'm working on the 3.3.0.GA version and i can't change it for an unstable version.
Also, when i right-click on a node wich doesn't have a rich:context menu on it, nothing happens (no change of stage). It occurs only when i click on an element of the context menu.
I hope someone could help me on this one.
By the way, is there any way to know in the adviseNodeOpened method where did the event came from ? If i could filter the event by its origin, that would be much more simple.
Thanks for your help -
5. Re: [rich:tree] advisenodeopened alter regular comportement
eligriv May 18, 2009 9:08 AM (in response to eligriv)i'm still stuck with this.. Does anyones have an idea ?
Thanks -
6. Re: [rich:tree] advisenodeopened alter regular comportement
romulodinizbh Jan 13, 2011 1:06 PM (in response to eligriv)Well, probably the answer has already been found, but I guess
toggleOnClick should be set to "false"
-
7. Re: [rich:tree] advisenodeopened alter regular comportement of t
yaseralhs Jul 25, 2011 10:45 AM (in response to eligriv)Hi ALL
I using richfaces 4 tree where i need to right click
Can I do that in richfaces 4???