[Jreepad-CVS] jreepad/src/jreepad/editor HtmlViewer.java, NONE, 1.1 TextileViewer.java, NONE, 1.1
Brought to you by:
danstowell
From: PeWu <pe...@us...> - 2007-02-06 11:10:17
|
Update of /cvsroot/jreepad/jreepad/src/jreepad/editor In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32050/src/jreepad/editor Added Files: HtmlViewer.java TextileViewer.java Log Message: refactoring: refactored HtmlViewer and TextileViewer from JreepadView --- NEW FILE: TextileViewer.java --- /* Jreepad - personal information manager. Copyright (C) 2004 Dan Stowell This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The full license can be read online here: http://www.gnu.org/copyleft/gpl.html */ package jreepad.editor; import org.philwilson.JTextile; import jreepad.JreepadArticle; /** * The plain text editor pane. */ public class TextileViewer extends HtmlViewer { public TextileViewer(JreepadArticle article) { super(article); } public void reloadArticle() { try { setText(JTextile.textile(article.getContent())); } catch (Exception e) { // Fallback to HTML if Textile failed e.printStackTrace(); super.reloadArticle(); } } } --- NEW FILE: HtmlViewer.java --- /* Jreepad - personal information manager. Copyright (C) 2004 Dan Stowell This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The full license can be read online here: http://www.gnu.org/copyleft/gpl.html */ package jreepad.editor; import javax.swing.JEditorPane; import jreepad.JreepadArticle; /** * The plain text editor pane. */ public class HtmlViewer extends JEditorPane { protected JreepadArticle article; public HtmlViewer(JreepadArticle article) { super("text/html", ""); this.article = article; setEditable(false); reloadArticle(); } public void reloadArticle() { setText(article.getContent()); } public void setArticle(JreepadArticle article) { this.article = article; reloadArticle(); } } |