src/demo/share/jfc/Stylepad/HelloWorld.java
author zgu
Fri, 12 Apr 2019 09:55:30 -0400
changeset 54524 33fda525ad41
parent 50830 5500595d8ebf
permissions -rw-r--r--
8222403: Shenandoah: Remove ShenandoahAlwaysTrueClosure, use AlwaysTrueClosure instead Reviewed-by: shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50830
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     1
/*
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     2
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     3
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     4
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     5
 * Redistribution and use in source and binary forms, with or without
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     6
 * modification, are permitted provided that the following conditions
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     7
 * are met:
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     8
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
     9
 *   - Redistributions of source code must retain the above copyright
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    10
 *     notice, this list of conditions and the following disclaimer.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    11
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    12
 *   - Redistributions in binary form must reproduce the above copyright
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    13
 *     notice, this list of conditions and the following disclaimer in the
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    14
 *     documentation and/or other materials provided with the distribution.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    15
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    16
 *   - Neither the name of Oracle nor the names of its
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    17
 *     contributors may be used to endorse or promote products derived
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    18
 *     from this software without specific prior written permission.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    19
 *
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    20
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    21
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    22
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    23
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    24
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    25
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    26
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    27
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    28
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    29
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    30
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    31
 */
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    32
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    33
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    34
import java.awt.Color;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    35
import java.util.HashMap;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    36
import java.util.Locale;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    37
import java.util.MissingResourceException;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    38
import java.util.ResourceBundle;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    39
import javax.swing.Icon;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    40
import javax.swing.ImageIcon;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    41
import javax.swing.text.BadLocationException;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    42
import javax.swing.text.DefaultStyledDocument;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    43
import javax.swing.text.Style;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    44
import javax.swing.text.StyleConstants;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    45
import javax.swing.text.StyleContext;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    46
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    47
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    48
/**
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    49
 * hack to load attributed content.
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    50
 */
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    51
public class HelloWorld {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    52
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    53
    HelloWorld(DefaultStyledDocument doc, StyleContext styles) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    54
        this.doc = doc;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    55
        this.styles = styles;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    56
        runAttr = new HashMap<String, Style>();
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    57
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    58
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    59
    void loadDocument() {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    60
        createStyles();
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    61
        for (int i = 0; i < data.length; i++) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    62
            Paragraph p = data[i];
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    63
            addParagraph(p);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    64
        }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    65
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    66
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    67
    void addParagraph(Paragraph p) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    68
        try {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    69
            Style s = null;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    70
            for (int i = 0; i < p.data.length; i++) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    71
                Run run = p.data[i];
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    72
                s = runAttr.get(run.attr);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    73
                doc.insertString(doc.getLength(), run.content, s);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    74
            }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    75
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    76
            // set logical style
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    77
            Style ls = styles.getStyle(p.logical);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    78
            doc.setLogicalStyle(doc.getLength() - 1, ls);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    79
            doc.insertString(doc.getLength(), "\n", null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    80
        } catch (BadLocationException e) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    81
            System.err.println("Internal error: " + e);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    82
        }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    83
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    84
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    85
    void createStyles() {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    86
        // no attributes defined
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    87
        Style s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    88
        runAttr.put("none", s);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    89
        s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    90
        StyleConstants.setItalic(s, true);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    91
        StyleConstants.setForeground(s, new Color(153, 153, 102));
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    92
        runAttr.put("cquote", s); // catepillar quote
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    93
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    94
        s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    95
        StyleConstants.setItalic(s, true);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    96
        StyleConstants.setForeground(s, new Color(51, 102, 153));
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    97
        runAttr.put("aquote", s); // alice quote
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    98
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
    99
        try {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   100
            ResourceBundle resources = ResourceBundle.getBundle(
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   101
                    "resources.Stylepad",
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   102
                    Locale.getDefault());
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   103
            s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   104
            Icon alice = new ImageIcon(resources.getString("aliceGif"));
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   105
            StyleConstants.setIcon(s, alice);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   106
            runAttr.put("alice", s); // alice
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   107
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   108
            s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   109
            Icon caterpillar = new ImageIcon(resources.getString(
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   110
                    "caterpillarGif"));
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   111
            StyleConstants.setIcon(s, caterpillar);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   112
            runAttr.put("caterpillar", s); // caterpillar
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   113
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   114
            s = styles.addStyle(null, null);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   115
            Icon hatter = new ImageIcon(resources.getString("hatterGif"));
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   116
            StyleConstants.setIcon(s, hatter);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   117
            runAttr.put("hatter", s); // hatter
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   118
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   119
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   120
        } catch (MissingResourceException mre) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   121
            // can't display image
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   122
        }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   123
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   124
        Style def = styles.getStyle(StyleContext.DEFAULT_STYLE);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   125
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   126
        Style heading = styles.addStyle("heading", def);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   127
        //StyleConstants.setFontFamily(heading, "SansSerif");
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   128
        StyleConstants.setBold(heading, true);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   129
        StyleConstants.setAlignment(heading, StyleConstants.ALIGN_CENTER);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   130
        StyleConstants.setSpaceAbove(heading, 10);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   131
        StyleConstants.setSpaceBelow(heading, 10);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   132
        StyleConstants.setFontSize(heading, 18);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   133
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   134
        // Title
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   135
        Style sty = styles.addStyle("title", heading);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   136
        StyleConstants.setFontSize(sty, 32);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   137
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   138
        // edition
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   139
        sty = styles.addStyle("edition", heading);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   140
        StyleConstants.setFontSize(sty, 16);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   141
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   142
        // author
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   143
        sty = styles.addStyle("author", heading);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   144
        StyleConstants.setItalic(sty, true);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   145
        StyleConstants.setSpaceBelow(sty, 25);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   146
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   147
        // subtitle
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   148
        sty = styles.addStyle("subtitle", heading);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   149
        StyleConstants.setSpaceBelow(sty, 35);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   150
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   151
        // normal
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   152
        sty = styles.addStyle("normal", def);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   153
        StyleConstants.setLeftIndent(sty, 10);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   154
        StyleConstants.setRightIndent(sty, 10);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   155
        //StyleConstants.setFontFamily(sty, "SansSerif");
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   156
        StyleConstants.setFontSize(sty, 14);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   157
        StyleConstants.setSpaceAbove(sty, 4);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   158
        StyleConstants.setSpaceBelow(sty, 4);
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   159
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   160
    DefaultStyledDocument doc;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   161
    StyleContext styles;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   162
    HashMap<String, Style> runAttr;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   163
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   164
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   165
    static class Paragraph {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   166
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   167
        Paragraph(String logical, Run[] data) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   168
            this.logical = logical;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   169
            this.data = data;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   170
        }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   171
        String logical;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   172
        Run[] data;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   173
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   174
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   175
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   176
    static class Run {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   177
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   178
        Run(String attr, String content) {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   179
            this.attr = attr;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   180
            this.content = content;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   181
        }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   182
        String attr;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   183
        String content;
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   184
    }
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   185
    Paragraph[] data = new Paragraph[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   186
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   187
            new Run("none", "Hello from Cupertino")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   188
        }),
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   189
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   190
            new Run("none", "\u53F0\u5317\u554F\u5019\u60A8\u0021")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   191
        }),
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   192
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   193
            new Run("none", "\u0391\u03B8\u03B7\u03BD\u03B1\u03B9\u0020" // Greek
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   194
            + "\u03B1\u03C3\u03C0\u03B1\u03B6\u03BF\u03BD"
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   195
            + "\u03C4\u03B1\u03B9\u0020\u03C5\u03BC\u03B1"
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   196
            + "\u03C2\u0021")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   197
        }),
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   198
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   199
            new Run("none", "\u6771\u4eac\u304b\u3089\u4eca\u65e5\u306f")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   200
        }),
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   201
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   202
            new Run("none", "\u05e9\u05dc\u05d5\u05dd \u05de\u05d9\u05e8\u05d5"
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   203
            + "\u05e9\u05dc\u05d9\u05dd")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   204
        }),
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   205
        new Paragraph("title", new Run[] {
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   206
            new Run("none", "\u0633\u0644\u0627\u0645")
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   207
        }), };
5500595d8ebf 8205136: Move StylePad demo to the open repository
prr
parents:
diff changeset
   208
}