Author: yradtsevich
Date: 2009-01-16 15:57:08 -0500 (Fri, 16 Jan 2009)
New Revision: 13103
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor_toolbar.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
CODING IN PROGRESS - issue JBIDE-3555: VPE templates for new components in RichFaces 3.3.
https://jira.jboss.org/jira/browse/JBIDE-3555
- support of a4j:queue tag has been added
- early implementation of rich:editor template has been added
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2009-01-16
18:56:06 UTC (rev 13102)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2009-01-16
20:57:08 UTC (rev 13103)
@@ -287,5 +287,16 @@
<vpe:template children="no" modify="no" >
</vpe:template>
</vpe:tag>
-
+
+ <!-- Since RichFaces 3.3.0 -->
+ <vpe:tag name="a4j:queue" case-sensitive="yes">
+ <vpe:if test="tld_version('min=3.3')">
+ <vpe:template children="no" modify="no">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
+ </vpe:tag>
</vpe:templates>
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor.css
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor.css 2009-01-16
20:57:08 UTC (rev 13103)
@@ -0,0 +1,41 @@
+.richfacesSimpleSkin {
+ position:relative;
+}
+
+.richfacesSimpleSkin table.mceLayout {
+ background:#ECF4FE none repeat scroll 0 0;
+ border:1px solid #BED6F8;
+}
+
+.richfacesSimpleSkin * {
+ background:transparent none repeat scroll 0 0;
+ border:0 none;
+ color:#000000;
+ cursor:default;
+ font-weight:normal;
+ margin:0;
+ padding:0;
+ text-decoration:none;
+ white-space:nowrap;
+}
+
+.mceToolbar, .mceToolbarTable {
+ height:26px;
+}
+
+.mceToolbarTable {
+ position:relative;
+ margin-left:auto;
+ margin-right:auto;
+}
+
+.mceIframeContainer {
+ background:#FFFFFF none repeat scroll 0 0;
+}
+div.mce_panel {
+ display:block;
+ height:22px;
+ width:215px;
+ background-repeat:no-repeat;
+ background-image: url(editor_toolbar.gif);
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor_toolbar.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/editor/editor_toolbar.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java 2009-01-16
20:57:08 UTC (rev 13103)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * 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.ComponentUtil;
+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.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Template for rich:editor.
+ *
+ * @author yradtsevich
+ *
+ */
+public class RichFacesEditorTemplate extends VpeAbstractTemplate {
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+
+ RichFacesEditorTemplateHelper editorTemplateHelper = new
RichFacesEditorTemplateHelper(
+ pageContext, (Element) sourceNode, visualDocument
+ );
+ nsIDOMElement mainElement = editorTemplateHelper.create();
+
+ VpeCreationData creationData = new VpeCreationData(mainElement);
+ return creationData;
+ }
+}
+
+/**
+ * Creates visual nodes for rich:editor.
+ *
+ * @author yradtsevich
+ *
+ */
+class RichFacesEditorTemplateHelper {
+ private static final String STYLE_PATH = "editor/editor.css"; //$NON-NLS-1$
+
+ private final VpePageContext pageContext;
+ private final Element sourceElement;
+ private final nsIDOMDocument visualDocument;
+
+ public RichFacesEditorTemplateHelper(VpePageContext pageContext,
+ Element sourceNode, nsIDOMDocument visualDocument) {
+ this.pageContext = pageContext;
+ this.sourceElement = sourceNode;
+ this.visualDocument = visualDocument;
+ }
+
+ public nsIDOMElement create() {
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "editor"); //$NON-NLS-1$
+ // create nodes
+ nsIDOMElement mainSpan = visualDocument.createElement(HTML.TAG_SPAN); {
+ mainSpan.setAttribute(HTML.ATTR_CLASS, "richfacesSimpleSkin");
+ }
+ nsIDOMElement mainTable = createMainTable();
+ nsIDOMElement textContainer = createTextContainer();
+ nsIDOMElement toolbar = createToolbar();
+
+ // nest created nodes
+ mainSpan.appendChild(mainTable); {
+ mainTable.appendChild(textContainer);
+ mainTable.appendChild(toolbar);
+ }
+
+ return mainSpan;
+ }
+
+ /**
+ * Creates {@code
+ * <table cellspacing="0" cellpadding="0"
class="mceLayout" style="width: 400px; height: 300px;"/>
+ * }
+ * @return created element
+ */
+ private nsIDOMElement createMainTable() {
+ nsIDOMElement mainTable = visualDocument.createElement(HTML.TAG_TABLE); {
+ mainTable.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ mainTable.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ mainTable.setAttribute(HTML.ATTR_CLASS, "mceLayout"); //$NON-NLS-1$
+ // TODO: change the witdh and height attributes
+ mainTable.setAttribute(HTML.ATTR_STYLE, "width: 400px; height: 300px;");
//$NON-NLS-1$
+ }
+
+ return mainTable;
+ }
+
+ /**
+ * Creates {@code
+ * <tr style="height: 100%;">
+ * <td>
+ * <div class="mceIframeContainer" style="height: 100%;">
+ * <table border="0" style="width: 100%; height: 100%;">
+ * <tr><td> </td></tr>
+ * </table>
+ * </div>
+ * </td>
+ * </tr>
+ * }
+ *
+ * @return created element
+ */
+ private nsIDOMElement createTextContainer() {
+ // create nodes
+ nsIDOMElement outerTR = visualDocument.createElement(HTML.TAG_TR); {
+ outerTR.setAttribute(HTML.ATTR_STYLE, "height: 100%;"); //$NON-NLS-1$
+ }
+ nsIDOMElement outerTD = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV); {
+ div.setAttribute(HTML.ATTR_CLASS, "mceIframeContainer");
+ div.setAttribute(HTML.ATTR_STYLE, "height: 100%;");
+ }
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE); {
+ table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_STYLE, "width: 100%; height: 100%;");
//$NON-NLS-1$
+ }
+ nsIDOMElement innerTR = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement innerTD = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMText text = visualDocument.createTextNode(" "); //$NON-NLS-1$
+
+ // nest created nodes
+ outerTR.appendChild(outerTD); {
+ outerTD.appendChild(div); {
+ div.appendChild(table); {
+ table.appendChild(innerTR); {
+ innerTR.appendChild(innerTD); {
+ innerTD.appendChild(text);
+ }
+ }
+ }
+ }
+ }
+
+ return outerTR;
+ }
+
+ /**
+ * Creates {@code
+ * <tr>
+ * <td class="mceToolbar" >
+ * <table cellspacing="0" cellpadding="0"
class="mceToolbarTable">
+ * <tr>
+ * <td>
+ * <div class="mce_panel"/>
+ * </td>
+ * </tr>
+ * </table>
+ * </td>
+ * </tr>
+ * }
+ *
+ * @return created element
+ */
+ private nsIDOMElement createToolbar() {
+ // create nodes
+ nsIDOMElement outerTR = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement outerTD = visualDocument.createElement(HTML.TAG_TD); {
+ outerTD.setAttribute(HTML.ATTR_CLASS, "mceToolbar"); //$NON-NLS-1$
+ }
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE); {
+ table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CLASS, "mceToolbarTable"); //$NON-NLS-1$
+ }
+ nsIDOMElement innerTR = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement innerTD = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV); {
+ div.setAttribute(HTML.ATTR_CLASS, "mce_panel"); //$NON-NLS-1$
+ }
+
+ // nest created nodes
+ outerTR.appendChild(outerTD); {
+ outerTD.appendChild(table); {
+ table.appendChild(innerTR); {
+ innerTR.appendChild(innerTD); {
+ innerTD.appendChild(div);
+ }
+ }
+ }
+ }
+
+ return outerTR;
+ }
+}
\ No newline at end of file
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 2009-01-16
18:56:06 UTC (rev 13102)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2009-01-16
20:57:08 UTC (rev 13103)
@@ -737,5 +737,17 @@
<vpe:tag name="rich:hotKey" case-sensitive="yes">
<vpe:template children="yes" modify="no"/>
</vpe:tag>
-
+
+ <!-- Since RichFaces 3.3.0 -->
+ <vpe:tag name="rich:editor" case-sensitive="yes">
+ <vpe:if test="tld_version('min=3.3')">
+ <vpe:template children="no" modify="no"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesEditorTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
+ </vpe:tag>
</vpe:templates>