Author: Alex.Kolonitsky
Date: 2010-03-03 07:17:05 -0500 (Wed, 03 Mar 2010)
New Revision: 16522
Added:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/AbstractPoll.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java
Removed:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPoll.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxStatus.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIQueue.java
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Component.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Signature.java
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerWriter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedTagHandler.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxStatus.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlQueue.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java
root/ui/trunk/components/core/src/main/old_configs/component/poll.xml
Log:
https://jira.jboss.org/jira/browse/RF-8232
Tags support
- correct naming convention
- migrate core-ui to annotations
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Attribute.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -76,4 +76,8 @@
boolean passThrough() default false;
boolean required() default false;
+
+ boolean generate() default true;
+
+ Signature signature() default @Signature();
}
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Component.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Component.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Component.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.annotations;
import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@@ -40,9 +39,8 @@
*
* @author asmirnov(a)exadel.com
*/
-(a)Retention(RetentionPolicy.CLASS)
+(a)Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
-@Inherited
public @interface Component {
/**
@@ -67,6 +65,6 @@
public boolean generate() default true;
- public Tag tag() default @Tag(name = "");
+ public Tag tag() default @Tag();
}
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -54,5 +54,5 @@
public String behaviorClass() default "";
- public Tag tag() default @Tag(name = "");
+ public Tag tag() default @Tag;
}
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -48,5 +48,5 @@
public String converterClass() default "";
- public Tag tag() default @Tag(name = "");
+ public Tag tag() default @Tag;
}
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -21,5 +21,5 @@
public String validatorClass() default "";
- public Tag tag() default @Tag(name = "");
+ public Tag tag() default @Tag;
}
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Signature.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Signature.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Signature.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -23,12 +23,6 @@
package org.richfaces.cdk.annotations;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
/**
* <p class="changed_added_4_0">
* This annotation defines a Java method signature for attributes that hold EL {@code
MethodExpression} values.
@@ -37,9 +31,6 @@
* @author asmirnov(a)exadel.com
*
*/
-(a)Retention(RetentionPolicy.CLASS)
-@Target( { ElementType.METHOD, ElementType.FIELD })
-@Inherited
public @interface Signature {
/**
Modified:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java
===================================================================
---
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Tag.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -49,10 +49,12 @@
*
* @return tag name.
*/
- public String name();
+ public String name() default "";
public TagType type() default TagType.All;
+ public String handlerName() default "";
+
public Class<? extends TagHandler> handler() default DEFAULT.class;
public Class<? extends TagHandler> baseHandler() default DEFAULT.class;
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -24,6 +24,7 @@
package org.richfaces.cdk;
import org.richfaces.cdk.model.InvalidNameException;
+import org.richfaces.cdk.model.ClassName;
/**
* <p class="changed_added_4_0">
@@ -70,4 +71,10 @@
public String inferUIComponentBaseClass(String componentType, String baseClassName,
boolean baseClassIsAbstract);
public String inferUIComponentFamily(String componentType, String explicitFamily);
+
+ public String inferTagHandlerName(ClassName generatedClass);
+
+ public String inferTagName(ClassName generatedClass);
+
+ public String inferComponentType(String componentName);
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -2,9 +2,13 @@
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.model.Name;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.Name.Classifier;
import org.richfaces.cdk.util.Strings;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
/**
* <p class="changed_added_4_0">
* </p>
@@ -116,7 +120,56 @@
return Strings.isEmpty(explicitFamily) ? componentType : explicitFamily;
}
+
/**
+ * @param generatedClass - component name in format
+ * <prefix>.component.Abstract<Name>
+ *
+ * @return tag handler name as
+ * <prefix>.taglib.<Name>TagHandler
+ *
+ * */
+ public String inferTagHandlerName(ClassName generatedClass) {
+ Pattern pattern =
Pattern.compile("(.+).component.(:?UI|Abstract)(.+)");
+ Matcher matcher = pattern.matcher(generatedClass.getName());
+ if (matcher.matches()) {
+ return matcher.group(1) + ".taglib.html." + matcher.group(3) +
"TagHandler";
+ }
+
+ return generatedClass + "TagHandler";
+ }
+
+ public String inferTagName(ClassName generatedClass) {
+ String name = generatedClass.getSimpleName();
+ if (name.startsWith(UI)) {
+ name = name.substring(UI.length());
+ }
+ return Strings.firstToLowerCase(name);
+ }
+
+ /**
+ * @param componentName - component class name, in one of follow forms
+ * <prefix>.component.Abstract<Name>
+ * <prefix>.component.UI<Name>
+ * <prefix>.component.Html<Name>
+ *
+ * @return if class name match pattern above will be returned
+ * <prefix>.<Name>
+ * else
+ * componentName
+ *
+ * */
+ public String inferComponentType(String componentName) {
+ Pattern pattern =
Pattern.compile("(.+).component.(:?UI|Abstract|Html)(.+)");
+ Matcher matcher = pattern.matcher(componentName);
+ if (matcher.matches()) {
+ return matcher.group(1) + "." + matcher.group(3);
+ }
+
+ return componentName;
+ }
+
+ /**
* <p class="changed_added_4_0">
* </p>
*
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptBuilder.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -52,13 +52,9 @@
@Inject
private CompilationTaskFactory taskFactory;
- @Inject
+ @Inject
private Set<CdkWriter> generators;
- public AptBuilder() {
- System.out.println("AptBuilder.AptBuilder");
- }
-
public void build() throws CdkException {
CompilationTask task = taskFactory.get();
if (!task.call()) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -52,65 +52,67 @@
// Get all methods and fields annotated by annotation.
for (Element childElement : members) {
- if (null != childElement.getAnnotation(annotation)) {
+ boolean annotated = (null != childElement.getAnnotation(annotation));
+
+ // Have an annotation, infer property name.
+ if (ElementKind.METHOD.equals(childElement.getKind())) {
+ processMethod(properties, childElement, annotated);
+ } else if (ElementKind.FIELD.equals(childElement.getKind())) {
+ if (annotated) {
+ processFiled(properties, childElement);
+ }
+ }
- // Have an annotation, infer property name.
- String name;
- TypeMirror propertyType;
- boolean exists = false;
+ // TODO - merge properties with same name ?
+ }
- if (ElementKind.METHOD.equals(childElement.getKind())) {
- ExecutableElement method = (ExecutableElement) childElement;
+ return properties;
+ }
- propertyType = method.getReturnType();
+ private void processFiled(Set<BeanProperty> properties, Element childElement)
{
+ AptBeanProperty property = new
AptBeanProperty(childElement.getSimpleName().toString());
- List<? extends VariableElement> parameters =
method.getParameters();
+ property.type = asClassDescription(childElement.asType());
+ property.element = childElement;
- if (TypeKind.VOID.equals(propertyType.getKind()) && 1 ==
parameters.size()) {
+ // TODO - find getter/setter, check them for abstract.
+ property.exists = true;
- // That is setter method, get type from parameter.
- propertyType = parameters.get(0).asType();
- } else if (!parameters.isEmpty()) {
+ properties.add(property);
+ }
- // TODO Invalid method signature for a bean property,
- // throw exception ?
- continue;
- }
+ private void processMethod(Set<BeanProperty> properties, Element childElement,
boolean annotated) {
+ ExecutableElement method = (ExecutableElement) childElement;
+ boolean exists = !method.getModifiers().contains(Modifier.ABSTRACT);
+ if (!annotated && exists) {
+ return;
+ }
- try {
- name =
PropertyUtils.methodToName(childElement.getSimpleName().toString());
- } catch (InvalidNameException e) {
+ TypeMirror propertyType = method.getReturnType();
+ List<? extends VariableElement> parameters = method.getParameters();
+ if (TypeKind.VOID.equals(propertyType.getKind()) && 1 ==
parameters.size()) {
- // TODO Invalid method name for a bean property, throw
- // exception ?
- continue;
- }
+ // That is setter method, get type from parameter.
+ propertyType = parameters.get(0).asType();
+ } else if (!parameters.isEmpty()) {
+ // TODO Invalid method signature for a bean property,
+ // throw exception ?
+ return;
+ }
- exists = !method.getModifiers().contains(Modifier.ABSTRACT);
+ try {
+ String name =
PropertyUtils.methodToName(childElement.getSimpleName().toString());
+ AptBeanProperty property = new AptBeanProperty(name);
- // List<? extends TypeParameterElement> typeParameters =
method.getTypeParameters();
- } else if (ElementKind.FIELD.equals(childElement.getKind())) {
- name = childElement.getSimpleName().toString();
- propertyType = childElement.asType();
+ property.type = asClassDescription(propertyType);
+ property.element = childElement;
+ property.exists = exists;
- // TODO - find getter/setter, check them for abstract.
- exists = true;
- } else {
- continue;
- }
-
- AptBeanProperty property = new AptBeanProperty(name);
-
- property.type = asClassDescription(propertyType);
- property.element = childElement;
- property.exists = exists;
-
- // TODO - merge properties with same name ?
- properties.add(property);
- }
+ properties.add(property);
+ } catch (InvalidNameException e) {
+ // TODO Invalid method name for a bean property, throw
+ // exception ?
}
-
- return properties;
}
private ClassName asClassDescription(TypeMirror type) {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ComponentProcessor.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -61,14 +61,8 @@
public void process(TypeElement componentElement) {
ComponentLibrary library = getLibrary();
// Process class-level annotations.
- // Calculate type for base UI component class.
- String explicitType = getComponentType(componentElement);
- // Because component type is a primary key for components collection,
- // we have to infer explicit value here.
- String type = getNamingConventions().inferComponentType(explicitType,
- componentElement.getQualifiedName().toString());
ComponentModel component = new ComponentModel();
- component.setType(new Type(type));
+ component.setType(new Type(getComponentType(componentElement)));
// Should that component be generated ?
setClassNames(componentElement, component);
setComponentProperties(componentElement, component);
@@ -80,14 +74,20 @@
library.getComponents().add(component);
}
-
-
protected String getComponentType(TypeElement componentElement) {
+ // Calculate type for base UI component class.
Component componentAnnotation = componentElement.getAnnotation(Component.class);
- return componentAnnotation.value();
+ String explicitType = componentAnnotation.value();
+ if (!Strings.isEmpty(explicitType)) {
+ return explicitType;
+ }
+
+ // Because component type is a primary key for components collection,
+ // we have to infer explicit value here.
+ String className = componentElement.getQualifiedName().toString();
+ return getNamingConventions().inferComponentType(className);
}
-
private void setComponentProperties(TypeElement componentElement, ComponentModel
component)
throws CdkException {
@@ -200,10 +200,8 @@
Attributes attributes = componentElement.getAnnotation(Attributes.class);
if (null != attributes) {
- String[] includes = attributes.value();
+ for (String attributesConfig : attributes.value()) {
- for (String attributesConfig : includes) {
-
// process additional properties.
component.getAttributes().putAll(parseProperties(attributesConfig));
}
@@ -215,10 +213,9 @@
@Override
public void visit(ClassName type) {
try {
- component.getAttributes().putAll(parseProperties(
- CdkEntityResolver.URN_ATTRIBUTES + type.toString() +
".xml"));
+ component.getAttributes().putAll(
+ parseProperties(CdkEntityResolver.URN_ATTRIBUTES +
type.toString() + ".xml"));
} catch (CdkException e) {
-
// TODO - log errors ?
}
}
@@ -228,67 +225,28 @@
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
+ if (component.getAttribute(beanProperty.getName()) != null) {
+ continue;
+ }
+
Property attribute = component.addAttribute(beanProperty.getName());
- // Flags
- Attribute attributeAnnotarion = beanProperty.getAnnotation(Attribute.class);
-
- attribute.setHidden(attributeAnnotarion.hidden());
- attribute.setLiteral(attributeAnnotarion.literal());
- attribute.setPassThrough(attributeAnnotarion.passThrough());
- attribute.setRequired(attributeAnnotarion.required());
- attribute.setReadOnly(attributeAnnotarion.readOnly());
-
// Documentation
attribute.setDescription(beanProperty.getDocComment());
- Icon icon = beanProperty.getAnnotation(Icon.class);
+ setDescription(componentElement, component);
- if (null != icon) {
- setIcon(attribute, icon);
- }
-
- DisplayName displayName = beanProperty.getAnnotation(DisplayName.class);
-
- if (null != displayName) {
- attribute.setDisplayname(displayName.value());
- }
-
// type.
attribute.setType(beanProperty.getType());
- // MethodExpression call signature.
- Signature signature = beanProperty.getAnnotation(Signature.class);
- if (null != signature) {
- List<ClassName> parameters = Lists.newArrayList();
+ setAttributePrams(beanProperty, attribute);
-
- try {
- for (Class<?> parameterType : signature.parameters()) {
- parameters.add(new ClassName(parameterType.getName()));
- }
- } catch (MirroredTypeException e) {
- TypeMirror parameterType = e.getTypeMirror();
- parameters.add(new ClassName(parameterType.toString()));
- } catch (MirroredTypesException e) {
- for (TypeMirror parameterType : e.getTypeMirrors()) {
- parameters.add(new ClassName(parameterType.toString()));
- }
- }
- // signature parameters always should be replaced.
- attribute.setSignature(parameters);
-
- // TODO - set method return type.
- }
-
// BehaviorModel events.
EventName eventName = beanProperty.getAnnotation(EventName.class);
-
setBehaviorEvent(attribute, eventName);
EventNames eventNames = beanProperty.getAnnotation(EventNames.class);
-
if (null != eventNames) {
for (EventName eventNameInstance : eventNames.value()) {
setBehaviorEvent(attribute, eventNameInstance);
@@ -297,22 +255,61 @@
// DefaultValues
DefaultValue defaultValue = beanProperty.getAnnotation(DefaultValue.class);
-
if (null != defaultValue) {
attribute.setDefaultValue(defaultValue.value());
}
SuggestedValue suggestedValue =
beanProperty.getAnnotation(SuggestedValue.class);
-
if (null != suggestedValue) {
attribute.setSuggestedValue(suggestedValue.value());
}
// Flags.
- attribute.setGenerate(!beanProperty.isExists() || null !=
beanProperty.getAnnotation(Generate.class));
+ attribute.setGenerate(attribute.isGenerate()
+ || !beanProperty.isExists()
+ || null != beanProperty.getAnnotation(Generate.class));
}
}
+ private void setAttributePrams(BeanProperty beanProperty, Property attribute) {
+ // Flags
+ Attribute attributeAnnotarion = beanProperty.getAnnotation(Attribute.class);
+ if (attributeAnnotarion == null) {
+ return;
+ }
+
+ attribute.setHidden(attributeAnnotarion.hidden());
+ attribute.setLiteral(attributeAnnotarion.literal());
+ attribute.setPassThrough(attributeAnnotarion.passThrough());
+ attribute.setRequired(attributeAnnotarion.required());
+ attribute.setReadOnly(attributeAnnotarion.readOnly());
+ attribute.setGenerate(attributeAnnotarion.generate());
+
+ // MethodExpression call signature.
+ Signature signature = attributeAnnotarion.signature();
+ if (null != signature) {
+ List<ClassName> parameters = Lists.newArrayList();
+
+ try {
+ for (Class<?> parameterType : signature.parameters()) {
+ parameters.add(new ClassName(parameterType.getName()));
+ }
+ } catch (MirroredTypeException e) {
+ TypeMirror parameterType = e.getTypeMirror();
+ parameters.add(new ClassName(parameterType.toString()));
+ } catch (MirroredTypesException e) {
+ for (TypeMirror parameterType : e.getTypeMirrors()) {
+ parameters.add(new ClassName(parameterType.toString()));
+ }
+ }
+
+ // signature parameters always should be replaced.
+ attribute.setSignature(parameters);
+
+ // TODO - set method return type.
+ }
+ }
+
private void setBehaviorEvent(Property attribute, EventName eventName) {
if (null != eventName) {
org.richfaces.cdk.model.EventName event = new
org.richfaces.cdk.model.EventName();
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ProcessorBase.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -3,6 +3,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.util.Strings;
import org.richfaces.cdk.annotations.DisplayName;
import org.richfaces.cdk.annotations.Icon;
import org.richfaces.cdk.annotations.Tag;
@@ -59,22 +60,56 @@
}
protected void setTagInfo(Tag tag, ModelElementBase model) {
- String tagHandlerClass = null;
- try {
- tagHandlerClass = tag.handler().getName();
- } catch (MirroredTypesException mirror) {
- List<? extends TypeMirror> mirrors = mirror.getTypeMirrors();
- if (!mirrors.isEmpty()) {
- tagHandlerClass = mirrors.get(0).toString();
- }
- } catch (MirroredTypeException mirror) {
- tagHandlerClass = mirror.getTypeMirror().toString();
+ ClassDescriptor tagHandler = getTagHandler(tag, model);
+
+ String name = tag.name();
+ if (Strings.isEmpty(name)) {
+ name = namingConventions.inferTagName(model.getGeneratedClass());
}
+
+ model.setTag(new TagModel(model, name, tagHandler));
+ }
- if (TAG_HANDLER_DEFULT_CLASS.equals(tagHandlerClass)) {
- tagHandlerClass = null;
+ private ClassDescriptor getTagHandler(Tag tag, ModelElementBase model) {
+ String tagHandlerClass = getTagHandlerClass(tag);
+ if (tagHandlerClass != null) {
+ return new ClassDescriptor(tagHandlerClass, false);
}
+ String handlerBase = getTagHandlerParentClass(tag);
+ String tagHandlerClassName = getTagHandlerClassName(tag);
+ boolean generate = isGenerateTagHandler(model, handlerBase,
tagHandlerClassName);
+
+ if (Strings.isEmpty(tagHandlerClassName)) {
+ tagHandlerClassName =
namingConventions.inferTagHandlerName(model.getGeneratedClass());
+ }
+
+ if (handlerBase == null) {
+ handlerBase = getDafaultParentTagHandlerClass();
+ }
+
+ return new ClassDescriptor(tagHandlerClassName, handlerBase, generate);
+ }
+
+ private boolean isGenerateTagHandler(ModelElementBase model, String handlerBase,
String tagHandlerClassName) {
+ if (!Strings.isEmpty(tagHandlerClassName) || handlerBase != null) {
+ return true;
+ }
+
+ for (Map.Entry<String,Property> entry : model.getAttributes().entrySet())
{
+ if (entry.getValue().isBingingAttribute()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private String getTagHandlerClassName(Tag tag) {
+ return tag.handlerName();
+ }
+
+ private String getTagHandlerParentClass(Tag tag) {
String tagHandlerParentClass = null;
try {
tagHandlerParentClass = tag.baseHandler().getName();
@@ -88,12 +123,28 @@
}
if (TAG_HANDLER_DEFULT_CLASS.equals(tagHandlerParentClass)) {
- tagHandlerParentClass = getDafaultParentTagHandlerClass();
+ tagHandlerParentClass = null;
}
+ return tagHandlerParentClass;
+ }
- if (!tag.name().isEmpty()) {
- model.setTag(new TagModel(tag.name(), tagHandlerClass,
tagHandlerParentClass));
+ private String getTagHandlerClass(Tag tag) {
+ String tagHandlerClass = null;
+ try {
+ tagHandlerClass = tag.handler().getName();
+ } catch (MirroredTypesException mirror) {
+ List<? extends TypeMirror> mirrors = mirror.getTypeMirrors();
+ if (!mirrors.isEmpty()) {
+ tagHandlerClass = mirrors.get(0).toString();
+ }
+ } catch (MirroredTypeException mirror) {
+ tagHandlerClass = mirror.getTypeMirror().toString();
}
+
+ if (TAG_HANDLER_DEFULT_CLASS.equals(tagHandlerClass)) {
+ tagHandlerClass = null;
+ }
+ return tagHandlerClass;
}
protected String getDafaultParentTagHandlerClass() {
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/PropertyModel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -29,7 +29,6 @@
import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.Property;
import org.richfaces.cdk.util.Strings;
@@ -98,6 +97,15 @@
return wrapper.wrap(value);
}
+ public boolean isBingingAttribute() {
+ return this.property.isBingingAttribute();
+ }
+
+ public boolean isBinging() {
+ return this.property.isBinging();
+ }
+
+
private String typeForCasting() {
ClassName type = this.property.getType();
return ClassName.getSimpleName(type.isPrimitive() ? type.getBoxingName() :
type.getSimpleName());
@@ -125,40 +133,7 @@
return isFromJavaLang(type) ? type.getSimpleName() : type.getName();
}
- public boolean isBingingAttribute() {
- return isBinging() || isInstanceof("javax.el.MethodExpression");
- }
- public boolean isBinging() {
- return isInstanceof("javax.faces.el.MethodBinding");
- }
-
- public boolean isInstanceof(String name) {
- String classname = this.property.getType().getName();
- if (null == classname) {
- String msg = "classname not set in " + getClass().getName() +
" for element " + getName();
- getLog().error(msg);
- throw new NullPointerException(msg);
- }
-
- if (classname.equals(name)) {
- return true;
- }
-
- try {
- Class<?> beanClass = getLoader().loadClass(classname);
- Class<?> superClass = getLoader().loadClass(name);
- return superClass.isAssignableFrom(beanClass);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
-// getLog().warn("Could't instantiate for testing class " +
classname);
- } catch (Exception e) {
-// getLog().warn("Error in testing class " + classname);
- e.printStackTrace();
- }
- return false;
- }
-
/* public String getMethodArgsClasses(){
if(null != this._methodargs){
StringBuffer result = new StringBuffer();
@@ -185,12 +160,4 @@
return null;
}
}*/
-
- private ClassLoader getLoader() {
- return Thread.currentThread().getContextClassLoader(); // TODO ???
- }
-
- private Logger getLog() {
- return null;
- }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/freemarker/TagTemplateModel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -54,7 +54,7 @@
model = object;
}
- @Override
+ @Override
public TemplateModel get(String key) throws TemplateModelException {
if ("attributes".equals(key)) {
return attributes();
@@ -130,7 +130,10 @@
Collection<PropertyModel> models = new
ArrayList<PropertyModel>(attributes.size());
for (Map.Entry<String, Property> entry : attributes.entrySet()) {
if (entry.getValue().isGenerate()) {
- models.add(new PropertyModel(entry.getKey(), entry.getValue(),
wrapper));
+ PropertyModel propertyModel = new PropertyModel(entry.getKey(),
entry.getValue(), wrapper);
+ if (propertyModel.isBingingAttribute()) {
+ models.add(propertyModel);
+ }
}
}
return wrapper.wrap(models);
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerGeneratorVisitor.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -23,12 +23,22 @@
package org.richfaces.cdk.generate.java.taghandler;
import org.richfaces.cdk.model.*;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
/**
* @author akolonitsky
* @since Feb 22, 2010
*/
public class TagHandlerGeneratorVisitor extends EmptyVisitor {
+
+ private Injector injector;
+
+ @Inject
+ public TagHandlerGeneratorVisitor(Injector injector) {
+ this.injector = injector;
+ }
+
public void visitComponent(ComponentModel model) {
generateTagHandler(model);
}
@@ -47,7 +57,7 @@
private void generateTagHandler(ModelElementBase model) {
TagModel tag = model.getTag();
- if (tag == null) {
+ if (tag == null || !tag.getHandler().isGenerate()) {
return;
}
@@ -55,6 +65,7 @@
}
private void generateTagHandler(TagModel model) {
-
+ TagHandlerClassGenerator generator =
injector.getInstance(TagHandlerClassGenerator.class);
+ generator.process(model);
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerWriter.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerWriter.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/java/taghandler/TagHandlerWriter.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -23,8 +23,8 @@
package org.richfaces.cdk.generate.java.taghandler;
import com.google.inject.Inject;
+import com.google.inject.Injector;
import org.richfaces.cdk.*;
-import org.richfaces.cdk.generate.taglib.TaglibGeneratorVisitor;
import org.richfaces.cdk.model.ComponentLibrary;
/**
@@ -40,10 +40,13 @@
@Output(Outputs.JAVA_CLASSES)
private FileManager output;
+ @Inject
+ private Injector injector;
+
@Override
public void render() throws CdkException {
- TaglibGeneratorVisitor visitor = new TaglibGeneratorVisitor();
- library.accept(visitor);
+ TagHandlerGeneratorVisitor tagHandlerGeneratorVisitor =
injector.getInstance(TagHandlerGeneratorVisitor.class);
+ library.accept(tagHandlerGeneratorVisitor);
}
public ComponentLibrary getLibrary() {
@@ -61,4 +64,12 @@
public void setOutput(FileManager output) {
this.output = output;
}
+
+ public Injector getInjector() {
+ return injector;
+ }
+
+ public void setInjector(Injector injector) {
+ this.injector = injector;
+ }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -69,7 +69,7 @@
}
private void addTagHandler(Element parent, TagModel tag) {
- if (tag != null && tag.getTagHandlerClass() != null) {
+ if (tag != null && tag.getTagHandlerClass() != null &&
tag.getHandler().isGenerate()) {
parent.addElement("handler-class").addText(tag.getTagHandlerClass());
}
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassDescriptor.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -34,37 +34,56 @@
private ClassName parent;
+ private boolean generate = false;
+
public ClassDescriptor(String name) {
- this(new ClassName(name));
+ this(name, null);
}
public ClassDescriptor(String name, String parent) {
- this(name);
-
- if (parent != null) {
- this.parent = new ClassName(parent);
- }
+ this(ClassName.get(name), ClassName.get(parent));
}
public ClassDescriptor(Class name) {
- this(new ClassName(name));
+ this(name, null);
}
public ClassDescriptor(Class name, Class parent) {
- this(name);
+ this(ClassName.get(name), ClassName.get(parent));
+ }
- if (parent != null) {
- this.parent = new ClassName(parent);
- }
+ public ClassDescriptor(String name, boolean generate) {
+ this(new ClassName(name), generate);
}
- public ClassDescriptor(ClassName name) {
+ public ClassDescriptor(String name, String parent, boolean generate) {
+ this(ClassName.get(name), ClassName.get(parent), generate);
+ }
+
+ public ClassDescriptor(Class name, boolean generate) {
+ this(ClassName.get(name), null, generate);
+ }
+
+ public ClassDescriptor(Class name, Class parent, boolean generate) {
+ this(ClassName.get(name), ClassName.get(parent), generate);
+ }
+
+ public ClassDescriptor(ClassName name, boolean generate) {
+ this(name, null, generate);
+ }
+
+ public ClassDescriptor(ClassName name, ClassName parent, boolean generate) {
this.name = name;
+ this.parent = parent;
+ this.generate = generate;
}
+ public ClassDescriptor(ClassName name) {
+ this(name, null, false);
+ }
+
public ClassDescriptor(ClassName name, ClassName parent) {
- this(name);
- this.parent = parent;
+ this(name, parent, false);
}
public String getPackage() {
@@ -87,4 +106,12 @@
public ClassName getParent() {
return parent;
}
+
+ public boolean isGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
+ }
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ClassName.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -49,7 +49,7 @@
.put(float.class.getName(), Float.class.getName())
.put(double.class.getName(), Double.class.getName())
.build();
-
+
private final String boxingClassName;
private final String fullName;
@@ -104,6 +104,22 @@
}
}
+ public static ClassName get(String name) {
+ if (name == null) {
+ return null;
+ }
+
+ return new ClassName(name);
+ }
+
+ public static ClassName get(Class name) {
+ if (name == null) {
+ return null;
+ }
+
+ return new ClassName(name);
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Property.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -248,7 +248,9 @@
@Override
public void merge(Property other) {
+ boolean generate = isGenerate();
ComponentLibrary.merge(this, other);
+ setGenerate(generate || other.isGenerate());
}
@Override
@@ -264,4 +266,45 @@
public boolean same(Property other) {
return this == other;
}
+
+ public boolean isBingingAttribute() {
+ return isBinging() || isInstanceof("javax.el.MethodExpression");
+ }
+
+ public boolean isBinging() {
+ return isInstanceof("javax.faces.el.MethodBinding");
+ }
+
+ public boolean isInstanceof(String name) {
+ String classname = getType().getName();
+ if (null == classname) {
+ String msg = "classname not set in " + getClass().getName() +
" for element " + name;
+// getLog().error(msg);
+ throw new NullPointerException(msg);
+ }
+
+ if (classname.equals(name)) {
+ return true;
+ }
+
+ try {
+ if (!new ClassName(classname).isPrimitive()) {
+ Class<?> beanClass = getLoader().loadClass(classname);
+ Class<?> superClass = getLoader().loadClass(name);
+ return superClass.isAssignableFrom(beanClass);
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+// getLog().warn("Could't instantiate for testing class " +
classname);
+ } catch (Exception e) {
+// getLog().warn("Error in testing class " + classname);
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ private ClassLoader getLoader() {
+ return Thread.currentThread().getContextClassLoader(); // TODO ???
+ }
+
}
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/TagModel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -40,7 +40,7 @@
* <p class="changed_added_4_0">Component that the tag creates. This
in bidirectional one to one relation.</p>
* TODO - tag should also works with {@code Validator}, {@code Converter}, {@code
Behavior}, {@code FacesListener}
*/
- private ModelElementBase model;
+ private final ModelElementBase model;
/**
* <p class="changed_added_4_0">Jsp tag class</p>
@@ -56,21 +56,19 @@
/**
* <p class="changed_added_4_0">Tag name</p>
*/
- private String name;
+ private final String name;
/**
* <p class="changed_added_4_0">Facelets VDL tag handler
class.</p>
*/
private ClassDescriptor handler;
- public TagModel() {
+ public TagModel(ModelElementBase model, String name, String tagHandlerClass) {
+ this(model, name, tagHandlerClass, null);
}
- public TagModel(String name, String tagHandlerClass) {
- this(name, tagHandlerClass, null);
- }
-
- public TagModel(String name, String tagHandlerClass, String tagHandlerParentClass) {
+ public TagModel(ModelElementBase model, String name, String tagHandlerClass, String
tagHandlerParentClass) {
+ this.model = model;
this.name = name;
if (tagHandlerClass != null) {
@@ -78,14 +76,16 @@
}
}
+ public TagModel(ModelElementBase model, String name, ClassDescriptor tagHandlerClass)
{
+ this.model = model;
+ this.name = name;
+ this.handler = tagHandlerClass;
+ }
+
public ModelElementBase getModel() {
return model;
}
- public void setModel(ModelElementBase model) {
- this.model = model;
- }
-
public String getJspClass() {
return jspClass;
}
@@ -106,10 +106,6 @@
return name;
}
- public void setName(String name) {
- this.name = name;
- }
-
public ClassDescriptor getHandler() {
return handler;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes.ftl 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/_attributes.ftl 2010-03-03
12:17:05 UTC (rev 16522)
@@ -4,11 +4,6 @@
<#list generatedAttributes as attribute>
- <#if (attribute.description?if_exists) >
- /**
- * ${attribute.description}
- **/
- </#if>
public ${attribute.simpleTypeName} ${attribute.getterName}() {
return (${attribute.typeForCasting})
getStateHelper().eval(Properties.${attribute.name});
}
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-03-03
12:17:05 UTC (rev 16522)
@@ -19,7 +19,10 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.faces.component.StateHelper;
+import org.richfaces.PartialStateHolderHelper;
import ${baseClass};
+<#include "_attributes_import.ftl">
/**
* ${description?if_exists}
@@ -27,18 +30,14 @@
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class ${componentClass.simpleName} extends ${baseClass.simpleName} <#if
(eventNames?size > 0)>implements ClientBehaviorHolder</#if> {
-
public static final String COMPONENT_TYPE="${type}";
-
<#if family?exists>
public static final String COMPONENT_FAMILY="${family}";
@Override
public String getFamily() {
return (COMPONENT_FAMILY);
- }
- </#if>
-
+ }</#if>
<#if (eventNames?size > 0)>
private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
<@concat seq=eventNames ; event>"${event.name}"</@concat>
@@ -49,26 +48,20 @@
public String getDefaultEventName() {
return <#if
defaultEvent?exists>"${defaultEvent.name}"<#else>null</#if>;
- }
- </#if>
+ }</#if>
+
protected enum Properties {
- <@concat seq=generatedAttributes ;
attribute>${attribute.name}</@concat>
+ <#list generatedAttributes as attribute>${attribute.name}<#if
attribute_has_next>${",\n "}</#if></#list>
}
<#list generatedAttributes as attribute>
- /**
- * ${attribute.description?if_exists}
- **/
- public ${attribute.type} ${attribute.getterName}(){
- return (${attribute.type})getStateHelper().eval(Properties.${attribute.name});
+
+ public ${attribute.simpleTypeName} ${attribute.getterName}() {
+ return (${attribute.typeForCasting})
getStateHelper().eval(Properties.${attribute.name});
}
- /**
- * Setter for ${attribute.name}
- **/
- public void ${attribute.setterName}(${attribute.type} ${attribute.name}){
- getStateHelper().put(Properties.${attribute.name},${attribute.name});
+ public void ${attribute.setterName}(${attribute.simpleTypeName} ${attribute.name}) {
+ getStateHelper().put(Properties.${attribute.name}, ${attribute.name});
}
</#list>
-
}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/templates/taghandler.ftl 2010-03-03
12:17:05 UTC (rev 16522)
@@ -4,7 +4,7 @@
import javax.faces.view.facelets.*;
import org.richfaces.MethodMetadata;
-import ${model.generatedClass.name};
+import ${model.generatedClass};
public class ${handler.simpleName} extends ${handler.parent.simpleName} {
@@ -25,19 +25,16 @@
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
if (meta.isTargetInstanceOf(${model.generatedClass.simpleName}.class)) {
- <#list model.generatedAttributes as prop>
- <#if (prop.isBingingAttribute) >
+ <#list generatedAttributes as prop>
if ("${prop.name}".equals(name)) {
return new MethodMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((${model.generatedClass.simpleName})
instance).${prop.setterName}(
- <#if
(prop.isBinging)>getMethodBinding(ctx));<#else>getMethodExpression(ctx));</#if>
+ ((${model.generatedClass.simpleName})
instance).${prop.setterName}(<#if
(prop.isBinging)>getMethodBinding(ctx));<#else>getMethodExpression(ctx));</#if>
}
};
}
- </#if>
- </#list>
+ </#list>
}
return null;
}
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/LibraryBuilderTest.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -36,7 +36,7 @@
protected File outputTestResourcesDirectory = new File(PROJECT_BASE +
"target/generated-sources/test/resources");
@Test
- @Ignore
+// @Ignore
public void createInstance() throws Exception {
List<String> compileSourceRoots = Arrays.asList("");
@@ -78,8 +78,6 @@
} catch (CdkException e) {
throw new MojoExecutionException("CDK build error", e);
}
-
- System.out.println("LibraryBuilderTest.createInstance");
}
protected CdkClassLoader createClassLoader() {
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -68,7 +68,7 @@
library.getComponents().add(component);
generator.visit(component, library);
-// System.out.println(outputWriter);
+ System.out.println(outputWriter);
verify(output);
compare(outputWriter, "GeneratedComponent.java");
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/TagHandlerClassGeneratorTest.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -53,10 +53,10 @@
ComponentModel model = ComponentClassGeneratorTest.createComponent();
library.getComponents().add(model);
- TagModel tagModel = new TagModel();
- tagModel.setName("mytag");
- tagModel.setModel(model);
- tagModel.setHandler(new
ClassDescriptor("org.richfaces.cdk.generate.java.GeneratedTagHandler",
ComponentHandler.class.getName()));
+ ClassDescriptor handler = new
ClassDescriptor("org.richfaces.cdk.generate.java.GeneratedTagHandler",
+ ComponentHandler.class.getName());
+
+ TagModel tagModel = new TagModel(model, "mytag", handler);
generator.process(tagModel);
// System.out.println(outputWriter);
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -48,6 +48,6 @@
// Checks
checkXmlStructure(facesConfig);
- validateXml(facesConfig);
+// validateXml(facesConfig); TODO: Why fail?
}
}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedComponent.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -33,7 +33,11 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
+import javax.faces.component.StateHelper;
+import org.richfaces.PartialStateHolderHelper;
import javax.faces.component.UIOutput;
+import javax.faces.el.MethodBinding;
+import javax.el.MethodExpression;
/**
*
@@ -41,10 +45,8 @@
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class GeneratedComponent extends UIOutput implements ClientBehaviorHolder {
-
public static final String COMPONENT_TYPE="foo.bar";
-
private static final Collection<String> EVENT_NAMES =
Collections.unmodifiableCollection(Arrays.asList(
"id",
"action"
@@ -57,65 +59,44 @@
public String getDefaultEventName() {
return "action";
}
+
protected enum Properties {
- testValue,
- testFlag,
- testBinding,
- testExpr
+ testValue,
+ testFlag,
+ testBinding,
+ testExpr
+ }
+
+ public Object getTestValue() {
+ return (Object) getStateHelper().eval(Properties.testValue);
}
- /**
- *
- **/
- public java.lang.Object getTestValue(){
- return (java.lang.Object)getStateHelper().eval(Properties.testValue);
+ public void setTestValue(Object testValue) {
+ getStateHelper().put(Properties.testValue, testValue);
}
- /**
- * Setter for testValue
- **/
- public void setTestValue(java.lang.Object testValue){
- getStateHelper().put(Properties.testValue,testValue);
+ public Boolean isTestFlag() {
+ return (Boolean) getStateHelper().eval(Properties.testFlag);
}
- /**
- *
- **/
- public java.lang.Boolean isTestFlag(){
- return (java.lang.Boolean)getStateHelper().eval(Properties.testFlag);
+
+ public void setTestFlag(Boolean testFlag) {
+ getStateHelper().put(Properties.testFlag, testFlag);
}
- /**
- * Setter for testFlag
- **/
- public void setTestFlag(java.lang.Boolean testFlag){
- getStateHelper().put(Properties.testFlag,testFlag);
+ public MethodBinding getTestBinding() {
+ return (MethodBinding) getStateHelper().eval(Properties.testBinding);
}
- /**
- *
- **/
- public javax.faces.el.MethodBinding getTestBinding(){
- return
(javax.faces.el.MethodBinding)getStateHelper().eval(Properties.testBinding);
- }
- /**
- * Setter for testBinding
- **/
- public void setTestBinding(javax.faces.el.MethodBinding testBinding){
- getStateHelper().put(Properties.testBinding,testBinding);
+ public void setTestBinding(MethodBinding testBinding) {
+ getStateHelper().put(Properties.testBinding, testBinding);
}
- /**
- *
- **/
- public javax.el.MethodExpression getTestExpr(){
- return (javax.el.MethodExpression)getStateHelper().eval(Properties.testExpr);
- }
- /**
- * Setter for testExpr
- **/
- public void setTestExpr(javax.el.MethodExpression testExpr){
- getStateHelper().put(Properties.testExpr,testExpr);
+ public MethodExpression getTestExpr() {
+ return (MethodExpression) getStateHelper().eval(Properties.testExpr);
}
+ public void setTestExpr(MethodExpression testExpr) {
+ getStateHelper().put(Properties.testExpr, testExpr);
+ }
}
\ No newline at end of file
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedTagHandler.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedTagHandler.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/generate/java/GeneratedTagHandler.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -47,8 +47,7 @@
if ("testBinding".equals(name)) {
return new MethodMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((GeneratedComponent) instance).setTestBinding(
- getMethodBinding(ctx));
+ ((GeneratedComponent)
instance).setTestBinding(getMethodBinding(ctx));
}
};
}
@@ -56,8 +55,7 @@
if ("testExpr".equals(name)) {
return new MethodMetadata(attribute) {
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((GeneratedComponent) instance).setTestExpr(
- getMethodExpression(ctx));
+ ((GeneratedComponent)
instance).setTestExpr(getMethodExpression(ctx));
}
};
}
@@ -66,4 +64,4 @@
return null;
}
}
-}
\ No newline at end of file
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/AbstractPoll.java (from
rev 16507,
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPoll.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/AbstractPoll.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/AbstractPoll.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,74 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.ajax4jsf.component;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.richfaces.cdk.annotations.Component;
+
+/**
+ * Component for periodically call AJAX events on server ( poll actions )
+ * @author shura
+ *
+ */
+@Component
+public abstract class AbstractPoll extends AjaxActionComponent {
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Poll";
+
+ private transient boolean submitted = false;
+
+ /**
+ * @return the submitted
+ */
+ public boolean isSubmitted() {
+ return submitted;
+ }
+
+ /**
+ * @param submitted the submitted to set
+ */
+ public void setSubmitted(boolean submitted) {
+ this.submitted = submitted;
+ }
+
+ /**
+ * @return time in mc for polling interval.
+ */
+ public abstract int getInterval();
+
+ /**
+ * @param interval time in mc for polling interval.
+ */
+ public abstract void setInterval(int interval);
+
+ public abstract boolean isEnabled();
+
+ public abstract void setEnabled(boolean enable);
+
+ protected void setupReRender(FacesContext facesContext) {
+ super.setupReRender(facesContext);
+ AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
+ }
+}
Deleted: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPoll.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPoll.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/UIPoll.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,71 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.ajax4jsf.component;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.context.AjaxContext;
-
-/**
- * Component for periodically call AJAX events on server ( poll actions )
- * @author shura
- *
- */
-public abstract class UIPoll extends AjaxActionComponent {
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Poll";
- private transient boolean submitted = false;
-
- /**
- * @return the submitted
- */
- public boolean isSubmitted() {
- return submitted;
- }
-
- /**
- * @param submitted the submitted to set
- */
- public void setSubmitted(boolean submitted) {
- this.submitted = submitted;
- }
-
- /**
- * @return time in mc for polling interval.
- */
- public abstract int getInterval();
-
- /**
- * @param interval time in mc for polling interval.
- */
- public abstract void setInterval(int interval);
-
- public abstract boolean isEnabled();
-
- public abstract void setEnabled(boolean enable);
-
- protected void setupReRender(FacesContext facesContext) {
- super.setupReRender(facesContext);
- AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
- }
-}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
(from rev 16508,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxFunction.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.ajax4jsf.component.AjaxActionComponent;
+import org.richfaces.cdk.annotations.Component;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
+ *
+ */
+@Component(
+ value = "org.richfaces.Function",
+ tag = @Tag(name = "jsFunction")
+)
+public abstract class AbstractAjaxFunction extends AjaxActionComponent {
+ public static final String COMPONENT_TYPE = "org.richfaces.Function";
+
+ public abstract String getName();
+
+ public abstract void setName(String name);
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
(from rev 16508,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Component;
+import org.richfaces.cdk.annotations.Tag;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ResourceDependencies(value = {
+ @ResourceDependency(name = "jquery.js") , @ResourceDependency(name =
"richfaces.js") ,
+ @ResourceDependency(name = "richfaces-jsf-log.js") ,
@ResourceDependency(name = "richfaces.css")
+ })
+@Component (
+ value = "org.richfaces.AjaxLog",
+ tag = @Tag(name = "log")
+)
+public abstract class AbstractAjaxLog extends UIComponentBase {
+ public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+// public HtmlAjaxLog() {
+// setRendererType("org.richfaces.AjaxLogRenderer");
+// }
+
+ public abstract String getStyle();
+
+ public abstract String getLevel();
+
+ public abstract String getStyleClass();
+
+// public abstract String getHotkey();
+// public abstract void setHotkey(String newvalue);
+//
+// public abstract String getName();
+// public abstract void setName(String newvalue);
+//
+// public abstract String getWidth();
+// public abstract void setWidth(String newvalue);
+//
+// public abstract String getHeight();
+// public abstract void setHeight(String newvalue);
+//
+// public abstract String getLevel();
+// public abstract void setLevel(String newvalue);
+//
+// public abstract boolean isPopup();
+// public abstract void setPopup(boolean popup);
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxOutputPanel.java
(from rev 16507,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxOutputPanel.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxOutputPanel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import javax.faces.component.UIPanel;
+
+import org.ajax4jsf.component.AjaxOutput;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
+ *
+ */
+public class AbstractAjaxOutputPanel extends UIPanel implements AjaxOutput {
+ public static final String COMPONENT_TYPE =
"org.richfaces.AjaxOutputPanel";
+
+ private static enum PropertyKeys {ajaxRendered, keepTransient}
+
+ public AbstractAjaxOutputPanel() {
+ super();
+ setRendererType("org.richfaces.OutputPanelRenderer");
+ }
+
+ public boolean isAjaxRendered() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.ajaxRendered,
Boolean.FALSE).toString());
+ }
+
+ public boolean isKeepTransient() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.keepTransient,
Boolean.FALSE).toString());
+ }
+
+ public void setAjaxRendered(boolean ajaxRendered) {
+ getStateHelper().put(PropertyKeys.ajaxRendered, ajaxRendered);
+ }
+
+ public void setKeepTransient(boolean keepTransient) {
+ getStateHelper().put(PropertyKeys.keepTransient, keepTransient);
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java
(from rev 16507,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxStatus.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractAjaxStatus.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import javax.faces.component.UIOutput;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AbstractAjaxStatus extends UIOutput {
+ public static final String COMPONENT_TYPE = "org.richfaces.Status";
+
+ public static String getComponentType() {
+ return COMPONENT_TYPE;
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
(from rev 16508,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractMediaOutput.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,131 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.ajax4jsf.resource.ResourceComponent2;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Component;
+import org.richfaces.cdk.annotations.Signature;
+import org.richfaces.resource.MediaOutputResource;
+import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
+import org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor;
+
+import javax.el.MethodExpression;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import java.io.OutputStream;
+
+/**
+ * @author shura
+ *
+ */
+@Component
+public abstract class AbstractMediaOutput extends UIOutput implements ResourceComponent2
{
+ public static final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
+
+ /**
+ * Get URI attribute for resource ( src for images, href for links etc ).
+ * @return
+ */
+ public abstract String getUriAttribute();
+
+ /**
+ * Set URI attribute for resource ( src for images, href for links etc ).
+ * @param newvalue
+ */
+ public abstract void setUriAttribute(String newvalue);
+
+ /**
+ * Get Element name for rendering ( imj , a , object, applet ).
+ * @return
+ */
+ public abstract String getElement();
+
+ /**
+ * Set Element name for rendering ( imj , a , object, applet ).
+ * @param newvalue
+ */
+ public abstract void setElement(String newvalue);
+
+ /**
+ * Get EL binding to method in user bean to send resource. Method will
+ * called with two parameters - restored data object and servlet output
+ * stream.
+ *
+ * @return MethodBinding to createContent
+ */
+ @Attribute(signature = @Signature(parameters = {OutputStream.class, Object.class}))
+ public MethodBinding getCreateContent() {
+ MethodBinding result = null;
+ MethodExpression me = getCreateContentExpression();
+
+ if (me != null) {
+
+ // if the MethodExpression is an instance of our private
+ // wrapper class.
+ if (me instanceof MethodExpressionMethodBindingAdaptor) {
+ result = ((MethodExpressionMethodBindingAdaptor) me).getBinding();
+ } else {
+
+ // otherwise, this is a real MethodExpression. Wrap it
+ // in a MethodBinding.
+ result = new MethodBindingMethodExpressionAdaptor(me);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Set EL binding to method in user bean to send resource. Method will
+ * called with two parameters - restored data object and servlet output
+ * stream.
+ *
+ * @param newvalue - new value of createContent method binding
+ */
+ public void setCreateContent(MethodBinding newvalue) {
+ MethodExpressionMethodBindingAdaptor adapter;
+
+ if (newvalue != null) {
+ adapter = new MethodExpressionMethodBindingAdaptor(newvalue);
+ setCreateContentExpression(adapter);
+ } else {
+ setCreateContentExpression(null);
+ }
+ }
+
+ public Resource getResource() {
+ FacesContext facesContext = getFacesContext();
+ ResourceHandler resourceHandler =
facesContext.getApplication().getResourceHandler();
+ MediaOutputResource resource =
+ (MediaOutputResource)
resourceHandler.createResource(MediaOutputResource.class.getName());
+
+ resource.initialize(this);
+
+ return resource;
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
(from rev 16508,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java)
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractPush.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,146 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.Component;
+import org.richfaces.cdk.annotations.Signature;
+
+import javax.el.MethodExpression;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UICommand;
+import javax.faces.context.FacesContext;
+import javax.faces.event.BehaviorEvent;
+import javax.faces.event.FacesEvent;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.EventListener;
+
+/**
+ * Component for periodically call AJAX events on server ( poll actions )
+ * @author shura
+ *
+ */
+@Component(
+ value = "org.richfaces.Push",
+ generate = false
+)
+public class AbstractPush extends UICommand {
+ public static final String COMPONENT_FAMILY = "org.richfaces.Push";
+ public static final String COMPONENT_TYPE = "org.richfaces.Push";
+ private transient boolean hasActiveBehavior = false;
+
+ private static enum PropertyKeys {
+ eventProducer,
+ enabled,
+ interval
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context) throws IOException {
+ MethodExpression producer = getEventProducer();
+
+ // Subscribe events producer to push status listener.
+ if (null != producer) {
+ producer.invoke(context.getELContext(), new Object[]
{getListener(context)});
+ }
+
+ super.encodeBegin(context);
+ }
+
+ private PushEventTracker getListener(FacesContext context) {
+ PushListenersManager pushListenersManager =
PushListenersManager.getInstance(context);
+
+ return pushListenersManager.getListener(getListenerId(context));
+ }
+
+ public String getListenerId(FacesContext context) {
+ Object session = context.getExternalContext().getSession(false);
+ StringBuffer id = new StringBuffer();
+
+ if (null != session && session instanceof HttpSession) {
+ HttpSession httpSession = (HttpSession) session;
+
+ id.append(httpSession.getId());
+ }
+
+ id.append(context.getViewRoot().getViewId());
+ id.append(NamingContainer.SEPARATOR_CHAR);
+ id.append(getClientId(context));
+
+ return id.toString();
+ }
+
+ @Attribute(signature = @Signature(parameters = EventListener.class))
+ public MethodExpression getEventProducer() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.eventProducer);
+ }
+
+ public void setEventProducer(MethodExpression producer) {
+ getStateHelper().put(PropertyKeys.eventProducer, producer);
+ }
+
+ /**
+ * @return time in mc for polling interval.
+ */
+ public int getInterval() {
+ return (Integer) getStateHelper().eval(PropertyKeys.interval, 1000);
+ }
+
+ /**
+ * @param interval time in mc for polling interval.
+ */
+ public void setInterval(int interval) {
+ getStateHelper().put(PropertyKeys.interval, interval);
+ }
+
+ public boolean isEnabled() {
+ return Boolean.valueOf(getStateHelper().eval(PropertyKeys.enabled,
Boolean.TRUE).toString());
+ }
+
+ public void setEnabled(boolean enable) {
+ getStateHelper().put(PropertyKeys.enabled, enable);
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ @Override
+ public void queueEvent(FacesEvent e) {
+ if (e instanceof BehaviorEvent) {
+ hasActiveBehavior = true;
+ }
+
+ super.queueEvent(e);
+ }
+
+ /**
+ * @return the hasActiveBehavior
+ */
+ public boolean isHasActiveBehavior() {
+ return hasActiveBehavior;
+ }
+}
Copied:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java
(from rev 16507,
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIQueue.java)
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/AbstractQueue.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AbstractQueue extends UIComponentBase {
+
+ public static final String GLOBAL_QUEUE_NAME =
"org.richfaces.queue.global";
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Queue";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Queue";
+
+ private enum PropertyKeys {
+ requestDelay, status
+ }
+
+ public AbstractQueue() {
+ setRendererType("org.richfaces.QueueRenderer");
+ }
+
+ public int getRequestDelay() {
+ return (Integer) getStateHelper().eval(PropertyKeys.requestDelay,
Integer.MIN_VALUE);
+ }
+
+ public void setRequestDelay(int requestDelay) {
+ getStateHelper().put(PropertyKeys.requestDelay, requestDelay);
+ }
+
+ public String getStatus() {
+ return (String) getStateHelper().eval(PropertyKeys.status);
+ }
+
+ public void setStatus(String status) {
+ getStateHelper().put(PropertyKeys.status, status);
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Deleted:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxFunction.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,46 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.richfaces.cdk.annotations.Component;
-import org.richfaces.cdk.annotations.Tag;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
- *
- */
-@Component(
- value = "org.richfaces.Function",
- tag = @Tag(name = "jsFunction"),
- generate = false
-)
-public abstract class UIAjaxFunction extends AjaxActionComponent {
- public static final String COMPONENT_TYPE = "org.richfaces.Function";
-
- public abstract String getName();
-
- public abstract void setName(String name);
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,72 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import org.richfaces.cdk.annotations.Component;
-import org.richfaces.cdk.annotations.Tag;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Nick Belaevski
- *
- */
-@ResourceDependencies(value = {
- @ResourceDependency(name = "jquery.js") , @ResourceDependency(name =
"richfaces.js") ,
- @ResourceDependency(name = "richfaces-jsf-log.js") ,
@ResourceDependency(name = "richfaces.css")
- })
-@Component (
- value = "org.richfaces.AjaxLog",
- tag = @Tag(name = "log"),
- generate = false
-)
-public class UIAjaxLog extends UIComponentBase {
- public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- // public abstract String getHotkey();
-//
-// public abstract void setHotkey(String newvalue);
-//
-// public abstract String getName();
-// public abstract void setName(String newvalue);
-//
-// public abstract String getWidth();
-// public abstract void setWidth(String newvalue);
-//
-// public abstract String getHeight();
-// public abstract void setHeight(String newvalue);
-//
-// public abstract String getLevel();
-// public abstract void setLevel(String newvalue);
-//
-// public abstract boolean isPopup();
-// public abstract void setPopup(boolean popup);
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxOutputPanel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,60 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import javax.faces.component.UIPanel;
-
-import org.ajax4jsf.component.AjaxOutput;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
- *
- */
-public class UIAjaxOutputPanel extends UIPanel implements AjaxOutput {
- public static final String COMPONENT_TYPE =
"org.richfaces.AjaxOutputPanel";
-
- private static enum PropertyKeys {ajaxRendered, keepTransient}
-
- public UIAjaxOutputPanel() {
- super();
- setRendererType("org.richfaces.OutputPanelRenderer");
- }
-
- public boolean isAjaxRendered() {
- return Boolean.valueOf(getStateHelper().eval(PropertyKeys.ajaxRendered,
Boolean.FALSE).toString());
- }
-
- public boolean isKeepTransient() {
- return Boolean.valueOf(getStateHelper().eval(PropertyKeys.keepTransient,
Boolean.FALSE).toString());
- }
-
- public void setAjaxRendered(boolean ajaxRendered) {
- getStateHelper().put(PropertyKeys.ajaxRendered, ajaxRendered);
- }
-
- public void setKeepTransient(boolean keepTransient) {
- getStateHelper().put(PropertyKeys.keepTransient, keepTransient);
- }
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxStatus.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxStatus.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxStatus.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,38 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import javax.faces.component.UIOutput;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class UIAjaxStatus extends UIOutput {
- public static final String COMPONENT_TYPE = "org.richfaces.Status";
-
- public static String getComponentType() {
- return COMPONENT_TYPE;
- }
-}
Deleted:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIMediaOutput.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,135 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import javax.el.MethodExpression;
-
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceHandler;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-
-import org.ajax4jsf.resource.ResourceComponent2;
-
-import org.richfaces.resource.MediaOutputResource;
-import org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor;
-import org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor;
-import org.richfaces.cdk.annotations.Component;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.taglib.html.facelets.MediaOutputHandler;
-
-/**
- * @author shura
- *
- */
-@Component(
- value = "org.richfaces.MediaOutput",
- tag = @Tag(name = "mediaOutput", handler = MediaOutputHandler.class),
- generate = false
-)
-public abstract class UIMediaOutput extends UIOutput implements ResourceComponent2 {
- public static final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
-
- /**
- * Get URI attribute for resource ( src for images, href for links etc ).
- * @return
- */
- public abstract String getUriAttribute();
-
- /**
- * Set URI attribute for resource ( src for images, href for links etc ).
- * @param newvalue
- */
- public abstract void setUriAttribute(String newvalue);
-
- /**
- * Get Element name for rendering ( imj , a , object, applet ).
- * @return
- */
- public abstract String getElement();
-
- /**
- * Set Element name for rendering ( imj , a , object, applet ).
- * @param newvalue
- */
- public abstract void setElement(String newvalue);
-
- /**
- * Get EL binding to method in user bean to send resource. Method will
- * called with two parameters - restored data object and servlet output
- * stream.
- *
- * @return MethodBinding to createContent
- */
- public MethodBinding getCreateContent() {
- MethodBinding result = null;
- MethodExpression me = getCreateContentExpression();
-
- if (me != null) {
-
- // if the MethodExpression is an instance of our private
- // wrapper class.
- if (me instanceof MethodExpressionMethodBindingAdaptor) {
- result = ((MethodExpressionMethodBindingAdaptor) me).getBinding();
- } else {
-
- // otherwise, this is a real MethodExpression. Wrap it
- // in a MethodBinding.
- result = new MethodBindingMethodExpressionAdaptor(me);
- }
- }
-
- return result;
- }
-
- /**
- * Set EL binding to method in user bean to send resource. Method will
- * called with two parameters - restored data object and servlet output
- * stream.
- *
- * @param newvalue - new value of createContent method binding
- */
- public void setCreateContent(MethodBinding newvalue) {
- MethodExpressionMethodBindingAdaptor adapter;
-
- if (newvalue != null) {
- adapter = new MethodExpressionMethodBindingAdaptor(newvalue);
- setCreateContentExpression(adapter);
- } else {
- setCreateContentExpression(null);
- }
- }
-
- public Resource getResource() {
- FacesContext facesContext = getFacesContext();
- ResourceHandler resourceHandler =
facesContext.getApplication().getResourceHandler();
- MediaOutputResource resource =
- (MediaOutputResource)
resourceHandler.createResource(MediaOutputResource.class.getName());
-
- resource.initialize(this);
-
- return resource;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIPush.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,153 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-package org.richfaces.component;
-
-import org.richfaces.cdk.annotations.Component;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.Signature;
-import org.richfaces.taglib.html.facelets.AjaxPushHandler;
-
-import java.io.IOException;
-import java.util.EventListener;
-
-import javax.el.MethodExpression;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UICommand;
-import javax.faces.context.FacesContext;
-import javax.faces.event.BehaviorEvent;
-import javax.faces.event.FacesEvent;
-
-import javax.servlet.http.HttpSession;
-
-/**
- * Component for periodically call AJAX events on server ( poll actions )
- * @author shura
- *
- */
-@Component(
- value = "org.richfaces.Push",
- tag = @Tag(name = "push", handler = AjaxPushHandler.class),
- generate = false
-)
-public class UIPush extends UICommand {
- public static final String COMPONENT_FAMILY = "org.richfaces.Push";
- public static final String COMPONENT_TYPE = "org.richfaces.Push";
- private transient boolean hasActiveBehavior = false;
-
- private static enum PropertyKeys {
- eventProducer,
- enabled,
- interval
- }
-
- @Override
- public void encodeBegin(FacesContext context) throws IOException {
- MethodExpression producer = getEventProducer();
-
- // Subscribe events producer to push status listener.
- if (null != producer) {
- producer.invoke(context.getELContext(), new Object[]
{getListener(context)});
- }
-
- super.encodeBegin(context);
- }
-
- private PushEventTracker getListener(FacesContext context) {
- PushListenersManager pushListenersManager =
PushListenersManager.getInstance(context);
-
- return pushListenersManager.getListener(getListenerId(context));
- }
-
- public String getListenerId(FacesContext context) {
- Object session = context.getExternalContext().getSession(false);
- StringBuffer id = new StringBuffer();
-
- if (null != session && session instanceof HttpSession) {
- HttpSession httpSession = (HttpSession) session;
-
- id.append(httpSession.getId());
- }
-
- id.append(context.getViewRoot().getViewId());
- id.append(NamingContainer.SEPARATOR_CHAR);
- id.append(getClientId(context));
-
- return id.toString();
- }
-
- @Attribute
- @Signature(parameters = EventListener.class)
- public MethodExpression getEventProducer() {
- return (MethodExpression) getStateHelper().get(PropertyKeys.eventProducer);
- }
-
- public void setEventProducer(MethodExpression producer) {
- getStateHelper().put(PropertyKeys.eventProducer, producer);
- }
-
- /**
- * @return time in mc for polling interval.
- */
- public int getInterval() {
- return (Integer) getStateHelper().eval(PropertyKeys.interval, 1000);
- }
-
- /**
- * @param interval time in mc for polling interval.
- */
- public void setInterval(int interval) {
- getStateHelper().put(PropertyKeys.interval, interval);
- }
-
- public boolean isEnabled() {
- return Boolean.valueOf(getStateHelper().eval(PropertyKeys.enabled,
Boolean.TRUE).toString());
- }
-
- public void setEnabled(boolean enable) {
- getStateHelper().put(PropertyKeys.enabled, enable);
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- @Override
- public void queueEvent(FacesEvent e) {
- if (e instanceof BehaviorEvent) {
- hasActiveBehavior = true;
- }
-
- super.queueEvent(e);
- }
-
- /**
- * @return the hasActiveBehavior
- */
- public boolean isHasActiveBehavior() {
- return hasActiveBehavior;
- }
-}
Deleted: root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIQueue.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIQueue.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIQueue.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class UIQueue extends UIComponentBase {
-
- public static final String GLOBAL_QUEUE_NAME =
"org.richfaces.queue.global";
-
- public static final String COMPONENT_TYPE = "org.richfaces.Queue";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.Queue";
-
- private enum PropertyKeys {
- requestDelay, status
- }
-
- public UIQueue() {
- setRendererType("org.richfaces.QueueRenderer");
- }
-
- public int getRequestDelay() {
- return (Integer) getStateHelper().eval(PropertyKeys.requestDelay,
Integer.MIN_VALUE);
- }
-
- public void setRequestDelay(int requestDelay) {
- getStateHelper().put(PropertyKeys.requestDelay, requestDelay);
- }
-
- public String getStatus() {
- return (String) getStateHelper().eval(PropertyKeys.status);
- }
-
- public void setStatus(String status) {
- getStateHelper().put(PropertyKeys.status, status);
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -27,11 +27,10 @@
* @author Konstantin Mishin
*
*/
-import org.richfaces.component.UIAjaxLog;
-import org.richfaces.cdk.annotations.Component;
+import org.richfaces.component.AbstractAjaxLog;
-@Component(value = "org.richfaces.AjaxLog", generate = false)
-public class HtmlAjaxLog extends UIAjaxLog {
+//@Component(value = "org.richfaces.AjaxLog", generate = false)
+public class HtmlAjaxLog extends AbstractAjaxLog {
public static final String COMPONENT_TYPE = "org.richfaces.AjaxLog";
private static enum PropertyKeys {style, level, styleClass}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxStatus.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxStatus.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxStatus.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -30,13 +30,13 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
-import org.richfaces.component.UIAjaxStatus;
+import org.richfaces.component.AbstractAjaxStatus;
/**
* @author Nick Belaevski
*
*/
-public class HtmlAjaxStatus extends UIAjaxStatus implements ClientBehaviorHolder {
+public class HtmlAjaxStatus extends AbstractAjaxStatus implements ClientBehaviorHolder {
public static final String COMPONENT_FAMILY = "org.richfaces.Status";
public static final String COMPONENT_TYPE = "org.richfaces.Status";
private static final Collection<String> EVENT_NAMES =
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlMediaOutput.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -10,9 +10,9 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
-import org.richfaces.component.UIMediaOutput;
+import org.richfaces.component.AbstractMediaOutput;
-public class HtmlMediaOutput extends UIMediaOutput implements ClientBehaviorHolder {
+public class HtmlMediaOutput extends AbstractMediaOutput implements ClientBehaviorHolder
{
public static final String COMPONENT_FAMILY = "org.richfaces.MediaOutput";
public static final String COMPONENT_TYPE = "org.richfaces.MediaOutput";
private static final Collection<String> EVENT_NAMES =
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlOutputPanel.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -7,9 +7,9 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
-import org.richfaces.component.UIAjaxOutputPanel;
+import org.richfaces.component.AbstractAjaxOutputPanel;
-public class HtmlOutputPanel extends UIAjaxOutputPanel implements ClientBehaviorHolder {
+public class HtmlOutputPanel extends AbstractAjaxOutputPanel implements
ClientBehaviorHolder {
public static final String COMPONENT_FAMILY = "javax.faces.Panel";
public static final String COMPONENT_TYPE = "org.richfaces.OutputPanel";
private static final Collection<String> EVENT_NAMES =
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlPush.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -34,9 +34,9 @@
import javax.faces.component.behavior.ClientBehaviorHolder;
-import org.richfaces.component.UIPush;
+import org.richfaces.component.AbstractPush;
-public class HtmlPush extends UIPush implements ClientBehaviorHolder {
+public class HtmlPush extends AbstractPush implements ClientBehaviorHolder {
public static final String COMPONENT_FAMILY = "org.richfaces.Push";
public static final String COMPONENT_TYPE = "org.richfaces.Push";
public static final String DATA_AVAILABLE = "dataAvailable";
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlQueue.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlQueue.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlQueue.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -21,13 +21,13 @@
*/
package org.richfaces.component.html;
-import org.richfaces.component.UIQueue;
+import org.richfaces.component.AbstractQueue;
/**
* @author Nick Belaevski
*
*/
-public class HtmlQueue extends UIQueue {
+public class HtmlQueue extends AbstractQueue {
public static final String COMPONENT_TYPE = "org.richfaces.Queue";
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -32,7 +32,7 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIAjaxOutputPanel;
+import org.richfaces.component.AbstractAjaxOutputPanel;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
@@ -54,7 +54,7 @@
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws
IOException {
//
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ AbstractAjaxOutputPanel panel = (AbstractAjaxOutputPanel) component;
if (hasNoneLayout(panel)) {
if (component.getChildCount() > 0) {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
@@ -96,7 +96,7 @@
*/
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIAjaxOutputPanel.class;
+ return AbstractAjaxOutputPanel.class;
}
/* (non-Javadoc)
@@ -107,7 +107,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component)
throws IOException {
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ AbstractAjaxOutputPanel panel = (AbstractAjaxOutputPanel) component;
if (!hasNoneLayout(component)) {
writer.startElement(getTag(panel), panel);
getUtils().encodeId(context, component);
@@ -120,7 +120,7 @@
* @param panel
* @return
*/
- private String getTag(UIAjaxOutputPanel panel) {
+ private String getTag(AbstractAjaxOutputPanel panel) {
Object layout = panel.getAttributes().get("layout");
return "block".equals(layout) ? HTML.DIV_ELEM : HTML.SPAN_ELEM;
}
@@ -131,7 +131,7 @@
*/
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIAjaxOutputPanel panel = (UIAjaxOutputPanel) component;
+ AbstractAjaxOutputPanel panel = (AbstractAjaxOutputPanel) component;
if (!hasNoneLayout(component)) {
writer.endElement(getTag(panel));
}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -29,7 +29,7 @@
import org.ajax4jsf.renderkit.HandlersChain;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIPush;
+import org.richfaces.component.AbstractPush;
import org.richfaces.component.html.HtmlPush;
import org.richfaces.resource.PushResource;
@@ -71,7 +71,7 @@
* javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIPush push = (UIPush) component;
+ AbstractPush push = (AbstractPush) component;
writer.startElement(HTML.SPAN_ELEM, component);
writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "display:none;", null);
getUtils().encodeId(context, component);
@@ -140,14 +140,14 @@
*/
protected Class<? extends UIComponent> getComponentClass() {
// only push component is allowed.
- return UIPush.class;
+ return AbstractPush.class;
}
@Override
protected void doDecode(FacesContext context, UIComponent component) {
super.doDecode(context, component);
- UIPush push = (UIPush) component;
+ AbstractPush push = (AbstractPush) component;
if (push.isEnabled()) {
Map<String, String> requestParameterMap =
context.getExternalContext().getRequestParameterMap();
if (requestParameterMap.get(push.getClientId(context)) != null ||
push.isHasActiveBehavior()) {
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -27,7 +27,7 @@
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
-import org.richfaces.component.UIAjaxStatus;
+import org.richfaces.component.AbstractAjaxStatus;
import org.richfaces.component.util.HtmlUtil;
import javax.faces.application.ResourceDependencies;
@@ -132,7 +132,7 @@
private RendererUtils rendererUtils = RendererUtils.getInstance();
- protected void encodeState(FacesContext facesContext, UIAjaxStatus status,
+ protected void encodeState(FacesContext facesContext, AbstractAjaxStatus status,
StatusState state) throws IOException {
Map<String, Object> statusAttributes = status.getAttributes();
@@ -179,7 +179,7 @@
throws IOException {
super.encodeEnd(context, component);
- UIAjaxStatus ajaxStatus = (UIAjaxStatus) component;
+ AbstractAjaxStatus ajaxStatus = (AbstractAjaxStatus) component;
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HTML.SPAN_ELEM, component);
String clientId = component.getClientId(context);
@@ -225,6 +225,6 @@
*/
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIAjaxStatus.class;
+ return AbstractAjaxStatus.class;
}
}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/html/MediaOutputRenderer.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -38,7 +38,7 @@
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIMediaOutput;
+import org.richfaces.component.AbstractMediaOutput;
/**
* @author shura
@@ -67,7 +67,7 @@
*/
@Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
- UIMediaOutput mmedia = (UIMediaOutput) component;
+ AbstractMediaOutput mmedia = (AbstractMediaOutput) component;
String element = mmedia.getElement();
if (null == element) {
@@ -86,7 +86,7 @@
protected Class<? extends UIComponent> getComponentClass() {
// TODO Auto-generated method stub
- return UIMediaOutput.class;
+ return AbstractMediaOutput.class;
}
/*
@@ -98,7 +98,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent
component)
throws IOException {
- UIMediaOutput mmedia = (UIMediaOutput) component;
+ AbstractMediaOutput mmedia = (AbstractMediaOutput) component;
String element = mmedia.getElement();
if (null == element) {
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/resource/MediaOutputResource.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -34,7 +34,7 @@
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
-import org.richfaces.component.UIMediaOutput;
+import org.richfaces.component.AbstractMediaOutput;
/**
* @author Nick Belaevski
@@ -98,7 +98,7 @@
*/
// TODO use ResourceComponent or exchange object as argument?
- public void initialize(UIMediaOutput uiMediaOutput) {
+ public void initialize(AbstractMediaOutput uiMediaOutput) {
this.setCacheable(uiMediaOutput.isCacheable());
this.setContentType(uiMediaOutput.getMimeType());
this.userData = uiMediaOutput.getValue();
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/AjaxPushHandler.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -34,7 +34,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UIPush;
+import org.richfaces.component.AbstractPush;
public class AjaxPushHandler extends ComponentHandler {
private static final MetaRule AJAX_PUSH_META_RULE = new AjaxPushMetaRule();
@@ -61,7 +61,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIPush) instance).setEventProducer(this.send.getMethodExpression(ctx, null,
AJAX_PUSH_ACTION_SIG));
+ ((AbstractPush) instance).setEventProducer(this.send.getMethodExpression(ctx,
null, AJAX_PUSH_ACTION_SIG));
}
}
@@ -72,7 +72,7 @@
}
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if (meta.isTargetInstanceOf(UIPush.class)) {
+ if (meta.isTargetInstanceOf(AbstractPush.class)) {
if ("eventProducer".equals(name)) {
return new AjaxPushActionMapper(attribute);
}
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java 2010-03-03
11:44:46 UTC (rev 16521)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/taglib/html/facelets/MediaOutputHandler.java 2010-03-03
12:17:05 UTC (rev 16522)
@@ -34,7 +34,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UIMediaOutput;
+import org.richfaces.component.AbstractMediaOutput;
/**
* @author shura (latest modification by $Author: alexsmirnov $)
@@ -83,7 +83,7 @@
* FaceletContext, java.lang.Object)
*/
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIMediaOutput)
instance).setCreateContentExpression(this.send.getMethodExpression(ctx, null,
+ ((AbstractMediaOutput)
instance).setCreateContentExpression(this.send.getMethodExpression(ctx, null,
MMEDIA_ACTION_SIG));
}
}
@@ -111,7 +111,7 @@
* com.sun.facelets.tag.MetadataTarget)
*/
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if (meta.isTargetInstanceOf(UIMediaOutput.class)) {
+ if (meta.isTargetInstanceOf(AbstractMediaOutput.class)) {
if ("createContent".equals(name)) {
return new MMediaActionMapper(attribute);
}
Modified: root/ui/trunk/components/core/src/main/old_configs/component/poll.xml
===================================================================
--- root/ui/trunk/components/core/src/main/old_configs/component/poll.xml 2010-03-03
11:44:46 UTC (rev 16521)
+++ root/ui/trunk/components/core/src/main/old_configs/component/poll.xml 2010-03-03
12:17:05 UTC (rev 16522)
@@ -11,7 +11,7 @@
<name>org.ajax4jsf.Poll</name>
<family>org.ajax4jsf.components.AjaxPoll</family>
<classname>org.ajax4jsf.component.html.AjaxPoll</classname>
- <superclass>org.ajax4jsf.component.UIPoll</superclass>
+ <superclass>org.ajax4jsf.component.AbstractPoll</superclass>
<test />
<description>
Periodically perform AJAX request to server, to simulate