[jbosstools-commits] JBoss Tools SVN: r22084 - in workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces: src/org/jboss/tools/jsf/vpe/template/mock/impl and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri May 14 08:34:39 EDT 2010


Author: mareshkau
Date: 2010-05-14 08:34:39 -0400 (Fri, 14 May 2010)
New Revision: 22084

Added:
   workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceInputTextTemplate.java
Modified:
   workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUIComponent.java
   workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4710 input text has been added template

Added: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceInputTextTemplate.java
===================================================================
--- workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceInputTextTemplate.java	                        (rev 0)
+++ workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceInputTextTemplate.java	2010-05-14 12:34:39 UTC (rev 22084)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.icefaces.template;
+
+import javax.faces.render.Renderer;
+
+import org.jboss.tools.jsf.vpe.icefaces.IceFacesActivator;
+import org.jboss.tools.jsf.vpe.icefaces.utill.VpeRendererUtil;
+import org.jboss.tools.jsf.vpe.template.mock.impl.VpeFacesContext;
+import org.jboss.tools.jsf.vpe.template.mock.impl.VpeUICommand;
+import org.jboss.tools.jsf.vpe.template.mock.impl.VpeUIComponent;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class IceInputTextTemplate extends VpeAbstractTemplate{
+
+	public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+			nsIDOMDocument visualDocument) {
+		try {
+			VpeFacesContext.getInstance().setResponseWriter(null);
+			Renderer render = new com.icesoft.faces.component.ext.renderkit.InputTextRenderer();
+			VpeUICommand uiComponent = new VpeUICommand(
+					(Element) sourceNode);
+			Node result = VpeRendererUtil.processRenderer(render, uiComponent);
+			nsIDOMNode resultVisualNode = VpeRendererUtil.createVisualNode(
+					result, visualDocument);
+			if (resultVisualNode.getNodeType() == Node.TEXT_NODE) {
+				nsIDOMElement domElement = VisualDomUtil
+						.createBorderlessContainer(visualDocument);
+				domElement.appendChild(resultVisualNode);
+				resultVisualNode = domElement;
+			}
+			return new VpeCreationData(resultVisualNode);
+		} catch (Throwable th) {
+			IceFacesActivator.getDefault().logError(th);
+		}
+		return VpeTemplateManager.getInstance().getDefTemplate().create(
+				pageContext, sourceNode, visualDocument);
+	}
+
+}

Modified: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUIComponent.java
===================================================================
--- workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUIComponent.java	2010-05-14 12:32:31 UTC (rev 22083)
+++ workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUIComponent.java	2010-05-14 12:34:39 UTC (rev 22084)
@@ -12,6 +12,11 @@
 
 import java.util.HashMap;
 import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
 import javax.faces.context.FacesContext;
 import javax.faces.el.EvaluationException;
 import javax.faces.el.PropertyNotFoundException;
@@ -65,36 +70,72 @@
 	}
 
 	/* (non-Javadoc)
-	 * @see javax.faces.component.UIComponent#getValueBinding(java.lang.String)
+	 * @see javax.faces.component.UIComponent#getValueExpression(java.lang.String)
 	 */
 	@Override
-	public ValueBinding getValueBinding(String arg0) {
+	public ValueExpression getValueExpression(final String name) {
+		return new ValueExpression(){
 
-		final String value=arg0;
-		return new ValueBinding() {
-			
 			@Override
-			public void setValue(FacesContext arg0, Object arg1)
-					throws EvaluationException, PropertyNotFoundException {				
+			public Class<?> getExpectedType() {
+				// TODO Auto-generated method stub
+				return String.class;
 			}
-			
+
 			@Override
-			public boolean isReadOnly(FacesContext arg0) throws EvaluationException,
-					PropertyNotFoundException {
-				return true;
+			public Class<?> getType(ELContext arg0)
+					throws NullPointerException, PropertyNotFoundException,
+					ELException {
+				// TODO Auto-generated method stub
+				return String.class;
 			}
-			
+
 			@Override
-			public Object getValue(FacesContext arg0) throws EvaluationException,
-					PropertyNotFoundException {
-				return getAttributes().get(value);
+			public Object getValue(ELContext arg0) throws NullPointerException,
+					PropertyNotFoundException, ELException {
+				return  getAttributes().get(name);
 			}
-			
+
 			@Override
-			public Class getType(FacesContext arg0) throws EvaluationException,
-					PropertyNotFoundException {
-				return null;
+			public boolean isReadOnly(ELContext arg0)
+					throws NullPointerException, PropertyNotFoundException,
+					ELException {
+				// TODO Auto-generated method stub
+				return false;
 			}
+
+			@Override
+			public void setValue(ELContext arg0, Object arg1)
+					throws NullPointerException, PropertyNotFoundException,
+					PropertyNotWritableException, ELException {
+				// TODO Auto-generated method stub
+				
+			}
+
+			@Override
+			public boolean equals(Object arg0) {
+				// TODO Auto-generated method stub
+				return false;
+			}
+
+			@Override
+			public String getExpressionString() {
+				// TODO Auto-generated method stub
+				return (String) getAttributes().get(name);
+			}
+
+			@Override
+			public int hashCode() {
+				// TODO Auto-generated method stub
+				return 0;
+			}
+
+			@Override
+			public boolean isLiteralText() {
+				// TODO Auto-generated method stub
+				return false;
+			}
+			
 		};
 	}
 

Modified: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml
===================================================================
--- workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml	2010-05-14 12:32:31 UTC (rev 22083)
+++ workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml	2010-05-14 12:34:39 UTC (rev 22084)
@@ -3,12 +3,6 @@
 <vpe:templates xmlns:vpe="http://org.jboss.org/tools/vpe/template"
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<vpe:template-taglib uri="http://www.icesoft.com/icefaces/component" prefix="ice" />
-
-	<vpe:tag name="ice:inputText" case-sensitive="yes">
-		<vpe:template children="yes" modify="yes">
-			<div>#Input Text</div>
-		</vpe:template>
-	</vpe:tag>
 	
 	<vpe:tag name="ice:outputText" case-sensitive="yes">
 		<vpe:template children="yes" modify="yes"
@@ -50,4 +44,17 @@
 			</vpe:dnd>
 		</vpe:template>
 	</vpe:tag>
+	<vpe:tag name="ice:inputText" case-sensitive="yes">
+		<vpe:template children="yes" modify="yes"
+		class="org.jboss.tools.jsf.vpe.icefaces.template.IceInputTextTemplate">
+			<vpe:resize>
+				<vpe:width width-attr="style.width" />
+				<vpe:height height-attr="style.height" />
+			</vpe:resize>
+			<vpe:dnd>
+				<vpe:drag start-enable="yes" />
+				<vpe:drop container="no"></vpe:drop>
+			</vpe:dnd>
+		</vpe:template>
+	</vpe:tag>
 </vpe:templates>



More information about the jbosstools-commits mailing list