Package javax.swing.text

Examples of javax.swing.text.MutableAttributeSet


        out.flush();
        savedOut = out;
        tableRowsWriter = new StringWriter();
        out = new PrintWriter( tableRowsWriter );

        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( SimplifiedDocbookMarkup.COLS_ATTRIBUTE, String.valueOf( justification.length ) );

        writeStartTag( SimplifiedDocbookMarkup.TGROUP_TAG, att );

        for ( int i = 0; i < justification.length; ++i )
        {
            String justif;
            switch ( justification[i] )
            {
                case Sink.JUSTIFY_LEFT:
                    justif = "left";
                    break;
                case Sink.JUSTIFY_RIGHT:
                    justif = "right";
                    break;
                case Sink.JUSTIFY_CENTER:
                default:
                    justif = "center";
                    break;
            }

            att = new SimpleAttributeSet();
            att.addAttribute( "align", justif );

            writeSimpleTag( SimplifiedDocbookMarkup.COLSPEC_TAG, att );
        }

        writeStartTag( SimplifiedDocbookMarkup.TBODY_TAG );
View Full Code Here


        {
            frame = "none";
            sep = 0;
        }

        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( SimplifiedDocbookMarkup.FRAME_ATTRIBUTE, frame );
        att.addAttribute( SimplifiedDocbookMarkup.ROWSEP_ATTRIBUTE, String.valueOf( sep ) );
        att.addAttribute( SimplifiedDocbookMarkup.COLSEP_ATTRIBUTE, String.valueOf( sep ) );

        writeStartTag( TABLE_TAG, att );

        writeStartTag( SimplifiedDocbookMarkup.TITLE_TAG );
    }
View Full Code Here

            String msg = "Modified invalid anchor name: '" + name + "' to '" + id + "'";
            logMessage( "modifiedLink", msg );
        }

        MutableAttributeSet att = new SimpleAttributeSet();
        att.addAttribute( ID_ATTRIBUTE, id );

        writeSimpleTag( SimplifiedDocbookMarkup.ANCHOR_TAG, att );
    }
View Full Code Here

        }

        if ( DoxiaUtils.isInternalLink( name ) )
        {
            String linkend = name.substring( 1 );
            MutableAttributeSet att = new SimpleAttributeSet();
            att.addAttribute( SimplifiedDocbookMarkup.LINKEND_ATTRIBUTE, HtmlTools.escapeHTML( linkend ) );

            writeStartTag( SimplifiedDocbookMarkup.LINK_TAG, att );
        }
        else
        {
            externalLinkFlag = true;
            MutableAttributeSet att = new SimpleAttributeSet();
            att.addAttribute( SimplifiedDocbookMarkup.URL_ATTRIBUTE, HtmlTools.escapeHTML( name, true ) );

            writeStartTag( SimplifiedDocbookMarkup.ULINK_TAG, att );
        }
    }
View Full Code Here

        assertNull( SinkUtils.filterAttributes( null, null ) );

        AttributeSet attributes = new SinkEventAttributeSet( 1 );
        String[] valids = null;

        MutableAttributeSet result = SinkUtils.filterAttributes( attributes, valids );
        assertEquals( 0, result.getAttributeCount() );

        valids = new String[] {};
        result = SinkUtils.filterAttributes( attributes, valids );
        assertEquals( 0, result.getAttributeCount() );

        result = SinkUtils.filterAttributes( SinkEventAttributeSet.BOLD, SinkUtils.SINK_BASE_ATTRIBUTES );
        assertEquals( 1, result.getAttributeCount() );

        result = SinkUtils.filterAttributes( SinkEventAttributeSet.CENTER, SinkUtils.SINK_BASE_ATTRIBUTES );
        assertEquals( 0, result.getAttributeCount() );
    }
View Full Code Here

      {
        muxList.add(cssRule);
      }
    }

    final MutableAttributeSet retval = new SimpleAttributeSet();
    for (int i = muxList.size() - 1; i >= 0; i--)
    {
      final AttributeSet o = muxList.get(i);
      retval.addAttributes(o);
    }
    return retval;
  }
View Full Code Here

  private void createAttributes() { 
    Priority prio[] = Priority.getAllPossiblePriorities();
   
    attributes = new Hashtable();
    for (int i=0; i<prio.length;i++) {
      MutableAttributeSet att = new SimpleAttributeSet();
      attributes.put(prio[i], att);
      StyleConstants.setFontSize(att,14);
    }
    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.ERROR),Color.red);
    StyleConstants.setForeground((MutableAttributeSet)attributes.get(Priority.WARN),Color.orange);
View Full Code Here

  }
 
 
  public void test(TestHarness harness)
  {
    MutableAttributeSet a1 = new SimpleAttributeSet();
    MutableAttributeSet a2 = new SimpleAttributeSet();

    a1.addAttribute(StyleConstants.NameAttribute, "MY_FIRST");
    a2.addAttribute(StyleConstants.NameAttribute, "MY_SECOND");

    ElementSpec s1 = new ElementSpec(a1, ElementSpec.ContentType,
                                     "1".toCharArray(), 0, 1);
    ElementSpec s2 = new ElementSpec(a2, ElementSpec.ContentType,
                                     "2".toCharArray(), 0, 1);

    OpenDocument d = new OpenDocument();

    try
      {
        d.insert(0, new ElementSpec[] { s1, s2 });

        harness.check(d.getLength(), 2, "Length");       
        harness.check("12", d.getText(0, d.getLength()));
        Element[] e = d.getRootElements();

        StringBuffer b = new StringBuffer();
        for (int i = 0; i < e.length; i++)
          {
            dump(b, e[i]);
          }
       
        String r = b.toString();
       
        // Both elements must be included somewhere. They positions must match.
        harness.check(r.indexOf("MY_FIRST:0-1") >=0);
        harness.check(r.indexOf("MY_SECOND:1-2") >=0);
       
        // Insert the third element in between.
        MutableAttributeSet a3 = new SimpleAttributeSet();
        a1.addAttribute(StyleConstants.NameAttribute, "MY_MIDDLE");
        ElementSpec sm = new ElementSpec(a1, ElementSpec.ContentType,
                                     "m".toCharArray(), 0, 1);
       
        d.insert(1, new ElementSpec[] { sm });
View Full Code Here

    resultStyle = new SimpleAttributeSet();
    StyleConstants.setItalic(resultStyle, true);
    StyleConstants.setForeground(resultStyle, new Color(0x20, 0x4a, 0x87));

    if (message != null) {
      final MutableAttributeSet messageStyle = new SimpleAttributeSet();
      StyleConstants.setBackground(messageStyle, text.getForeground());
      StyleConstants.setForeground(messageStyle, text.getBackground());
      append(message, messageStyle);
    }
View Full Code Here

        print( result, attributes );
        print( "\n", attributes );
    }

    public void println( String text, Color color ) {
        MutableAttributeSet fmt = commandOutput.getInputAttributes();
        StyleConstants.setForeground(fmt, color);
        println( text, fmt );
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.MutableAttributeSet

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.