public class MyComponentGenerator extends BaseComponentGenerator {
public UIComponent generate(FacesContext context, String id) {
// TODO Auto-generated method stub
UIComponent component = context.getApplication().
createComponent(UISelectOne.COMPONENT_TYPE);
FacesHelper.setupComponentId(context, component, id);
// create the list of choices
UISelectItems itemsComponent = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
itemsComponent.setValue(getMyItems());
// add the items as a child component
component.getChildren().add(itemsComponent);
return component;
}
protected SelectItem[] getMyItems()
{
int kval;
SelectItem[] items=new SelectItem[10];
for(kval=0;kval<10;kval++){
items[kval] = new SelectItem("string"+kval,"Choix" + kval);
}
return items;
}
}
Et donc je n'ai plus maintenant qu'à aller chercher la valeur de mes items dans ma base de données.<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<!– *************************************************************** –>
<!– Empty JSF config file to prevent errors being thrown during JSF –>
<!– initialisation. Overwrite this file with your custom version. –>
<!– *************************************************************** –>
<managed-bean>
<description>
Bean Test
</description>
<managed-bean-name>MyComponentGenerator</managed-bean-name>
<managed-bean-class>MyComponentGenerator</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
et <config evaluator="string-compare" condition="Action Wizards">
<subtypes>
<type name="custom:Player" />
</subtypes>
</config>
<config evaluator="string-compare" condition="Content Wizards">
<content-types>
<type name="custom:Player" />
</content-types>
</config>
<config evaluator="node-type" condition="custom:Player">
<property-sheet>
<show-property name="custom:PlayerName" />
</property-sheet>
</config>
<!– Lists the custom aspect in business rules Action wizard –>
<config evaluator="string-compare" condition="Action Wizards">
<subtypes>
<type name="custom:Team"/>
</subtypes>
</config>
<config evaluator="string-compare" condition="Content Wizards">
<content-types>
<type name="custom:Team" />
</content-types>
</config>
<config evaluator="node-type" condition="custom:Team">
<property-sheet>
<show-property name="custom:TeamName" />
<show-property name="custom:Players" component-generator="MyComponen
tGenerator"/>
</property-sheet>
</config>
Voilà.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.