voyent
Messages posted by: venraf  XML
Profile for venraf -> Messages posted by venraf [1]
Author Message
Hello everyone! I have a problem with loading beans state in different forms.

I have 2 Managed bean class:
-Workbench.java
-PanelBean.java

and 2 xhtml pages:
-index.xhtml
-panels.xhtml

In index.xhtml there is a menu loaded from a xml file, for each item of xml file there is a menu item included in "LeftMenu" form . When an user click on menu item, in a second form, called "panelContent" dinamically, load panel.
It's source code of "left menu" form:
Code:
 			<h:form id="LeftMenu">
 				<ace:menu id="menu">
 					<c:forEach items="#{workbench.currentMenu}" var="item">
 						<ace:menuItem id="#{item.id}" value="#{item.value}"
 							icon="ui-icon ui-icon-circle-plus"
 							actionListener="#{workbench.changeContentPage}"
 							styleClass="ui-state-hover-all-content colora">
 						</ace:menuItem>
 					</c:forEach>
 				</ace:menu>
 			</h:form>
 


when an event "click "occurs is called "workbench.changeContentPage":
Code:
 	public void changeContentPage(ActionEvent event) {
 			
 		String s;
 		Map<String, Object> map = event.getComponent().getAttributes();
 		PanelBean pb = new PanelBean();
 		String label = (String) map.get("value");
 		String id = "PL"+label;
 		pb.setHeader(label);
 		pb.setId(id);// for identify panel when a close event occurs
 		pb.setPage(page);
 		addPanel(pb, id);
 	}
 


The method addPanel() is in the same class (Workbench). It put a PanelBean in a map:

Code:
 	private void addPanel(PanelBean pb, String 		
 		if (!panels.containsKey(
 			System.out.println("Pannello non contenuto");
 			
 			this.panels.put(label, pb);
 		}
 	}
 


The map is defined as follow:
Code:
 	private Map<String,PanelBean> panels = new HashMap<String,PanelBean>();
 


When I call index.xhtml, it include panel.xhtml:
Code:
 			<c:forEach items="#{workbench.panels}" var="item">
 				<ace:panel id="#{item.value.id}" header="#{item.value.header}"
 					visible="true" closable="true" toggleable="true" collapsed="false"
 					style="float:left;width:78%;margin-left: 2%">
 					<ui:include src="#{item.value.page}" />
 					<ace:ajax event="close" listener="#{workbench.close}"/>
 				</ace:panel>
 			</c:forEach>
 



Sometimes panels aren't correctly loaded. In particular, when I close a panels and try to open another one, the ajax response have id view LeftMenu and also include update of the new panel opened in panelForm Form, but it isn't rendered on page. I have to refresh page for see the correctly result.
Please help me, thanks a lot.
 
Profile for venraf -> Messages posted by venraf [1]
Go to:   
Powered by JForum 2.1.7ice © JForum Team