Author: yradtsevich
Date: 2011-05-25 09:36:17 -0400 (Wed, 25 May 2011)
New Revision: 31470
Added:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlEmbedTemplate.java
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlFlashAbstractTemplate.java
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlObjectTemplate.java
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html.xml
Removed:
branches/jbosstools-3.2.x/xulrunner/plugins/org.mozilla.xulrunner.gtk.linux.x86/xulrunner/plugins/libnullplugin.so
branches/jbosstools-3.2.x/xulrunner/plugins/org.mozilla.xulrunner.win32.win32.x86/xulrunner/plugins/npnul32.dll
Modified:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java
Log:
https://issues.jboss.org/browse/JBIDE-8792 : Install flash plugin message appears in VPE
if on page used flash references
- removed null-plugins for Linux 32 and Windows 32-bit (there was no plugin for Linux 64)
- created templates for the <embed> and <object> tags
Modified:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-05-25
07:24:24 UTC (rev 31469)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-05-25
13:36:17 UTC (rev 31470)
@@ -20,6 +20,7 @@
private HTML() {
}
+ public static final String TAG_EMBED = "embed"; //$NON-NLS-1$
public static final String TAG_HTML = "html"; //$NON-NLS-1$
public static final String TAG_HEAD = "head"; //$NON-NLS-1$
public static final String TAG_BODY = "body"; //$NON-NLS-1$
@@ -51,6 +52,7 @@
public static final String TAG_INPUT = "input"; //$NON-NLS-1$
public static final String TAG_BUTTON = "button"; //$NON-NLS-1$
public static final String TAG_OL = "ol"; //$NON-NLS-1$
+ public static final String TAG_OBJECT = "object"; //$NON-NLS-1$
public static final String TAG_UL = "ul"; //$NON-NLS-1$
public static final String TAG_CODE = "code"; //$NON-NLS-1$
public static final String TAG_PRE = "pre"; //$NON-NLS-1$
Added:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlEmbedTemplate.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlEmbedTemplate.java
(rev 0)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlEmbedTemplate.java 2011-05-25
13:36:17 UTC (rev 31470)
@@ -0,0 +1,28 @@
+package org.jboss.tools.vpe.html.template;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.tools.vpe.editor.util.HTML;
+
+/**
+ * Template for {@code <embed>} tag.
+ *
+ * @author Yahor Radtsevich
+ */
+public class HtmlEmbedTemplate extends HtmlFlashAbstractTemplate {
+ List<String> ATTRIBUTES_TO_BE_COPIED = Arrays.asList(
+ "align", "height", "hidden", "hspace",
//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ "pluginspage", "src", "vspace",
"width");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+
+ @Override
+ public String getTagName() {
+ return HTML.TAG_EMBED;
+ }
+
+ @Override
+ public List<String> getAttributesToBeCopied() {
+ return ATTRIBUTES_TO_BE_COPIED;
+ }
+
+}
Added:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlFlashAbstractTemplate.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlFlashAbstractTemplate.java
(rev 0)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlFlashAbstractTemplate.java 2011-05-25
13:36:17 UTC (rev 31470)
@@ -0,0 +1,70 @@
+package org.jboss.tools.vpe.html.template;
+
+import java.util.Arrays;
+import java.util.List;
+
+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.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+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;
+
+/**
+ * Base template for {@code <object>} and {@code <embed>} tags.
+ *
+ * @author Yahor Radtsevich
+ */
+public abstract class HtmlFlashAbstractTemplate extends VpeAbstractTemplate {
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+ nsIDOMElement wrapper = VisualDomUtil
+ .createBorderlessContainer(visualDocument, HTML.TAG_DIV);
+ String wrapperStyle = "display:inline-block;"; //$NON-NLS-1$
+ if (sourceElement.hasAttribute(HTML.ATTR_WIDTH)) {
+ try {
+ int width = Integer.parseInt(sourceElement.getAttribute(HTML.ATTR_WIDTH));
+ wrapperStyle = VpeStyleUtil.setSizeInStyle(wrapperStyle,
+ HTML.STYLE_PARAMETER_WIDTH, width);
+ } catch (NumberFormatException e) {
+ }
+ }
+ if (sourceElement.hasAttribute(HTML.ATTR_HEIGHT)) {
+ try {
+ int height = Integer.parseInt(sourceElement.getAttribute(HTML.ATTR_HEIGHT));
+ wrapperStyle = VpeStyleUtil.setSizeInStyle(wrapperStyle,
+ HTML.STYLE_PARAMETER_HEIGHT, height);
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ wrapper.setAttribute(HTML.ATTR_STYLE, wrapperStyle);
+
+ nsIDOMElement objectElement = visualDocument.createElement(getTagName());
+ wrapper.appendChild(objectElement);
+ VisualDomUtil.copyAttributes(sourceElement, objectElement, getAttributesToBeCopied());
+
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(objectElement);
+ NodeList children = sourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ childrenInfo.addSourceChild(children.item(i));
+ }
+
+ VpeCreationData creationData = new VpeCreationData(wrapper);
+ creationData.addChildrenInfo(childrenInfo);
+
+ return creationData;
+ }
+
+ public abstract String getTagName();
+ public abstract List<String> getAttributesToBeCopied();
+
+}
Added:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlObjectTemplate.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlObjectTemplate.java
(rev 0)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlObjectTemplate.java 2011-05-25
13:36:17 UTC (rev 31470)
@@ -0,0 +1,28 @@
+package org.jboss.tools.vpe.html.template;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.tools.vpe.editor.util.HTML;
+
+/**
+ * Template for {@code <object>} tag.
+ *
+ * @author Yahor Radtsevich
+ */
+public class HtmlObjectTemplate extends HtmlFlashAbstractTemplate {
+ List<String> ATTRIBUTES_TO_BE_COPIED = Arrays.asList(
+ "align", "height", "hspace", "vspace",
//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ "width", "id",
"dir"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+
+ @Override
+ public String getTagName() {
+ return HTML.TAG_OBJECT;
+ }
+
+ @Override
+ public List<String> getAttributesToBeCopied() {
+ return ATTRIBUTES_TO_BE_COPIED;
+ }
+
+}
Modified:
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
===================================================================
---
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-05-25
07:24:24 UTC (rev 31469)
+++
branches/jbosstools-3.2.x/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-05-25
13:36:17 UTC (rev 31470)
@@ -1420,9 +1420,8 @@
</vpe:tag>
<vpe:tag name="object" case-sensitive="no">
- <vpe:template children="yes" modify="no">
- <vpe:copy
- attrs="align,height,hspace,vspace,width,id,dir" />
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.vpe.html.template.HtmlObjectTemplate">
<vpe:dnd>
<vpe:drop container="yes">
<vpe:container-child tag-name="param" />
@@ -1434,10 +1433,9 @@
</vpe:tag>
<vpe:tag name="embed" case-sensitive="no">
- <vpe:template children="yes" modify="no">
- <vpe:copy
- attrs="align,height,hidden,hspace,pluginspage,src,vspace,width" />
- </vpe:template>
+ <vpe:template children="yes" modify="no"
+ class="org.jboss.tools.vpe.html.template.HtmlEmbedTemplate">
+ </vpe:template>
</vpe:tag>
<vpe:tag name="ol" case-sensitive="no">
Added:
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html
===================================================================
---
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html
(rev 0)
+++
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html 2011-05-25
13:36:17 UTC (rev 31470)
@@ -0,0 +1,18 @@
+<html>
+<body>
+Abc
+ <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+
codebase="http://download.macromedia.com/pub/shockwave/
+cabs/flash/swflash.cab#version=6,0,40,0"
+ width="468" height="60" id="object1">
+ <param name="movie" value="example.swf" />
+ <param name="quality" value="high" />
+ <param name="bgcolor" value="#ffffff" />
+ <embed
src="http://www.tizag.com/pics/example.swf"
quality="high"
+ bgcolor="#ffffff" width="468" height="60"
name="mymoviename" align=""
+ type="application/x-shockwave-flash"
+
pluginspage="http://www.macromedia.com/go/getflashplayer">
+ </object>
+Def
+</body>
+</html>
Added:
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html.xml
===================================================================
---
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html.xml
(rev 0)
+++
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/object-embed.html.xml 2011-05-25
13:36:17 UTC (rev 31470)
@@ -0,0 +1,13 @@
+<tests>
+ <test id="object1">
+ <DIV CLASS="vpe-text" STYLE="display: inline-block; width: 468px;
height: 60px;">
+ <OBJECT WIDTH="468" HEIGHT="60" ID="object1">
+ <DIV CLASS="vpe-text" STYLE="display: inline-block; width: 468px;
height: 60px;">
+ <EMBED WIDTH="468" HEIGHT="60" ALIGN=""
+
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"
SRC="http://www.tizag.com/pics/example.swf">
+ </EMBED>
+ </DIV>
+ </OBJECT>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Modified:
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java
===================================================================
---
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java 2011-05-25
07:24:24 UTC (rev 31469)
+++
branches/jbosstools-3.2.x/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java 2011-05-25
13:36:17 UTC (rev 31470)
@@ -126,8 +126,8 @@
performContentTest("components/core/map.html"); //$NON-NLS-1$
}
- public void testObject() throws Throwable {
- performContentTest("components/core/object.html"); //$NON-NLS-1$
+ public void testObjectEmbed() throws Throwable {
+ performContentTest("components/core/object-embed.html"); //$NON-NLS-1$
}
public void testParam() throws Throwable {
@@ -387,10 +387,6 @@
performContentTest("components/other/center.html"); //$NON-NLS-1$
}
- public void testEmbed() throws Throwable {
- performContentTest("components/other/embed.html"); //$NON-NLS-1$
- }
-
public void testFont() throws Throwable {
performContentTest("components/other/font.html"); //$NON-NLS-1$
}
Deleted:
branches/jbosstools-3.2.x/xulrunner/plugins/org.mozilla.xulrunner.gtk.linux.x86/xulrunner/plugins/libnullplugin.so
===================================================================
(Binary files differ)
Deleted:
branches/jbosstools-3.2.x/xulrunner/plugins/org.mozilla.xulrunner.win32.win32.x86/xulrunner/plugins/npnul32.dll
===================================================================
(Binary files differ)