/[classpath]/classpath/javax/swing/text/DefaultEditorKit.java
ViewVC logotype

Diff of /classpath/javax/swing/text/DefaultEditorKit.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mark, Sat Jul 2 20:32:51 2005 UTC revision 1.18 by rabbit78, Fri Aug 5 10:10:17 2005 UTC
# Line 51  import java.io.Writer; Line 51  import java.io.Writer;
51    
52  import javax.swing.Action;  import javax.swing.Action;
53    
54    /**
55     * The default implementation of {@link EditorKit}. This <code>EditorKit</code>
56     * a plain text <code>Document</code> and several commands that together
57     * make up a basic editor, like cut / copy + paste.
58     *
59     * @author original author unknown
60     * @author Roman Kennke (roman@kennke.org)
61     */
62  public class DefaultEditorKit extends EditorKit  public class DefaultEditorKit extends EditorKit
63  {  {
64      /**
65       * Creates a beep on the PC speaker.
66       *
67       * @see {@link Toolkit#beep()}
68       */
69    public static class BeepAction    public static class BeepAction
70      extends TextAction      extends TextAction
71    {    {
72        /**
73         * Creates a new <code>BeepAction</code>.
74         */
75      public BeepAction()      public BeepAction()
76      {      {
77        super(beepAction);        super(beepAction);
78      }      }
79    
80        /**
81         * Performs the <code>Action</code>.
82         *
83         * @param event the action event describing the user action
84         */
85      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
86      {      {
87        Toolkit.getDefaultToolkit().beep();        Toolkit.getDefaultToolkit().beep();
88      }      }
89    }    }
90    
91      /**
92       * Copies the selected content into the system clipboard.
93       *
94       * @see {@link Toolkit#getSystemClipboard()}
95       * @see {@link CutAction}
96       * @see {@link PasteAction}
97       */
98    public static class CopyAction    public static class CopyAction
99      extends TextAction      extends TextAction
100    {    {
101    
102        /**
103         * Create a new <code>CopyAction</code>.
104         */
105      public CopyAction()      public CopyAction()
106      {      {
107        super(copyAction);        super(copyAction);
108      }      }
109    
110        /**
111         * Performs the <code>Action</code>.
112         *
113         * @param event the action event describing the user action
114         */
115      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
116      {      {
117          // FIXME: Implement me. Tookit.getSystemClipboard should be used
118          // for that.
119      }      }
120    }    }
121    
122    
123      /**
124       * Copies the selected content into the system clipboard and deletes the
125       * selection.
126       *
127       * @see {@link Toolkit#getSystemClipboard()}
128       * @see {@link CopyAction}
129       * @see {@link PasteAction}
130       */
131    public static class CutAction    public static class CutAction
132      extends TextAction      extends TextAction
133    {    {
134    
135        /**
136         * Create a new <code>CutAction</code>.
137         */
138      public CutAction()      public CutAction()
139      {      {
140        super(cutAction);        super(cutAction);
141      }      }
142    
143        /**
144         * Performs the <code>Action</code>.
145         *
146         * @param event the action event describing the user action
147         */
148      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
149      {      {
150          // FIXME: Implement me. Tookit.getSystemClipboard should be used
151          // for that.
152        }
153      }
154    
155      /**
156       * Copies content from the system clipboard into the editor.
157       *
158       * @see {@link Toolkit#getSystemClipboard()}
159       * @see {@link CopyAction}
160       * @see {@link CutAction}
161       */
162      public static class PasteAction
163        extends TextAction
164      {
165    
166        /**
167         * Create a new <code>PasteAction</code>.
168         */
169        public PasteAction()
170        {
171          super(pasteAction);
172        }
173    
174        /**
175         * Performs the <code>Action</code>.
176         *
177         * @param event the action event describing the user action
178         */
179        public void actionPerformed(ActionEvent event)
180        {
181          // FIXME: Implement me. Tookit.getSystemClipboard should be used
182          // for that.
183      }      }
184    }    }
185    
# Line 99  public class DefaultEditorKit extends Ed Line 190  public class DefaultEditorKit extends Ed
190     * the control characters and characters with the ALT-modifier.     * the control characters and characters with the ALT-modifier.
191     *     *
192     * If an event does not get filtered, it is inserted into the document     * If an event does not get filtered, it is inserted into the document
193     * of the text component. If there is some text selected in the text component,     * of the text component. If there is some text selected in the text
194     * this text will be replaced.     * component, this text will be replaced.
195     */     */
196    public static class DefaultKeyTypedAction    public static class DefaultKeyTypedAction
197      extends TextAction      extends TextAction
198    {    {
199    
200        /**
201         * Creates a new <code>DefaultKeyTypedAction</code>.
202         */
203      public DefaultKeyTypedAction()      public DefaultKeyTypedAction()
204      {      {
205        super(defaultKeyTypedAction);        super(defaultKeyTypedAction);
206      }      }
207    
208        /**
209         * Performs the <code>Action</code>.
210         *
211         * @param event the action event describing the user action
212         */
213      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
214      {      {
215        // first we filter the following events:        // first we filter the following events:
# Line 124  public class DefaultEditorKit extends Ed Line 224  public class DefaultEditorKit extends Ed
224          {          {
225            try            try
226              {              {
227                t.getDocument().insertString(t.getCaret().getDot(), event.getActionCommand(), null);                t.getDocument().insertString(t.getCaret().getDot(),
228                                               event.getActionCommand(), null);
229                t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,                t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
230                                             t.getDocument().getEndPosition().getOffset()));                                             t.getDocument().getEndPosition()
231                                               .getOffset()));
232              }              }
233            catch (BadLocationException be)            catch (BadLocationException be)
234              {              {
# Line 144  public class DefaultEditorKit extends Ed Line 246  public class DefaultEditorKit extends Ed
246    public static class InsertBreakAction    public static class InsertBreakAction
247      extends TextAction      extends TextAction
248    {    {
249    
250        /**
251         * Creates a new <code>InsertBreakAction</code>.
252         */
253      public InsertBreakAction()      public InsertBreakAction()
254      {      {
255        super(insertBreakAction);        super(insertBreakAction);
256      }      }
257    
258        /**
259         * Performs the <code>Action</code>.
260         *
261         * @param event the action event describing the user action
262         */
263      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
264      {      {
265        JTextComponent t = getTextComponent(event);        JTextComponent t = getTextComponent(event);
# Line 156  public class DefaultEditorKit extends Ed Line 267  public class DefaultEditorKit extends Ed
267      }      }
268    }    }
269    
270      /**
271       * Places content into the associated editor. If there currently is a
272       * selection, this selection is replaced.
273       */
274      // FIXME: Figure out what this Action is supposed to do. Obviously text
275      // that is entered by the user is inserted through DefaultKeyTypedAction.
276    public static class InsertContentAction    public static class InsertContentAction
277      extends TextAction      extends TextAction
278    {    {
279    
280        /**
281         * Creates a new <code>InsertContentAction</code>.
282         */
283      public InsertContentAction()      public InsertContentAction()
284      {      {
285        super(insertContentAction);        super(insertContentAction);
286      }      }
287    
288        /**
289         * Performs the <code>Action</code>.
290         *
291         * @param event the action event describing the user action
292         */
293      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
294      {      {
295      }      }
296    }    }
297    
298      /**
299       * Inserts a TAB character into the text editor.
300       */
301    public static class InsertTabAction    public static class InsertTabAction
302      extends TextAction      extends TextAction
303    {    {
304    
305        /**
306         * Creates a new <code>TabAction</code>.
307         */
308      public InsertTabAction()      public InsertTabAction()
309      {      {
310        super(insertTabAction);        super(insertTabAction);
311      }      }
312    
313        /**
314         * Performs the <code>Action</code>.
315         *
316         * @param event the action event describing the user action
317         */
318      public void actionPerformed(ActionEvent event)      public void actionPerformed(ActionEvent event)
319      {      {
320          // FIXME: Implement this.
321      }      }
322    }    }
323    
324    public static class PasteAction    /**
325      extends TextAction     * The serial version of DefaultEditorKit.
326    {     */
     public PasteAction()  
     {  
       super(pasteAction);  
     }  
   
     public void actionPerformed(ActionEvent event)  
     {  
     }  
   }  
   
327    private static final long serialVersionUID = 9017245433028523428L;    private static final long serialVersionUID = 9017245433028523428L;
328      
329      /**
330       * The name of the <code>Action</code> that moves the caret one character
331       * backwards.
332       *
333       * @see {@link #getActions()}
334       */
335    public static final String backwardAction = "caret-backward";    public static final String backwardAction = "caret-backward";
336    
337      /**
338       * The name of the <code>Action</code> that creates a beep in the speaker.
339       *
340       * @see {@link #getActions()}
341       */
342    public static final String beepAction = "beep";    public static final String beepAction = "beep";
343    
344      /**
345       * The name of the <code>Action</code> that moves the caret to the beginning
346       * of the <code>Document</code>.
347       *
348       * @see {@link #getActions()}
349       */
350    public static final String beginAction = "caret-begin";    public static final String beginAction = "caret-begin";
351    
352      /**
353       * The name of the <code>Action</code> that moves the caret to the beginning
354       * of the current line.
355       *
356       * @see {@link #getActions()}
357       */
358    public static final String beginLineAction = "caret-begin-line";    public static final String beginLineAction = "caret-begin-line";
359    
360      /**
361       * The name of the <code>Action</code> that moves the caret to the beginning
362       * of the current paragraph.
363       *
364       * @see {@link #getActions()}
365       */
366    public static final String beginParagraphAction = "caret-begin-paragraph";    public static final String beginParagraphAction = "caret-begin-paragraph";
367    
368      /**
369       * The name of the <code>Action</code> that moves the caret to the beginning
370       * of the current word.
371       *
372       * @see {@link #getActions()}
373       */
374    public static final String beginWordAction = "caret-begin-word";    public static final String beginWordAction = "caret-begin-word";
375    
376      /**
377       * The name of the <code>Action</code> that copies the selected content
378       * into the system clipboard.
379       *
380       * @see {@link #getActions()}
381       */
382    public static final String copyAction = "copy-to-clipboard";    public static final String copyAction = "copy-to-clipboard";
383    
384      /**
385       * The name of the <code>Action</code> that copies the selected content
386       * into the system clipboard and removes the selection.
387       *
388       * @see {@link #getActions()}
389       */
390    public static final String cutAction = "cut-to-clipboard";    public static final String cutAction = "cut-to-clipboard";
391    
392      /**
393       * The name of the <code>Action</code> that is performed by default if
394       * a key is typed and there is no keymap entry.
395       *
396       * @see {@link #getActions()}
397       */
398    public static final String defaultKeyTypedAction = "default-typed";    public static final String defaultKeyTypedAction = "default-typed";
399    
400      /**
401       * The name of the <code>Action</code> that deletes the character that
402       * follows the current caret position.
403       *
404       * @see {@link #getActions()}
405       */
406    public static final String deleteNextCharAction = "delete-next";    public static final String deleteNextCharAction = "delete-next";
407    
408      /**
409       * The name of the <code>Action</code> that deletes the character that
410       * precedes the current caret position.
411       *
412       * @see {@link #getActions()}
413       */
414    public static final String deletePrevCharAction = "delete-previous";    public static final String deletePrevCharAction = "delete-previous";
415    
416      /**
417       * The name of the <code>Action</code> that moves the caret one line down.
418       *
419       * @see {@link #getActions()}
420       */
421    public static final String downAction = "caret-down";    public static final String downAction = "caret-down";
422    
423      /**
424       * The name of the <code>Action</code> that moves the caret to the end
425       * of the <code>Document</code>.
426       *
427       * @see {@link #getActions()}
428       */
429    public static final String endAction = "caret-end";    public static final String endAction = "caret-end";
430    
431      /**
432       * The name of the <code>Action</code> that moves the caret to the end
433       * of the current line.
434       *
435       * @see {@link #getActions()}
436       */
437    public static final String endLineAction = "caret-end-line";    public static final String endLineAction = "caret-end-line";
438    
439      /**
440       * When a document is read and an CRLF is encountered, then we add a property
441       * with this name and a value of &quot;\r\n&quot;.
442       */
443    public static final String EndOfLineStringProperty = "__EndOfLine__";    public static final String EndOfLineStringProperty = "__EndOfLine__";
444    
445      /**
446       * The name of the <code>Action</code> that moves the caret to the end
447       * of the current paragraph.
448       *
449       * @see {@link #getActions()}
450       */
451    public static final String endParagraphAction = "caret-end-paragraph";    public static final String endParagraphAction = "caret-end-paragraph";
452    
453      /**
454       * The name of the <code>Action</code> that moves the caret to the end
455       * of the current word.
456       *
457       * @see {@link #getActions()}
458       */
459    public static final String endWordAction = "caret-end-word";    public static final String endWordAction = "caret-end-word";
460    
461      /**
462       * The name of the <code>Action</code> that moves the caret one character
463       * forward.
464       *
465       * @see {@link #getActions()}
466       */
467    public static final String forwardAction = "caret-forward";    public static final String forwardAction = "caret-forward";
468    
469      /**
470       * The name of the <code>Action</code> that inserts a line break.
471       *
472       * @see {@link #getActions()}
473       */
474    public static final String insertBreakAction = "insert-break";    public static final String insertBreakAction = "insert-break";
475    
476      /**
477       * The name of the <code>Action</code> that inserts some content.
478       *
479       * @see {@link #getActions()}
480       */
481    public static final String insertContentAction = "insert-content";    public static final String insertContentAction = "insert-content";
482    
483      /**
484       * The name of the <code>Action</code> that inserts a TAB.
485       *
486       * @see {@link #getActions()}
487       */
488    public static final String insertTabAction = "insert-tab";    public static final String insertTabAction = "insert-tab";
489    
490      /**
491       * The name of the <code>Action</code> that moves the caret to the beginning
492       * of the next word.
493       *
494       * @see {@link #getActions()}
495       */
496    public static final String nextWordAction = "caret-next-word";    public static final String nextWordAction = "caret-next-word";
497    
498      /**
499       * The name of the <code>Action</code> that moves the caret one page down.
500       *
501       * @see {@link #getActions()}
502       */
503    public static final String pageDownAction = "page-down";    public static final String pageDownAction = "page-down";
504    
505      /**
506       * The name of the <code>Action</code> that moves the caret one page up.
507       *
508       * @see {@link #getActions()}
509       */
510    public static final String pageUpAction = "page-up";    public static final String pageUpAction = "page-up";
511    
512      /**
513       * The name of the <code>Action</code> that copies content from the system
514       * clipboard into the document.
515       *
516       * @see {@link #getActions()}
517       */
518    public static final String pasteAction = "paste-from-clipboard";    public static final String pasteAction = "paste-from-clipboard";
519    
520      /**
521       * The name of the <code>Action</code> that moves the caret to the beginning
522       * of the previous word.
523       *
524       * @see {@link #getActions()}
525       */
526    public static final String previousWordAction = "caret-previous-word";    public static final String previousWordAction = "caret-previous-word";
527    
528      /**
529       * The name of the <code>Action</code> that sets the editor in read only
530       * mode.
531       *
532       * @see {@link #getActions()}
533       */
534    public static final String readOnlyAction = "set-read-only";    public static final String readOnlyAction = "set-read-only";
535    
536      /**
537       * The name of the <code>Action</code> that selects the whole document.
538       *
539       * @see {@link #getActions()}
540       */
541    public static final String selectAllAction = "select-all";    public static final String selectAllAction = "select-all";
542    
543      /**
544       * The name of the <code>Action</code> that moves the caret one character
545       * backwards, possibly extending the current selection.
546       *
547       * @see {@link #getActions()}
548       */
549    public static final String selectionBackwardAction = "selection-backward";    public static final String selectionBackwardAction = "selection-backward";
550    
551      /**
552       * The name of the <code>Action</code> that moves the caret to the beginning
553       * of the document, possibly extending the current selection.
554       *
555       * @see {@link #getActions()}
556       */
557    public static final String selectionBeginAction = "selection-begin";    public static final String selectionBeginAction = "selection-begin";
558    
559      /**
560       * The name of the <code>Action</code> that moves the caret to the beginning
561       * of the current line, possibly extending the current selection.
562       *
563       * @see {@link #getActions()}
564       */
565    public static final String selectionBeginLineAction = "selection-begin-line";    public static final String selectionBeginLineAction = "selection-begin-line";
566    
567      /**
568       * The name of the <code>Action</code> that moves the caret to the beginning
569       * of the current paragraph, possibly extending the current selection.
570       *
571       * @see {@link #getActions()}
572       */
573    public static final String selectionBeginParagraphAction =    public static final String selectionBeginParagraphAction =
574      "selection-begin-paragraph";      "selection-begin-paragraph";
575    
576      /**
577       * The name of the <code>Action</code> that moves the caret to the beginning
578       * of the current word, possibly extending the current selection.
579       *
580       * @see {@link #getActions()}
581       */
582    public static final String selectionBeginWordAction = "selection-begin-word";    public static final String selectionBeginWordAction = "selection-begin-word";
583    
584      /**
585       * The name of the <code>Action</code> that moves the caret one line down,
586       * possibly extending the current selection.
587       *
588       * @see {@link #getActions()}
589       */
590    public static final String selectionDownAction = "selection-down";    public static final String selectionDownAction = "selection-down";
591    
592      /**
593       * The name of the <code>Action</code> that moves the caret to the end
594       * of the document, possibly extending the current selection.
595       *
596       * @see {@link #getActions()}
597       */
598    public static final String selectionEndAction = "selection-end";    public static final String selectionEndAction = "selection-end";
599    
600      /**
601       * The name of the <code>Action</code> that moves the caret to the end
602       * of the current line, possibly extending the current selection.
603       *
604       * @see {@link #getActions()}
605       */
606    public static final String selectionEndLineAction = "selection-end-line";    public static final String selectionEndLineAction = "selection-end-line";
607    
608      /**
609       * The name of the <code>Action</code> that moves the caret to the end
610       * of the current paragraph, possibly extending the current selection.
611       *
612       * @see {@link #getActions()}
613       */
614    public static final String selectionEndParagraphAction =    public static final String selectionEndParagraphAction =
615      "selection-end-paragraph";      "selection-end-paragraph";
616    
617      /**
618       * The name of the <code>Action</code> that moves the caret to the end
619       * of the current word, possibly extending the current selection.
620       *
621       * @see {@link #getActions()}
622       */
623    public static final String selectionEndWordAction = "selection-end-word";    public static final String selectionEndWordAction = "selection-end-word";
624    
625      /**
626       * The name of the <code>Action</code> that moves the caret one character
627       * forwards, possibly extending the current selection.
628       *
629       * @see {@link #getActions()}
630       */
631    public static final String selectionForwardAction = "selection-forward";    public static final String selectionForwardAction = "selection-forward";
632    
633      /**
634       * The name of the <code>Action</code> that moves the caret to the beginning
635       * of the next word, possibly extending the current selection.
636       *
637       * @see {@link #getActions()}
638       */
639    public static final String selectionNextWordAction = "selection-next-word";    public static final String selectionNextWordAction = "selection-next-word";
640    
641      /**
642       * The name of the <code>Action</code> that moves the caret to the beginning
643       * of the previous word, possibly extending the current selection.
644       *
645       * @see {@link #getActions()}
646       */
647    public static final String selectionPreviousWordAction =    public static final String selectionPreviousWordAction =
648      "selection-previous-word";      "selection-previous-word";
649    
650      /**
651       * The name of the <code>Action</code> that moves the caret one line up,
652       * possibly extending the current selection.
653       *
654       * @see {@link #getActions()}
655       */
656    public static final String selectionUpAction = "selection-up";    public static final String selectionUpAction = "selection-up";
657    
658      /**
659       * The name of the <code>Action</code> that selects the line around the
660       * caret.
661       *
662       * @see {@link #getActions()}
663       */
664    public static final String selectLineAction = "select-line";    public static final String selectLineAction = "select-line";
665    
666      /**
667       * The name of the <code>Action</code> that selects the paragraph around the
668       * caret.
669       *
670       * @see {@link #getActions()}
671       */
672    public static final String selectParagraphAction = "select-paragraph";    public static final String selectParagraphAction = "select-paragraph";
673    
674      /**
675       * The name of the <code>Action</code> that selects the word around the
676       * caret.
677       *
678       * @see {@link #getActions()}
679       */
680    public static final String selectWordAction = "select-word";    public static final String selectWordAction = "select-word";
681    
682      /**
683       * The name of the <code>Action</code> that moves the caret one line up.
684       *
685       * @see {@link #getActions()}
686       */
687    public static final String upAction = "caret-up";    public static final String upAction = "caret-up";
688    
689      /**
690       * The name of the <code>Action</code> that sets the editor in read-write
691       * mode.
692       *
693       * @see {@link #getActions()}
694       */
695    public static final String writableAction = "set-writable";    public static final String writableAction = "set-writable";
696    
697      /**
698       * Creates a new <code>DefaultEditorKit</code>.
699       */
700    public DefaultEditorKit()    public DefaultEditorKit()
701    {    {
702    }    }
703    
704      /**
705       * The <code>Action</code>s that are supported by the
706       * <code>DefaultEditorKit</code>.
707       */
708      // TODO: All these inner classes look ugly. Maybe work out a better way
709      // to handle this.
710    private static Action[] defaultActions =    private static Action[] defaultActions =
711    new Action[] {    new Action[] {
712      new BeepAction(),      new BeepAction(),
# Line 356  public class DefaultEditorKit extends Ed Line 812  public class DefaultEditorKit extends Ed
812      },      },
813    };    };
814    
815      /**
816       * Creates the <code>Caret</code> for this <code>EditorKit</code>. This
817       * returns a {@link DefaultCaret} in this case.
818       *
819       * @return the <code>Caret</code> for this <code>EditorKit</code>
820       */
821    public Caret createCaret()    public Caret createCaret()
822    {    {
823      return new DefaultCaret();      return new DefaultCaret();
824    }    }
825    
826      /**
827       * Creates the default {@link Document} that this <code>EditorKit</code>
828       * supports. This is a {@link DefaultDocument} in this case.
829       *
830       * @return the default {@link Document} that this <code>EditorKit</code>
831       *         supports
832       */
833    public Document createDefaultDocument()    public Document createDefaultDocument()
834    {    {
835      return new PlainDocument();      return new PlainDocument();
836    }    }
837        
838      /**
839       * Returns the <code>Action</code>s supported by this <code>EditorKit</code>.
840       *
841       * @return the <code>Action</code>s supported by this <code>EditorKit</code>
842       */
843    public Action[] getActions()    public Action[] getActions()
844    {    {
845      return defaultActions;      return defaultActions;
846    }    }
847    
848      /**
849       * Returns the content type that this <code>EditorKit</code> supports.
850       * The <code>DefaultEditorKit</code> supports the content type
851       * <code>text/plain</code>.
852       *
853       * @return the content type that this <code>EditorKit</code> supports
854       */
855    public String getContentType()    public String getContentType()
856    {    {
857      return "text/plain";      return "text/plain";
858    }    }
859      
860      /**
861       * Returns a {@link ViewFactory} that is able to create {@link View}s for
862       * the <code>Element</code>s that are used in this <code>EditorKit</code>'s
863       * model. This returns null which lets the UI of the text component supply
864       * <code>View</code>s.
865       *
866       * @return a {@link ViewFactory} that is able to create {@link View}s for
867       *         the <code>Element</code>s that are used in this
868       *         <code>EditorKit</code>'s model
869       */
870    public ViewFactory getViewFactory()    public ViewFactory getViewFactory()
871    {    {
872      return null;      return null;
873    }    }
874    
875      /**
876       * Reads a document of the supported content type from an {@link InputStream}
877       * into the actual {@link Document} object.
878       *
879       * @param in the stream from which to read the document
880       * @param document the document model into which the content is read
881       * @param offset the offset inside to document where the content is inserted
882       *
883       * @throws BadLocationException if <code>offset</code> is an invalid location
884       *         inside <code>document</code>
885       * @throws IOException if something goes wrong while reading from
886       *        <code>in</code>
887       */
888    public void read(InputStream in, Document document, int offset)    public void read(InputStream in, Document document, int offset)
889      throws BadLocationException, IOException      throws BadLocationException, IOException
890    {    {
891      read(new InputStreamReader(in), document, offset);      read(new InputStreamReader(in), document, offset);
892    }    }
893    
894      /**
895       * Reads a document of the supported content type from a {@link Reader}
896       * into the actual {@link Document} object.
897       *
898       * @param in the reader from which to read the document
899       * @param document the document model into which the content is read
900       * @param offset the offset inside to document where the content is inserted
901       *
902       * @throws BadLocationException if <code>offset</code> is an invalid location
903       *         inside <code>document</code>
904       * @throws IOException if something goes wrong while reading from
905       *        <code>in</code>
906       */
907    public void read(Reader in, Document document, int offset)    public void read(Reader in, Document document, int offset)
908      throws BadLocationException, IOException      throws BadLocationException, IOException
909    {    {
# Line 405  public class DefaultEditorKit extends Ed Line 922  public class DefaultEditorKit extends Ed
922                            SimpleAttributeSet.EMPTY);                            SimpleAttributeSet.EMPTY);
923    }    }
924    
925      /**
926       * Writes the <code>Document</code> (or a fragment of the
927       * <code>Document</code>) to an {@link OutputStream} in the
928       * supported content type format.
929       *
930       * @param out the stream to write to
931       * @param document the document that should be written out
932       * @param offset the beginning offset from where to write
933       * @param len the length of the fragment to write
934       *
935       * @throws BadLocationException if <code>offset</code> or
936       *         <code>offset + len</code>is an invalid location inside
937       *         <code>document</code>
938       * @throws IOException if something goes wrong while writing to
939       *        <code>out</code>
940       */
941    public void write(OutputStream out, Document document, int offset, int len)    public void write(OutputStream out, Document document, int offset, int len)
942      throws BadLocationException, IOException      throws BadLocationException, IOException
943    {    {
944      write(new OutputStreamWriter(out), document, offset, len);      write(new OutputStreamWriter(out), document, offset, len);
945    }    }
946    
947      /**
948       * Writes the <code>Document</code> (or a fragment of the
949       * <code>Document</code>) to a {@link Writer} in the
950       * supported content type format.
951       *
952       * @param out the writer to write to
953       * @param document the document that should be written out
954       * @param offset the beginning offset from where to write
955       * @param len the length of the fragment to write
956       *
957       * @throws BadLocationException if <code>offset</code> or
958       *         <code>offset + len</code>is an invalid location inside
959       *         <code>document</code>
960       * @throws IOException if something goes wrong while writing to
961       *        <code>out</code>
962       */
963    public void write(Writer out, Document document, int offset, int len)    public void write(Writer out, Document document, int offset, int len)
964      throws BadLocationException, IOException      throws BadLocationException, IOException
965    {    {
966        // TODO: Implement this properly.
967    }    }
968  }  }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26