/** * Sets the background color. * * @param a the attribute set * @param fg the color */ public static void setTwoToneColor(MutableAttributeSet a, Color fg) { a.addAttribute(TwoToneColor, fg); }
/** {@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 ); } writeln( "<fo:external-graphic" + SinkUtils.getAttributeString( atts ) + "/>" ); }
public static void setHighlightMatchesEnabled(MutableAttributeSet attr, boolean state) { attr.addAttribute(Attribute.HIGHLIGHT_MATCHES, state); }
private static void setColor(MutableAttributeSet attr, Color color, Attribute key) { attr.addAttribute(key, color != null ? color : false); }
public static void setFontHeight(MutableAttributeSet attr, int height) { attr.addAttribute(Attribute.FONT_HEIGHT, height); }
/** * Currently whether the line is even and the timestamp of when the line * was added (this method called). * * @param even * @return */ public MutableAttributeSet variableLineAttributes(boolean even, boolean updateTimestamp) { MutableAttributeSet style = even ? styles.get("even") : styles.get("odd"); if (updateTimestamp) { style.addAttribute(Attribute.TIMESTAMP, System.currentTimeMillis()); } return style; }
public MutableAttributeSet banMessage(User user, String message) { MutableAttributeSet style = new SimpleAttributeSet(standard()); style.addAttribute(Attribute.IS_BAN_MESSAGE, user); style.addAttribute(Attribute.TIMESTAMP, System.currentTimeMillis()); style.addAttribute(Attribute.BAN_MESSAGE, message); return style; }
public void addAttribute(String name, Object value) { Attribute att = HTML.getAttributeKey(name.toLowerCase()); swingset.addAttribute(att, value); }
public void addAttribute(String name, Object value) { Attribute att = HTML.getAttributeKey(name.toLowerCase()); swingset.addAttribute(att, value); }
private void addBy(MutableAttributeSet attributes, String byName) { java.util.List<String> old = (java.util.List)attributes.getAttribute(Attribute.ACTION_BY); java.util.List<String> changed; if (old != null) { changed = new ArrayList<>(old); } else { changed = new ArrayList<>(); } // If already present, append to end changed.remove(byName); changed.add(byName); attributes.addAttribute(Attribute.ACTION_BY, changed); }
private void addBooleanSetting(Setting key, String name) { other.addAttribute(key, settings.getBoolean(name)); }
private void addLongSetting(Setting key, String name) { other.addAttribute(key, settings.getLong(name)); }
public MutableAttributeSet banMessageCount(int count) { MutableAttributeSet style = new SimpleAttributeSet(info()); style.addAttribute(Attribute.BAN_MESSAGE_COUNT, count); return style; }
private void addFormattedText(Color color, int start, int end, Map<Integer, Integer> ranges, Map<Integer, MutableAttributeSet> rangesStyle) { if (!inRanges(start, ranges) && !inRanges(end, ranges)) { ranges.put(start, end); MutableAttributeSet attr = styles.standard(color); StyleConstants.setBold(attr, true); attr.addAttribute("start", start); rangesStyle.put(start,attr); } }
/** {@inheritDoc} */ public void figureGraphics( String name ) { String format = FileUtils.extension( name ).toUpperCase( Locale.ENGLISH ); writeStartTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG ); MutableAttributeSet att = new SimpleAttributeSet(); att.addAttribute( SimplifiedDocbookMarkup.FORMAT_ATTRIBUTE, format ); att.addAttribute( SimplifiedDocbookMarkup.FILEREF_ATTRIBUTE, HtmlTools.escapeHTML( name, true ) ); writeSimpleTag( SimplifiedDocbookMarkup.IMAGEDATA_TAG, att ); writeEndTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG ); }
/** * Inserts a network address into the current document. * * @param address - the address to insert( ex. \superpc\etc\file\ OR http://localhost/ ) * @throws BadLocationException if the location is not available for insertion. */ public void insertAddress( Document doc, String address ) throws BadLocationException { // Create a new style, based on the style used for generic text, for the address. final MutableAttributeSet addressStyle = new SimpleAttributeSet( getMessageStyle().copyAttributes() ); StyleConstants.setForeground( addressStyle, (Color) UIManager.get( "Address.foreground" ) ); StyleConstants.setUnderline( addressStyle, true ); addressStyle.addAttribute( "link", address ); doc.insertString( doc.getLength(), address, addressStyle ); }
/** * The default valign is <code>top</code>. * * {@inheritDoc} * @see javax.swing.text.html.HTML.Tag#TR */ public void tableRow() { MutableAttributeSet att = new SinkEventAttributeSet(); att.addAttribute( Attribute.VALIGN, "top" ); writeStartTag( TR, att ); setCellCount( 0 ); }
/** * {@inheritDoc} * @see SimplifiedDocbookMarkup#ORDEREDLIST_TAG * @see SimplifiedDocbookMarkup#NUMERATION_ATTRIBUTE */ public void numberedList( int numbering ) { String numeration = DocbookUtils.docbookListNumbering( numbering ); paragraph_(); MutableAttributeSet att = new SimpleAttributeSet(); att.addAttribute( SimplifiedDocbookMarkup.NUMERATION_ATTRIBUTE, numeration ); writeStartTag( SimplifiedDocbookMarkup.ORDEREDLIST_TAG, att ); }
/** {@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 ); }
private void printAutoModMessage(AutoModMessage message, AttributeSet style) { closeCompactMode(); print(getTimePrefix(), style); MutableAttributeSet specialStyle = styles.user(message.user, style); specialStyle.addAttribute(Attribute.ID_AUTOMOD, message.msgId); print("[AutoMod] <"+message.user.getDisplayNick()+"> ", specialStyle); print(message.message, style); finishLine(); }