[Jreepad-CVS] jreepad/src/jreepad/editor EditorPaneView.java, NONE, 1.1 HtmlViewer.java, 1.1, 1.2 T
Brought to you by:
danstowell
Update of /cvsroot/jreepad/jreepad/src/jreepad/editor In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18896/src/jreepad/editor Modified Files: HtmlViewer.java TextileViewer.java PlainTextEditor.java ArticleView.java AbstractArticleView.java Added Files: EditorPaneView.java Log Message: refactoring: Changed HtmlViewer to ArticleView interface Index: TextileViewer.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/editor/TextileViewer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TextileViewer.java 6 Feb 2007 11:10:10 -0000 1.1 --- TextileViewer.java 7 Feb 2007 21:10:43 -0000 1.2 *************** *** 25,29 **** /** ! * The plain text editor pane. */ public class TextileViewer extends HtmlViewer --- 25,29 ---- /** ! * The Textile viewer pane. */ public class TextileViewer extends HtmlViewer *************** *** 38,42 **** try { ! setText(JTextile.textile(article.getContent())); } catch (Exception e) --- 38,42 ---- try { ! editorPane.setText(JTextile.textile(article.getContent())); } catch (Exception e) Index: HtmlViewer.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/editor/HtmlViewer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HtmlViewer.java 6 Feb 2007 11:10:10 -0000 1.1 --- HtmlViewer.java 7 Feb 2007 21:10:43 -0000 1.2 *************** *** 20,51 **** 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(); } } --- 20,34 ---- package jreepad.editor; import jreepad.JreepadArticle; /** ! * The plain HTML viewer pane. */ ! public class HtmlViewer extends EditorPaneView { public HtmlViewer(JreepadArticle article) { ! super("text/html", article); ! editorPane.setEditable(false); } } Index: PlainTextEditor.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/editor/PlainTextEditor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PlainTextEditor.java 7 Feb 2007 20:16:20 -0000 1.3 --- PlainTextEditor.java 7 Feb 2007 21:10:43 -0000 1.4 *************** *** 20,25 **** package jreepad.editor; - import javax.swing.JComponent; - import javax.swing.JEditorPane; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; --- 20,23 ---- *************** *** 46,59 **** * The plain text editor pane. */ ! public class PlainTextEditor extends AbstractArticleView implements CaretListener, UndoableEditListener { - private JEditorPane editorPane; - private ContentChangeListener contentChangeListener = null; public PlainTextEditor(JreepadArticle article) { ! super(article); ! editorPane = new JEditorPane("text/plain", article.getContent()); editorPane.setEditable(true); --- 44,54 ---- * The plain text editor pane. */ ! public class PlainTextEditor extends EditorPaneView implements CaretListener, UndoableEditListener { private ContentChangeListener contentChangeListener = null; public PlainTextEditor(JreepadArticle article) { ! super("text/plain", article); editorPane.setEditable(true); *************** *** 83,107 **** } ! public void reloadArticle() ! { ! editorPane.setText(article.getContent()); ! } ! ! public JComponent getComponent() ! { ! return editorPane; ! } ! ! public String getText() ! { ! return editorPane.getText(); ! } ! ! public String getSelectedText() ! { ! return editorPane.getSelectedText(); ! } ! ! public void setContentChangeListener(ContentChangeListener listener) { contentChangeListener = listener; --- 78,82 ---- } ! public void setContentChangeListener(ContentChangeListener listener) { contentChangeListener = listener; Index: ArticleView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/editor/ArticleView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArticleView.java 7 Feb 2007 20:16:20 -0000 1.1 --- ArticleView.java 7 Feb 2007 21:10:43 -0000 1.2 *************** *** 1,2 **** --- 1,21 ---- + /* + 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; --- NEW FILE: EditorPaneView.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.JComponent; import javax.swing.JEditorPane; import jreepad.JreepadArticle; /** * Abstract article view in the form of a JEditorPane. * * @author <a href="mailto:pe...@lo...">Przemek WiÄch</a> * @version $Id: EditorPaneView.java,v 1.1 2007/02/07 21:10:43 pewu Exp $ */ public abstract class EditorPaneView extends AbstractArticleView { protected JEditorPane editorPane; public EditorPaneView(String type, JreepadArticle article) { super(article); editorPane = new JEditorPane(type, ""); reloadArticle(); } public void reloadArticle() { editorPane.setText(article.getContent()); } public JComponent getComponent() { return editorPane; } public String getText() { return editorPane.getText(); } public String getSelectedText() { return editorPane.getSelectedText(); } } Index: AbstractArticleView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/editor/AbstractArticleView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractArticleView.java 7 Feb 2007 20:16:20 -0000 1.1 --- AbstractArticleView.java 7 Feb 2007 21:10:43 -0000 1.2 *************** *** 1,6 **** --- 1,32 ---- + /* + 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 jreepad.JreepadArticle; + /** + * Abstract implementation of ArticleView. + * Several basic methods are implemented. + * + * @author <a href="mailto:pe...@lo...">Przemek WiÄch</a> + * @version $Id$ + */ public abstract class AbstractArticleView implements ArticleView { |