Author: dsakovich
Date: 2008-07-08 07:02:51 -0400 (Tue, 08 Jul 2008)
New Revision: 9086
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLinkTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-2119
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-07-08
11:00:20 UTC (rev 9085)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-07-08
11:02:51 UTC (rev 9086)
@@ -54,7 +54,6 @@
Element sourceElement) {
copyGeneralJsfAttributes(visualElement, sourceElement);
copyAttribute(visualElement, sourceElement, JSF.ATTR_DIR, HTML.ATTR_DIR);
-
}
/**
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java 2008-07-08
11:02:51 UTC (rev 9086)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.template;
+
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+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 jsf tag commandLink
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ *
+ */
+public class JsfCommandLinkTemplate extends AbstractOutputJsfTemplate {
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element element = (Element) sourceNode;
+
+ boolean disabled = ComponentUtil.string2boolean(ComponentUtil
+ .getAttribute(element, HTML.ATTR_DISABLED));
+
+ nsIDOMElement parentElement;
+ if (disabled)
+ parentElement = visualDocument.createElement(HTML.TAG_SPAN);
+ else
+ parentElement = visualDocument.createElement(HTML.TAG_A);
+
+ VpeCreationData creationData = new VpeCreationData(parentElement);
+
+ // copy attributes
+ copyOutputJsfAttributes(parentElement, element);
+
+ processOutputAttribute(pageContext, visualDocument, element,
+ parentElement, creationData);
+
+ return creationData;
+
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLinkTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLinkTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLinkTemplate.java 2008-07-08
11:02:51 UTC (rev 9086)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.jsf.template;
+
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+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;
+import org.w3c.dom.NodeList;
+
+/**
+ * Template for jsf tag outputLink (ver 1.*)
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ *
+ */
+public class JsfOutputLinkTemplate extends VpeAbstractTemplate {
+
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+
+ boolean disabled = ComponentUtil.string2boolean(ComponentUtil
+ .getAttribute(sourceElement, HTML.ATTR_DISABLED));
+ String dir = ComponentUtil.getAttribute(sourceElement, HTML.ATTR_DIR);
+ String style = ComponentUtil.getAttribute(sourceElement,
+ HTML.ATTR_STYLE);
+ String styleClass = ComponentUtil.getAttribute(sourceElement,
+ HTML.ATTR_CLASS);
+
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+ VpeCreationData creationData = new VpeCreationData(span);
+ if (disabled) {
+
+ if (styleClass != null && styleClass.length() > 0)
+ span.setAttribute(HTML.ATTR_CLASS, styleClass);
+ if (dir != null && dir.length() > 0)
+ span.setAttribute(HTML.ATTR_DIR, dir);
+ if (style != null && style.length() > 0)
+ span.setAttribute(HTML.ATTR_STYLE, style);
+
+ return creationData;
+ }
+
+ nsIDOMElement a = visualDocument.createElement(HTML.TAG_A);
+ span.appendChild(a);
+ NodeList children = sourceNode.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (!(child instanceof Element)) {
+ continue;
+ }
+
+ VpeChildrenInfo info;
+ if (child.getPrefix() == null) {
+ info = new VpeChildrenInfo(span);
+
+ } else {
+ info = new VpeChildrenInfo(a);
+ }
+ info.addSourceChild(child);
+ creationData.addChildrenInfo(info);
+ }
+ 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 2008-07-08
11:00:20 UTC (rev 9085)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-07-08
11:02:51 UTC (rev 9086)
@@ -226,12 +226,7 @@
<!-- Проблема с вложенным параметром (31 of 4) -->
<vpe:tag name="h:commandLink" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <span class="def-link {@styleClass}"
- style="{@style}"
- title="{tagstring()}">
- <vpe:value expr="{jsfvalue(@value)}" />
- </span>
+ <vpe:template children="yes" modify="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfCommandLinkTemplate">
<vpe:dnd>
<vpe:drag start-enable="yes" />
<vpe:drop container="yes">
@@ -276,6 +271,15 @@
</vpe:textFormatting>
</vpe:template>
</vpe:if>
+ <vpe:if test="tld_version('max=1.2')" >
+ <vpe:template children="yes" modify="yes"
class="org.jboss.tools.jsf.vpe.jsf.template.JsfOutputLinkTemplate">
+ <vpe:textFormatting use-default-formats="yes">
+ <vpe:format type="UnderlineFormat" setDefault="true">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormatting>
+ </vpe:template>
+ </vpe:if>
<vpe:template children="yes" modify="yes">
<vpe:a class="{@styleClass}"
style="{@style}"
@@ -777,7 +781,7 @@
</vpe:textFormatting>
</vpe:template>
</vpe:tag>
-
+
<!--
Проблема с селектированием элемента: в мозилле селектируется заголовок а не рамка
-->
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-07-08
11:00:20 UTC (rev 9085)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-07-08
11:02:51 UTC (rev 9086)
@@ -66,7 +66,7 @@
public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
public static final String ATTR_TITLE = "TITLE"; //$NON-NLS-1$
public static final String ATTR_NAME = "NAME"; //$NON-NLS-1$
- public static final String ATTR_VALUE = "VALUE"; //$NON-NLS-1$
+ public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
public static final String ATTR_STYLE = "style"; //$NON-NLS-1$
public static final String ATTR_SIZE = "size"; //$NON-NLS-1$
public static final String ATTR_MULTIPLE = "MULTIPLE"; //$NON-NLS-1$