Author: mvitenkov
Date: 2008-07-14 05:48:21 -0400 (Mon, 14 Jul 2008)
New Revision: 9556
Modified:
trunk/test-applications/jsp/src/main/java/calendar/CalendarBean.java
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
trunk/test-applications/jsp/src/main/java/util/style/Style.java
trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBox.jsp
Log:
componentInfo correction
Modified: trunk/test-applications/jsp/src/main/java/calendar/CalendarBean.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/calendar/CalendarBean.java 2008-07-12
16:04:47 UTC (rev 9555)
+++ trunk/test-applications/jsp/src/main/java/calendar/CalendarBean.java 2008-07-14
09:48:21 UTC (rev 9556)
@@ -100,6 +100,7 @@
private boolean showFooter;
private boolean resetTimeOnDateSelect;
private String defaultTime;
+ private boolean ignoreDupResponses;
private HtmlCalendar htmlCalendar = null;
public HtmlCalendar getHtmlCalendar() {
@@ -217,6 +218,7 @@
timeZone = "Eastern European Time";
preloadDateRangeBegin = "11.11.2007"; //d.m.y
preloadDateRangeEnd = "01.01.2008";
+ ignoreDupResponses = true;
}
@@ -505,6 +507,7 @@
}
public void ddd(ValueChangeEvent event) {
+ System.out.println("=============inside valueChangeListener==========");
System.out.println(event.getOldValue());
System.out.println(event.getNewValue());
@@ -790,4 +793,14 @@
ComponentInfo info = ComponentInfo.getInstance();
info.addField(htmlCalendar);
}
+
+
+ public boolean isIgnoreDupResponses() {
+ return ignoreDupResponses;
+ }
+
+
+ public void setIgnoreDupResponses(boolean ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
}
Modified: trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
===================================================================
---
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-07-12
16:04:47 UTC (rev 9555)
+++
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-07-14
09:48:21 UTC (rev 9556)
@@ -12,13 +12,42 @@
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;
public class ComponentInfo {
private static volatile ComponentInfo INSTANCE;
private ComponentAttribute componentAttribute = new ComponentAttribute();
private Object component = null;
-
+ private String beanName;
+ private String description;
+ private String attribute;
+ private String property;
+ private boolean print;
+
+ public ComponentInfo(String beanName) {
+ this.beanName = beanName;
+ this.attribute = "";
+ this.property = "";
+ print = true;
+ }
+
+ public void setComponentInfo(String attribute, String property) {
+ this.attribute = attribute;
+ this.property = property;
+ this.description = "";
+ if(print) printInfo();
+ }
+
+ public void setComponentInfo(String attribute, String property, String description) {
+ this.attribute = attribute;
+ this.property = property;
+ this.description = description;
+ if(print) printInfo();
+ }
+
protected ComponentInfo() {
}
@@ -41,26 +70,35 @@
if (component == null)
return;
this.component = component;
+
+ //if(ve.isLiteralText()) {ve.getExpressionString()} {ve.getValue(). }
+
componentAttribute.cleanAll();
String str = null;
Field[] fields = component.getClass().getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())) {
- str = field.getName().substring(1);
+ str = field.getName().substring(1);
if (str.startsWith("on")) {
componentAttribute.putEvent(str,
"");
} else if (str.indexOf("tyle") != -1 || str.indexOf("lass") !=
-1) {
try {
- Object obj = field.get(component);
- componentAttribute.putStyle(str, obj == null ? "null" : obj.toString());
+ //Object obj = field.get(component);
+ UIComponentBase comp = (UIComponentBase) component;
+ ValueExpression ve = comp.getValueExpression(str);
+ if(ve != null){
+ if(ve.isLiteralText()){
+ componentAttribute.putStyle(str, ve == null ? "null" :
ve.getExpressionString());
+ } else{
+ componentAttribute.putStyle(str, ve == null ? "null" :
ve.getValue(FacesContext.getCurrentInstance().getELContext()).toString());
+ }
+ }
+
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
} else {
@@ -68,13 +106,20 @@
try {
Class cl = field.getType();
if(cl.isPrimitive() || cl.getName().equals("java.lang.String")){
- Object obj = field.get(component);
- componentAttribute.putAttribute(str, obj == null ? "null" :
obj.toString());
+ UIComponentBase comp = (UIComponentBase) component;
+ ValueExpression ve = comp.getValueExpression(str);
+ if(ve != null){
+ if(ve.isLiteralText()){
+ componentAttribute.putAttribute(str, ve.getExpressionString());
+ } else{
+ componentAttribute.putAttribute(str,
ve.getValue(FacesContext.getCurrentInstance().getELContext()).toString());
+ }
+ }
+// Object obj = field.get(component);
+// componentAttribute.putAttribute(str, obj == null ? "null" :
obj.toString());
} else componentAttribute.putAttribute(str, "---");
} catch (IllegalArgumentException e) {
e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
}
}
}
@@ -82,6 +127,34 @@
}
+ public static String toString(Object obj) {
+ Class cl = obj.getClass();
+ String r = cl.getName() + "[";
+ Class sc = cl.getSuperclass();
+ if (!sc.equals(Object.class))
+ r += sc + ",";
+ Field[] fields = cl.getDeclaredFields();
+ try {
+ AccessibleObject.setAccessible(fields, true);
+ } catch (SecurityException e) {
+ }
+ for (int i = 0; i < fields.length; i++) {
+ Field f = fields[i];
+ r += f.getName() + "=";
+ try {
+ Object val = f.get(obj);
+ r += val.toString();
+ } catch (IllegalAccessException e) {
+ r += "???";
+ }
+ if (i < fields.length - 1)
+ r += ",";
+ else
+ r += "]";
+ }
+ return r;
+ }
+
public Object invoke(String aMethod, Class[] params, Object[] args) {
Method m;
System.out.println("ComponentInfo.invoke()");
@@ -105,8 +178,69 @@
return "";
}
}
-
+
+ private void printInfo() {
+ System.out.println("beanName: " + beanName + "[attribute: " +
attribute + "; property: " + property + "; description: " +
description + "];");
+ }
+
+ public String [] getComponentInfo() {
+ String [] str = {attribute, property};
+ return str;
+ }
+
public ComponentAttribute getComponentAttribute() {
return componentAttribute;
}
+
+ public Object getComponent() {
+ return component;
+ }
+
+ public void setComponent(Object component) {
+ this.component = component;
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public void setBeanName(String beanName) {
+ this.beanName = beanName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getAttribute() {
+ return attribute;
+ }
+
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public boolean isPrint() {
+ return print;
+ }
+
+ public void setPrint(boolean print) {
+ this.print = print;
+ }
+
+ public void setComponentAttribute(ComponentAttribute componentAttribute) {
+ this.componentAttribute = componentAttribute;
+ }
}
Modified: trunk/test-applications/jsp/src/main/java/util/style/Style.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/style/Style.java 2008-07-12 16:04:47
UTC (rev 9555)
+++ trunk/test-applications/jsp/src/main/java/util/style/Style.java 2008-07-14 09:48:21
UTC (rev 9556)
@@ -66,7 +66,7 @@
private String trailerStyleClass;
private String barClass;
private String handleStyle;
-
+ private String contentStyle;
private String styleA;
private String styleClassA;
private String selectStyleA;
@@ -141,7 +141,7 @@
trailerStyleClass = "trailerStyleClass";
barClass = "barClass";
handleStyle = "handleStyle";
-
+ contentStyle = "contentStyle";
styleA = "styleA";
styleClassA = "styleClassA";
selectStyleA = "selectStyleA";
@@ -737,4 +737,12 @@
public void setControlsClass(String controlsClass) {
this.controlsClass = controlsClass;
}
+
+ public String getContentStyle() {
+ return contentStyle;
+ }
+
+ public void setContentStyle(String contentStyle) {
+ this.contentStyle = contentStyle;
+ }
}
Modified: trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBox.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBox.jsp 2008-07-12
16:04:47 UTC (rev 9555)
+++ trunk/test-applications/jsp/src/main/webapp/SuggestionBox/SuggestionBox.jsp 2008-07-14
09:48:21 UTC (rev 9556)
@@ -37,15 +37,12 @@
onobjectchange="#{event.onobjectchange}"
onselect="#{event.onselect}"
onsubmit="#{event.onsubmit}"
-
- popupStyle="background-color: black"
-
+ popupStyle="background-color: black;"
usingSuggestObjects="#{sb.usingSuggestObjects}"
reRender="label"
rendered="#{sb.rendered}"
requestDelay="#{sb.requestDelay}"
- selfRendered="#{sb.selfRendered}"
- value="#{sb.value}"
+ selfRendered="#{sb.selfRendered}"
var="result"
suggestionAction="#{sb.autocomplete}"
width="#{sb.width}"
@@ -73,7 +70,7 @@
<h:outputText value="#{result.flag}" />
</h:column>
<h:column>
- <h:outputLink
value="http://www.jboss.com/"><f:verbatim>Link</f:v...
+ <a4j:htmlCommandLink actionListener="#{sb.selectValue}"
value="Click me!"/>
</h:column>
</rich:suggestionbox>
<div id="label" style="position: relative; font-size: 50px; z-index:
2; color: navy">z-index</div>