public static ComponentModel createComponent() { ComponentModel component = new ComponentModel(FacesId.parseId("foo.bar")); component.setGenerate(true); component.setTargetClass( ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedComponent")); component.setBaseClass(ClassName.parseName(UIOutput.class.getName())); component.setRendererType(FacesId.parseId("foo.barRenderer")); PropertyBase attribute = component.getOrCreateAttribute("testValue"); attribute.setType(new ClassName(Object.class)); attribute.setGenerate(true); attribute = component.getOrCreateAttribute("testFlag"); attribute.setType(new ClassName(Boolean.TYPE)); attribute.setRequired(true); attribute.setGenerate(true); attribute = component.getOrCreateAttribute("testBinding"); attribute.setType(new ClassName(MethodBinding.class)); attribute.setGenerate(true); attribute.setBinding(true); attribute.setBindingAttribute(true); attribute = component.getOrCreateAttribute("testExpr"); attribute.setType(new ClassName(MethodExpression.class)); attribute.setGenerate(true); attribute.setBindingAttribute(true); MethodSignature signature = new MethodSignature(); signature.setParameters( Arrays.asList(new ClassName(String.class), new ClassName(Integer.class))); attribute.setSignature(signature); attribute = component.getOrCreateAttribute("id"); attribute.setType(new ClassName(String.class)); attribute.setGenerate(false); attribute = component.getOrCreateAttribute("listStrings"); attribute.setType(new ClassName(new ArrayList<String>().getClass())); attribute.setGenerate(true); attribute = component.getOrCreateAttribute("listInteger"); attribute.setType(new ClassName(new ArrayList<Integer>().getClass())); attribute.setGenerate(true); attribute = component.getOrCreateAttribute("list"); attribute.setType(new ClassName(ArrayList.class)); attribute.setGenerate(true); Set<EventName> eventNames = attribute.getEventNames(); eventNames.add(getEvent("id", false)); eventNames.add(getEvent("action", true)); return component; }
@Override public ClassName getDefaultBaseClass() throws CallbackException { return ClassName.get(UIComponentBase.class); }
@Override public ClassName getDefaultClass() throws CallbackException { return ClassName.get(Object.class); }
@Override public ClassName getDefaultBaseClass() throws CallbackException { return ClassName.get(Renderer.class); }
@Override public ClassName getDefaultBaseClass() throws CallbackException { return ClassName.get(ClientBehaviorBase.class); }