You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2006/07/25 04:42:46 UTC
svn commit: r425276 [10/12] - in
/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src:
main/java/org/apache/myfaces/adfinternal/agent/
main/java/org/apache/myfaces/adfinternal/agent/parse/
main/java/org/apache/myfaces/adf...
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/ComponentDefinition.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/ComponentDefinition.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/ComponentDefinition.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/ComponentDefinition.java Mon Jul 24 21:42:41 2006
@@ -13,116 +13,116 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import org.apache.myfaces.adfinternal.share.expl.Coercions;
-
-public class ComponentDefinition
-{
- public ComponentDefinition(String componentType, FacesConfigInfo info)
- {
- _componentType = componentType;
- _info = info;
- }
-
- public FacesConfigInfo.ComponentInfo getComponentInfo()
- {
- return _info.getComponentInfo(_componentType);
- }
-
- public boolean isUsesUpload()
- {
- return _usesUpload;
- }
-
- public void setUsesUpload(boolean usesUpload)
- {
- _usesUpload = usesUpload;
- }
-
- public UIComponent createComponent(FacesContext context)
- {
- Application appl = context.getApplication();
- UIComponent comp = appl.createComponent(_componentType);
- FacesConfigInfo.ComponentInfo info = getComponentInfo();
-
- Iterator names = _attributes.keySet().iterator();
- while (names.hasNext())
- {
- String name = (String) names.next();
- String valueStr = (String) _attributes.get(name);
- if (isValueExpression(valueStr))
- {
- ValueBinding binding = context.getApplication().
- createValueBinding(valueStr);
- comp.setValueBinding(name, binding);
- }
- else
- {
- FacesConfigInfo.PropertyInfo propertyInfo = info.getPropertyInfo(name);
- Object value;
- if (propertyInfo.type == null)
- value = valueStr;
- else
- value = Coercions.coerce(null, valueStr, propertyInfo.type);
- comp.getAttributes().put(name, value);
- }
- }
-
- Iterator children = getChildren().iterator();
- while (children.hasNext())
- {
- ComponentDefinition cd = (ComponentDefinition) children.next();
- comp.getChildren().add(cd.createComponent(context));
- }
-
- Iterator facets = getFacets().keySet().iterator();
- while (facets.hasNext())
- {
- String name = (String) facets.next();
- ComponentDefinition cd = (ComponentDefinition) getFacets().get(name);
- comp.getFacets().put(name, cd.createComponent(context));
- }
-
- return comp;
- }
-
- static public boolean isValueExpression(String expression)
- {
- return ((expression != null) &&
- expression.startsWith("#{") &&
- expression.endsWith("}"));
- }
-
- public Map getAttributes()
- {
- return _attributes;
- }
-
- public Map getFacets()
- {
- return _facets;
- }
-
- public List getChildren()
- {
- return _children;
- }
-
- private final String _componentType;
- private boolean _usesUpload;
- private final Map _attributes = new HashMap();
- private final Map _facets = new HashMap();
- private final List _children = new ArrayList();
- private final FacesConfigInfo _info;
-}
+package org.apache.myfaces.adfinternal.renderkit;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import org.apache.myfaces.adfinternal.share.expl.Coercions;
+
+public class ComponentDefinition
+{
+ public ComponentDefinition(String componentType, FacesConfigInfo info)
+ {
+ _componentType = componentType;
+ _info = info;
+ }
+
+ public FacesConfigInfo.ComponentInfo getComponentInfo()
+ {
+ return _info.getComponentInfo(_componentType);
+ }
+
+ public boolean isUsesUpload()
+ {
+ return _usesUpload;
+ }
+
+ public void setUsesUpload(boolean usesUpload)
+ {
+ _usesUpload = usesUpload;
+ }
+
+ public UIComponent createComponent(FacesContext context)
+ {
+ Application appl = context.getApplication();
+ UIComponent comp = appl.createComponent(_componentType);
+ FacesConfigInfo.ComponentInfo info = getComponentInfo();
+
+ Iterator names = _attributes.keySet().iterator();
+ while (names.hasNext())
+ {
+ String name = (String) names.next();
+ String valueStr = (String) _attributes.get(name);
+ if (isValueExpression(valueStr))
+ {
+ ValueBinding binding = context.getApplication().
+ createValueBinding(valueStr);
+ comp.setValueBinding(name, binding);
+ }
+ else
+ {
+ FacesConfigInfo.PropertyInfo propertyInfo = info.getPropertyInfo(name);
+ Object value;
+ if (propertyInfo.type == null)
+ value = valueStr;
+ else
+ value = Coercions.coerce(null, valueStr, propertyInfo.type);
+ comp.getAttributes().put(name, value);
+ }
+ }
+
+ Iterator children = getChildren().iterator();
+ while (children.hasNext())
+ {
+ ComponentDefinition cd = (ComponentDefinition) children.next();
+ comp.getChildren().add(cd.createComponent(context));
+ }
+
+ Iterator facets = getFacets().keySet().iterator();
+ while (facets.hasNext())
+ {
+ String name = (String) facets.next();
+ ComponentDefinition cd = (ComponentDefinition) getFacets().get(name);
+ comp.getFacets().put(name, cd.createComponent(context));
+ }
+
+ return comp;
+ }
+
+ static public boolean isValueExpression(String expression)
+ {
+ return ((expression != null) &&
+ expression.startsWith("#{") &&
+ expression.endsWith("}"));
+ }
+
+ public Map getAttributes()
+ {
+ return _attributes;
+ }
+
+ public Map getFacets()
+ {
+ return _facets;
+ }
+
+ public List getChildren()
+ {
+ return _children;
+ }
+
+ private final String _componentType;
+ private boolean _usesUpload;
+ private final Map _attributes = new HashMap();
+ private final Map _facets = new HashMap();
+ private final List _children = new ArrayList();
+ private final FacesConfigInfo _info;
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/ComponentDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitPerf.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitPerf.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitPerf.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitPerf.java Mon Jul 24 21:42:41 2006
@@ -13,457 +13,457 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit;
-
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.html.HtmlDataTable;
-import javax.faces.component.html.HtmlInputText;
-import javax.faces.component.html.HtmlOutputText;
-import javax.faces.component.html.HtmlSelectOneMenu;
-import javax.faces.component.html.HtmlSelectOneRadio;
-import javax.faces.component.UISelectItem;
-import javax.faces.render.Renderer;
-
-import org.apache.myfaces.adf.component.core.CoreDocument;
-import org.apache.myfaces.adf.component.core.CoreForm;
-import org.apache.myfaces.adf.component.core.data.CoreColumn;
-import org.apache.myfaces.adf.component.core.data.CoreTable;
-import org.apache.myfaces.adf.component.core.data.CoreSelectRangeChoiceBar;
-import org.apache.myfaces.adf.component.core.layout.CorePanelGroup;
-import org.apache.myfaces.adf.component.core.output.CoreOutputText;
-import org.apache.myfaces.adf.component.core.output.CoreOutputFormatted;
-import org.apache.myfaces.adf.component.core.input.CoreInputHidden;
-import org.apache.myfaces.adf.component.core.input.CoreInputText;
-import org.apache.myfaces.adf.component.core.input.CoreSelectOneChoice;
-import org.apache.myfaces.adf.component.core.input.CoreSelectOneRadio;
-import org.apache.myfaces.adf.component.core.input.CoreSelectInputDate;
-import org.apache.myfaces.adf.component.core.input.CoreSelectItem;
-
-
-
-public class CoreRenderKitPerf extends RenderKitPerfTestCase
-{
- public CoreRenderKitPerf() throws IOException, SAXException
- {
- }
-
- public CoreRenderKitPerf(String testName) throws IOException, SAXException
- {
- super(testName);
- }
-
- public void testSimplePerf() throws IOException
- {
- CoreOutputText out = _createCoreOutputText();
- out.setValue("Plain value");
- UIViewRoot root = createTestTree(out, "testSimplePerf()");
- renderRoot(root);
-
- root = createTestTree(out, "testSimplePerf() 2");
- renderRoot(root);
- }
-
- public void testManyAttributes() throws IOException
- {
- CoreOutputText out = _createCoreOutputText();
- out.setValue("Plain value");
- out.setEscape(true);
- out.setId("OutId");
- out.setShortDesc("Short Desc");
- out.setStyleClass("Style Class");
- out.setOnclick("on click");
-
- /*
- out.setTruncateAt(100);
- out.setOnclick("on click");
- out.setOndblclick("on dblclick");
- out.setOnkeydown("on keydown");
- out.setOnkeyup("on keyup");
- out.setOnkeypress("on keypress ");
- out.setOnmousedown("on mousedown");
- out.setOnmousemove("on mousemove");
- out.setOnmouseout("on mouseout ");
- out.setOnmouseover("on mouseover ");
- out.setOnmouseup("on mouseup ");*/
-
- UIViewRoot root = createTestTree(out, "testManyAttributes()");
- renderRoot(root);
-
- root = createTestTree(out, "testManyAttributes() 2");
- renderRoot(root);
- }
-
- public void testManyInputAttributes() throws IOException
- {
- CoreInputText out = new CoreInputText();
-
- out.setSimple(true);
- out.setValue("Plain value");
- out.setId("OutId");
- out.setShortDesc("Short Desc");
- out.setStyleClass("Style Class");
- out.setOnclick("on click");
-
- out.setOnclick("on click");
- out.setOndblclick("on dblclick");
- out.setOnkeydown("on keydown");
- out.setOnkeyup("on keyup");
- out.setOnkeypress("on keypress ");
- out.setOnmousedown("on mousedown");
- out.setOnmousemove("on mousemove");
- out.setOnmouseout("on mouseout ");
- out.setOnmouseover("on mouseover ");
- out.setOnmouseup("on mouseup ");
-
- UIViewRoot root = createTestTree(out, "testManyInputAttributes()");
- renderRoot(root);
-
- root = createTestTree(out, "testManyInputAttributes() 2");
- renderRoot(root);
- }
-
- public void testRIManyInputAttributes() throws IOException
- {
- HtmlInputText out = new HtmlInputText();
- out.setValue("Plain value");
- out.setId("OutId");
- out.setTitle("Title");
- out.setStyleClass("Style Class");
- out.setOnclick("on click");
-
- out.setOnclick("on click");
- out.setOndblclick("on dblclick");
- out.setOnkeydown("on keydown");
- out.setOnkeyup("on keyup");
- out.setOnkeypress("on keypress ");
- out.setOnmousedown("on mousedown");
- out.setOnmousemove("on mousemove");
- out.setOnmouseout("on mouseout ");
- out.setOnmouseover("on mouseover ");
- out.setOnmouseup("on mouseup ");
-
- UIViewRoot root = createTestTree(out, "testRIManyInputAttributes()");
- renderRoot(root);
-
- root = createTestTree(out, "testRIManyInputAttributes() 2");
- renderRoot(root);
- }
-
-
- public void testManyNonSimpleInputAttributes() throws IOException
- {
- CoreInputText out = new CoreInputText();
- out.setSimple(false);
- out.setValue("Plain value");
- out.setId("OutId");
- out.setShortDesc("Short Desc");
- out.setStyleClass("Style Class");
- out.setOnclick("on click");
-
- out.setOnclick("on click");
- out.setOndblclick("on dblclick");
- out.setOnkeydown("on keydown");
- out.setOnkeyup("on keyup");
- out.setOnkeypress("on keypress ");
- out.setOnmousedown("on mousedown");
- out.setOnmousemove("on mousemove");
- out.setOnmouseout("on mouseout ");
- out.setOnmouseover("on mouseover ");
- out.setOnmouseup("on mouseup ");
-
- UIViewRoot root = createTestTree(out, "testManyNonSimpleInputAttributes()");
- renderRoot(root);
-
- root = createTestTree(out, "testManyNonSimpleInputAttributes() 2");
- renderRoot(root);
- }
-
-
- public void testRISimplePerf() throws IOException
- {
- HtmlOutputText out = _createHtmlOutputText();
- out.setValue("Plain value");
- UIViewRoot root = createTestTree(out, "testRISimplePerf()");
- renderRoot(root);
-
- root = createTestTree(out, "testRISimplePerf() 2");
- renderRoot(root);
- }
-
- public void testRIManyAttributes() throws IOException
- {
- HtmlOutputText out = _createHtmlOutputText();
- out.setValue("Plain value");
- out.setEscape(true);
- out.setId("OutId");
- out.setTitle("Short Desc");
- out.setStyleClass("Style Class");
- out.setStyle("The Style");
-
- UIViewRoot root = createTestTree(out, "testRIManyAttributes()");
- renderRoot(root);
-
- root = createTestTree(out, "testRIManyAttributes() 2");
- renderRoot(root);
- }
-
-
- public void testRITable() throws IOException
- {
- HtmlDataTable table = new HtmlDataTable();
- ArrayList l = new ArrayList();
- for (int i = 0 ; i < 10; i++)
- l.add(new Integer(i));
- table.setValue(l);
- table.setStyleClass("TableContent");
- table.setHeaderClass("af_column_header-text SomeBorderStyle");
- table.setColumnClasses("af_column_cell-text OraTableBorder1111");
-
- for (int i = 0 ; i < 3; i++)
- {
- UIColumn col = new UIColumn();
- /*
- HtmlOutputText header = new HtmlOutputText();
- header.setValue("Header " + i);
- col.setHeader(header);
- //HtmlOutputText text = new HtmlOutputText();
- HtmlInputText text = new HtmlInputText();
- text.setValue("Column " + i);
- col.getChildren().add(text);
- */
-
- col.setHeader(new NullComp());
- col.getChildren().add(new NullComp());
- table.getChildren().add(col);
- }
-
- UIViewRoot root = createTestTree(table, "testRITable()", 500);
- renderRoot(root);
- }
-
-
- public void testTable() throws IOException
- {
- CoreTable table = new CoreTable();
- ArrayList l = new ArrayList();
- for (int i = 0 ; i < 10; i++)
- l.add(new Integer(i));
- table.setValue(l);
-
- for (int i = 0 ; i < 3; i++)
- {
- CoreColumn col = new CoreColumn();
-
- /*
- col.setHeaderText("Header " + i);
- // Use headerText instead of adding the facet; easier and faster.
- //CoreOutputText header = new CoreOutputText();
- //header.setValue("Header " + i);
- //col.setHeader(header);
- //CoreOutputText text = new CoreOutputText();
- CoreInputText text = new CoreInputText();
- text.setSimple(true);
- text.setValue("Column " + i);
- col.getChildren().add(text);
- */
- col.setHeader(new NullComp());
- col.getChildren().add(new NullComp());
- table.getChildren().add(col);
- }
-
- UIViewRoot root = createTestTree(table, "testTable()", 500);
- renderRoot(root);
- }
-
-
- public void testPanelGroupPerf() throws IOException
- {
- CorePanelGroup group = new CorePanelGroup();
- group.setLayout(CorePanelGroup.LAYOUT_VERTICAL);
- for (int i = 0; i < 8; i++)
- {
- /*
- CoreOutputText out = _createCoreOutputText();
- out.setValue("Plain value");
- group.getChildren().add(out);*/
- group.getChildren().add(new NullComp());
- }
-
- UIViewRoot root = createTestTree(group, "testPanelGroup()");
- renderRoot(root);
-
- root = createTestTree(group, "testPanelGroup() 2");
- renderRoot(root);
- }
-
- public void testInputHidden() throws IOException
- {
- CoreInputHidden cih = new CoreInputHidden();
- cih.setValue("value");
-
- UIViewRoot root = createTestTree(cih, "testInputHidden");
- renderRoot(root);
- }
-
-
- public void notestSelectRangeChoicePerf() throws IOException
- {
- CoreSelectRangeChoiceBar bar = new CoreSelectRangeChoiceBar();
- bar.setValue(new MVariableResolver.BigList());
- bar.setRows(30);
-
- UIViewRoot root = createTestTree(bar, "testSelectRangeChoiceBar");
- renderRoot(root);
- }
-
-
- public void notestSelectInputDate() throws IOException
- {
- CoreSelectInputDate date = new CoreSelectInputDate();
- date.setLabel("Label");
-
- UIViewRoot root = createTestTree(date, "testSelectInputDate");
- renderRoot(root);
- }
-
- public void testSelectOneChoice() throws IOException
- {
- CoreSelectOneChoice choice = new CoreSelectOneChoice();
- choice.setSimple(true);
- choice.setValue(new Integer(2));
- for (int i = 0 ; i < 10; i++)
- {
- UISelectItem selectItem = new UISelectItem();
- selectItem.setItemLabel("Item " + i);
- selectItem.setItemValue(new Integer(i));
- choice.getChildren().add(selectItem);
- }
-
- UIViewRoot root = createTestTree(choice, "testSelectOneChoice");
- renderRoot(root);
-
- root = createTestTree(choice, "testSelectOneChoice2");
- renderRoot(root);
- }
-
-
- public void testRISelectOneMenu() throws IOException
- {
- //
- HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
- menu.setValue(new Integer(2));
- for (int i = 0 ; i < 10; i++)
- {
- UISelectItem selectItem = new UISelectItem();
- selectItem.setItemLabel("Item " + i);
- selectItem.setItemValue("" + i);
- menu.getChildren().add(selectItem);
- }
-
- UIViewRoot root = createTestTree(menu, "testRISelectOneMenu");
- renderRoot(root);
-
- root = createTestTree(menu, "testRISelectOneNavigation2");
- renderRoot(root);
- }
-
-
- public void testSelectOneRadio() throws IOException
- {
- CoreSelectOneRadio radio = new CoreSelectOneRadio();
- radio.setSimple(true);
- radio.setValue(new Integer(2));
- for (int i = 0 ; i < 10; i++)
- {
- UISelectItem selectItem = new UISelectItem();
- selectItem.setItemLabel("Item " + i);
- selectItem.setItemValue(new Integer(i));
- radio.getChildren().add(selectItem);
- }
-
- UIViewRoot root = createTestTree(radio, "testSelectOneRadio");
- renderRoot(root);
-
- root = createTestTree(radio, "testSelectOneRadio2");
- renderRoot(root);
- }
-
-
- public void testRISelectOneRadio() throws IOException
- {
- //
- HtmlSelectOneRadio radio = new HtmlSelectOneRadio();
- radio.setValue(new Integer(2));
- for (int i = 0 ; i < 10; i++)
- {
- UISelectItem selectItem = new UISelectItem();
- selectItem.setItemLabel("Item " + i);
- selectItem.setItemValue("" + i);
- radio.getChildren().add(selectItem);
- }
-
- UIViewRoot root = createTestTree(radio, "testRISelectOneRadio");
- renderRoot(root);
-
- root = createTestTree(radio, "testRISelectOneRadio2");
- renderRoot(root);
- }
-
- private HtmlOutputText _createHtmlOutputText()
- {
- return new HtmlOutputText();
- }
-
- private CoreOutputText _createCoreOutputText()
- {
- return new CoreOutputText();
- /*
- {
- public Renderer getRenderer(FacesContext context)
- {
- // Simulate the overhead of retrieving the renderer from the RenderKit
- return super.getRenderer(context);
- //return _fastRenderer;
- }
- };*/
- }
-
- static private class NullComp extends UIComponentBase
- {
- public NullComp()
- {
- setRendererType(null);
- }
-
- public String getFamily()
- {
- return "org.apache.myfaces.adftest.PerfComp";
- }
-
- public boolean getRendersChildren()
- {
- return true;
- }
-
- public void encodeBegin(FacesContext context) throws IOException
- {
- }
-
- public void encodeChildren(FacesContext context) throws IOException
- {
- }
-
- public void encodeEnd(FacesContext context) throws IOException
- {
- }
- }
-}
+package org.apache.myfaces.adfinternal.renderkit;
+
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.component.html.HtmlSelectOneRadio;
+import javax.faces.component.UISelectItem;
+import javax.faces.render.Renderer;
+
+import org.apache.myfaces.adf.component.core.CoreDocument;
+import org.apache.myfaces.adf.component.core.CoreForm;
+import org.apache.myfaces.adf.component.core.data.CoreColumn;
+import org.apache.myfaces.adf.component.core.data.CoreTable;
+import org.apache.myfaces.adf.component.core.data.CoreSelectRangeChoiceBar;
+import org.apache.myfaces.adf.component.core.layout.CorePanelGroup;
+import org.apache.myfaces.adf.component.core.output.CoreOutputText;
+import org.apache.myfaces.adf.component.core.output.CoreOutputFormatted;
+import org.apache.myfaces.adf.component.core.input.CoreInputHidden;
+import org.apache.myfaces.adf.component.core.input.CoreInputText;
+import org.apache.myfaces.adf.component.core.input.CoreSelectOneChoice;
+import org.apache.myfaces.adf.component.core.input.CoreSelectOneRadio;
+import org.apache.myfaces.adf.component.core.input.CoreSelectInputDate;
+import org.apache.myfaces.adf.component.core.input.CoreSelectItem;
+
+
+
+public class CoreRenderKitPerf extends RenderKitPerfTestCase
+{
+ public CoreRenderKitPerf() throws IOException, SAXException
+ {
+ }
+
+ public CoreRenderKitPerf(String testName) throws IOException, SAXException
+ {
+ super(testName);
+ }
+
+ public void testSimplePerf() throws IOException
+ {
+ CoreOutputText out = _createCoreOutputText();
+ out.setValue("Plain value");
+ UIViewRoot root = createTestTree(out, "testSimplePerf()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testSimplePerf() 2");
+ renderRoot(root);
+ }
+
+ public void testManyAttributes() throws IOException
+ {
+ CoreOutputText out = _createCoreOutputText();
+ out.setValue("Plain value");
+ out.setEscape(true);
+ out.setId("OutId");
+ out.setShortDesc("Short Desc");
+ out.setStyleClass("Style Class");
+ out.setOnclick("on click");
+
+ /*
+ out.setTruncateAt(100);
+ out.setOnclick("on click");
+ out.setOndblclick("on dblclick");
+ out.setOnkeydown("on keydown");
+ out.setOnkeyup("on keyup");
+ out.setOnkeypress("on keypress ");
+ out.setOnmousedown("on mousedown");
+ out.setOnmousemove("on mousemove");
+ out.setOnmouseout("on mouseout ");
+ out.setOnmouseover("on mouseover ");
+ out.setOnmouseup("on mouseup ");*/
+
+ UIViewRoot root = createTestTree(out, "testManyAttributes()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testManyAttributes() 2");
+ renderRoot(root);
+ }
+
+ public void testManyInputAttributes() throws IOException
+ {
+ CoreInputText out = new CoreInputText();
+
+ out.setSimple(true);
+ out.setValue("Plain value");
+ out.setId("OutId");
+ out.setShortDesc("Short Desc");
+ out.setStyleClass("Style Class");
+ out.setOnclick("on click");
+
+ out.setOnclick("on click");
+ out.setOndblclick("on dblclick");
+ out.setOnkeydown("on keydown");
+ out.setOnkeyup("on keyup");
+ out.setOnkeypress("on keypress ");
+ out.setOnmousedown("on mousedown");
+ out.setOnmousemove("on mousemove");
+ out.setOnmouseout("on mouseout ");
+ out.setOnmouseover("on mouseover ");
+ out.setOnmouseup("on mouseup ");
+
+ UIViewRoot root = createTestTree(out, "testManyInputAttributes()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testManyInputAttributes() 2");
+ renderRoot(root);
+ }
+
+ public void testRIManyInputAttributes() throws IOException
+ {
+ HtmlInputText out = new HtmlInputText();
+ out.setValue("Plain value");
+ out.setId("OutId");
+ out.setTitle("Title");
+ out.setStyleClass("Style Class");
+ out.setOnclick("on click");
+
+ out.setOnclick("on click");
+ out.setOndblclick("on dblclick");
+ out.setOnkeydown("on keydown");
+ out.setOnkeyup("on keyup");
+ out.setOnkeypress("on keypress ");
+ out.setOnmousedown("on mousedown");
+ out.setOnmousemove("on mousemove");
+ out.setOnmouseout("on mouseout ");
+ out.setOnmouseover("on mouseover ");
+ out.setOnmouseup("on mouseup ");
+
+ UIViewRoot root = createTestTree(out, "testRIManyInputAttributes()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testRIManyInputAttributes() 2");
+ renderRoot(root);
+ }
+
+
+ public void testManyNonSimpleInputAttributes() throws IOException
+ {
+ CoreInputText out = new CoreInputText();
+ out.setSimple(false);
+ out.setValue("Plain value");
+ out.setId("OutId");
+ out.setShortDesc("Short Desc");
+ out.setStyleClass("Style Class");
+ out.setOnclick("on click");
+
+ out.setOnclick("on click");
+ out.setOndblclick("on dblclick");
+ out.setOnkeydown("on keydown");
+ out.setOnkeyup("on keyup");
+ out.setOnkeypress("on keypress ");
+ out.setOnmousedown("on mousedown");
+ out.setOnmousemove("on mousemove");
+ out.setOnmouseout("on mouseout ");
+ out.setOnmouseover("on mouseover ");
+ out.setOnmouseup("on mouseup ");
+
+ UIViewRoot root = createTestTree(out, "testManyNonSimpleInputAttributes()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testManyNonSimpleInputAttributes() 2");
+ renderRoot(root);
+ }
+
+
+ public void testRISimplePerf() throws IOException
+ {
+ HtmlOutputText out = _createHtmlOutputText();
+ out.setValue("Plain value");
+ UIViewRoot root = createTestTree(out, "testRISimplePerf()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testRISimplePerf() 2");
+ renderRoot(root);
+ }
+
+ public void testRIManyAttributes() throws IOException
+ {
+ HtmlOutputText out = _createHtmlOutputText();
+ out.setValue("Plain value");
+ out.setEscape(true);
+ out.setId("OutId");
+ out.setTitle("Short Desc");
+ out.setStyleClass("Style Class");
+ out.setStyle("The Style");
+
+ UIViewRoot root = createTestTree(out, "testRIManyAttributes()");
+ renderRoot(root);
+
+ root = createTestTree(out, "testRIManyAttributes() 2");
+ renderRoot(root);
+ }
+
+
+ public void testRITable() throws IOException
+ {
+ HtmlDataTable table = new HtmlDataTable();
+ ArrayList l = new ArrayList();
+ for (int i = 0 ; i < 10; i++)
+ l.add(new Integer(i));
+ table.setValue(l);
+ table.setStyleClass("TableContent");
+ table.setHeaderClass("af_column_header-text SomeBorderStyle");
+ table.setColumnClasses("af_column_cell-text OraTableBorder1111");
+
+ for (int i = 0 ; i < 3; i++)
+ {
+ UIColumn col = new UIColumn();
+ /*
+ HtmlOutputText header = new HtmlOutputText();
+ header.setValue("Header " + i);
+ col.setHeader(header);
+ //HtmlOutputText text = new HtmlOutputText();
+ HtmlInputText text = new HtmlInputText();
+ text.setValue("Column " + i);
+ col.getChildren().add(text);
+ */
+
+ col.setHeader(new NullComp());
+ col.getChildren().add(new NullComp());
+ table.getChildren().add(col);
+ }
+
+ UIViewRoot root = createTestTree(table, "testRITable()", 500);
+ renderRoot(root);
+ }
+
+
+ public void testTable() throws IOException
+ {
+ CoreTable table = new CoreTable();
+ ArrayList l = new ArrayList();
+ for (int i = 0 ; i < 10; i++)
+ l.add(new Integer(i));
+ table.setValue(l);
+
+ for (int i = 0 ; i < 3; i++)
+ {
+ CoreColumn col = new CoreColumn();
+
+ /*
+ col.setHeaderText("Header " + i);
+ // Use headerText instead of adding the facet; easier and faster.
+ //CoreOutputText header = new CoreOutputText();
+ //header.setValue("Header " + i);
+ //col.setHeader(header);
+ //CoreOutputText text = new CoreOutputText();
+ CoreInputText text = new CoreInputText();
+ text.setSimple(true);
+ text.setValue("Column " + i);
+ col.getChildren().add(text);
+ */
+ col.setHeader(new NullComp());
+ col.getChildren().add(new NullComp());
+ table.getChildren().add(col);
+ }
+
+ UIViewRoot root = createTestTree(table, "testTable()", 500);
+ renderRoot(root);
+ }
+
+
+ public void testPanelGroupPerf() throws IOException
+ {
+ CorePanelGroup group = new CorePanelGroup();
+ group.setLayout(CorePanelGroup.LAYOUT_VERTICAL);
+ for (int i = 0; i < 8; i++)
+ {
+ /*
+ CoreOutputText out = _createCoreOutputText();
+ out.setValue("Plain value");
+ group.getChildren().add(out);*/
+ group.getChildren().add(new NullComp());
+ }
+
+ UIViewRoot root = createTestTree(group, "testPanelGroup()");
+ renderRoot(root);
+
+ root = createTestTree(group, "testPanelGroup() 2");
+ renderRoot(root);
+ }
+
+ public void testInputHidden() throws IOException
+ {
+ CoreInputHidden cih = new CoreInputHidden();
+ cih.setValue("value");
+
+ UIViewRoot root = createTestTree(cih, "testInputHidden");
+ renderRoot(root);
+ }
+
+
+ public void notestSelectRangeChoicePerf() throws IOException
+ {
+ CoreSelectRangeChoiceBar bar = new CoreSelectRangeChoiceBar();
+ bar.setValue(new MVariableResolver.BigList());
+ bar.setRows(30);
+
+ UIViewRoot root = createTestTree(bar, "testSelectRangeChoiceBar");
+ renderRoot(root);
+ }
+
+
+ public void notestSelectInputDate() throws IOException
+ {
+ CoreSelectInputDate date = new CoreSelectInputDate();
+ date.setLabel("Label");
+
+ UIViewRoot root = createTestTree(date, "testSelectInputDate");
+ renderRoot(root);
+ }
+
+ public void testSelectOneChoice() throws IOException
+ {
+ CoreSelectOneChoice choice = new CoreSelectOneChoice();
+ choice.setSimple(true);
+ choice.setValue(new Integer(2));
+ for (int i = 0 ; i < 10; i++)
+ {
+ UISelectItem selectItem = new UISelectItem();
+ selectItem.setItemLabel("Item " + i);
+ selectItem.setItemValue(new Integer(i));
+ choice.getChildren().add(selectItem);
+ }
+
+ UIViewRoot root = createTestTree(choice, "testSelectOneChoice");
+ renderRoot(root);
+
+ root = createTestTree(choice, "testSelectOneChoice2");
+ renderRoot(root);
+ }
+
+
+ public void testRISelectOneMenu() throws IOException
+ {
+ //
+ HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
+ menu.setValue(new Integer(2));
+ for (int i = 0 ; i < 10; i++)
+ {
+ UISelectItem selectItem = new UISelectItem();
+ selectItem.setItemLabel("Item " + i);
+ selectItem.setItemValue("" + i);
+ menu.getChildren().add(selectItem);
+ }
+
+ UIViewRoot root = createTestTree(menu, "testRISelectOneMenu");
+ renderRoot(root);
+
+ root = createTestTree(menu, "testRISelectOneNavigation2");
+ renderRoot(root);
+ }
+
+
+ public void testSelectOneRadio() throws IOException
+ {
+ CoreSelectOneRadio radio = new CoreSelectOneRadio();
+ radio.setSimple(true);
+ radio.setValue(new Integer(2));
+ for (int i = 0 ; i < 10; i++)
+ {
+ UISelectItem selectItem = new UISelectItem();
+ selectItem.setItemLabel("Item " + i);
+ selectItem.setItemValue(new Integer(i));
+ radio.getChildren().add(selectItem);
+ }
+
+ UIViewRoot root = createTestTree(radio, "testSelectOneRadio");
+ renderRoot(root);
+
+ root = createTestTree(radio, "testSelectOneRadio2");
+ renderRoot(root);
+ }
+
+
+ public void testRISelectOneRadio() throws IOException
+ {
+ //
+ HtmlSelectOneRadio radio = new HtmlSelectOneRadio();
+ radio.setValue(new Integer(2));
+ for (int i = 0 ; i < 10; i++)
+ {
+ UISelectItem selectItem = new UISelectItem();
+ selectItem.setItemLabel("Item " + i);
+ selectItem.setItemValue("" + i);
+ radio.getChildren().add(selectItem);
+ }
+
+ UIViewRoot root = createTestTree(radio, "testRISelectOneRadio");
+ renderRoot(root);
+
+ root = createTestTree(radio, "testRISelectOneRadio2");
+ renderRoot(root);
+ }
+
+ private HtmlOutputText _createHtmlOutputText()
+ {
+ return new HtmlOutputText();
+ }
+
+ private CoreOutputText _createCoreOutputText()
+ {
+ return new CoreOutputText();
+ /*
+ {
+ public Renderer getRenderer(FacesContext context)
+ {
+ // Simulate the overhead of retrieving the renderer from the RenderKit
+ return super.getRenderer(context);
+ //return _fastRenderer;
+ }
+ };*/
+ }
+
+ static private class NullComp extends UIComponentBase
+ {
+ public NullComp()
+ {
+ setRendererType(null);
+ }
+
+ public String getFamily()
+ {
+ return "org.apache.myfaces.adftest.PerfComp";
+ }
+
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ public void encodeBegin(FacesContext context) throws IOException
+ {
+ }
+
+ public void encodeChildren(FacesContext context) throws IOException
+ {
+ }
+
+ public void encodeEnd(FacesContext context) throws IOException
+ {
+ }
+ }
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/CoreRenderKitPerf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigInfo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigInfo.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigInfo.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigInfo.java Mon Jul 24 21:42:41 2006
@@ -13,169 +13,169 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.TreeMap;
-
-import javax.faces.application.Application;
-import javax.faces.render.RenderKit;
-import javax.faces.render.Renderer;
-
-import org.apache.myfaces.adf.logging.ADFLogger;
-
-import org.apache.myfaces.adfinternal.XMLValidityTestCase;
-import org.apache.myfaces.adfinternal.share.xml.TreeBuilder;
-import java.util.List;
-
-public class FacesConfigInfo
-{
- public FacesConfigInfo()
- {
- }
-
- public void registerConverters(Application appl)
- {
- Iterator convertersByType = _convertersByType.keySet().iterator();
- while (convertersByType.hasNext())
- {
- try
- {
- String type = (String) convertersByType.next();
- String converterType = (String) _convertersByType.get(type);
- appl.addConverter(Class.forName(type), converterType);
- }
- catch (Exception e)
- {
- _LOG.severe(e);
- }
- }
-
- Iterator convertersById = _convertersById.keySet().iterator();
- while (convertersById.hasNext())
- {
- try
- {
- String id = (String) convertersById.next();
- String converterType = (String) _convertersById.get(id);
- appl.addConverter(id, converterType);
- }
- catch (Exception e)
- {
- _LOG.severe(e);
- }
- }
- }
-
- public void registerComponents(Application appl)
- {
- Iterator components = _components.keySet().iterator();
- while (components.hasNext())
- {
- String type = (String) components.next();
- ComponentInfo info = (ComponentInfo) _components.get(type);
- String className = info.componentClass;
- appl.addComponent(type, className);
- }
- }
-
- public Map<String, RenderKit> getRenderKits()
- {
- return _renderKits;
- }
-
- public void addConverterByType(String type, String converter)
- {
- _convertersByType.put(type, converter);
- }
-
- public void addConverterById(String id, String converter)
- {
- _convertersById.put(id, converter);
- }
-
- public void addComponent(
- ComponentInfo info)
- {
- String componentType = info.componentType;
- if (_LOG.isFine())
- _LOG.fine("Found component: type {0}, class {1}",
- new Object[]{componentType, info.componentClass});
- if (_components.containsKey(componentType))
- _LOG.warning("faces-config.xml contains duplicate definitions for " +
- "component type {0}", componentType);
-
- _components.put(componentType, info);
- }
-
- public ComponentInfo getComponentInfo(String componentType)
- {
- return (ComponentInfo) _components.get(componentType);
- }
-
- public void load(String file) throws IOException, SAXException
- {
- TreeBuilder builder = new TreeBuilder();
- XMLValidityTestCase.ER er = new XMLValidityTestCase.ER();
- String publicID =
- "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN";
- URL dtdSource = getClass().getResource(
- "/oracle/adfinternal/view/faces/web-facesconfig_1_1.dtd");
- er.registerPublicId(publicID, dtdSource);
- builder.setEntityResolver(er);
-
- Enumeration resources = getClass().getClassLoader().getResources(file);
- while (resources.hasMoreElements())
- {
- URL resource = (URL) resources.nextElement();
- System.out.println("PARSING " + resource);
- InputStream inputStream = resource.openStream();
- try
- {
- InputSource source = new InputSource(inputStream);
- source.setSystemId(resource.toExternalForm());
- builder.parse(source, new FacesConfigParser(this));
- }
- finally
- {
- inputStream.close();
- }
- }
- }
-
- static public class ComponentInfo
- {
- public String componentType;
- public String componentClass;
- // Use a TreeMap so the properties always come back in
- // sorted order.
- public Map properties = new TreeMap();
- public PropertyInfo getPropertyInfo(String name)
- {
- return (PropertyInfo) properties.get(name);
- }
- }
-
- static public class PropertyInfo
- {
- public Class type;
- public Object defaultValue;
- public List enumValues;
- }
-
- private Map _components = new HashMap();
- private Map<String, RenderKit> _renderKits = new HashMap<String, RenderKit>();
- private Map _convertersByType = new HashMap();
- private Map _convertersById = new HashMap();
-
- private static final ADFLogger _LOG =
- ADFLogger.createADFLogger(FacesConfigInfo.class);
-}
+package org.apache.myfaces.adfinternal.renderkit;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.TreeMap;
+
+import javax.faces.application.Application;
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+
+import org.apache.myfaces.adf.logging.ADFLogger;
+
+import org.apache.myfaces.adfinternal.XMLValidityTestCase;
+import org.apache.myfaces.adfinternal.share.xml.TreeBuilder;
+import java.util.List;
+
+public class FacesConfigInfo
+{
+ public FacesConfigInfo()
+ {
+ }
+
+ public void registerConverters(Application appl)
+ {
+ Iterator convertersByType = _convertersByType.keySet().iterator();
+ while (convertersByType.hasNext())
+ {
+ try
+ {
+ String type = (String) convertersByType.next();
+ String converterType = (String) _convertersByType.get(type);
+ appl.addConverter(Class.forName(type), converterType);
+ }
+ catch (Exception e)
+ {
+ _LOG.severe(e);
+ }
+ }
+
+ Iterator convertersById = _convertersById.keySet().iterator();
+ while (convertersById.hasNext())
+ {
+ try
+ {
+ String id = (String) convertersById.next();
+ String converterType = (String) _convertersById.get(id);
+ appl.addConverter(id, converterType);
+ }
+ catch (Exception e)
+ {
+ _LOG.severe(e);
+ }
+ }
+ }
+
+ public void registerComponents(Application appl)
+ {
+ Iterator components = _components.keySet().iterator();
+ while (components.hasNext())
+ {
+ String type = (String) components.next();
+ ComponentInfo info = (ComponentInfo) _components.get(type);
+ String className = info.componentClass;
+ appl.addComponent(type, className);
+ }
+ }
+
+ public Map<String, RenderKit> getRenderKits()
+ {
+ return _renderKits;
+ }
+
+ public void addConverterByType(String type, String converter)
+ {
+ _convertersByType.put(type, converter);
+ }
+
+ public void addConverterById(String id, String converter)
+ {
+ _convertersById.put(id, converter);
+ }
+
+ public void addComponent(
+ ComponentInfo info)
+ {
+ String componentType = info.componentType;
+ if (_LOG.isFine())
+ _LOG.fine("Found component: type {0}, class {1}",
+ new Object[]{componentType, info.componentClass});
+ if (_components.containsKey(componentType))
+ _LOG.warning("faces-config.xml contains duplicate definitions for " +
+ "component type {0}", componentType);
+
+ _components.put(componentType, info);
+ }
+
+ public ComponentInfo getComponentInfo(String componentType)
+ {
+ return (ComponentInfo) _components.get(componentType);
+ }
+
+ public void load(String file) throws IOException, SAXException
+ {
+ TreeBuilder builder = new TreeBuilder();
+ XMLValidityTestCase.ER er = new XMLValidityTestCase.ER();
+ String publicID =
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN";
+ URL dtdSource = getClass().getResource(
+ "/oracle/adfinternal/view/faces/web-facesconfig_1_1.dtd");
+ er.registerPublicId(publicID, dtdSource);
+ builder.setEntityResolver(er);
+
+ Enumeration resources = getClass().getClassLoader().getResources(file);
+ while (resources.hasMoreElements())
+ {
+ URL resource = (URL) resources.nextElement();
+ System.out.println("PARSING " + resource);
+ InputStream inputStream = resource.openStream();
+ try
+ {
+ InputSource source = new InputSource(inputStream);
+ source.setSystemId(resource.toExternalForm());
+ builder.parse(source, new FacesConfigParser(this));
+ }
+ finally
+ {
+ inputStream.close();
+ }
+ }
+ }
+
+ static public class ComponentInfo
+ {
+ public String componentType;
+ public String componentClass;
+ // Use a TreeMap so the properties always come back in
+ // sorted order.
+ public Map properties = new TreeMap();
+ public PropertyInfo getPropertyInfo(String name)
+ {
+ return (PropertyInfo) properties.get(name);
+ }
+ }
+
+ static public class PropertyInfo
+ {
+ public Class type;
+ public Object defaultValue;
+ public List enumValues;
+ }
+
+ private Map _components = new HashMap();
+ private Map<String, RenderKit> _renderKits = new HashMap<String, RenderKit>();
+ private Map _convertersByType = new HashMap();
+ private Map _convertersById = new HashMap();
+
+ private static final ADFLogger _LOG =
+ ADFLogger.createADFLogger(FacesConfigInfo.class);
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigParser.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigParser.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigParser.java Mon Jul 24 21:42:41 2006
@@ -13,411 +13,411 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit;
-
-import javax.faces.render.Renderer;
-import javax.faces.render.RenderKit;
-
-import java.lang.reflect.Array;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.myfaces.adfinternal.share.expl.Coercions;
-import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser;
-import org.apache.myfaces.adfinternal.share.xml.NodeParser;
-import org.apache.myfaces.adfinternal.share.xml.ParseContext;
-import org.apache.myfaces.adfinternal.share.xml.StringParser;
-import org.apache.myfaces.adfinternal.share.xml.XMLUtils;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXParseException;
-
-class FacesConfigParser extends BaseNodeParser
-{
- public FacesConfigParser(FacesConfigInfo info)
- {
- _info = info;
- }
-
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("render-kit".equals(localName))
- return new RenderKitParser(_info);
- if ("component".equals(localName))
- return new ComponentParser();
- if ("converter".equals(localName))
- return new ConverterParser();
-
- return BaseNodeParser.getIgnoreParser();
- }
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if ("component".equals(localName))
- {
- FacesConfigInfo.ComponentInfo info = (FacesConfigInfo.ComponentInfo) child;
- _info.addComponent(info);
- }
- }
-
-
- private class RenderKitParser extends BaseNodeParser
- {
- public RenderKitParser(FacesConfigInfo info)
- {
- _info = info;
- }
-
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("render-kit-id".equals(localName))
- return new StringParser();
- if ("render-kit-class".equals(localName))
- return new StringParser();
- if ("renderer".equals(localName))
- return new RendererParser();
-
- return BaseNodeParser.getIgnoreParser();
- }
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if ("render-kit-id".equals(localName))
- _renderKitId = (String) child;
- else if ("render-kit-class".equals(localName))
- {
- try
- {
- _kit = (RenderKit) Class.forName((String) child).newInstance();
- }
- catch (Exception e)
- {
- throw new SAXParseException("Couldn't create RenderKit", context.getLocator(), e);
- }
- }
- else if ("renderer".equals(localName))
- {
- RendererInfo info = (RendererInfo) child;
- try
- {
- Renderer renderer = (Renderer)
- Class.forName(info.rendererClass).newInstance();
- _kit.addRenderer(info.componentFamily, info.rendererType, renderer);
- }
- catch (Exception e)
- {
- System.err.println("Couldn't create renderer " + info.rendererClass);
- // throw new SAXParseException("Couldn't create Renderer", context.getLocator(), e);
- }
- }
- }
-
- public Object endElement(
- ParseContext context,
- String namespaceURI,
- String localName) throws SAXParseException
- {
- _info.getRenderKits().put(_renderKitId, _kit);
- return null;
- }
-
- private FacesConfigInfo _info;
- private String _renderKitId;
- private RenderKit _kit;
- }
-
-
- private class ComponentParser extends BaseNodeParser
- {
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("component-type".equals(localName) ||
- "component-class".equals(localName))
- return new StringParser();
- else if ("property".equals(localName))
- {
- return new PropertyParser(_info);
- }
-
- return BaseNodeParser.getIgnoreParser();
- }
-
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if (child instanceof String)
- {
- String s = (String) child;
- if ("component-type".equals(localName))
- _info.componentType = s;
- else if ("component-class".equals(localName))
- _info.componentClass = s;
- }
- }
-
- public Object endElement(
- ParseContext context,
- String namespaceURI,
- String localName) throws SAXParseException
- {
- return _info;
- }
-
- private FacesConfigInfo.ComponentInfo _info = new FacesConfigInfo.ComponentInfo();
- }
-
-
- private class ConverterParser extends BaseNodeParser
- {
- public ConverterParser()
- {
- }
-
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("converter-id".equals(localName) ||
- "converter-for-class".equals(localName) ||
- "converter-class".equals(localName))
- return new StringParser();
-
- return BaseNodeParser.getIgnoreParser();
- }
-
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if (child instanceof String)
- {
- String s = (String) child;
- if ("converter-id".equals(localName))
- _converterId = s;
- else if ("converter-for-class".equals(localName))
- _converterForClass = s;
- else if ("converter-class".equals(localName))
- _converterClass = s;
- }
- }
-
- public Object endElement(
- ParseContext context,
- String namespaceURI,
- String localName) throws SAXParseException
- {
- if (_converterId != null)
- _info.addConverterById(_converterId, _converterClass);
- if (_converterForClass != null)
- _info.addConverterByType(_converterForClass, _converterClass);
- return null;
- }
-
- private String _converterId;
- private String _converterForClass;
- private String _converterClass;
- }
-
- private class PropertyParser extends BaseNodeParser
- {
- public PropertyParser(FacesConfigInfo.ComponentInfo info)
- {
- _info = info;
- _property = new FacesConfigInfo.PropertyInfo();
- }
-
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("property-name".equals(localName) ||
- "property-class".equals(localName) ||
- "default-value".equals(localName) ||
- "attribute-values".equals(localName))
- return new StringParser();
- else if ("property-extension".equals(localName) ||
- "property-metadata".equals(localName))
- {
- return this;
- }
-
- return BaseNodeParser.getIgnoreParser();
- }
-
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if (child instanceof String)
- {
- String s = (String) child;
- if ("property-name".equals(localName))
- {
- _info.properties.put(s, _property);
- }
- else if ("property-class".equals(localName))
- {
- Class c = (Class) _sPrimitiveTypes.get(s);
- if (c == null)
- {
- boolean isArray = s.endsWith("[]");
- if (isArray)
- s = s.substring(0, s.length() - 2);
-
- try
- {
- c = Class.forName(s);
- if (isArray)
- c = _getArrayType(c);
- }
- catch (Exception e)
- {
- logError(context, "Couldn't find class " + s, e);
- }
- }
-
- _property.type = c;
- }
- else if ("default-value".equals(localName))
- {
- Class c = _property.type;
- if (c == null)
- c = String.class;
- _property.defaultValue = Coercions.coerce(null, s, c);
- }
- else if ("attribute-values".equals(localName))
- {
- _property.enumValues = new ArrayList();
- String[] values = XMLUtils.parseNameTokens(s);
- _property.enumValues.addAll(Arrays.asList(values));
- }
- }
- }
-
- public Object endElement(
- ParseContext context,
- String namespaceURI,
- String localName) throws SAXParseException
- {
- return _info;
- }
-
- private FacesConfigInfo.ComponentInfo _info;
- private FacesConfigInfo.PropertyInfo _property;
- }
-
- private class RendererParser extends BaseNodeParser
- {
- public NodeParser startChildElement(
- ParseContext context,
- String namespaceURI,
- String localName,
- Attributes attrs) throws SAXParseException
- {
- if ("component-family".equals(localName) ||
- "renderer-type".equals(localName) ||
- "renderer-class".equals(localName))
- return new StringParser();
- return BaseNodeParser.getIgnoreParser();
- }
-
- public void addCompletedChild(
- ParseContext context,
- String namespaceURI,
- String localName,
- Object child) throws SAXParseException
- {
- if (child instanceof String)
- {
- String s = (String) child;
- if ("component-family".equals(localName))
- _info.componentFamily = s;
- else if ("renderer-type".equals(localName))
- _info.rendererType = s;
- else if ("renderer-class".equals(localName))
- _info.rendererClass = s;
- }
- }
-
- public Object endElement(
- ParseContext context,
- String namespaceURI,
- String localName) throws SAXParseException
- {
- return _info;
- }
-
- private RendererInfo _info = new RendererInfo();
- }
-
- static class RendererInfo
- {
- public String componentFamily;
- public String rendererType;
- public String rendererClass;
- }
-
- private FacesConfigInfo _info;
-
- static private Class _getArrayType(Class baseClass)
- {
- return Array.newInstance(baseClass, 0).getClass();
- }
-
- static private final HashMap _sPrimitiveTypes = new HashMap();
- static
- {
- _sPrimitiveTypes.put("int[]", _getArrayType(Integer.TYPE));
- _sPrimitiveTypes.put("boolean[]", _getArrayType(Boolean.TYPE));
- _sPrimitiveTypes.put("char[]", _getArrayType(Character.TYPE));
- _sPrimitiveTypes.put("long[]", _getArrayType(Long.TYPE));
- _sPrimitiveTypes.put("short[]", _getArrayType(Short.TYPE));
- _sPrimitiveTypes.put("float[]", _getArrayType(Float.TYPE));
- _sPrimitiveTypes.put("double[]", _getArrayType(Double.TYPE));
- _sPrimitiveTypes.put("int", Integer.TYPE);
- _sPrimitiveTypes.put("boolean", Boolean.TYPE);
- _sPrimitiveTypes.put("char", Character.TYPE);
- _sPrimitiveTypes.put("long", Long.TYPE);
- _sPrimitiveTypes.put("short", Short.TYPE);
- _sPrimitiveTypes.put("float", Float.TYPE);
- _sPrimitiveTypes.put("double", Double.TYPE);
- }
-}
+package org.apache.myfaces.adfinternal.renderkit;
+
+import javax.faces.render.Renderer;
+import javax.faces.render.RenderKit;
+
+import java.lang.reflect.Array;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.myfaces.adfinternal.share.expl.Coercions;
+import org.apache.myfaces.adfinternal.share.xml.BaseNodeParser;
+import org.apache.myfaces.adfinternal.share.xml.NodeParser;
+import org.apache.myfaces.adfinternal.share.xml.ParseContext;
+import org.apache.myfaces.adfinternal.share.xml.StringParser;
+import org.apache.myfaces.adfinternal.share.xml.XMLUtils;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
+
+class FacesConfigParser extends BaseNodeParser
+{
+ public FacesConfigParser(FacesConfigInfo info)
+ {
+ _info = info;
+ }
+
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("render-kit".equals(localName))
+ return new RenderKitParser(_info);
+ if ("component".equals(localName))
+ return new ComponentParser();
+ if ("converter".equals(localName))
+ return new ConverterParser();
+
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if ("component".equals(localName))
+ {
+ FacesConfigInfo.ComponentInfo info = (FacesConfigInfo.ComponentInfo) child;
+ _info.addComponent(info);
+ }
+ }
+
+
+ private class RenderKitParser extends BaseNodeParser
+ {
+ public RenderKitParser(FacesConfigInfo info)
+ {
+ _info = info;
+ }
+
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("render-kit-id".equals(localName))
+ return new StringParser();
+ if ("render-kit-class".equals(localName))
+ return new StringParser();
+ if ("renderer".equals(localName))
+ return new RendererParser();
+
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if ("render-kit-id".equals(localName))
+ _renderKitId = (String) child;
+ else if ("render-kit-class".equals(localName))
+ {
+ try
+ {
+ _kit = (RenderKit) Class.forName((String) child).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new SAXParseException("Couldn't create RenderKit", context.getLocator(), e);
+ }
+ }
+ else if ("renderer".equals(localName))
+ {
+ RendererInfo info = (RendererInfo) child;
+ try
+ {
+ Renderer renderer = (Renderer)
+ Class.forName(info.rendererClass).newInstance();
+ _kit.addRenderer(info.componentFamily, info.rendererType, renderer);
+ }
+ catch (Exception e)
+ {
+ System.err.println("Couldn't create renderer " + info.rendererClass);
+ // throw new SAXParseException("Couldn't create Renderer", context.getLocator(), e);
+ }
+ }
+ }
+
+ public Object endElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName) throws SAXParseException
+ {
+ _info.getRenderKits().put(_renderKitId, _kit);
+ return null;
+ }
+
+ private FacesConfigInfo _info;
+ private String _renderKitId;
+ private RenderKit _kit;
+ }
+
+
+ private class ComponentParser extends BaseNodeParser
+ {
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("component-type".equals(localName) ||
+ "component-class".equals(localName))
+ return new StringParser();
+ else if ("property".equals(localName))
+ {
+ return new PropertyParser(_info);
+ }
+
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if (child instanceof String)
+ {
+ String s = (String) child;
+ if ("component-type".equals(localName))
+ _info.componentType = s;
+ else if ("component-class".equals(localName))
+ _info.componentClass = s;
+ }
+ }
+
+ public Object endElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName) throws SAXParseException
+ {
+ return _info;
+ }
+
+ private FacesConfigInfo.ComponentInfo _info = new FacesConfigInfo.ComponentInfo();
+ }
+
+
+ private class ConverterParser extends BaseNodeParser
+ {
+ public ConverterParser()
+ {
+ }
+
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("converter-id".equals(localName) ||
+ "converter-for-class".equals(localName) ||
+ "converter-class".equals(localName))
+ return new StringParser();
+
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if (child instanceof String)
+ {
+ String s = (String) child;
+ if ("converter-id".equals(localName))
+ _converterId = s;
+ else if ("converter-for-class".equals(localName))
+ _converterForClass = s;
+ else if ("converter-class".equals(localName))
+ _converterClass = s;
+ }
+ }
+
+ public Object endElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName) throws SAXParseException
+ {
+ if (_converterId != null)
+ _info.addConverterById(_converterId, _converterClass);
+ if (_converterForClass != null)
+ _info.addConverterByType(_converterForClass, _converterClass);
+ return null;
+ }
+
+ private String _converterId;
+ private String _converterForClass;
+ private String _converterClass;
+ }
+
+ private class PropertyParser extends BaseNodeParser
+ {
+ public PropertyParser(FacesConfigInfo.ComponentInfo info)
+ {
+ _info = info;
+ _property = new FacesConfigInfo.PropertyInfo();
+ }
+
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("property-name".equals(localName) ||
+ "property-class".equals(localName) ||
+ "default-value".equals(localName) ||
+ "attribute-values".equals(localName))
+ return new StringParser();
+ else if ("property-extension".equals(localName) ||
+ "property-metadata".equals(localName))
+ {
+ return this;
+ }
+
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if (child instanceof String)
+ {
+ String s = (String) child;
+ if ("property-name".equals(localName))
+ {
+ _info.properties.put(s, _property);
+ }
+ else if ("property-class".equals(localName))
+ {
+ Class c = (Class) _sPrimitiveTypes.get(s);
+ if (c == null)
+ {
+ boolean isArray = s.endsWith("[]");
+ if (isArray)
+ s = s.substring(0, s.length() - 2);
+
+ try
+ {
+ c = Class.forName(s);
+ if (isArray)
+ c = _getArrayType(c);
+ }
+ catch (Exception e)
+ {
+ logError(context, "Couldn't find class " + s, e);
+ }
+ }
+
+ _property.type = c;
+ }
+ else if ("default-value".equals(localName))
+ {
+ Class c = _property.type;
+ if (c == null)
+ c = String.class;
+ _property.defaultValue = Coercions.coerce(null, s, c);
+ }
+ else if ("attribute-values".equals(localName))
+ {
+ _property.enumValues = new ArrayList();
+ String[] values = XMLUtils.parseNameTokens(s);
+ _property.enumValues.addAll(Arrays.asList(values));
+ }
+ }
+ }
+
+ public Object endElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName) throws SAXParseException
+ {
+ return _info;
+ }
+
+ private FacesConfigInfo.ComponentInfo _info;
+ private FacesConfigInfo.PropertyInfo _property;
+ }
+
+ private class RendererParser extends BaseNodeParser
+ {
+ public NodeParser startChildElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Attributes attrs) throws SAXParseException
+ {
+ if ("component-family".equals(localName) ||
+ "renderer-type".equals(localName) ||
+ "renderer-class".equals(localName))
+ return new StringParser();
+ return BaseNodeParser.getIgnoreParser();
+ }
+
+ public void addCompletedChild(
+ ParseContext context,
+ String namespaceURI,
+ String localName,
+ Object child) throws SAXParseException
+ {
+ if (child instanceof String)
+ {
+ String s = (String) child;
+ if ("component-family".equals(localName))
+ _info.componentFamily = s;
+ else if ("renderer-type".equals(localName))
+ _info.rendererType = s;
+ else if ("renderer-class".equals(localName))
+ _info.rendererClass = s;
+ }
+ }
+
+ public Object endElement(
+ ParseContext context,
+ String namespaceURI,
+ String localName) throws SAXParseException
+ {
+ return _info;
+ }
+
+ private RendererInfo _info = new RendererInfo();
+ }
+
+ static class RendererInfo
+ {
+ public String componentFamily;
+ public String rendererType;
+ public String rendererClass;
+ }
+
+ private FacesConfigInfo _info;
+
+ static private Class _getArrayType(Class baseClass)
+ {
+ return Array.newInstance(baseClass, 0).getClass();
+ }
+
+ static private final HashMap _sPrimitiveTypes = new HashMap();
+ static
+ {
+ _sPrimitiveTypes.put("int[]", _getArrayType(Integer.TYPE));
+ _sPrimitiveTypes.put("boolean[]", _getArrayType(Boolean.TYPE));
+ _sPrimitiveTypes.put("char[]", _getArrayType(Character.TYPE));
+ _sPrimitiveTypes.put("long[]", _getArrayType(Long.TYPE));
+ _sPrimitiveTypes.put("short[]", _getArrayType(Short.TYPE));
+ _sPrimitiveTypes.put("float[]", _getArrayType(Float.TYPE));
+ _sPrimitiveTypes.put("double[]", _getArrayType(Double.TYPE));
+ _sPrimitiveTypes.put("int", Integer.TYPE);
+ _sPrimitiveTypes.put("boolean", Boolean.TYPE);
+ _sPrimitiveTypes.put("char", Character.TYPE);
+ _sPrimitiveTypes.put("long", Long.TYPE);
+ _sPrimitiveTypes.put("short", Short.TYPE);
+ _sPrimitiveTypes.put("float", Float.TYPE);
+ _sPrimitiveTypes.put("double", Double.TYPE);
+ }
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FacesConfigParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FastRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FastRenderer.java?rev=425276&r1=425275&r2=425276&view=diff
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FastRenderer.java (original)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FastRenderer.java Mon Jul 24 21:42:41 2006
@@ -13,132 +13,132 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.myfaces.adfinternal.renderkit;
-
-import java.io.IOException;
-import javax.faces.render.Renderer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
-
-import org.apache.myfaces.adf.bean.PropertyKey;
-import org.apache.myfaces.adf.component.core.output.CoreOutputText;
-import org.apache.myfaces.adf.context.AdfFacesContext;
-
-import org.apache.myfaces.adfinternal.convert.ConverterUtils;
-
-public class FastRenderer extends Renderer
-{
- public void encodeBegin(FacesContext context,
- UIComponent comp) throws IOException
- {
- AdfFacesContext.getCurrentInstance();
- CoreOutputText cot = (CoreOutputText) comp;
- if (cot.isEscape())
- {
- ResponseWriter rw = context.getResponseWriter();
- rw.startElement("span", comp);
-
- rw.writeAttribute("id", cot.getId(), "id");
- rw.writeAttribute("title", cot.getShortDesc(), "title");
- rw.writeAttribute("class", cot.getStyleClass(), "styleClass");
- rw.writeAttribute("style", cot.getInlineStyle(), "inlineStyle");
- rw.writeAttribute("onclick", cot.getOnclick(), null);
- rw.writeAttribute("ondblclick", cot.getOndblclick(), null);
- rw.writeAttribute("onkeydown", cot.getOnkeydown(), null);
- rw.writeAttribute("onkeyup", cot.getOnkeyup(), null);
- rw.writeAttribute("onkeypress", cot.getOnkeypress(), null);
- rw.writeAttribute("onmousedown", cot.getOnmousedown(), null);
- rw.writeAttribute("onmousemove", cot.getOnmousemove(), null);
- rw.writeAttribute("onmouseout", cot.getOnmouseout(), null);
- rw.writeAttribute("onmouseover", cot.getOnmouseover(), null);
- rw.writeAttribute("onmouseup", cot.getOnmouseup(), null);
- }
- }
-
- public void encodeEnd(FacesContext context,
- UIComponent comp) throws IOException
- {
- AdfFacesContext.getCurrentInstance();
- CoreOutputText cot = (CoreOutputText) comp;
- ResponseWriter rw = context.getResponseWriter();
-
- Object value = cot.getValue();
- if (!cot.isEscape())
- {
- if (value != null)
- {
- rw.write(value.toString());
- }
- }
- else
- {
- if (value != null)
- {
- String valueStr = value.toString();
- int truncateAt = cot.getTruncateAt();
- if (truncateAt > 0)
- {
- if (truncateAt < 13)
- truncateAt = 13;
- if (valueStr.length() > truncateAt)
- valueStr = valueStr.substring(0, truncateAt);
- }
-
- rw.writeText(valueStr, "value");
- }
-
- String description = cot.getDescription();
- if (description != null)
- {
- rw.startElement("span", null);
- rw.writeAttribute("class", "magicClass", null);
- rw.writeText(description, "description");
- rw.endElement("span");
- }
-
- rw.endElement("span");
- }
-
- }
-
-
- protected Object getConvertedValue(
- FacesContext context,
- CoreOutputText cot)
- {
- Object value = cot.getValue();
- if (value == null)
- return null;
-
- Converter converter = cot.getConverter();
- if ((converter == null) && !(value instanceof String))
- {
- converter = getConverterByType(context, cot);
- }
-
- if (converter != null)
- {
- return converter.getAsString(context, cot, value);
- }
-
- return value;
- }
-
- protected Converter getConverterByType(
- FacesContext context,
- CoreOutputText cot)
- {
- ValueBinding binding = cot.getFacesBean().getValueBinding(_valueKey);
- if (binding == null)
- return null;
-
- Class type = binding.getType(context);
- return ConverterUtils.createConverter(context, type);
- }
-
- private PropertyKey _valueKey = CoreOutputText.VALUE_KEY;
-}
+package org.apache.myfaces.adfinternal.renderkit;
+
+import java.io.IOException;
+import javax.faces.render.Renderer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import javax.faces.convert.Converter;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.adf.bean.PropertyKey;
+import org.apache.myfaces.adf.component.core.output.CoreOutputText;
+import org.apache.myfaces.adf.context.AdfFacesContext;
+
+import org.apache.myfaces.adfinternal.convert.ConverterUtils;
+
+public class FastRenderer extends Renderer
+{
+ public void encodeBegin(FacesContext context,
+ UIComponent comp) throws IOException
+ {
+ AdfFacesContext.getCurrentInstance();
+ CoreOutputText cot = (CoreOutputText) comp;
+ if (cot.isEscape())
+ {
+ ResponseWriter rw = context.getResponseWriter();
+ rw.startElement("span", comp);
+
+ rw.writeAttribute("id", cot.getId(), "id");
+ rw.writeAttribute("title", cot.getShortDesc(), "title");
+ rw.writeAttribute("class", cot.getStyleClass(), "styleClass");
+ rw.writeAttribute("style", cot.getInlineStyle(), "inlineStyle");
+ rw.writeAttribute("onclick", cot.getOnclick(), null);
+ rw.writeAttribute("ondblclick", cot.getOndblclick(), null);
+ rw.writeAttribute("onkeydown", cot.getOnkeydown(), null);
+ rw.writeAttribute("onkeyup", cot.getOnkeyup(), null);
+ rw.writeAttribute("onkeypress", cot.getOnkeypress(), null);
+ rw.writeAttribute("onmousedown", cot.getOnmousedown(), null);
+ rw.writeAttribute("onmousemove", cot.getOnmousemove(), null);
+ rw.writeAttribute("onmouseout", cot.getOnmouseout(), null);
+ rw.writeAttribute("onmouseover", cot.getOnmouseover(), null);
+ rw.writeAttribute("onmouseup", cot.getOnmouseup(), null);
+ }
+ }
+
+ public void encodeEnd(FacesContext context,
+ UIComponent comp) throws IOException
+ {
+ AdfFacesContext.getCurrentInstance();
+ CoreOutputText cot = (CoreOutputText) comp;
+ ResponseWriter rw = context.getResponseWriter();
+
+ Object value = cot.getValue();
+ if (!cot.isEscape())
+ {
+ if (value != null)
+ {
+ rw.write(value.toString());
+ }
+ }
+ else
+ {
+ if (value != null)
+ {
+ String valueStr = value.toString();
+ int truncateAt = cot.getTruncateAt();
+ if (truncateAt > 0)
+ {
+ if (truncateAt < 13)
+ truncateAt = 13;
+ if (valueStr.length() > truncateAt)
+ valueStr = valueStr.substring(0, truncateAt);
+ }
+
+ rw.writeText(valueStr, "value");
+ }
+
+ String description = cot.getDescription();
+ if (description != null)
+ {
+ rw.startElement("span", null);
+ rw.writeAttribute("class", "magicClass", null);
+ rw.writeText(description, "description");
+ rw.endElement("span");
+ }
+
+ rw.endElement("span");
+ }
+
+ }
+
+
+ protected Object getConvertedValue(
+ FacesContext context,
+ CoreOutputText cot)
+ {
+ Object value = cot.getValue();
+ if (value == null)
+ return null;
+
+ Converter converter = cot.getConverter();
+ if ((converter == null) && !(value instanceof String))
+ {
+ converter = getConverterByType(context, cot);
+ }
+
+ if (converter != null)
+ {
+ return converter.getAsString(context, cot, value);
+ }
+
+ return value;
+ }
+
+ protected Converter getConverterByType(
+ FacesContext context,
+ CoreOutputText cot)
+ {
+ ValueBinding binding = cot.getFacesBean().getValueBinding(_valueKey);
+ if (binding == null)
+ return null;
+
+ Class type = binding.getType(context);
+ return ConverterUtils.createConverter(context, type);
+ }
+
+ private PropertyKey _valueKey = CoreOutputText.VALUE_KEY;
+}
Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/adfinternal/renderkit/FastRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native