Author: adubovsky
Date: 2008-11-04 11:12:17 -0500 (Tue, 04 Nov 2008)
New Revision: 11018
Added:
trunk/test-applications/automator/
trunk/test-applications/automator/pom.xml
trunk/test-applications/automator/src/
trunk/test-applications/automator/src/main/
trunk/test-applications/automator/src/main/java/
trunk/test-applications/automator/src/main/java/comboBox/
trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java
trunk/test-applications/automator/src/main/java/general/
trunk/test-applications/automator/src/main/java/general/DrawGrids.java
trunk/test-applications/automator/src/main/java/general/General.java
trunk/test-applications/automator/src/main/java/parser/
trunk/test-applications/automator/src/main/java/parser/Attribute.java
trunk/test-applications/automator/src/main/java/parser/AttributesList.java
trunk/test-applications/automator/src/main/java/parser/Status.java
trunk/test-applications/automator/src/main/java/parser/TLDParser.java
trunk/test-applications/automator/src/main/java/phaseTracker/
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTracker.java
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTrackerComponent.java
trunk/test-applications/automator/src/main/resources/
trunk/test-applications/automator/src/main/webapp/
trunk/test-applications/automator/src/main/webapp/META-INF/
trunk/test-applications/automator/src/main/webapp/META-INF/MANIFEST.MF
trunk/test-applications/automator/src/main/webapp/WEB-INF/
trunk/test-applications/automator/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/components/
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/components/ComboBox.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/General.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/ShowResults.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Attribute.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/AttributesList.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Status.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/TLDParser.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTracker.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTrackerComponent.class
trunk/test-applications/automator/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/automator/src/main/webapp/WEB-INF/lib/
trunk/test-applications/automator/src/main/webapp/WEB-INF/web.xml
trunk/test-applications/automator/src/main/webapp/component/
trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp
trunk/test-applications/automator/src/main/webapp/icons/
trunk/test-applications/automator/src/main/webapp/icons/logo.png
trunk/test-applications/automator/src/main/webapp/index.jsp
trunk/test-applications/automator/src/main/webapp/main/
trunk/test-applications/automator/src/main/webapp/main/componentsList.jsp
trunk/test-applications/automator/src/main/webapp/main/main.jsp
Log:
automator app was added
Added: trunk/test-applications/automator/pom.xml
===================================================================
--- trunk/test-applications/automator/pom.xml (rev 0)
+++ trunk/test-applications/automator/pom.xml 2008-11-04 16:12:17 UTC (rev 11018)
@@ -0,0 +1,30 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>test-applications</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.test-applications</groupId>
+ <artifactId>automator</artifactId>
+ <packaging>war</packaging>
+ <name>RichFaces Test Application (AUTOMATOR)</name>
+ <build>
+ <finalName>automator</finalName>
+ </build>
+<dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.6</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+</dependencies>
+</project>
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java
===================================================================
--- trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java
(rev 0)
+++
trunk/test-applications/automator/src/main/java/comboBox/ComboBoxGeneral.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,209 @@
+package comboBox;
+
+import general.DrawGrids;
+
+import java.util.ArrayList;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlPanelGrid;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+import javax.faces.validator.ValidatorException;
+import org.richfaces.component.html.HtmlComboBox;
+import parser.Attribute;
+import parser.AttributesList;
+import parser.Status;
+import parser.TLDParser;
+import phaseTracker.PhaseTracker;
+
+public class ComboBoxGeneral {
+
+ private ArrayList<SelectItem> selectItems;
+ private HtmlComboBox comboBox;
+ private HtmlPanelGrid panelGrid;
+
+ // list of attributes
+ private boolean immediate;
+ private boolean required;
+ private String align;
+ private String validatorMessage;
+
+ private String statusValidator = "FAILED";
+ private String phaseValidator = "UNDEFINED";
+ private String validatorMessageTest = "";
+
+ private TLDParser tldParser = new TLDParser("comboBox");
+ private AttributesList attrs = tldParser.getAllAttributes();
+ private ArrayList<Attribute> generalAttrs = attrs.getCommonAttributes();
+
+ public ComboBoxGeneral() {
+ immediate = false;
+ required = true;
+ align = "right";
+ validatorMessage = "validator test message!";
+
+ selectItems = new ArrayList<SelectItem>();
+ for (int i = 0; i < 10; i++) {
+ selectItems.add(new SelectItem("selectItem " + i));
+ }
+ }
+
+ public void testGeneralAttributes(ActionEvent e) {
+ this.validatorCheck();
+ this.alignCheck();
+ this.validatorMessageCheck();
+ this.bindingCheck();
+
+ DrawGrids.showResultGrid(panelGrid, generalAttrs);
+ }
+
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ statusValidator = "PASSED";
+ phaseValidator = PhaseTracker.currentPhase.toString();
+
+ String selectedItem = null;
+ if (value != null)
+ selectedItem = value.toString();
+ if (selectedItem.equals("Gosha"))
+ throw new ValidatorException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR, "Validation error",
+ "Incorrect input"));
+ }
+
+ private void validatorCheck() {
+ int index = generalAttrs.indexOf(new Attribute("validator"));
+ if (index == -1) {
+ generalAttrs
+ .add(new Attribute(
+ "validator",
+ "void validator(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.Object)",
+ "", Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+ if (statusValidator.equals("PASSED")) {
+ if ((phaseValidator.equals("PROCESS_VALIDATIONS 3"))
+ && (!immediate)
+ || (phaseValidator.equals("APPLY_REQUEST_VALUES 2"))
+ && (immediate)) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ attr
+ .setDescription("Validator was triggered on incorrect phase");
+ }
+ } else {
+ attr.setStatus(Status.FAILED);
+ attr.setDescription("Validator was not triggered");
+ }
+ }
+ }
+
+ private void alignCheck() {
+ int index = generalAttrs.indexOf(new Attribute("align"));
+ if (index == -1) {
+ generalAttrs
+ .add(new Attribute("align", "", "",
Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+
+ attr.setStatus(Status.PASSED);
+ }
+ }
+
+ private void bindingCheck() {
+ int index = generalAttrs.indexOf(new Attribute("binding"));
+ if (index == -1) {
+ generalAttrs.add(new Attribute("binding", "", "",
+ Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+ if (comboBox != null) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+
+ private void validatorMessageCheck() {
+ int index = generalAttrs.indexOf(new Attribute("validatorMessage"));
+ if (index == -1) {
+ generalAttrs.add(new Attribute("validatorMessage", "",
"",
+ Status.IMPLEMENTED));
+ } else {
+ Attribute attr = generalAttrs.get(index);
+
+ if (validatorMessageTest.indexOf(validatorMessage) != -1) {
+ attr.setStatus(Status.PASSED);
+ } else {
+ attr.setStatus(Status.FAILED);
+ }
+ }
+ }
+
+ public HtmlComboBox getComboBox() {
+ return comboBox;
+ }
+
+ public void setComboBox(HtmlComboBox comboBox) {
+ this.comboBox = comboBox;
+ }
+
+ public ArrayList<SelectItem> getSelectItems() {
+ return selectItems;
+ }
+
+ public HtmlPanelGrid getPanelGrid() {
+ return panelGrid;
+ }
+
+ public void setPanelGrid(HtmlPanelGrid panelGrid) {
+ this.panelGrid = panelGrid;
+ }
+
+ public boolean isImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ public void setSelectItems(ArrayList<SelectItem> selectItems) {
+ this.selectItems = selectItems;
+ }
+
+ public String getAlign() {
+ return align;
+ }
+
+ public void setAlign(String align) {
+ this.align = align;
+ }
+
+ public String getValidatorMessage() {
+ return validatorMessage;
+ }
+
+ public void setValidatorMessage(String validatorMessage) {
+ this.validatorMessage = validatorMessage;
+ }
+
+ public String getValidatorMessageTest() {
+ return validatorMessageTest;
+ }
+
+ public void setValidatorMessageTest(String validatorMessageTest) {
+ this.validatorMessageTest = validatorMessageTest;
+ }
+}
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/java/general/DrawGrids.java
===================================================================
--- trunk/test-applications/automator/src/main/java/general/DrawGrids.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/general/DrawGrids.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,52 @@
+package general;
+
+import java.util.ArrayList;
+
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.component.html.HtmlPanelGrid;
+
+import parser.Attribute;
+
+public class DrawGrids {
+
+ public static void showResultGrid(HtmlPanelGrid panelGrid, ArrayList<Attribute>
attrs) {
+ panelGrid.getChildren().clear();
+
+ HtmlOutputText attrNameHeader = new HtmlOutputText();
+ attrNameHeader.setValue("Attribute");
+ attrNameHeader.setStyle("font-weight: bold; font-size: large");
+
+ HtmlOutputText attrStatusHeader = new HtmlOutputText();
+ attrStatusHeader.setValue("Status");
+ attrStatusHeader.setStyle("font-weight: bold; font-size: large");
+
+ panelGrid.getChildren().add(attrNameHeader);
+ panelGrid.getChildren().add(attrStatusHeader);
+
+ for (Attribute a : attrs) {
+ HtmlOutputText attrName = new HtmlOutputText();
+ attrName.setValue(a.getName());
+ HtmlOutputText attrStatus = new HtmlOutputText();
+ attrStatus.setValue(a.getStatus());
+
+ switch (a.getStatus()) {
+ case FAILED:
+ attrStatus.setStyle("color: red");
+ break;
+ case PASSED:
+ attrStatus.setStyle("color: green");
+ break;
+ case NOT_READY:
+ attrStatus.setStyle("color: grey");
+ break;
+ }
+
+ panelGrid.getChildren().add(attrName);
+ panelGrid.getChildren().add(attrStatus);
+ }
+ }
+
+ public static void showEventGrid(HtmlPanelGrid panelGrid, ArrayList<String>
events) {
+
+ }
+}
Added: trunk/test-applications/automator/src/main/java/general/General.java
===================================================================
--- trunk/test-applications/automator/src/main/java/general/General.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/general/General.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,18 @@
+package general;
+
+public class General {
+
+ private String componentPage;
+
+ public General() {
+ componentPage = "/main/componentsList.jsp";
+ }
+
+ public String getComponentPage() {
+ return componentPage;
+ }
+
+ public void setComponentPage(String componentPage) {
+ this.componentPage = componentPage;
+ }
+}
Added: trunk/test-applications/automator/src/main/java/parser/Attribute.java
===================================================================
--- trunk/test-applications/automator/src/main/java/parser/Attribute.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/parser/Attribute.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,69 @@
+package 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 +
"]";
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ Attribute attr = (Attribute) obj;
+
+ return (attr.getName().equals(this.name));
+ }
+}
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/java/parser/AttributesList.java
===================================================================
--- trunk/test-applications/automator/src/main/java/parser/AttributesList.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/parser/AttributesList.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,78 @@
+package 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/automator/src/main/java/parser/Status.java
===================================================================
--- trunk/test-applications/automator/src/main/java/parser/Status.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/parser/Status.java 2008-11-04 16:12:17
UTC (rev 11018)
@@ -0,0 +1,3 @@
+package parser;
+
+public enum Status {NOT_READY, IMPLEMENTED, FAILED, PASSED}
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/java/parser/TLDParser.java
===================================================================
--- trunk/test-applications/automator/src/main/java/parser/TLDParser.java
(rev 0)
+++ trunk/test-applications/automator/src/main/java/parser/TLDParser.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,124 @@
+package parser;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+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() {
+ allAttributes.clear();
+ 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/automator/src/main/java/phaseTracker/PhaseTracker.java
===================================================================
--- trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTracker.java
(rev 0)
+++
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTracker.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,43 @@
+package phaseTracker;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+/**
+ * @author AYanul
+ *
+ */
+public class PhaseTracker implements PhaseListener {
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 6533052212003582848L;
+
+ /** The Current JSF phase of the application. */
+ public static PhaseId currentPhase = PhaseId.ANY_PHASE;
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
+ */
+ public void afterPhase(PhaseEvent arg0) {
+ System.out.println("PhaseTracker.afterPhase()" + arg0.getPhaseId());
+ if (arg0.getPhaseId().toString().equals("RENDER_RESPONSE 6"))
+ System.out.println("********** end lifecycle *************");
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
+ */
+ public void beforePhase(PhaseEvent arg0) {
+ if (arg0.getPhaseId().toString().equals("RESTORE_VIEW 1"))
+ System.out.println("********** begin lifecycle *************");
+ currentPhase = arg0.getPhaseId();
+ System.out.println("PhaseTracker.beforePhase()" + arg0.getPhaseId());
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.PhaseListener#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return PhaseId.ANY_PHASE;
+ }
+}
Added:
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTrackerComponent.java
===================================================================
---
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTrackerComponent.java
(rev 0)
+++
trunk/test-applications/automator/src/main/java/phaseTracker/PhaseTrackerComponent.java 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,46 @@
+/**
+ *
+ */
+package phaseTracker;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Map;
+
+import javax.faces.component.UIPanel;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+/**
+ * @author user
+ *
+ */
+public class PhaseTrackerComponent extends UIPanel{
+
+ @Override
+ public void encodeAll(FacesContext context) throws IOException {
+ ResponseWriter responseWriter = context.getResponseWriter();
+ StringWriter stringWriter = new StringWriter();
+ ResponseWriter clonedWriter = responseWriter.cloneWithWriter(stringWriter);
+ context.setResponseWriter(clonedWriter);
+
+ super.encodeAll(context);
+ clonedWriter.flush();
+ context.setResponseWriter(responseWriter);
+
+ String string = stringWriter.toString();
+ responseWriter.write(string);
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ requestMap.put("pttc", string);
+ }
+
+ @Override
+ public String getRendererType() {
+ return null;
+ }
+
+
+}
Added: trunk/test-applications/automator/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/test-applications/automator/src/main/webapp/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/META-INF/MANIFEST.MF 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: trunk/test-applications/automator/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/test-applications/automator/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
(rev 0)
+++
trunk/test-applications/automator/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess"/>
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/components/ComboBox.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/components/ComboBox.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/General.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/General.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/ShowResults.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/general/ShowResults.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Attribute.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Attribute.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/AttributesList.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/AttributesList.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Status.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/Status.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/TLDParser.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/parser/TLDParser.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTracker.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTracker.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTrackerComponent.class
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/automator/src/main/webapp/WEB-INF/classes/phaseTracker/PhaseTrackerComponent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/test-applications/automator/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/automator/src/main/webapp/WEB-INF/faces-config.xml
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/WEB-INF/faces-config.xml 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <managed-bean-name>general</managed-bean-name>
+ <managed-bean-class>general.General</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>comboBoxGeneral</managed-bean-name>
+ <managed-bean-class>comboBox.ComboBoxGeneral</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <lifecycle>
+ <phase-listener>phaseTracker.PhaseTracker</phase-listener>
+ </lifecycle>
+</faces-config>
Added: trunk/test-applications/automator/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/automator/src/main/webapp/WEB-INF/web.xml
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/WEB-INF/web.xml 2008-11-04 16:12:17
UTC (rev 11018)
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>automator</display-name>
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>classic</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>ALL</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
+ <param-value>RESOURCE_URI_PREFIX</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <filter>
+ <display-name>RichFaces Filter</display-name>
+ <filter-name>richfaces</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>richfaces</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp
===================================================================
--- trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/component/comboBox.jsp 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,42 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:subview id="comboBoxSubview">
+ <div>The <rich:comboBox> is a component, that provides
+ editable combo box element on a page.</div>
+ <rich:spacer height="30"></rich:spacer>
+
+ <script type="text/javascript">
+ function showValue() {
+ var myMessage = document.getElementById('mainForm:comboBoxSubview:mess');
+ if(myMessage != null) {
+ myMessageText = myMessage.textContent;
+ document.getElementById('mainForm:comboBoxSubview:hiddenInput').value =
myMessageText;
+ }
+ return true;
+ }
+ </script>
+
+ <h:panelGrid id="comboBoxGrid" columns="1" >
+ <h:messages id="mess" style="color: red" />
+ <rich:comboBox id="comboBox"
binding="#{comboBoxGeneral.comboBox}"
+ align="#{comboBoxGeneral.align}"
validator="#{comboBoxGeneral.validate}"
+ required="#{comboBoxGeneral.required}"
+ validatorMessage="#{comboBoxGeneral.validatorMessage}">
+ <f:selectItems value="#{comboBoxGeneral.selectItems}" />
+ <f:selectItem itemValue="Gosha" itemLabel="Gosha" />
+ </rich:comboBox>
+ <h:inputHidden id="hiddenInput"
value="#{comboBoxGeneral.validatorMessageTest}" />
+ </h:panelGrid>
+ <rich:spacer height="30"></rich:spacer>
+
+ <a4j:commandButton value="testGeneralAttrs"
+ actionListener="#{comboBoxGeneral.testGeneralAttributes}"
+ reRender="generalResult, comboBoxGrid"></a4j:commandButton>
+
+ <h:panelGrid id="generalResult"
binding="#{comboBoxGeneral.panelGrid}"
+ columns="2">
+ </h:panelGrid>
+</f:subview>
Added: trunk/test-applications/automator/src/main/webapp/icons/logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/automator/src/main/webapp/icons/logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/test-applications/automator/src/main/webapp/index.jsp
===================================================================
--- trunk/test-applications/automator/src/main/webapp/index.jsp
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/index.jsp 2008-11-04 16:12:17 UTC
(rev 11018)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head></head>
+ <body>
+ <jsp:forward page="/main/main.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/webapp/main/componentsList.jsp
===================================================================
--- trunk/test-applications/automator/src/main/webapp/main/componentsList.jsp
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/main/componentsList.jsp 2008-11-04
16:12:17 UTC (rev 11018)
@@ -0,0 +1,13 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:subview id="componentsListSubview">
+ <h:panelGrid columns="1">
+ <a4j:commandLink reRender="componentPage" value="Combo Box">
+ <a4j:actionparam value="/component/comboBox.jsp"
+ assignTo="#{general.componentPage}" />
+ </a4j:commandLink>
+ </h:panelGrid>
+</f:subview>
\ No newline at end of file
Added: trunk/test-applications/automator/src/main/webapp/main/main.jsp
===================================================================
--- trunk/test-applications/automator/src/main/webapp/main/main.jsp
(rev 0)
+++ trunk/test-applications/automator/src/main/webapp/main/main.jsp 2008-11-04 16:12:17
UTC (rev 11018)
@@ -0,0 +1,36 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib
uri="http://richfaces.org/rich" prefix="rich"%>
+
+<f:view>
+ <html>
+ <head>
+ <title>Automator</title>
+ </head>
+ <body>
+ <h:form id="mainForm">
+ <div align="center"><h:panelGrid columns="2">
+ <h:graphicImage value="/icons/logo.png" />
+ <h:panelGroup>
+ <span style="color: orange; font-size: 50; font-family:
cursive">Automator</span>
+ </h:panelGroup>
+ </h:panelGrid></div>
+ <div align="right"><h:panelGrid id="mainMenu"
columns="3"
+ border="1">
+ <a4j:status id="a4jStatus" startText="WORK!"
startStyle="color: red;"
+ stopText="a4j:status" />
+ <a4j:commandButton reRender="componentPage" value="reRender"
/>
+ <a4j:commandLink reRender="componentPage" value="Return"
immediate="true">
+ <a4j:actionparam value="/main/componentsList.jsp"
+ assignTo="#{general.componentPage}" />
+ </a4j:commandLink>
+ </h:panelGrid></div>
+ <rich:spacer height="20"></rich:spacer>
+ <h:panelGrid id="componentPage" columns="1">
+ <jsp:include page="${general.componentPage}" />
+ </h:panelGrid>
+ </h:form>
+ </body>
+ </html>
+</f:view>
\ No newline at end of file