Author: yradtsevich
Date: 2009-02-09 08:04:32 -0500 (Mon, 09 Feb 2009)
New Revision: 13542
Modified:
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/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/resources/richFacesTest/WebContent/pages/components/editor.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp.xml
Log:
RESOLVED - issue JBIDE-3755: Add support of attributes for rich:editor in VPE
https://jira.jboss.org/jira/browse/JBIDE-3755
- Support of attributes 'width', 'height', 'style',
'styleClass' has been added
- Resizer now works for rich:editor
- JUnit tests have been modified
Modified:
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 2009-02-09
11:16:18 UTC (rev 13541)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesEditorTemplate.java 2009-02-09
13:04:32 UTC (rev 13542)
@@ -11,10 +11,12 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+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.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMText;
@@ -31,9 +33,10 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- RichFacesEditorTemplateHelper editorTemplateHelper = new
RichFacesEditorTemplateHelper(
- pageContext, (Element) sourceNode, visualDocument
- );
+ RichFacesEditorTemplateHelper editorTemplateHelper =
+ new RichFacesEditorTemplateHelper(
+ pageContext, (Element) sourceNode, visualDocument
+ );
nsIDOMElement mainElement = editorTemplateHelper.create();
VpeCreationData creationData = new VpeCreationData(mainElement);
@@ -70,12 +73,23 @@
public nsIDOMElement create() {
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "editor"); //$NON-NLS-1$
+
+ String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
+ if (style == null) {
+ style = ""; //$NON-NLS-1$
+ }
+ String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+ if (styleClass == null) {
+ styleClass = ""; //$NON-NLS-1$
+ }
+
// create nodes
nsIDOMElement mainSpan = visualDocument.createElement(HTML.TAG_SPAN); {
- mainSpan.setAttribute(HTML.ATTR_CLASS, "richfacesSimpleSkin");
//$NON-NLS-1$
-
+ mainSpan.setAttribute(HTML.ATTR_CLASS, "richfacesSimpleSkin " + styleClass);
//$NON-NLS-1$
+
// Yahor Radtsevich: Fix of JBIDE-3653: inFlasher doesn't shows for rich:editor
component
- mainSpan.setAttribute(HTML.ATTR_STYLE, "display: table;"); //$NON-NLS-1$
+ // (style "display: table;" has been added)
+ mainSpan.setAttribute(HTML.ATTR_STYLE, "display: table;" + style);
//$NON-NLS-1$
}
nsIDOMElement mainTable = createMainTable();
nsIDOMElement textContainer = createTextContainer();
@@ -92,19 +106,31 @@
/**
* Creates {@code
- * <table cellspacing="0" cellpadding="0"
class="mceLayout" style="width: 400px; height: 300px;"/>
+ * <table cellspacing="0" cellpadding="0"
class="mceLayout" style="width: ???px; height: ???px;"/>
* }
* @return created element
*/
private nsIDOMElement createMainTable() {
+ // evaluate width and height
+ String style = "width: 183px; height: 100px;"; //$NON-NLS-1$
+ String width = sourceElement.getAttribute(RichFaces.ATTR_WIDTH);
+ if (width != null) {
+ width = VpeStyleUtil.addPxIfNecessary(width);
+ style = VpeStyleUtil.setParameterInStyle(style, HTML.STYLE_PARAMETER_WIDTH, width);
+ }
+ String height = sourceElement.getAttribute(RichFaces.ATTR_HEIGHT);
+ if (height != null) {
+ height = VpeStyleUtil.addPxIfNecessary(height);
+ style = VpeStyleUtil.setParameterInStyle(style, HTML.STYLE_PARAMETER_HEIGHT, height);
+ }
+
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$
+ mainTable.setAttribute(HTML.ATTR_STYLE, style);
}
-
+
return mainTable;
}
@@ -204,4 +230,4 @@
return outerTR;
}
-}
\ No newline at end of file
+}
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 2009-02-09
11:16:18 UTC (rev 13541)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2009-02-09
13:04:32 UTC (rev 13542)
@@ -84,6 +84,7 @@
public static final String ATTR_VISIBLE = "visible"; //$NON-NLS-1$
/** The Constant ATTR_WIDTH. */
public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$
+ public static final String ATTR_HEIGHT = "height"; //$NON-NLS-1$
public static final String ATTR_HORIZONTAL_OFFSET = "horizontalOffset";
//$NON-NLS-1$
public static final String ATTR_VERTICAL_OFFSET = "verticalOffset";
//$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 2009-02-09
11:16:18 UTC (rev 13541)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2009-02-09
13:04:32 UTC (rev 13542)
@@ -743,6 +743,10 @@
<vpe:if test="tld_version('min=3.3')">
<vpe:template children="no" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesEditorTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes" />
<vpe:drop container="no"/>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp 2009-02-09
11:16:18 UTC (rev 13541)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp 2009-02-09
13:04:32 UTC (rev 13542)
@@ -5,11 +5,16 @@
<html>
<head>
+<style type="text/css">
+ .blue-border {
+ color:blue;
+ }
+</style>
</head>
<body>
<f:view>
<h:form>
- <rich:editor id="richEditor"/>
+ <rich:editor id="richEditor" width="391" height="347"
styleClass="blue-border" style="border: 5px dotted;"/>
</h:form>
</f:view>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp.xml 2009-02-09
11:16:18 UTC (rev 13541)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/editor.jsp.xml 2009-02-09
13:04:32 UTC (rev 13542)
@@ -1,8 +1,8 @@
<tests>
<test id="richEditor">
- <SPAN CLASS="richfacesSimpleSkin" STYLE="display: table;">
+ <SPAN CLASS="richfacesSimpleSkin blue-border" STYLE="border: 5px
dotted ; display: table;">
<TABLE CELLSPACING="0" CELLPADDING="0"
CLASS="mceLayout"
- STYLE="width: 400px; height: 300px;">
+ STYLE="width: 391px; height: 347px;">
<TR STYLE="height: 100%;">
<TD>
<DIV CLASS="mceIframeContainer" STYLE="height: 100%;">