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

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

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

revision 1.11 by rabbit78, Fri Jul 29 15:27:41 2005 UTC revision 1.12 by rabbit78, Fri Jul 29 23:02:02 2005 UTC
# Line 455  public class StyledEditorKit extends Def Line 455  public class StyledEditorKit extends Def
455    }    }
456    
457    /**    /**
458     * StyledViewFactory     * A {@link ViewFactory} that is able to create {@link View}s for
459       * the <code>Element</code>s that are supported by
460       * <code>StyledEditorKit</code>, namely the following types of Elements:
461       *
462       * <ul>
463       * <li>{@link AbstractDocument.ContentElementName}</li>
464       * <li>{@link AbstractDocument.ParagraphElementName}</li>
465       * <li>{@link AbstractDocument.SectionElementName}</li>
466       * <li>{@link StyleContext.ComponentElementName}</li>
467       * <li>{@link StyleContext.IconElementName}</li>
468       * </ul>
469     */     */
470    static class StyledViewFactory    static class StyledViewFactory
471      implements ViewFactory      implements ViewFactory
472    {    {
473      /**      /**
474       * create       * Creates a {@link View} for the specified <code>Element</code>.
475       * @param value0 TODO       *
476       * @returns View       * @param element the <code>Element</code> to create a <code>View</code>
477         *        for
478         * @return the <code>View</code> for the specified <code>Element</code>
479         *         or <code>null</code> if the type of <code>element</code> is
480         *         not supported
481       */       */
482      public View create(Element element)      public View create(Element element)
483      {      {
# Line 485  public class StyledEditorKit extends Def Line 499  public class StyledEditorKit extends Def
499    }    }
500    
501    /**    /**
502     * AttributeTracker     * Keeps track of the caret position and updates the currentRun
503       * <code>Element</code> and the <code>inputAttributes</code>.
504     */     */
505    class CaretTracker    class CaretTracker
506      implements CaretListener      implements CaretListener
507    {    {
508      /**      /**
509       * caretUpdate       * Notifies an update of the caret position.
510       * @param value0 TODO       *
511         * @param ev the event for the caret update
512       */       */
513      public void caretUpdate(CaretEvent ev)      public void caretUpdate(CaretEvent ev)
514      {      {
# Line 514  public class StyledEditorKit extends Def Line 530  public class StyledEditorKit extends Def
530    }    }
531    
532    /**    /**
533     * currentRun     * Stores the <code>Element</code> at the current caret position. This
534       * is updated by {@link CaretTracker}.
535     */     */
536    Element currentRun;    Element currentRun;
537    
538    /**    /**
539     * inputAttributes     * The current input attributes. This is updated by {@link CaretTracker}.
540     */     */
541    MutableAttributeSet inputAttributes;    MutableAttributeSet inputAttributes;
542    
# Line 535  public class StyledEditorKit extends Def Line 552  public class StyledEditorKit extends Def
552    StyledViewFactory viewFactory;    StyledViewFactory viewFactory;
553    
554    /**    /**
555     * Constructor StyledEditorKit     * Creates a new instance of <code>StyledEditorKit</code>.
556     */     */
557    public StyledEditorKit()    public StyledEditorKit()
558    {    {
# Line 543  public class StyledEditorKit extends Def Line 560  public class StyledEditorKit extends Def
560    }    }
561    
562    /**    /**
563     * clone     * Creates an exact copy of this <code>StyledEditorKit</code>.
564     * @returns Object     *
565       * @return an exact copy of this <code>StyledEditorKit</code>
566     */     */
567    public Object clone()    public Object clone()
568    {    {
# Line 554  public class StyledEditorKit extends Def Line 572  public class StyledEditorKit extends Def
572    }    }
573    
574    /**    /**
575     * getActions     * Returns the <code>Action</code>s supported by this {@link EditorKit}.
576     * @returns Action[]     * This includes the {@link BoldAction}, {@link ItalicAction} and
577       * {@link UnderlineAction} as well as the <code>Action</code>s supported
578       * by {@link DefaultEditorKit}.
579       *
580       * The other <code>Action</code>s of <code>StyledEditorKit</code> are not
581       * returned here, since they require a parameter and thus custom
582       * instantiation.
583       *
584       * @return the <code>Action</code>s supported by this {@link EditorKit}
585     */     */
586    public Action[] getActions()    public Action[] getActions()
587    {    {
# Line 566  public class StyledEditorKit extends Def Line 592  public class StyledEditorKit extends Def
592    }    }
593    
594    /**    /**
595     * getInputAttributes     * Returns the current input attributes. These are automatically set on
596     * @returns MutableAttributeSet     * any newly inserted content, if not specified otherwise.
597       *
598       * @return the current input attributes
599     */     */
600    public MutableAttributeSet getInputAttributes()    public MutableAttributeSet getInputAttributes()
601    {    {
# Line 575  public class StyledEditorKit extends Def Line 603  public class StyledEditorKit extends Def
603    }    }
604    
605    /**    /**
606     * getCharacterAttributeRun     * Returns the {@link Element} that represents the character run at the
607     * @returns Element     * current caret position.
608       *
609       * @return the {@link Element} that represents the character run at the
610       *         current caret position
611     */     */
612    public Element getCharacterAttributeRun()    public Element getCharacterAttributeRun()
613    {    {
# Line 584  public class StyledEditorKit extends Def Line 615  public class StyledEditorKit extends Def
615    }    }
616    
617    /**    /**
618     * createDefaultDocument     * Creates the default {@link Document} supported by this
619     * @returns Document     * <code>EditorKit</code>. This is an instance of
620       * {@link DefaultStyledDocument} in this case but may be overridden by
621       * subclasses.
622       *
623       * @return an instance of <code>DefaultStyledDocument</code>
624     */     */
625    public Document createDefaultDocument()    public Document createDefaultDocument()
626    {    {
# Line 593  public class StyledEditorKit extends Def Line 628  public class StyledEditorKit extends Def
628    }    }
629    
630    /**    /**
631     * install     * Installs this <code>EditorKit</code> on the specified {@link JEditorPane}.
632     * @param component TODO     * This basically involves setting up required listeners on the
633       * <code>JEditorPane</code>.
634       *
635       * @param component the <code>JEditorPane</code> to install this
636       *        <code>EditorKit</code> on
637     */     */
638    public void install(JEditorPane component)    public void install(JEditorPane component)
639    {    {
# Line 603  public class StyledEditorKit extends Def Line 642  public class StyledEditorKit extends Def
642    }    }
643    
644    /**    /**
645     * deinstall     * Deinstalls this <code>EditorKit</code> from the specified
646     * @param component TODO     * {@link JEditorPane}. This basically involves removing all listeners from
647       * <code>JEditorPane</code> that have been set up by this
648       * <code>EditorKit</code>.
649       *
650       * @param component the <code>JEditorPane</code> from which to deinstall this
651       *        <code>EditorKit</code>
652     */     */
653    public void deinstall(JEditorPane component)    public void deinstall(JEditorPane component)
654    {    {
# Line 615  public class StyledEditorKit extends Def Line 659  public class StyledEditorKit extends Def
659    }    }
660    
661    /**    /**
662     * getViewFactory     * Returns a {@link ViewFactory} that is able to create {@link View}s
663     * @returns ViewFactory     * for {@link Element}s that are supported by this <code>EditorKit</code>,
664       * namely the following types of <code>Element</code>s:
665       *
666       * <ul>
667       * <li>{@link AbstractDocument.ContentElementName}</li>
668       * <li>{@link AbstractDocument.ParagraphElementName}</li>
669       * <li>{@link AbstractDocument.SectionElementName}</li>
670       * <li>{@link StyleContext.ComponentElementName}</li>
671       * <li>{@link StyleContext.IconElementName}</li>
672       * </ul>
673       *
674       * @return a {@link ViewFactory} that is able to create {@link View}s
675       *          for {@link Element}s that are supported by this <code>EditorKit</code>
676     */     */
677    public ViewFactory getViewFactory()    public ViewFactory getViewFactory()
678    {    {
# Line 626  public class StyledEditorKit extends Def Line 682  public class StyledEditorKit extends Def
682    }    }
683    
684    /**    /**
685     * createInputAttributes     * Copies the text attributes from <code>element</code> to <code>set</code>.
686     * @param element TODO     * This is called everytime when the caret position changes to keep
687     * @param set TODO     * track of the current input attributes. The attributes in <code>set</code>
688       * are cleaned before adding the attributes of <code>element</code>.
689       *
690       * This method filters out attributes for element names, <code>Icon</code>s
691       * and <code>Component</code>s.
692       *
693       * @param element the <code>Element</code> from which to copy the text
694       *         attributes
695       * @param set the inputAttributes to copy the attributes to
696     */     */
697    protected void createInputAttributes(Element element,    protected void createInputAttributes(Element element,
698                                         MutableAttributeSet set)                                         MutableAttributeSet set)

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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