Author: dvinnichek
Date: 2010-11-01 10:40:15 -0400 (Mon, 01 Nov 2010)
New Revision: 26164
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAutocompleteTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml.xml
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
added template for <rich:autocomplete> element
(
https://jira.jboss.org/browse/JBIDE-7448)
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAutocompleteTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAutocompleteTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAutocompleteTemplate.java 2010-11-01
14:40:15 UTC (rev 26164)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.richfaces.template;
+
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Template for the <rich:autocomplete> component.
+ *
+ * @author dvinnichek
+ */
+public class RichFacesAutocompleteTemplate extends
+ AbstractEditableRichFacesTemplate {
+
+ private boolean disabled;
+ private boolean showButton;
+
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ readAttributes(pageContext, sourceNode);
+
+ nsIDOMElement wrapper = visualDocument.createElement(HTML.TAG_SPAN);
+ nsIDOMElement element = showButton ? visualDocument
+ .createElement(HTML.TAG_SELECT) : visualDocument
+ .createElement(HTML.TAG_INPUT);
+ if (disabled) {
+ element.setAttribute(RichFaces.ATTR_DISABLED,
+ RichFaces.ATTR_DISABLED);
+ }
+ wrapper.appendChild(element);
+ VpeCreationData creationData = new VpeCreationData(wrapper);
+
+ return creationData;
+ }
+
+ /**
+ * Read attributes from the source element.
+ *
+ * @param sourceNode
+ * the source node
+ */
+ private void readAttributes(VpePageContext pageContext, Node sourceNode) {
+
+ Element sourceElement = (Element) sourceNode;
+
+ // disabled
+ disabled = Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(RichFaces.ATTR_DISABLED));
+ // showButton
+ showButton = Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(RichFaces.ATTR_SHOW_BUTTON));
+ }
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAutocompleteTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2010-11-01
14:34:45 UTC (rev 26163)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2010-11-01
14:40:15 UTC (rev 26164)
@@ -60,7 +60,8 @@
public static final String ATTR_ROWS = "rows"; //$NON-NLS-1$
public static final String ATTR_ROW_CLASSES = "rowClasses"; //$NON-NLS-1$
public static final String ATTR_SELECT_ITEM_LABEL = "itemLabel";
//$NON-NLS-1$
- public static final String ATTR_SELECT_ITEM_VALUE = "itemValue";
//$NON-NLS-1$
+ public static final String ATTR_SELECT_ITEM_VALUE = "itemValue";
//$NON-NLS-1$showButton
+ public static final String ATTR_SHOW_BUTTON = "showButton"; //$NON-NLS-1$
public static final String ATTR_SHOW_BUTTON_LABELS = "showButtonLabels";
//$NON-NLS-1$
public static final String ATTR_SORT_BY = "sortBy"; //$NON-NLS-1$
public static final String ATTR_SORT_ICON = "sortIcon"; //$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2010-11-01
14:34:45 UTC (rev 26163)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2010-11-01
14:40:15 UTC (rev 26164)
@@ -781,4 +781,15 @@
</vpe:template>
</vpe:tag>
+ <!-- Since RichFaces 4.0 -->
+ <vpe:tag name="rich:autocomplete" case-sensitive="yes">
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAutocompleteTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
</vpe:templates>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml.xml 2010-11-01
14:40:15 UTC (rev 26164)
@@ -0,0 +1,17 @@
+<tests>
+ <test id="autocomplete1">
+ <SPAN>
+ <INPUT />
+ </SPAN>
+ </test>
+ <test id="autocomplete2">
+ <SPAN>
+ <INPUT DISABLED="disabled" />
+ </SPAN>
+ </test>
+ <test id="autocomplete3">
+ <SPAN>
+ <SELECT />
+ </SPAN>
+ </test>
+</tests>
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/autocomplete.xhtml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-01
14:34:45 UTC (rev 26163)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-01
14:40:15 UTC (rev 26164)
@@ -368,6 +368,10 @@
performContentTest("components/colorPicker.xhtml");//$NON-NLS-1$
}
+ public void testAutocomplete() throws Throwable {
+ performContentTest("components/autocomplete.xhtml");//$NON-NLS-1$
+ }
+
@Override
protected String getTestProjectName() {
return RichFacesAllTests.IMPORT_PROJECT_NAME;