Author: mvitenkov
Date: 2008-11-25 12:07:46 -0500 (Tue, 25 Nov 2008)
New Revision: 11370
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/Queue.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/QueueComponent.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/Attribute.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/AttributesList.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/TLDParser.java
trunk/test-applications/seamApp/web/src/main/webapp/Queue/
trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueDefault.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueStraightforward.xhtml
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/dataScroller/DataScroller.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/rich/RichBean.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/sb/Sb.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/componentInfo/ComponentInfo.java
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/event/Event.java
Log:
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/dataScroller/DataScroller.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/dataScroller/DataScroller.java 2008-11-25
16:40:07 UTC (rev 11369)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/dataScroller/DataScroller.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -10,11 +10,13 @@
import org.richfaces.event.DataScrollerEvent;
import org.richfaces.model.Ordering;
+import org.richfaces.helloworld.domain.util.data.Data;
+
@Name("dataScroller")
@Scope(ScopeType.SESSION)
public class DataScroller {
- private ArrayList<Data> dataTable;
+ private ArrayList dataTable;
public Data tD;
public String align;
public String fastControls;
@@ -139,13 +141,13 @@
sortMode = "single";
sortOrder = Ordering.ASCENDING;
selfSorted = true;
- currentSortOrder = "ASCENDING";
+ currentSortOrder = "ASCENDING";
+ dataTable = new ArrayList();
- dataTable = new ArrayList<Data>();
-
for(int i=0;i<1000;i++)
{
- dataTable.add(new Data("Random", i));
+
+ dataTable.add(new Data(Data.Random(6),i));
}
}
@@ -170,7 +172,7 @@
int k = dataTable.size()-1;
for(int i = k;i < (k+1)*2;i++)
{
- dataTable.add(new Data("Random", i));
+ dataTable.add(new Data("Random",i));
}
}
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/Queue.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/Queue.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/Queue.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,94 @@
+package org.richfaces.helloworld.domain.queue;
+
+import org.ajax4jsf.component.UIQueue;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.helloworld.domain.util.componentInfo.ComponentInfo;
+
+@Name("queue")
+(a)Scope(ScopeType.SESSION)
+public class Queue {
+ private UIQueue myQueue = null;
+ private boolean disabled;
+ private boolean ignoreDupResponses;
+ private String name;
+ private boolean rendered;
+ private int requestDelay;
+ private int size;
+ private String sizeExceededBehavior;
+ private int timeout;
+
+ public Queue(){
+ this.disabled = false;
+ this.ignoreDupResponses = false;
+ this.name = "DefaultQueue";
+ this.rendered = true;
+ this.requestDelay = 500;
+ this.size = 3;
+ this.sizeExceededBehavior = "dropNext";
+ this.timeout = 5000;
+ }
+
+ public String addQueue(){
+ ComponentInfo info = ComponentInfo.getInstance();
+ info.addField(myQueue);
+ return null;
+ }
+
+ public UIQueue getMyQueue() {
+ return myQueue;
+ }
+ public void setMyQueue(UIQueue myQueue) {
+ this.myQueue = myQueue;
+ }
+ public boolean isDisabled() {
+ return disabled;
+ }
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+ public boolean isIgnoreDupResponses() {
+ return ignoreDupResponses;
+ }
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public boolean isRendered() {
+ return rendered;
+ }
+ public void setRendered(boolean rendered) {
+ this.rendered = rendered;
+ }
+ public int getRequestDelay() {
+ return requestDelay;
+ }
+ public void setRequestDelay(int requestDelay) {
+ this.requestDelay = requestDelay;
+ }
+ public int getSize() {
+ return size;
+ }
+ public void setSize(int size) {
+ this.size = size;
+ }
+ public String getSizeExceededBehavior() {
+ return sizeExceededBehavior;
+ }
+ public void setSizeExceededBehavior(String sizeExceededBehavior) {
+ this.sizeExceededBehavior = sizeExceededBehavior;
+ }
+ public int getTimeout() {
+ return timeout;
+ }
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+}
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/QueueComponent.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/QueueComponent.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/queue/QueueComponent.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,182 @@
+package org.richfaces.helloworld.domain.queue;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.faces.model.SelectItem;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Name("queueComponent")
+(a)Scope(ScopeType.SESSION)
+public class QueueComponent {
+ private String inputValue;
+ private String inputQueue;
+ private ArrayList<SelectItem> queues;
+ private Date calendarValue;
+ private String calendarQueue;
+ private boolean checkboxValue;
+ private String checkboxQueue;
+ private String dfsQueue;
+ private Object dataScrollerValue;
+ private String dataScrollerQueue;
+ private String radioValue;
+ private String radioQueue;
+ private String selectMenuValue;
+ private String selectMenuQueue;
+ private String suggestionValue;
+ private String suggestionQueue;
+
+ public String getSuggestionValue() {
+ return suggestionValue;
+ }
+
+ public void setSuggestionValue(String suggestionValue) {
+ this.suggestionValue = suggestionValue;
+ }
+
+ public String getSuggestionQueue() {
+ return suggestionQueue;
+ }
+
+ public void setSuggestionQueue(String suggestionQueue) {
+ this.suggestionQueue = suggestionQueue;
+ }
+
+ public String getSelectMenuValue() {
+ return selectMenuValue;
+ }
+
+ public void setSelectMenuValue(String selectMenuValue) {
+ this.selectMenuValue = selectMenuValue;
+ }
+
+ public String getSelectMenuQueue() {
+ return selectMenuQueue;
+ }
+
+ public void setSelectMenuQueue(String selectMenuQueue) {
+ this.selectMenuQueue = selectMenuQueue;
+ }
+
+ public String getRadioValue() {
+ return radioValue;
+ }
+
+ public void setRadioValue(String radioValue) {
+ this.radioValue = radioValue;
+ }
+
+ public String getRadioQueue() {
+ return radioQueue;
+ }
+
+ public void setRadioQueue(String radioQueue) {
+ this.radioQueue = radioQueue;
+ }
+
+ public Object getDataScrollerValue() {
+ return dataScrollerValue;
+ }
+
+ public void setDataScrollerValue(Object dataScrollerValue) {
+ this.dataScrollerValue = dataScrollerValue;
+ }
+
+ public String getDataScrollerQueue() {
+ return dataScrollerQueue;
+ }
+
+ public void setDataScrollerQueue(String dataScrollerQueue) {
+ this.dataScrollerQueue = dataScrollerQueue;
+ }
+
+ public String getDfsQueue() {
+ return dfsQueue;
+ }
+
+ public void setDfsQueue(String dfsQueue) {
+ this.dfsQueue = dfsQueue;
+ }
+
+ public boolean isCheckboxValue() {
+ return checkboxValue;
+ }
+
+ public void setCheckboxValue(boolean checkboxValue) {
+ this.checkboxValue = checkboxValue;
+ }
+
+ public String getCheckboxQueue() {
+ return checkboxQueue;
+ }
+
+ public void setCheckboxQueue(String checkboxQueue) {
+ this.checkboxQueue = checkboxQueue;
+ }
+
+ public Date getCalendarValue() {
+ return calendarValue;
+ }
+
+ public void setCalendarValue(Date calendarValue) {
+ this.calendarValue = calendarValue;
+ }
+
+ public String getCalendarQueue() {
+ return calendarQueue;
+ }
+
+ public void setCalendarQueue(String calendarQueue) {
+ this.calendarQueue = calendarQueue;
+ }
+
+ public QueueComponent(){
+ this.inputValue = "";
+ this.inputQueue = "org.richfaces.global_queue";
+ this.calendarValue = new Date();
+ this.calendarQueue = "namedQueue";
+ this.checkboxValue = false;
+ this.checkboxQueue = "formQueue";
+ this.dataScrollerValue = null;
+ this.dataScrollerQueue = "default";
+ this.radioValue = "org.richfaces.global_queue";
+ this.radioQueue = "org.richfaces.global_queue";
+ this.dfsQueue = "namedQueue";
+ this.selectMenuValue = "apple";
+ this.selectMenuQueue = "formQueue";
+ this.suggestionValue = "";
+ this.suggestionQueue = "default";
+ String[] qu = {"org.richfaces.global_queue", "namedQueue",
"formQueue", "default"};
+ queues = new ArrayList<SelectItem>();
+ for(int i=0; i<qu.length; i++){
+ queues.add(new SelectItem(qu[i], qu[i]));
+ }
+ }
+
+ public String getInputQueue() {
+ return inputQueue;
+ }
+
+ public void setInputQueue(String inputQueue) {
+ this.inputQueue = inputQueue;
+ }
+
+ public String getInputValue() {
+ return inputValue;
+ }
+
+ public void setInputValue(String inputValue) {
+ this.inputValue = inputValue;
+ }
+
+ public ArrayList<SelectItem> getQueues() {
+ return queues;
+ }
+
+ public void setQueues(ArrayList<SelectItem> queues) {
+ this.queues = queues;
+ }
+}
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/rich/RichBean.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/rich/RichBean.java 2008-11-25
16:40:07 UTC (rev 11369)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/rich/RichBean.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -77,6 +77,8 @@
map.add("DataGrid", add("/DataGrid/DataGrid", new boolean []
{false, true, false}));
map.add("ExtendedDataTable",
add("/ExtendedDataTable/ExtendedDataTable", new boolean [] {false, true,
false}));
map.add("Editor", add("/Editor/Editor", new boolean [] {true, true,
false}));
+ map.add("Queue", add("/Queue/Queue", new boolean [] {false, true,
true}));
+
Iterator<String> iterator = map.getSet().iterator();
while(iterator.hasNext()){
list.add(new SelectItem(iterator.next()));
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/sb/Sb.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/sb/Sb.java 2008-11-25
16:40:07 UTC (rev 11369)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/sb/Sb.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -4,15 +4,17 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
+//import javax.faces.context.FacesContext;
+//import javax.faces.event.ActionEvent;
+import javax.persistence.Entity;
+
import org.richfaces.helloworld.domain.util.componentInfo.ComponentInfo;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.component.html.HtmlSuggestionBox;
import org.richfaces.renderkit.html.SuggestionBoxRenderer;
-
+@Entity
@Name("sb")
@Scope(ScopeType.SESSION)
public class Sb implements Serializable {
@@ -107,15 +109,15 @@
setCities(getAllData());
}
- public void selectValue(ActionEvent actionEvent){
- System.out.println("----inside selectValue(ActionEvent actionEvent)-----");
- }
+// public void selectValue(ActionEvent actionEvent){
+// System.out.println("----inside selectValue(ActionEvent
actionEvent)-----");
+// }
+//
+// public void checkBinding(ActionEvent actionEvent) {
+// FacesContext context = FacesContext.getCurrentInstance();
+// bindLabel = mySuggestionBox.getClientId(context) + "; param: " +
mySuggestionBox.getParam();
+// }
- public void checkBinding(ActionEvent actionEvent) {
- FacesContext context = FacesContext.getCurrentInstance();
- bindLabel = mySuggestionBox.getClientId(context) + "; param: " +
mySuggestionBox.getParam();
- }
-
public List autocomplete(Object event) {
String pref = event.toString();
ArrayList result = new ArrayList();
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/componentInfo/ComponentInfo.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/componentInfo/ComponentInfo.java 2008-11-25
16:40:07 UTC (rev 11369)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/componentInfo/ComponentInfo.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -5,17 +5,15 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
+
import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
+import org.richfaces.helloworld.domain.util.parser.Attribute;
+import org.richfaces.helloworld.domain.util.parser.AttributesList;
+import org.richfaces.helloworld.domain.util.parser.TLDParser;
+
public class ComponentInfo {
private static volatile ComponentInfo INSTANCE;
private ComponentAttribute componentAttribute = new ComponentAttribute();
@@ -68,23 +66,50 @@
public void addField(Object component) {
if (component == null)
return;
- this.component = component;
+ this.component = component;
- //if(ve.isLiteralText()) {ve.getExpressionString()} {ve.getValue(). }
-
componentAttribute.cleanAll();
String str = null;
Field[] fields = component.getClass().getDeclaredFields();
+
+ String richName = null;
+ boolean isAjax = false;
+ if(component.getClass().getName().startsWith("org.richfaces.component.html.Html")){
+ richName =
component.getClass().getName().substring("org.richfaces.component.html.Html".length());
+ richName = richName.substring(0, 1).toLowerCase() + richName.substring(1,
richName.length());
+ } else
if(component.getClass().getName().startsWith("org.richfaces.component.UI")){
+ richName =
component.getClass().getName().substring("org.richfaces.component.UI".length());
+ richName = richName.substring(0, 1).toLowerCase() + richName.substring(1,
richName.length());
+ }else if(isAjax =
component.getClass().getName().startsWith("org.ajax4jsf.component.html.Html")){
+ richName =
component.getClass().getName().substring("org.ajax4jsf.component.html.Html".length());
+ richName = richName.substring(0, 1).toLowerCase() + richName.substring(1,
richName.length());
+ }else {
+ try {
+ throw new Exception("Unknown class for component!!!Component class:" +
component.getClass().getName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ TLDParser parser = new TLDParser(richName);
+ AttributesList allAttributes = parser.getAllAttributes();
+ for(Attribute s:allAttributes){
+ System.out.println(s.toString());
+ }
+
+ System.out.println("----------HANDLERS----------");
+ for(Attribute attr:allAttributes.getHandlers()){
+ System.out.println(attr.getName());
+ }
+
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
- if (!Modifier.isStatic(field.getModifiers())) {
- str = field.getName().substring(1);
+ str = field.getName().substring(1);
+ if (!Modifier.isStatic(field.getModifiers()) &&
(allAttributes.getNamesArray().contains(str) || isAjax)) {
if (str.startsWith("on")) {
componentAttribute.putEvent(str,
"");
} else if (str.indexOf("tyle") != -1 || str.indexOf("lass") !=
-1) {
- try {
- //Object obj = field.get(component);
+ try {
UIComponentBase comp = (UIComponentBase) component;
ValueExpression ve = comp.getValueExpression(str);
if(ve != null){
@@ -95,15 +120,14 @@
}
} else componentAttribute.putStyle(str, "null");
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
+ } catch (IllegalArgumentException e) {
e.printStackTrace();
}
} else {
try {
- Class cl = field.getType();
+ Class cl = field.getType();
if(cl.isPrimitive() || cl.getName().equals("java.lang.String")){
UIComponentBase comp = (UIComponentBase) component;
ValueExpression ve = comp.getValueExpression(str);
@@ -114,8 +138,6 @@
componentAttribute.putAttribute(str,
ve.getValue(FacesContext.getCurrentInstance().getELContext()).toString());
}
}else componentAttribute.putAttribute(str, "null");
-// Object obj = field.get(component);
-// componentAttribute.putAttribute(str, obj == null ? "null" :
obj.toString());
} else componentAttribute.putAttribute(str, "---");
} catch (IllegalArgumentException e) {
e.printStackTrace();
@@ -126,7 +148,7 @@
}
- public static String toString(Object obj) {
+ public static String toString(Object obj) {
Class cl = obj.getClass();
String r = cl.getName() + "[";
Class sc = cl.getSuperclass();
Modified:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/event/Event.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/event/Event.java 2008-11-25
16:40:07 UTC (rev 11369)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/event/Event.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -127,7 +127,16 @@
private String onitemmouseup;
private String onsetup;
private String onsave;
+ private String onsizeexceeded;
+ public String getOnsizeexceeded() {
+ return onsizeexceeded;
+ }
+
+ public void setOnsizeexceeded(String onsizeexceeded) {
+ this.onsizeexceeded = onsizeexceeded;
+ }
+
// showEvent('onkeypressInputID', 'onkeypress work!')
public Event() {
onsave = "showEvent('formID:infoSubview:onsaveInputID', 'onsave
work!')";
@@ -250,6 +259,7 @@
onbeforehide = "showEvent('formID:infoSubview:onbeforehideInputID',
'onbeforehide work!')";
onbeforeshow = "showEvent('formID:infoSubview:onbeforeshowInputID',
'onbeforeshow work!')";
onadd = "showEvent('formID:infoSubview:onaddInputID', 'onadd
work!')";
+ onsizeexceeded = "showEvent('formID:infoSubview:onsizeexceededInputID',
'onsizeexceeded work!')";
}
public String getOncontextmenu() {
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/Attribute.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/Attribute.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/Attribute.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,64 @@
+package org.richfaces.helloworld.domain.util.parser;
+
+public class Attribute {
+ private String name;
+ private String type;
+ private String description;
+ private Status status;
+
+ public Attribute(){
+ this.description = "";
+ }
+
+ public Attribute(String name){
+ this.name = name;
+ this.description = "";
+ }
+
+ public Attribute(String name, String type, String desc, Status status){
+ this.name = name;
+ this.type = type;
+ this.description = desc;
+ this.status = status;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString(){
+ return "[" + "Name: " + name + "\r\n" +
"Description: " + description + "\r\n" +
+ "Type: " + type + "\r\n" + "Status: " + status +
"]";
+ }
+}
+
+ enum Status {NOT_READY, IMPLEMENTED, FAILED, PASSED}
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/AttributesList.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/AttributesList.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/AttributesList.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,78 @@
+package org.richfaces.helloworld.domain.util.parser;
+
+import java.util.ArrayList;
+
+public class AttributesList extends ArrayList<Attribute> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3245089852351607636L;
+
+ public AttributesList(){
+ super();
+ }
+
+ public ArrayList<String> getNamesArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:this){
+ result.add(attr.getName());
+ }
+ return result;
+ }
+
+ public ArrayList<String> getDescriptionArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:this){
+ result.add(attr.getDescription());
+ }
+ return result;
+ }
+
+ public ArrayList<String> getTypeArray(){
+ ArrayList<String> result = new ArrayList<String>();
+ for(Attribute attr:this){
+ result.add(attr.getType());
+ }
+ return result;
+ }
+
+ public ArrayList<Status> getStatusArray(){
+ ArrayList<Status> result = new ArrayList<Status>();
+ for(Attribute attr:this){
+ result.add(attr.getStatus());
+ }
+ return result;
+ }
+
+ public ArrayList<Attribute> getHandlers(){
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for(Attribute attr:this){
+ if (attr.getName().startsWith("on")) {
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+
+ public ArrayList<Attribute> getStyles(){
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for(Attribute attr:this){
+ if (attr.getName().indexOf("tyle") != -1 ||
attr.getName().indexOf("lass") != -1) {
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+
+ public ArrayList<Attribute> getCommonAttributes(){
+ ArrayList<Attribute> result = new ArrayList<Attribute>();
+ for(Attribute attr:this){
+ if(!(attr.getName().startsWith("on") ||
(attr.getName().indexOf("tyle") != -1) ||
(attr.getName().indexOf("lass") != -1))){
+ result.add(attr);
+ }
+ }
+ return result;
+ }
+
+}
Added:
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/TLDParser.java
===================================================================
---
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/TLDParser.java
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/java/org/richfaces/helloworld/domain/util/parser/TLDParser.java 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,125 @@
+package org.richfaces.helloworld.domain.util.parser;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+public class TLDParser {
+
+ protected String component;
+ protected JarEntry tld;
+ protected JarFile richfacesUI;
+ protected AttributesList allAttributes;
+
+ public TLDParser(String str) {
+ this.component = str;
+ allAttributes = new AttributesList();
+ }
+
+ public AttributesList getAllAttributes() {
+
+ tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
+ InputStream input = null;
+ try {
+ input = richfacesUI.getInputStream(tld);
+
+ InputStreamReader isr = new InputStreamReader(input);
+ BufferedReader reader = new BufferedReader(isr);
+ String line, attr;
+ Attribute attribute = new Attribute();
+ int position, end;
+ boolean insideTag = true;
+ StringBuilder sb = new StringBuilder("");
+ while (((line = reader.readLine()) != null) && insideTag) {
+ if ((position = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ attr = line.substring(position + 6, end).trim();
+ if (attr.equalsIgnoreCase(component)) {
+ while (!(line = reader.readLine()).contains("</tag>")) {
+ if (line.contains("<attribute>")) {
+ do {
+ // find attribute name
+ if ((position = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ attribute.setName(line.substring(
+ position + 6, end).trim());
+ }
+ // find attribute description
+ if ((position = line.indexOf("<description>")) != -1) {
+
+ if((end = line.indexOf("</description>")) != -1){
+ attribute.setDescription(line.substring(position + 13, line.length()-14));
+ }else{
+ sb.append(line.substring(position + 13,
line.length()).trim().replaceAll("\t", ""));
+ line = reader.readLine();
+ while ((end = line.indexOf("</description>")) == -1) {
+ sb.append(line.substring(0, line.length()).replaceAll("\t",
""));
+ line = reader.readLine();
+ }
+ sb.append(line.substring(0, line.length() -
14).trim().replaceAll("\t", ""));
+
+ attribute.setDescription(sb.toString());
+ sb.delete(0, sb.length());
+ }
+ }
+ // find attribute type
+ if ((position = line.indexOf("<type>")) != -1) {
+ end = line.indexOf("</type>");
+ attribute.setType(line.substring(position + 6, end).trim());
+ }
+ // find attribute method-signature
+ if ((position = line.indexOf("<method-signature>")) != -1) {
+ end = line.indexOf("</method-signature>");
+ attribute.setType(line.substring(position + 18, end).trim());
+ }
+ } while (!((line = reader.readLine())
+ .contains("</attribute>")));
+ // define attribute status
+ attribute.setStatus(Status.NOT_READY);
+ allAttributes.add(attribute);
+ attribute = new Attribute();
+ }
+ }
+ insideTag = false;
+ }
+ }
+ }
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return allAttributes;
+ }
+
+ public String getExtPath() {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String resource = "META-INF/richfaces.tld";
+ return loader.getResource(resource).toString();
+ }
+
+ public String getComponent() {
+ return component;
+ }
+
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public JarFile getRichfacesUI() {
+ String temp = null;
+ int position;
+ try {
+ if ((position = getExtPath().indexOf('!')) != -1) {
+ temp = getExtPath().substring("jar:file:\\".length(), position);
+ }
+ richfacesUI = new JarFile(temp);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return richfacesUI;
+ }
+}
Added: trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml
(rev 0)
+++ trunk/test-applications/seamApp/web/src/main/webapp/Queue/Queue.xhtml 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,16 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich" id="queueSubviewID">
+
+ <a4j:queue binding="#{queue.myQueue}"
disabled="#{queue.disabled}"
+ ignoreDupResponses="#{queue.ignoreDupResponses}" name="formQueue"
+ onbeforedomupdate="#{event.onbeforedomupdate}"
+ oncomplete="#{event.oncomplete}" onerror="#{event.onerror}"
+ onsizeexceeded="#{event.onsizeexceeded}"
onsubmit="#{event.onsubmit}"
+ rendered="#{queue.rendered}" requestDelay="#{queue.requestDelay}"
+ size="#{queue.size}"
+ sizeExceededBehavior="#{queue.sizeExceededBehavior}"
+ timeout="#{queue.timeout}" />
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueDefault.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueDefault.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueDefault.xhtml 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,5 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich" id="queueDefaultSubviewID"
\ No newline at end of file
Added: trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueProperty.xhtml 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,40 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
id="queuePropertySubviewID">
+
+ <h:commandButton value="add test"
+ action="#{queue.addQueue}"></h:commandButton>
+ <h:panelGrid columns="2">
+ <h:outputText value="disabled" />
+ <h:selectBooleanCheckbox value="#{queue.disabled}"
onclick="submit()" />
+
+ <h:outputText value="ignoreDupResponses" />
+ <h:selectBooleanCheckbox value="#{queue.ignoreDupResponses}"
+ onclick="submit()" />
+
+ <h:outputText value="rendered" />
+ <h:selectBooleanCheckbox value="#{queue.rendered}"
onclick="submit()" />
+
+ <h:outputText value="requestDelay" />
+ <h:inputText value="#{queue.requestDelay}">
+ <a4j:support event="onchange"
reRender="queueID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="size" />
+ <h:inputText value="#{queue.size}">
+ <a4j:support event="onchange"
reRender="queueID"></a4j:support>
+ </h:inputText>
+
+ <h:outputText value="sizeExceededBehavior" />
+ <h:panelGroup>
+ <h:inputText value="#{queue.sizeExceededBehavior}"
+ id="sizeExceededBehaviorID">
+ <a4j:support event="onchange"
reRender="queueID"></a4j:support>
+ </h:inputText>
+ <h:outputLabel value="dropNext, dropNew, fireNext, fireNew"
for="sizeExceededBehaviorID" />
+ </h:panelGroup>
+
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added:
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueStraightforward.xhtml
===================================================================
--- trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueStraightforward.xhtml
(rev 0)
+++
trunk/test-applications/seamApp/web/src/main/webapp/Queue/QueueStraightforward.xhtml 2008-11-25
17:07:46 UTC (rev 11370)
@@ -0,0 +1,167 @@
+<f:subview
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+ id="queueStraightforwardSubviewID">
+ <h:panelGrid columns="3" id="panelID" border="1"
+ style="text-align:center;">
+
+ <h:outputText value="Component name" style="FONT-WEIGHT: bold;"
/>
+ <h:outputText value="Component" style="FONT-WEIGHT: bold;"
/>
+ <h:outputText value="Select eventsQueue" style="FONT-WEIGHT:
bold;" />
+
+ <h:outputText value="h:inputText" />
+ <h:inputText value="#{queueComponent.inputValue}"
id="inputID">
+ <a4j:support id="inputSupport" event="onblur"
+ eventsQueue="#{queueComponent.inputQueue}"></a4j:support>
+ </h:inputText>
+
+ <h:selectOneMenu value="#{queueComponent.inputQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="rich:calendar" />
+ <rich:calendar id="calendarID"
value="#{queueComponent.calendarValue}"
+ eventsQueue="#{queueComponent.calendarQueue}">
+ </rich:calendar>
+
+ <h:selectOneMenu value="#{queueComponent.calendarQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="h:selectBooleanCheckbox" />
+ <h:selectBooleanCheckbox value="#{queueComponent.checkboxValue}"
+ id="checkboxID">
+ <a4j:support id="checkboxSupport" event="onchange"
+ eventsQueue="#{queueComponent.checkboxQueue}"></a4j:support>
+ </h:selectBooleanCheckbox>
+
+ <h:selectOneMenu value="#{queueComponent.checkboxQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="rich:dataScroller" />
+ <rich:datascroller for="dataTableId" reRender="dataTableId"
+ boundaryControls="#{dataScroller.boundaryControls}"
+ fastStep="#{dataScroller.fastStep}" id="dsID"
+ page="#{dataScroller.page}"
+ value="#{queueComponent.dataScrollerValue}"
+ stepControls="#{dataScroller.stepControls}"
+ eventsQueue="#{queueComponent.dataScrollerQueue}"
+ fastControls="#{dataScroller.fastControls}"
+ action="#{dataScroller.act}"
+ actionListener="#{dataScroller.actListener}" maxPages="10"
+ scrollerListener="#{dataScroller.ScrollerListener}">
+ </rich:datascroller>
+
+ <h:selectOneMenu value="#{queueComponent.dataScrollerQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="h:selectOneRadio" />
+ <h:selectOneRadio value="#{queueComponent.radioValue}">
+ <a4j:support id="radioSupport" event="onblur"
+ eventsQueue="#{queueComponent.radioQueue}"></a4j:support>
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneRadio>
+
+ <h:selectOneMenu value="#{queueComponent.radioQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="rich:dataFilterSlider" />
+ <rich:dataFilterSlider sliderListener="#{dfs.doSlide}"
+ action="#{dfs.act}" forValRef="dataScroller.dataTable"
+ actionListener="#{dfs.actListener}" for="dataTableId"
+ filterBy="getInt0" storeResults="true" startRange="0"
endRange="999"
+ increment="9" manualInput="true" width="400px"
trailer="true"
+ handleValue="999" id="dfsID"
eventsQueue="#{queueComponent.dfsQueue}"></rich:dataFilterSlider>
+
+ <h:selectOneMenu value="#{queueComponent.dfsQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="h:selectOneMenu" />
+ <h:selectOneMenu value="#{queueComponent.selectMenuValue}">
+ <f:selectItem itemLabel="apple" itemValue="apple" />
+ <f:selectItem itemLabel="kiwi" itemValue="kiwi" />
+ <f:selectItem itemLabel="pineapple" itemValue="pineapple"
/>
+ <a4j:support id="selectMenuSupport" event="onchange"
+ eventsQueue="#{queueComponent.selectMenuQueue}"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:selectOneMenu value="#{queueComponent.selectMenuQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="rich:suggestionbox" />
+ <h:panelGroup>
+ <h:inputText value="#{queueComponent.suggestionValue}"
id="text">
+ <f:validateLength minimum="0" maximum="30" />
+ </h:inputText>
+ <rich:suggestionbox id="suggestionBoxId"
+ bypassUpdates="#{sb.bypassUpdates}"
cellpadding="#{sb.cellpadding}"
+ cellspacing="#{sb.cellspacing}"
+ eventsQueue="#{queueComponent.suggestionQueue}"
+ fetchValue="#{result.text}" first="#{sb.first}"
for="text"
+ height="#{sb.height}"
ignoreDupResponses="#{sb.ignoreDupResponses}"
+ limitToList="false" minChars="#{sb.minchars}"
+ nothingLabel="#{sb.nothingLabel}"
+ usingSuggestObjects="#{sb.usingSuggestObjects}"
+ requestDelay="#{sb.requestDelay}"
selfRendered="#{sb.selfRendered}"
+ var="result" suggestionAction="#{sb.autocomplete}"
+ width="#{sb.width}" tokens="#{sb.tokens}">
+ <h:column>
+ <h:outputText value="#{result.city}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.contry}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{result.flag}" />
+ </h:column>
+ <h:column>
+ <a4j:htmlCommandLink actionListener="#{sb.selectValue}"
+ value="Click me!" />
+ </h:column>
+ </rich:suggestionbox>
+ </h:panelGroup>
+
+ <h:selectOneMenu value="#{queueComponent.suggestionQueue}"
+ onchange="submit();">
+ <f:selectItems value="#{queueComponent.queues}" />
+ </h:selectOneMenu>
+
+ </h:panelGrid>
+
+ <rich:separator width="100%"
height="10px"></rich:separator>
+ <rich:dataTable id="dataTableId"
value="#{dataScroller.dataTable}"
+ var="dT" cellpadding="5px" rows="5" border="1"
+ reRender="dsID,dataTableId"
sortMode="#{dataScroller.sortMode}">
+ <f:facet name="header">
+ <h:outputText value="Header" />
+ </f:facet>
+ <f:facet name="footer">
+
+ </f:facet>
+ <rich:column sortBy="#{dT.str0}" filterBy="#{dT.str0}"
+ filterEvent="onkeyup" selfSorted="#{dataScroller.selfSorted}"
+ filterValue="#{dataScroller.filterValue}">
+ <h:outputText value="#{dT.str0}" />
+ </rich:column>
+ <rich:column sortBy="#{dT.int0}" filterBy="#{dT.int0}"
+ filterEvent="onkeyup" selfSorted="#{dataScroller.selfSorted}">
+ <h:outputText value="#{dT.int0} " />
+ </rich:column>
+ </rich:dataTable>
+
+
+</f:subview>
\ No newline at end of file