[jbosstools-commits] JBoss Tools SVN: r43070 - in trunk/jsf: plugins/org.jboss.tools.jsf.vpe.jsf/templates and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Aug 16 06:04:39 EDT 2012


Author: dmaliarevich
Date: 2012-08-16 06:04:38 -0400 (Thu, 16 Aug 2012)
New Revision: 43070

Added:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfMessages.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectBooleanCheckbox.java
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp.xml
Modified:
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfInputTextAreaTemplate.java
   trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml.xml
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp.xml
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentContentTest.java
Log:
https://issues.jboss.org/browse/JBIDE-3225 - adding text for h:inputHidden, h:inputTextarea, h:messages, h:selectBooleanCheckbox

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfInputTextAreaTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfInputTextAreaTemplate.java	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfInputTextAreaTemplate.java	2012-08-16 10:04:38 UTC (rev 43070)
@@ -16,9 +16,9 @@
 import org.jboss.tools.vpe.editor.mapping.VpeElementData;
 import org.jboss.tools.vpe.editor.template.VpeCreationData;
 import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
 import org.mozilla.interfaces.nsIDOMDocument;
 import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMHTMLTextAreaElement;
 import org.mozilla.interfaces.nsIDOMNode;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
@@ -33,14 +33,7 @@
 
 		nsIDOMElement textArea = visualDocument
 				.createElement(HTML.TAG_TEXTAREA);
-		
-// Commented as fix for JBIDE-3012.		
-//		((nsIDOMHTMLTextAreaElement) textArea
-//				.queryInterface(nsIDOMHTMLTextAreaElement.NS_IDOMHTMLTEXTAREAELEMENT_IID))
-//				.setReadOnly(true);
 
-		VpeCreationData creationData = new VpeCreationData(textArea);
-
 		copyGeneralJsfAttributes(sourceElement, textArea);
 		ComponentUtil.copyDisabled(sourceElement, textArea);
 
@@ -65,6 +58,13 @@
 
 		}
 		textArea.appendChild(text);
+		/*
+		 * https://issues.jboss.org/browse/JBIDE-3225
+		 * Components should render usual text inside
+		 */
+		VpeCreationData creationData = VisualDomUtil.createTemplateWithTextContainer(
+				sourceElement, textArea, HTML.TAG_DIV, visualDocument);
+		
 		creationData.setElementData(elementData);
 
 		return creationData;

Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfMessages.java	                        (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfMessages.java	2012-08-16 10:04:38 UTC (rev 43070)
@@ -0,0 +1,53 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+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.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class JsfMessages extends VpeAbstractTemplate {
+	
+	private static final String MESSAGES = "Error Messages"; //$NON-NLS-1$
+
+	@Override
+	public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+			nsIDOMDocument visualDocument) {
+		Element sourceElement = (Element) sourceNode;
+		nsIDOMElement ul = visualDocument.createElement(HTML.TAG_UL);
+		nsIDOMElement li = visualDocument.createElement(HTML.TAG_LI);
+		nsIDOMText text = visualDocument.createTextNode(MESSAGES);
+		if (sourceElement.hasAttribute(JSF.ATTR_STYLE)) {
+			ul.setAttribute(JSF.ATTR_STYLE, sourceElement.getAttribute(JSF.ATTR_STYLE));
+		}
+		if (sourceElement.hasAttribute(JSF.ATTR_STYLE_CLASS)) {
+			ul.setAttribute(HTML.ATTR_CLASS, sourceElement.getAttribute(JSF.ATTR_STYLE_CLASS));
+		}
+		li.appendChild(text);
+		ul.appendChild(li);
+		/*
+		 * https://issues.jboss.org/browse/JBIDE-3225
+		 * Components should render usual text inside
+		 */
+		VpeCreationData creationData = VisualDomUtil.createTemplateWithTextContainer(
+				sourceElement, ul, HTML.TAG_DIV, visualDocument);
+		
+		return creationData;
+	}
+
+}

Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectBooleanCheckbox.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectBooleanCheckbox.java	                        (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSelectBooleanCheckbox.java	2012-08-16 10:04:38 UTC (rev 43070)
@@ -0,0 +1,62 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+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.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class JsfSelectBooleanCheckbox extends VpeAbstractTemplate {
+
+	private static final String TRUE = "true"; //$NON-NLS-1$
+	
+	@Override
+	public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+			nsIDOMDocument visualDocument) {
+		Element sourceElement = (Element) sourceNode;
+		nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
+		input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_CHECKBOX);
+		
+		if (sourceElement.hasAttribute(HTML.ATTR_DISABLED)) {
+			String disabled = sourceElement.getAttribute(HTML.ATTR_DISABLED);
+			if (TRUE.equalsIgnoreCase(disabled)) {
+				input.setAttribute(HTML.ATTR_DISABLED, disabled);
+			}
+		}
+		if (sourceElement.hasAttribute(HTML.ATTR_BORDER)) {
+			input.setAttribute(HTML.ATTR_BORDER, sourceElement.getAttribute(HTML.ATTR_BORDER));
+		}
+		if (sourceElement.hasAttribute(HTML.ATTR_VALUE)) {
+			input.setAttribute(HTML.ATTR_CHECKED, sourceElement.getAttribute(HTML.ATTR_VALUE));
+		}
+		if (sourceElement.hasAttribute(JSF.ATTR_STYLE)) {
+			input.setAttribute(JSF.ATTR_STYLE, sourceElement.getAttribute(JSF.ATTR_STYLE));
+		}
+		if (sourceElement.hasAttribute(JSF.ATTR_STYLE_CLASS)) {
+			input.setAttribute(JSF.ATTR_STYLE_CLASS, sourceElement.getAttribute(JSF.ATTR_STYLE_CLASS));
+		}
+		/*
+		 * https://issues.jboss.org/browse/JBIDE-3225
+		 * Components should render usual text inside
+		 */
+		VpeCreationData creationData = VisualDomUtil.createTemplateWithTextContainer(
+				sourceElement, input, HTML.TAG_DIV, visualDocument);
+		
+		return creationData;
+	}
+
+}

Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml	2012-08-16 10:04:38 UTC (rev 43070)
@@ -118,7 +118,10 @@
 	</vpe:tag>
 
 	<vpe:tag name="h:inputHidden" case-sensitive="yes">
-		<vpe:template children="no" modify="no">
+		<vpe:template children="yes" modify="no">
+		<div>
+			<input id="{@id}" type="hidden" name="{@id}" value="{@value}" />
+		</div>
 			<vpe:dnd>
 				<vpe:drag start-enable="yes" />
 				<vpe:drop container="yes">
@@ -391,10 +394,8 @@
 	</vpe:tag>
 
 	<vpe:tag name="h:selectBooleanCheckbox" case-sensitive="yes">
-		<vpe:if test="@disabled='on'"><!-- Gavr --><!-- added x: 15.02.05 -->
-			<vpe:template children="no" modify="no">
-				<input type="checkbox" disabled="on" checked="{@value}" class="{@styleClass}"
-					style="{@style}" border="{@border}" title="{tagstring()}" />
+		<vpe:template children="yes" modify="no"
+		class="org.jboss.tools.jsf.vpe.jsf.template.JsfSelectBooleanCheckbox">
 				<vpe:dnd>
 					<vpe:drag start-enable="yes" />
 					<vpe:drop container="yes">
@@ -402,11 +403,6 @@
 						<vpe:container-child tag-name="selectItems" />
 					</vpe:drop>
 				</vpe:dnd>
-			</vpe:template>
-		</vpe:if>
-		<vpe:template children="no" modify="no">
-			<input type="checkbox" checked="{@value}" class="{@styleClass}"
-				style="{@style}" border="{@border}" title="{tagstring()}" />
 		</vpe:template>
 	</vpe:tag>
 
@@ -912,10 +908,8 @@
 	</vpe:tag>
 
 	<vpe:tag name="h:messages">
-		<vpe:template children="no" modify="no">
-			<ul class="{@styleClass}" style="{@style}">
-				<li>Error Messages</li>
-			</ul>
+		<vpe:template children="yes" modify="no"
+			class="org.jboss.tools.jsf.vpe.jsf.template.JsfMessages">
 			<vpe:dnd>
 				<vpe:drag start-enable="yes" />
 				<vpe:drop container="no" />

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml	2012-08-16 10:04:38 UTC (rev 43070)
@@ -11,7 +11,7 @@
 <ui:define name="body">
 	<h:form id="test_el">
 	<f:loadBundle basename="demo.resources" var="msg" />
-    <h:messages globalOnly="true" styleClass="message"/>
+    <h:messages globalOnly="true" styleClass="message" style="color: green;"/>
 
     <rich:panel style="#{test.color} ">123456789 #{test.scope} #{test.scope} #{test.scope}
 			<div style="width : 109px; height : 106px; background-color:green;"></div>

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml.xml	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/test.xhtml.xml	2012-08-16 10:04:38 UTC (rev 43070)
@@ -1,7 +1,7 @@
 <tests>
 	<test id="test_el">
 		<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
-			<UL CLASS="message" STYLE="-moz-user-modify: read-only;">
+			<UL CLASS="message" STYLE="color: green;">
 				<LI>
 					Error Messages
 				</LI>

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp	2012-08-16 10:04:38 UTC (rev 43070)
@@ -7,10 +7,7 @@
 <body>
 
 <f:view>
-	<h1><h:outputText value="inputHidden" /></h1>
-
-	<h:inputHidden value="inputHidden" id="inputHidden"/>
-	
+	<h:inputHidden value="inputHiddenValue" id="inputHiddenID"/>
 </f:view>
 </body>
 </html>
\ No newline at end of file

Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp.xml	                        (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputHidden.jsp.xml	2012-08-16 10:04:38 UTC (rev 43070)
@@ -0,0 +1,9 @@
+<tests>
+	<test id="inputHiddenID">
+		<DIV STYLE="-moz-user-modify: read-only;">
+			<INPUT TYPE="hidden" ID="inputHiddenID" NAME="inputHiddenID"
+				VALUE="inputHiddenValue" />
+			<BR VPE:PSEUDO-ELEMENT="yes" STYLE="-moz-user-modify: read-only;" />
+		</DIV>
+	</test>
+</tests>
\ No newline at end of file

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp	2012-08-16 10:04:38 UTC (rev 43070)
@@ -7,10 +7,7 @@
 <body>
 
 <f:view>
-	<h1><h:outputText value="inputTextArea" /></h1>
-
-	<h:inputTextarea value="inputTextArea" id="inputTextArea" />
-	
+	<h:inputTextarea value="inputTextAreaValue" id="inputTextAreaID" />
 </f:view>
 </body>
 </html>
\ No newline at end of file

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp.xml	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/inputTextArea.jsp.xml	2012-08-16 10:04:38 UTC (rev 43070)
@@ -1,5 +1,5 @@
 <tests>
-	<test id="inputTextArea">
-		<TEXTAREA> inputTextArea </TEXTAREA>
+	<test id="inputTextAreaID">
+		<TEXTAREA> inputTextAreaValue </TEXTAREA>
 	</test>
 </tests>
\ No newline at end of file

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentContentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentContentTest.java	2012-08-16 09:00:22 UTC (rev 43069)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentContentTest.java	2012-08-16 10:04:38 UTC (rev 43070)
@@ -46,8 +46,7 @@
 	}
 
 	public void testInputHidden() throws Throwable {
-		performInvisibleTagTest(
-				"components/inputHidden.jsp", "inputHidden"); //$NON-NLS-1$ //$NON-NLS-2$
+		performContentTest("components/inputHidden.jsp"); //$NON-NLS-1$
 	}
 
 	public void testInputSecret() throws Throwable {



More information about the jbosstools-commits mailing list