Package javax.swing.text

Examples of javax.swing.text.MutableAttributeSet


    public void appendMessage(String message) {
        try {
            if (message != null && !message.endsWith("\n")) {
                message += "\n";
            }
            MutableAttributeSet inputAttributes = messagePane
                    .getInputAttributes();
            StyleConstants.setForeground(inputAttributes, Color.BLACK);
            messagePane.getDocument().insertString(
                    messagePane.getDocument().getLength(), message,
                    inputAttributes);
View Full Code Here


     * (overridden)
     *
     * @see entagged.listing.gui.ListingProgressListener#errorOccured(java.lang.String)
     */
    public void errorOccured(String errorDescription) {
        MutableAttributeSet inputAttributes = messagePane.getInputAttributes();
        StyleConstants.setForeground(inputAttributes, Color.RED);
        if (errorDescription != null && !errorDescription.endsWith("\n")) {
            errorDescription += "\n";
        }
        try {
View Full Code Here

  private void createDefaultFontAttributes() {
    Priority[] prio = Priority.getAllPossiblePriorities();

    fontAttributes = new Hashtable();
    for (int i=0; i<prio.length;i++) {
      MutableAttributeSet att = new SimpleAttributeSet();
      fontAttributes.put(prio[i], att);
      //StyleConstants.setFontSize(att,11);
    }

    setTextColor(Priority.FATAL, Color.red);
View Full Code Here

  }

  private AttributeSet setStyle (
      String fontFamilyName, int  size, Color color)
  {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color!=null)
      StyleConstants.setForeground(attr, color);
    if (fontFamilyName!=null)
      StyleConstants.setFontFamily(attr, fontFamilyName);
    if (size!=-1)
View Full Code Here

      boolean bold,
      boolean italic,
      boolean underline
  )
  {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color!=null)
      StyleConstants.setForeground(attr, color);
    if (fontFamilyName!=null)
      StyleConstants.setFontFamily(attr, fontFamilyName);
    if (size!=-1)
View Full Code Here

    }

    /** {@inheritDoc} */
    public void figureGraphics( String src, SinkEventAttributes attributes )
    {
        MutableAttributeSet atts = config.getAttributeSet( "figure.graphics" );
        atts.addAttribute( Attribute.SRC.toString(), src );

        // http://xmlgraphics.apache.org/fop/graphics.html#resolution

        final String[] valids = new String[] {"content-height", "content-width", "height", "width"};
        final MutableAttributeSet filtered = SinkUtils.filterAttributes( attributes, valids );

        if ( filtered != null )
        {
            atts.addAttributes( filtered );
        }
View Full Code Here

    }

    /** {@inheritDoc} */
    public void paragraph( SinkEventAttributes attributes )
    {
        MutableAttributeSet atts = config.getAttributeSet( "normal.paragraph" );

        if ( attributes != null && attributes.isDefined( SinkEventAttributes.ALIGN ) )
        {
            atts.addAttribute( "text-align", attributes.getAttribute( SinkEventAttributes.ALIGN ) );
        }

        writeEOL();
        writeStartTag( BLOCK_TAG, atts );
    }
View Full Code Here

     * @param headerRow true if this is a header cell.
     * @param attributes the cell attributes, could be null.
     */
    private void tableCell( boolean headerRow, SinkEventAttributes attributes )
    {
        MutableAttributeSet cellAtts = headerRow
                 ? config.getAttributeSet( "table.heading.cell" )
                 : config.getAttributeSet( "table.body.cell" );

        // the column-number is needed for the hack to center the table, see tableRows.
        int cellCount = Integer.parseInt( this.cellCountStack.getLast().toString() );
        cellAtts.addAttribute( "column-number", String.valueOf( cellCount + 1 ) );

        if ( this.tableGridStack.getLast().equals( Boolean.TRUE ) )
        {
            cellAtts.addAttributes( config.getAttributeSet( "table.body.cell.grid" ) );
        }

        MutableAttributeSet blockAtts = headerRow
                 ? config.getAttributeSet( "table.heading.block" )
                 : config.getAttributeSet( "table.body.block" );

        String justif = null;
        if ( attributes == null )
        {
            attributes = new SinkEventAttributeSet( 0 );
        }

        if ( attributes.isDefined( Attribute.ALIGN.toString() ) )
        {
            justif = attributes.getAttribute( Attribute.ALIGN.toString() ).toString();
        }

        int[] cellJustif = this.cellJustifStack.getLast();
        if ( justif == null && cellJustif != null && cellJustif.length > 0
            && this.isCellJustifStack.getLast().equals( Boolean.TRUE ) )
        {
            switch ( cellJustif[Math.min( cellCount, cellJustif.length - 1 )] )
            {
                case JUSTIFY_LEFT:
                    justif = "left";
                    break;
                case JUSTIFY_RIGHT:
                    justif = "right";
                    break;
                case JUSTIFY_CENTER:
                default:
                    justif = "center";
            }
        }

        if ( justif != null )
        {
            blockAtts.addAttribute( "text-align", justif );
        }

        writeStartTag( TABLE_CELL_TAG, cellAtts );
        writeEOL();
        writeStartTag( BLOCK_TAG, blockAtts );
View Full Code Here

            write( " encoding=\"" + encoding + "\"" );
        }
        write( "?>" );
        writeEOL();

        MutableAttributeSet atts = new SinkEventAttributeSet();
        atts.addAttribute( "xmlns:" + getNameSpace(), FO_NAMESPACE );

        if ( languageId != null )
        {
            atts.addAttribute( "language", languageId );
        }

        writeStartTag( ROOT_TAG, atts );

        writeStartTag( LAYOUT_MASTER_SET_TAG );
View Full Code Here

     * @param name The name (value) of the id.
     */
    protected void writeStartTag( Tag tag, String id, String name )
    {
        writeEOL();
        MutableAttributeSet att = new SinkEventAttributeSet( new String[] {id, name} );

        writeStartTag( tag, att );
    }
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.