Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.
javax.swing.text.html

Class MinimalHTMLWriter


  • public class MinimalHTMLWriter
    extends AbstractWriter
    MinimalHTMLWriter is a fallback writer used by the HTMLEditorKit to write out HTML for a document that is a not produced by the EditorKit. The format for the document is:
     <html>
       <head>
         <style>
            <!-- list of named styles
             p.normal {
                font-family: SansSerif;
                margin-height: 0;
                font-size: 14
             }
            -->
          </style>
       </head>
       <body>
        <p style=normal>
            Bold, italic, and underline attributes
            of the run are emitted as HTML tags.
            The remaining attributes are emitted as
            part of the style attribute of a <span> tag.
            The syntax is similar to inline styles.
        </p>
       </body>
     </html>
     
    • Constructor Detail

      • MinimalHTMLWriter

        public MinimalHTMLWriter(Writer w,
                         StyledDocument doc)
        Creates a new MinimalHTMLWriter.
        Parameters:
        w - Writer
        doc - StyledDocument
      • MinimalHTMLWriter

        public MinimalHTMLWriter(Writer w,
                         StyledDocument doc,
                         int pos,
                         int len)
        Creates a new MinimalHTMLWriter.
        Parameters:
        w - Writer
        doc - StyledDocument
        pos - The location in the document to fetch the content.
        len - The amount to write out.
    • Method Detail

      • writeAttributes

        protected void writeAttributes(AttributeSet attr)
                                throws IOException
        Writes out all the attributes for the following types: StyleConstants.ParagraphConstants, StyleConstants.CharacterConstants, StyleConstants.FontConstants, StyleConstants.ColorConstants. The attribute name and value are separated by a colon. Each pair is separated by a semicolon.
        Overrides:
        writeAttributes in class AbstractWriter
        Parameters:
        attr - an AttributeSet.
        Throws:
        IOException - on any I/O error
      • writeStartTag

        protected void writeStartTag(String tag)
                              throws IOException
        Writes out a start tag appropriately indented. Also increments the indent level.
        Throws:
        IOException - on any I/O error
      • writeEndTag

        protected void writeEndTag(String endTag)
                            throws IOException
        Writes out an end tag appropriately indented. Also decrements the indent level.
        Throws:
        IOException - on any I/O error
      • writeHeader

        protected void writeHeader()
                            throws IOException
        Writes out the <head> and <style> tags, and then invokes writeStyles() to write out all the named styles as the content of the <style> tag. The content is surrounded by valid HTML comment markers to ensure that the document is viewable in applications/browsers that do not support the tag.
        Throws:
        IOException - on any I/O error
      • writeStyles

        protected void writeStyles()
                            throws IOException
        Writes out all the named styles as the content of the <style> tag.
        Throws:
        IOException - on any I/O error
      • writeBody

        protected void writeBody()
                          throws IOException,
                                 BadLocationException
        Iterates over the elements in the document and processes elements based on whether they are branch elements or leaf elements. This method specially handles leaf elements that are text.
        Throws:
        IOException - on any I/O error
        BadLocationException
      • writeEndParagraph

        protected void writeEndParagraph()
                                  throws IOException
        Emits an end tag for a <p> tag. Before writing out the tag, this method ensures that all other tags that have been opened are appropriately closed off.
        Throws:
        IOException - on any I/O error
      • writeStartParagraph

        protected void writeStartParagraph(Element elem)
                                    throws IOException
        Emits the start tag for a paragraph. If the paragraph has a named style associated with it, then this method also generates a class attribute for the <p> tag and sets its value to be the name of the style.
        Throws:
        IOException - on any I/O error
      • writeLeaf

        protected void writeLeaf(Element elem)
                          throws IOException
        Responsible for writing out other non-text leaf elements.
        Throws:
        IOException - on any I/O error
      • writeImage

        protected void writeImage(Element elem)
                           throws IOException
        Responsible for handling Icon Elements; deliberately unimplemented. How to implement this method is an issue of policy. For example, if you're generating an <img> tag, how should you represent the src attribute (the location of the image)? In certain cases it could be a URL, in others it could be read from a stream.
        Parameters:
        elem - element of type StyleConstants.IconElementName
        Throws:
        IOException
      • writeComponent

        protected void writeComponent(Element elem)
                               throws IOException
        Responsible for handling Component Elements; deliberately unimplemented. How this method is implemented is a matter of policy.
        Throws:
        IOException
      • isText

        protected boolean isText(Element elem)
        Returns true if the element is a text element.
      • writeHTMLTags

        protected void writeHTMLTags(AttributeSet attr)
                              throws IOException
        Generates bold <b>, italic <i>, and <u> tags for the text based on its attribute settings.
        Throws:
        IOException - on any I/O error
      • writeNonHTMLAttributes

        protected void writeNonHTMLAttributes(AttributeSet attr)
                                       throws IOException
        Writes out the remaining character-level attributes (attributes other than bold, italic, and underline) in an HTML-compliant way. Given that attributes such as font family and font size have no direct mapping to HTML tags, a <span> tag is generated and its style attribute is set to contain the list of remaining attributes just like inline styles.
        Throws:
        IOException - on any I/O error
      • inFontTag

        protected boolean inFontTag()
        Returns true if we are currently in a <font> tag.
      • endFontTag

        protected void endFontTag()
                           throws IOException
        This is no longer used, instead <span> will be written out.

        Writes out an end tag for the <font> tag.

        Throws:
        IOException - on any I/O error
      • startFontTag

        protected void startFontTag(String style)
                             throws IOException
        This is no longer used, instead <span> will be written out.

        Writes out a start tag for the <font> tag. Because font tags cannot be nested, this method closes out any enclosing font tag before writing out a new start tag.

        Throws:
        IOException - on any I/O error

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/text/html/minimalhtmlwriter.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut