Author: dvinnichek
Date: 2010-10-06 06:04:15 -0400 (Wed, 06 Oct 2010)
New Revision: 25511
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml.xml
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/templates/vpe-templates-docbook.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml.xml
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/src/org/jboss/tools/vpe/docbook/test/DocbookComponentContentTest.java
Log:
create classes for displaying docbook elements <tip> and <note> in vpe
(
https://jira.jboss.org/browse/JBIDE-7242)
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 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -153,6 +153,7 @@
public static final String STYLE_PARAMETER_HEIGHT = "height"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_BACKGROUND_IMAGE =
"background-image"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_BACKGROUND_COLOR =
"background-color"; //$NON-NLS-1$
+ public static final String STYLE_PARAMETER_BORDER = "border"; //$NON-NLS-1$
public static final String STYLE_PARAMETER_BORDER_WIDTH = "border-width";
//$NON-NLS-1$
public static final String STYLE_PARAMETER_BORDER_STYLE = "border-style";
//$NON-NLS-1$
public static final String STYLE_PARAMETER_MAX_HEIGHT = "max-height";
//$NON-NLS-1$
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.vpe.docbook.template;
+
+import org.jboss.tools.vpe.docbook.template.util.Docbook;
+
+/**
+ * Class for <note>
+ *
+ * @author Denis Vinnichek (dvinnichek)
+ */
+public class DocbookNoteTemplate extends ElementWithGeneratedOutputTemplate {
+
+ @Override
+ public String getGeneratedText() {
+ return Docbook.ELEMENT_NOTE.toUpperCase();
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.vpe.docbook.template;
+
+import org.jboss.tools.vpe.docbook.template.util.Docbook;
+
+/**
+ * Class for <tip>
+ *
+ * @author Denis Vinnichek (dvinnichek)
+ */
+public class DocbookTipTemplate extends ElementWithGeneratedOutputTemplate {
+
+ @Override
+ public String getGeneratedText() {
+ return Docbook.ELEMENT_TIP.toUpperCase();
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.vpe.docbook.template;
+
+import org.jboss.tools.vpe.docbook.template.util.Docbook;
+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.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
+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;
+
+/**
+ * Abstract Class for elements with generated output
+ *
+ * @author Denis Vinnichek (dvinnichek)
+ */
+public abstract class ElementWithGeneratedOutputTemplate extends
+ VpeAbstractTemplate {
+
+ private static final String BACKGROUND_COLOR = "rgb(236, 243, 255)";
//$NON-NLS-1$
+ private static final String BORDER = "1px solid black"; //$NON-NLS-1$
+
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element sourceElement = (Element) sourceNode;
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ VisualDomUtil.copyAttributes(sourceNode, div);
+
+ nsIDOMCSSStyleDeclaration style = VpeStyleUtil.getStyle(div);
+ style.setProperty(HTML.STYLE_PARAMETER_BACKGROUND_COLOR,
+ BACKGROUND_COLOR, HTML.STYLE_PRIORITY_DEFAULT);
+ style.setProperty(HTML.STYLE_PARAMETER_BORDER, BORDER,
+ HTML.STYLE_PRIORITY_DEFAULT);
+
+ NodeList titleElements = sourceElement
+ .getElementsByTagName(Docbook.ELEMENT_TITLE);
+ if (titleElements.getLength() == 0) {
+ nsIDOMElement h1 = visualDocument.createElement(HTML.TAG_H1);
+ h1.appendChild(visualDocument.createTextNode(getGeneratedText()));
+ div.appendChild(h1);
+ }
+
+ return new VpeCreationData(div);
+ }
+
+ public abstract String getGeneratedText();
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -22,4 +22,6 @@
public static final String ATTR_ENDTERM = "endterm"; //$NON-NLS-1$
public static final String ELEMENT_TITLE = "title"; //$NON-NLS-1$
+ public static final String ELEMENT_TIP = "tip"; //$NON-NLS-1$
+ public static final String ELEMENT_NOTE = "note"; //$NON-NLS-1$
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/templates/vpe-templates-docbook.xml
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/templates/vpe-templates-docbook.xml 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/templates/vpe-templates-docbook.xml 2010-10-06
10:04:15 UTC (rev 25511)
@@ -394,15 +394,12 @@
</vpe:template>
</vpe:tag>
<vpe:tag name="note" case-sensitive="yes"
docbook="yes">
- <vpe:template children="yes" modify="yes">
- <!-- vpe:any background-color="yellow" border="blue"
icon="no" /-->
- <div id="{@id}" style="background-color: yellow; border: 1 px solid
blue;" />
- </vpe:template>
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.vpe.docbook.template.DocbookNoteTemplate"/>
</vpe:tag>
<vpe:tag name="tip" case-sensitive="yes"
docbook="yes">
- <vpe:template children="yes" modify="yes">
- <div id="{@id}" />
- </vpe:template>
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.vpe.docbook.template.DocbookTipTemplate"/>
</vpe:tag>
<vpe:tag name="preface" case-sensitive="yes"
docbook="yes">
<vpe:template children="yes" modify="yes">
@@ -641,16 +638,6 @@
<vpe:tag name="xref" case-sensitive="yes"
docbook="yes">
<vpe:template children="no" modify="yes"
class="org.jboss.tools.vpe.docbook.template.DocbookXrefTemplate" />
- <!--
- <vpe:if test="attrpresent('linkend')">
- <vpe:template children="no" modify="yes">
- <span id="{@id}"><vpe:value expr="<xref
linkend='{@linkend}' />" /></span>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <a href="#{@linkend}">XRef</a>
- </vpe:template>
- -->
</vpe:tag>
<vpe:tag name="legalnotice" case-sensitive="yes"
docbook="yes">
<vpe:template children="yes" modify="yes">
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml 2010-10-06
10:04:15 UTC (rev 25511)
@@ -1,8 +1,13 @@
<!DOCTYPE note PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
-<note id="noteEl">
+<note id="note01">
<title>Upcoming Changes</title>
<para>
Future versions of this feature may not be backward-compatible. Consider implementing
the revised interface now.
</para>
+</note>
+<note id="note02">
+ <para>
+ Future versions of this feature may not be backward-compatible. Consider implementing
the revised interface now.
+ </para>
</note>
\ No newline at end of file
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml.xml
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml.xml 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/note/note.xml.xml 2010-10-06
10:04:15 UTC (rev 25511)
@@ -1,6 +1,6 @@
<tests>
- <test id="noteEl">
- <DIV ID="noteEl" STYLE="background-color: yellow;">
+ <test id="note01">
+ <DIV ID="note01" STYLE="border: 1px solid black; background-color:
rgb(236, 243, 255);">
<H1>
<SPAN>Upcoming Changes</SPAN>
</H1>
@@ -11,4 +11,16 @@
</P>
</DIV>
</test>
+ <test id="note02">
+ <DIV ID="note02" STYLE="border: 1px solid black; background-color:
rgb(236, 243, 255);">
+ <H1>
+ NOTE
+ </H1>
+ <P>
+ <SPAN>
+ Future versions of this feature may not be backward-compatible. Consider
implementing the revised interface now.
+ </SPAN>
+ </P>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
Added:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml 2010-10-06
10:04:15 UTC (rev 25511)
@@ -0,0 +1,13 @@
+<!DOCTYPE tip PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<tip id="tip01">
+ <title>Title</title>
+ <para>
+ If you tie your shoelaces, you're less likely to trip and fall down.
+ </para>
+</tip>
+<tip id="tip02">
+ <para>
+ If you tie your shoelaces, you're less likely to trip and fall down.
+ </para>
+</tip>
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Added:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml.xml
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml.xml
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml.xml 2010-10-06
10:04:15 UTC (rev 25511)
@@ -0,0 +1,20 @@
+<tests>
+ <test id="tip01">
+ <DIV ID="tip01" STYLE="border: 1px solid black; background-color:
rgb(236, 243, 255);">
+ <H1>
+ <SPAN>Title</SPAN>
+ </H1>
+ <P>
+ <SPAN>If you tie your shoelaces, you're less likely to trip and fall
down.</SPAN>
+ </P>
+ </DIV>
+ </test>
+ <test id="tip02">
+ <DIV ID="tip02" STYLE="border: 1px solid black; background-color:
rgb(236, 243, 255);">
+ <H1>TIP</H1>
+ <P>
+ <SPAN>If you tie your shoelaces, you're less likely to trip and fall
down.</SPAN>
+ </P>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/resources/DocbookTest/WebContent/pages/components/tip/tip.xml.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/src/org/jboss/tools/vpe/docbook/test/DocbookComponentContentTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/src/org/jboss/tools/vpe/docbook/test/DocbookComponentContentTest.java 2010-10-06
09:44:29 UTC (rev 25510)
+++
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/src/org/jboss/tools/vpe/docbook/test/DocbookComponentContentTest.java 2010-10-06
10:04:15 UTC (rev 25511)
@@ -44,6 +44,10 @@
performContentTest("components/note/note.xml"); //$NON-NLS-1$
}
+ public void testTip() throws Throwable {
+ performContentTest("components/tip/tip.xml"); //$NON-NLS-1$
+ }
+
@Override
protected String getTestProjectName() {
return DocbookAllTests.IMPORT_PROJECT_NAME;