From: <es...@us...> - 2009-11-11 02:46:05
|
Revision: 415 http://columba.svn.sourceforge.net/columba/?rev=415&view=rev Author: eschman Date: 2009-11-11 02:45:49 +0000 (Wed, 11 Nov 2009) Log Message: ----------- [feature]experimental support for cobra html renderer Modified Paths: -------------- columba/trunk/.classpath columba/trunk/plugins/pom.xml Added Paths: ----------- columba/trunk/plugins/org.columba.core.CobraRenderer/ columba/trunk/plugins/org.columba.core.CobraRenderer/build.properties columba/trunk/plugins/org.columba.core.CobraRenderer/lib/ columba/trunk/plugins/org.columba.core.CobraRenderer/lib/cobra.jar columba/trunk/plugins/org.columba.core.CobraRenderer/lib/js.jar columba/trunk/plugins/org.columba.core.CobraRenderer/plugin.xml columba/trunk/plugins/org.columba.core.CobraRenderer/pom.xml columba/trunk/plugins/org.columba.core.CobraRenderer/src/ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/CobraViewerPlugin.java Modified: columba/trunk/.classpath =================================================================== --- columba/trunk/.classpath 2009-11-11 01:23:23 UTC (rev 414) +++ columba/trunk/.classpath 2009-11-11 02:45:49 UTC (rev 415) @@ -30,6 +30,7 @@ <classpathentry kind="src" path="plugins/org.columba.chat.altura/api"/> <classpathentry kind="src" path="plugins/org.columba.chat.altura/res"/> <classpathentry kind="src" path="plugins/org.columba.chat.altura/src"/> + <classpathentry kind="src" path="plugins/org.columba.core.CobraRenderer/src"/> <classpathentry kind="src" path="plugins/org.columba.core.HippoLookAndFeel/src"/> <classpathentry kind="src" path="plugins/org.columba.core.KunststoffLookAndFeel/src"/> <classpathentry kind="src" path="plugins/org.columba.core.LiquidLookAndFeel/src"/> @@ -70,6 +71,8 @@ <classpathentry kind="lib" path="lib/je-2.1.30.jar"/> <classpathentry kind="lib" path="lib/jhall-2.0_02.jar"/> <classpathentry kind="lib" path="lib/jython-2.2a1.jar"/> + <classpathentry kind="lib" path="plugins/org.columba.core.CobraRenderer/lib/cobra.jar"/> + <classpathentry kind="lib" path="plugins/org.columba.core.CobraRenderer/lib/js.jar"/> <classpathentry kind="lib" path="plugins/org.columba.core.FlyingSaucerRenderer/lib/cssparser-0-9-4-fs.jar"/> <classpathentry kind="lib" path="plugins/org.columba.core.FlyingSaucerRenderer/lib/jtidy-04aug2000r7.jar"/> <classpathentry kind="lib" path="plugins/org.columba.core.FlyingSaucerRenderer/lib/core-renderer.jar"/> Added: columba/trunk/plugins/org.columba.core.CobraRenderer/build.properties =================================================================== --- columba/trunk/plugins/org.columba.core.CobraRenderer/build.properties (rev 0) +++ columba/trunk/plugins/org.columba.core.CobraRenderer/build.properties 2009-11-11 02:45:49 UTC (rev 415) @@ -0,0 +1,28 @@ +# +# build.properties +# +# for more documentation take a look at build.xml +# + +# unique id of plugin (also the filename of the zip-package) +# (always use package-like ID name) +plugin_id=org.columba.core.CobraRenderer + +# plugin version (also included in the zip-package filename) +plugin_version=1.0 + +# directory containing resource files (optional) +# (only one directory allowed) +# always use "${plugin_id}" variable ! +#plugin_resources=${plugin_dir}/res + +# directorys containing source files +# (":" separated list) +# always use "${plugin_id}" variable ! +plugin_sources=${plugin_dir}/src + +# plugin classpath (add all libraries here) (optional) +# always use "${plugin_id}" variable ! +plugin_classpath=${plugin_dir}/lib/:${plugin_dir}/lib/cobra.jar:${plugin_dir}/lib/js.jar + + Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/build.properties ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Added: columba/trunk/plugins/org.columba.core.CobraRenderer/lib/cobra.jar =================================================================== (Binary files differ) Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/lib/cobra.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: columba/trunk/plugins/org.columba.core.CobraRenderer/lib/js.jar =================================================================== (Binary files differ) Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/lib/js.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: columba/trunk/plugins/org.columba.core.CobraRenderer/plugin.xml =================================================================== --- columba/trunk/plugins/org.columba.core.CobraRenderer/plugin.xml (rev 0) +++ columba/trunk/plugins/org.columba.core.CobraRenderer/plugin.xml 2009-11-11 02:45:49 UTC (rev 415) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin name="Cobra Renderer" + description="Cobra Message Renderer" + id="org.columba.core.CobraRenderer" + version="1.0" + category="Renderer" + enabled="true"> + + <extensionlist id="org.columba.core.htmlviewer"> + <extension id="Cobra" class="org.columba.core.htmlviewer.CobraViewerPlugin" /> + </extensionlist> + + +</plugin> Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/plugin.xml ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Added: columba/trunk/plugins/org.columba.core.CobraRenderer/pom.xml =================================================================== --- columba/trunk/plugins/org.columba.core.CobraRenderer/pom.xml (rev 0) +++ columba/trunk/plugins/org.columba.core.CobraRenderer/pom.xml 2009-11-11 02:45:49 UTC (rev 415) @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <parent> + <artifactId>plugins</artifactId> + <groupId>org.columba</groupId> + <version>1.4</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.columba.plugins</groupId> + <artifactId>org.columba.core.CobraRenderer</artifactId> + <name>Cobra Renderer plugin</name> + <version>1.0</version> + <description></description> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.test.eschman</groupId> + <artifactId>js</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${basedir}/lib/js.jar</systemPath> + </dependency> + + <dependency> + <groupId>org.test.eschman</groupId> + <artifactId>cobra</artifactId> + <version>0.98.4</version> + <scope>system</scope> + <systemPath>${basedir}/lib/cobra.jar</systemPath> + </dependency> + </dependencies> + +</project> \ No newline at end of file Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/pom.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/CobraViewerPlugin.java =================================================================== --- columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/CobraViewerPlugin.java (rev 0) +++ columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/CobraViewerPlugin.java 2009-11-11 02:45:49 UTC (rev 415) @@ -0,0 +1,95 @@ +package org.columba.core.htmlviewer; + +import java.awt.BorderLayout; + +import java.io.StringReader; +import java.net.URL; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; + +import org.columba.core.desktop.ColumbaDesktop; +import org.columba.core.gui.htmlviewer.api.IHTMLViewerPlugin; +import org.lobobrowser.html.HtmlRendererContext; +import org.lobobrowser.html.gui.HtmlPanel; +import org.lobobrowser.html.parser.DocumentBuilderImpl; +import org.lobobrowser.html.parser.InputSourceImpl; +import org.lobobrowser.html.test.SimpleHtmlRendererContext; +import org.lobobrowser.html.test.SimpleUserAgentContext; +import org.w3c.dom.Document; +import org.w3c.dom.html2.HTMLElement; + +public class CobraViewerPlugin extends JPanel implements + IHTMLViewerPlugin { + + private HtmlPanel htmlPanel = new HtmlPanel(); + private HtmlRendererContext rendererContext; + private DocumentBuilderImpl builder; + + public CobraViewerPlugin() { + super(); + + setLayout(new BorderLayout()); + + rendererContext = new ColumbaHtmlRendererContext(htmlPanel); + builder = new DocumentBuilderImpl(rendererContext.getUserAgentContext(), rendererContext); + add(htmlPanel, BorderLayout.CENTER); + + setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + } + + public void view(String body) { + if (body == null) + return; + try { + Document document = builder.parse(new InputSourceImpl(new StringReader(body), "")); + + htmlPanel.setDocument(document, rendererContext); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String getSelectedText() { + return htmlPanel.getSelectionText(); + } + + public boolean initialized() { + return true; + } + + public JComponent getComponent() { + return htmlPanel; + } + + public JComponent getContainer() { + return this; + } + + public String getText() { + return ""; + } + + /** + * @see org.columba.core.gui.htmlviewer.api.IHTMLViewerPlugin#setCaretPosition(int) + */ + public void setCaretPosition(int position) { + } + + /** + * @see org.columba.core.gui.htmlviewer.api.IHTMLViewerPlugin#moveCaretPosition(int) + */ + public void moveCaretPosition(int position) { + } + + private static class ColumbaHtmlRendererContext extends SimpleHtmlRendererContext { + public ColumbaHtmlRendererContext(HtmlPanel contextComponent) { + super(contextComponent, new SimpleUserAgentContext()); + } + + public void linkClicked(HTMLElement linkNode, URL url, String target) { + ColumbaDesktop.getInstance().browse(url); + } + } +} Property changes on: columba/trunk/plugins/org.columba.core.CobraRenderer/src/org/columba/core/htmlviewer/CobraViewerPlugin.java ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + text/plain Modified: columba/trunk/plugins/pom.xml =================================================================== --- columba/trunk/plugins/pom.xml 2009-11-11 01:23:23 UTC (rev 414) +++ columba/trunk/plugins/pom.xml 2009-11-11 02:45:49 UTC (rev 415) @@ -124,6 +124,7 @@ <modules> <module>org.columba.chat.altura</module> + <module>org.columba.core.CobraRenderer</module> <module>org.columba.core.FlyingSaucerRenderer</module> <module>org.columba.core.HippoLookAndFeel</module> <module>org.columba.core.KunststoffLookAndFeel</module> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |