Package javax.swing.text

Examples of javax.swing.text.DefaultStyledDocument$ChangeDesc


    public void testReplaceSelectionWithAttributes() {
        if (true) {
            throw new UnsupportedOperationException("Not implemented");
        }
        AbstractDocument doc = new DefaultStyledDocument();
        SimpleAttributeSet as1 = new SimpleAttributeSet();
        as1.addAttribute("key1", "value1");
        SimpleAttributeSet as2 = new SimpleAttributeSet();
        as2.addAttribute("key2", "value2");
        try {
            doc.insertString(0, "testReplaceSelection", as1);
            doc.insertString(4, "INSERT", as2);
        } catch (final BadLocationException e) {
            assertFalse("unexpected exception :" + e.getMessage(), true);
        }
        //temporarily commented-out: HTMLEditorKit not implemented
        //jep.setEditorKit(new RTFEditorKit());
        jep.setEditorKit(new StyledEditorKit());
        jep.setDocument(doc);
        jep.setSelectionStart(6);
        jep.setSelectionEnd(7);
        jep.replaceSelection("YYY");
        for (int i = 0; i < doc.getLength(); i++) {
            AttributeSet as = getAttributeSetByIndex(doc, i);
            if (i > 3 && i < 12) {
                assertEquals(as2, as);
            } else {
                assertEquals(as1, as);
View Full Code Here


        assertNull(null);
        assertEquals("TextPaneUI", textPane.getUIClassID());
    }

    public void testSetDocument() {
        StyledDocument doc = new DefaultStyledDocument();
        textPane.setDocument(doc);
        assertSame(doc, textPane.getDocument());
        testExceptionalCase(new IllegalArgumentCase() {
            @Override
            public void exceptionalAction() throws Exception {
View Full Code Here

            }
        });
    }

    public void testSetStyledDocument() {
        StyledDocument doc = new DefaultStyledDocument();
        textPane.setDocument(doc);
        assertSame(doc, textPane.getDocument());
        testExceptionalCase(new IllegalArgumentCase() {
            @Override
            public void exceptionalAction() throws Exception {
View Full Code Here

    public SourceFile getSourceFile() {
        return sourceFile;
    }

    public JavaSourceDocument(String title, Reader in, SourceFile theSource) throws IOException {
        doc = new DefaultStyledDocument();
        this.title = title;
        this.sourceFile = theSource;
        Debug.println("Created JavaSourceDocument for " + title);
        try {
            dek.read(in, doc, 0);
View Full Code Here

  }

  private String convert(InputStream rtfDocumentInputStream) throws IOException {
    RTFEditorKit aRtfEditorkit = new RTFEditorKit();

    StyledDocument styledDoc = new DefaultStyledDocument();

    String textDocument;

    try {
      aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);

      textDocument = styledDoc.getText(0, styledDoc.getLength());
    } catch (BadLocationException e) {
      throw new IOException("Error during parsing");
    }

    return textDocument;
View Full Code Here

   * @param harness the test harness to use
   */
  public void test(TestHarness harness)
  {
    h2 = harness;
    DefaultStyledDocument doc = new ElementStructure2();
    Element root = doc.getDefaultRootElement();
    try
      {
        // Add some regular text
        doc.insertString(0, "the quick brown fox", null);
        doc.insertString(6, "MIDDLE", null);
        doc.insertString(0, "START", null);
        doc.insertString(30, "END", null);       
      }
    catch (BadLocationException ex)
      {
        harness.debug(ex);
      }       
View Full Code Here

   * @param harness the test harness to use
   */
  public void test(TestHarness harness)
  {
    h2 = harness;
    DefaultStyledDocument doc = new ElementStructure2();
    Element root = doc.getDefaultRootElement();
    try
      {
        // Add some regular text
        doc.insertString(0, "the quick brown fox", null);
        doc.insertString(6, "MIDDLE", null);
        doc.insertString(0, "START", null);
        doc.insertString(30, "END", null);       
      }
    catch (BadLocationException ex)
      {
        harness.debug(ex);
      }       
View Full Code Here

   *
   * @param harness the test harness to use
   */
  public void test(TestHarness harness)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView v = new TestFlowView(el, View.X_AXIS);
    harness.check(v.getFlowAxis(), View.Y_AXIS);
    v = new TestFlowView(el, View.Y_AXIS);
    harness.check(v.getFlowAxis(), View.X_AXIS);
View Full Code Here

   *
   * @param h
   */
  private void testUnbreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
View Full Code Here

   *
   * @param h
   */
  private void testGoodBreakable(TestHarness h)
  {
    DefaultStyledDocument doc = new DefaultStyledDocument();
    Element el = doc.new BranchElement(null, null);
    TestFlowView fv = new TestFlowView(el, View.Y_AXIS);
    // Create one row and fill it with one oversized testview.
    TestFlowView.TestRow row = (TestFlowView.TestRow) fv.createRow();
    fv.replace(0, 0, new View[]{row});
View Full Code Here

TOP

Related Classes of javax.swing.text.DefaultStyledDocument$ChangeDesc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.