Author: mareshkau
Date: 2010-05-14 04:17:38 -0400 (Fri, 14 May 2010)
New Revision: 22078
Added:
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceCommandButtonTemplate.java
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUICommand.java
Modified:
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/.classpath
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/resources/jsf-api.jar
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/resources/jsf-impl.jar
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml
Log:
Processing ice button has been added,
https://jira.jboss.org/jira/browse/JBIDE-4710
Modified: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/.classpath
===================================================================
--- workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/.classpath 2010-05-14 01:02:42
UTC (rev 22077)
+++ workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/.classpath 2010-05-14 08:17:38
UTC (rev 22078)
@@ -3,10 +3,10 @@
<classpathentry exported="true" kind="lib"
path="resources/servlet-api.jar"/>
<classpathentry exported="true" kind="lib"
path="resources/el-api.jar"/>
<classpathentry exported="true" kind="lib"
path="resources/jsp-api.jar"/>
- <classpathentry exported="true" kind="lib"
path="resources/jsf-api.jar"
sourcepath="/home/mareshkau/Programs/mojarra-2.0.0-RC-source.zip"/>
+ <classpathentry exported="true" kind="lib"
path="resources/jsf-api.jar"
sourcepath="/home/mareshkau/Programs/mojarra-1.2_12-source.zip"/>
<classpathentry exported="true" kind="lib"
path="resources/icefaces-facelets.jar"/>
<classpathentry exported="true" kind="lib"
path="resources/icefaces.jar"
sourcepath="/home/mareshkau/Programs/ICEfaces-1.8.1-src.zip"/>
- <classpathentry exported="true" kind="lib"
path="resources/icefaces-comps.jar"/>
+ <classpathentry exported="true" kind="lib"
path="resources/icefaces-comps.jar"
sourcepath="/home/mareshkau/Programs/ICEfaces-1.8.1-src.zip"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
Modified: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/resources/jsf-api.jar
===================================================================
(Binary files differ)
Modified: workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/resources/jsf-impl.jar
===================================================================
(Binary files differ)
Added:
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceCommandButtonTemplate.java
===================================================================
---
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceCommandButtonTemplate.java
(rev 0)
+++
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/icefaces/template/IceCommandButtonTemplate.java 2010-05-14
08:17:38 UTC (rev 22078)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.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 IceCommandButtonTemplate 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.ButtonRenderer();
+ 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);
+ }
+
+}
Added:
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUICommand.java
===================================================================
---
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUICommand.java
(rev 0)
+++
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/src/org/jboss/tools/jsf/vpe/template/mock/impl/VpeUICommand.java 2010-05-14
08:17:38 UTC (rev 22078)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * 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.template.mock.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import com.icesoft.faces.component.ext.HtmlCommandButton;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VpeUICommand extends HtmlCommandButton {
+
+ private Map attributesMap;
+
+ public VpeUICommand(Element sourceElement) {
+ attributesMap = new HashMap();
+ NamedNodeMap attributes = sourceElement.getAttributes();
+ for(int i=0;i<attributes.getLength();i++){
+ Node item = attributes.item(i);
+ attributesMap.put(item.getNodeName(), item.getNodeValue());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#getRendererType()
+ */
+ @Override
+ public String getRendererType() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getAttributes()
+ */
+ @Override
+ public Map getAttributes() {
+ return attributesMap;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getValueExpression(java.lang.String)
+ */
+ @Override
+ public ValueExpression getValueExpression(final String name) {
+ return new ValueExpression(){
+
+ @Override
+ public Class<?> getExpectedType() {
+ // TODO Auto-generated method stub
+ return String.class;
+ }
+
+ @Override
+ public Class<?> getType(ELContext arg0)
+ throws NullPointerException, PropertyNotFoundException,
+ ELException {
+ // TODO Auto-generated method stub
+ return String.class;
+ }
+
+ @Override
+ public Object getValue(ELContext arg0) throws NullPointerException,
+ PropertyNotFoundException, ELException {
+ return getAttributes().get(name);
+ }
+
+ @Override
+ 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
01:02:42 UTC (rev 22077)
+++
workspace/mareshkau/org.jboss.tools.jsf.vpe.icefaces/templates/vpe-templates-icefaces.xml 2010-05-14
08:17:38 UTC (rev 22078)
@@ -37,5 +37,17 @@
</vpe:dnd>
</vpe:template>
</vpe:tag>
-
+ <vpe:tag name="ice:commandButton" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.icefaces.template.IceCommandButtonTemplate">
+ <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>