[jboss-user] [JBoss Seam] - Re: Problem with entityconverter

dustismo do-not-reply at jboss.com
Fri Mar 16 12:44:46 EDT 2007


Thanks for the help, but the newest CVS version didn't help.  

Here is the menuBarHome class:


  | @Name("menuBarHome")
  | public class MenuBarHome extends EntityHome<MenuBar> {
  | 
  | 	private static final long serialVersionUID = -8414974539559465106L;
  | 
  | 	@In (required=true)
  | 	private User user;
  | 		
  | 	@In
  | 	private EntityManager entityManager;
  | 
  | 	@Logger 
  | 	private Log log;
  | 	
  | 	public void setMenuBarId(Integer id) {
  | 		setId(id);
  | 	}
  | 
  | 	public Integer getMenuBarId() {
  | 		return (Integer) getId();
  | 	}
  | 
  | 	@Override
  | 	protected MenuBar createInstance() {
  | 		MenuBar menuBar = new MenuBar();
  | 		return menuBar;
  | 	}
  | 
  | 	public MenuBar getDefinedInstance() {
  | 		return isIdDefined() ? getInstance() : null;
  | 	}
  | 
  | 	public List<MenuBarType> getMenuBarTypes() {
  | 		List<MenuBarType> types = entityManager
  | 			.createQuery("SELECT mt FROM MenuBarType mt ORDER BY mt.name")
  | 			.getResultList();
  | 		return types;
  | 	}
  | 	
  | 	public List<SelectItem> getPossibleParents() {
  | 		List<SelectItem> retList = new ArrayList<SelectItem> ();
  | 		List<MenuBar> m;
  | 		if (this.getInstance().getMenuBarType() != null) {
  | 			m = entityManager
  | 				.createQuery("SELECT mb FROM MenuBar mb WHERE mb.menuBarType.name=:name ORDER BY mb.label")
  | 				.setParameter("name", this.getInstance().getMenuBarType().getName())
  | 				.getResultList();
  | 		} else {
  | 			m = entityManager
  | 			.createQuery("SELECT mb FROM MenuBar mb ORDER BY mb.label")
  | 			.getResultList();
  | 		}
  | 		SelectItem choose = new SelectItem();
  | 		choose.setLabel("--- Choose A Parent ---");
  | 		choose.setDisabled(true);
  | 		retList.add(choose);
  | 		for (MenuBar parent : m) {
  | 			SelectItem item = new SelectItem();
  | 			item.setValue(parent.getId());
  | 			item.setLabel(parent.getLabel());
  | 			retList.add(item);
  | 		}
  | 		return retList;
  | 	}
  | }
  | 
  | 

And here is the whole form from the view:


  |     <h:form id="menuBar" styleClass="edit">
  |     
  |         <rich:panel>
  |             <f:facet name="header">Edit MenuBar</f:facet>
  |                 <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
  |                    <h:outputLabel for="label">
  |                         label
  |                     </h:outputLabel>
  |                     
  |                     <s:decorate id="labelDecoration">
  |                         <h:inputText id="label" 
  |                                    size="32"
  |                               maxlength="32"
  |                                   value="#{menuBarHome.instance.label}">
  |                         </h:inputText>
  |                     </s:decorate>
  | 
  |                     <h:outputLabel for="horizontalOrderIndex">
  |                         horizontalOrderIndex
  |                         <span class="required">*</span>
  |                     </h:outputLabel>
  |                     <s:decorate id="horizontalOrderIndexDecoration">
  |                         <h:inputText id="horizontalOrderIndex"
  |                                required="true"
  |                                   value="#{menuBarHome.instance.horizontalOrderIndex}">
  |                         </h:inputText>
  |                     </s:decorate>
  | 
  |                     <h:outputLabel for="verticalOrderIndex">
  |                         verticalOrderIndex
  |                         <span class="required">*</span>
  |                     </h:outputLabel>
  |                     <s:decorate id="verticalOrderIndexDecoration">
  |                         <h:inputText id="verticalOrderIndex"
  |                                required="true"
  |                                   value="#{menuBarHome.instance.verticalOrderIndex}">
  |                         </h:inputText>
  |                     </s:decorate>
  | 					
  | 					<h:outputLabel for="menuBarType">
  |                         MenuBar Type
  |                         <span class="required">*</span>
  |                     </h:outputLabel>
  | 					<s:decorate id="menuBarTypeDecoration">
  | 						<h:selectOneMenu value="#{menuBarHome.instance.menuBarType}"
  | 							id="menuBarType">
  | 							<s:selectItems value="#{menuBarHome.menuBarTypes}" 
  | 								var="item"
  | 								label="#{item.name}"
  | 								noSelectionLabel="--- Choose MenuBarType ---"
  | 								hideNoSelectionLabel="true"
  | 								/>
  | 							<s:convertEntity />
  | 							<a:support event="onchange" reRender="parentId"/>
  | 						</h:selectOneMenu>
  |                     </s:decorate>
  |                     
  |                     <h:outputLabel for="parentId">
  |                         Parent
  |                     </h:outputLabel>
  | 					<s:decorate id="parentIdDecoration">
  | 						<h:selectOneMenu value="#{menuBarHome.instance.parentId}" id="parentId">
  | 							<f:selectItems value="#{menuBarHome.possibleParents}"/>
  | 						</h:selectOneMenu>
  |                     </s:decorate>
  |                     
  |                     <h:outputLabel for="pageLink">
  |                         pageLink
  |                     </h:outputLabel>
  |                     <s:decorate id="pageLinkDecoration">
  |                         <h:inputText id="pageLink"
  |                                       size="32"
  |                                       value="#{menuBarHome.instance.pageLink}"/>
  |                     </s:decorate>
  | 
  | 					
  |                 </h:panelGrid>
  |         
  |             <div><span class="required">*</span> required fields</div>
  |             
  |         </rich:panel>
  |                 
  |         <div class="actionButtons">
  | 
  |             <h:commandButton id="save" 
  |                           value="Save" 
  |                          action="#{menuBarHome.persist}"
  |                        rendered="#{!menuBarHome.managed}"/>  
  |                           			  
  |             <h:commandButton id="update" 
  |                           value="Save" 
  |                          action="#{menuBarHome.update}"
  |                        rendered="#{menuBarHome.managed}"/>
  |                         			  
  |             <h:commandButton id="delete" 
  |                           value="Delete" 
  |                          action="#{menuBarHome.remove}"
  |                        rendered="#{menuBarHome.managed}"/>
  |                     
  |             <s:button id="cancel" 
  |                    value="Cancel"
  |              propagation="end"
  |                     view="/if/admin/#{empty menuBarFrom ? 'MenuBarList' : menuBarFrom}.xhtml"
  |                 rendered="#{!menuBarHome.managed}"/>
  | 
  |         </div>
  |     </h:form>
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028867#4028867

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4028867



More information about the jboss-user mailing list