Java 8 MutableAttributeSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MutableAttributeSet class.

This code example shows how to use the following methods:containsAttribute, getAttribute
		this.stylesheetHrefs = stylesheetHrefs;
	} 
	 
	private boolean isStylesheetLink(Tag tag, MutableAttributeSet attributes) {
		return ((tag == Tag.LINK)
				&& (attributes.containsAttribute(HTML.Attribute.REL, "stylesheet"))
				&& (attributes.containsAttribute(HTML.Attribute.TYPE, "text/css")));
	} 
	 
	 
	private void handleStylesheet(Tag tag, MutableAttributeSet attributes) {
		if (isStylesheetLink(tag, attributes)) {
			stylesheetHrefs.add(attributes.getAttribute(HTML.Attribute.HREF).toString());
		} 
	} 
	 
	public int hashCode() { 
		return parserCallback.hashCode();
	} 
 
6
CodeRank
This code example shows how to use the following methods:copyAttributes, addAttribute
        private int currentWhitespaceEnd;
        private boolean currentNewline;
        private boolean finished;
 
        static { 
            MutableAttributeSet attributes = new SimpleAttributeSet();
            attributes.addAttribute(StyleConstants.Foreground, new Color(0, 0, 0, 0));
            NEWLINE_ATTRIBUTES = attributes.copyAttributes();
        } 
 
        private HighlightsSequenceImpl(@NonNull StyledDocument document, int startOffset, int endOffset, @NonNull AttributeSet attributes) {
            Parameters.notNull("document", document);
            Parameters.notNull("attributes", attributes);
 
            this.document = document;
            this.startOffset = startOffset;
            int documentLength = document.getLength();
            this.endOffset = Math.min(endOffset, documentLength);
            this.includesEof = endOffset >= documentLength;
            this.attributes = attributes;
4
CodeRank
This code example shows how to use the following methods:addAttribute
			return; 
		} 
		fWidth = width;
		fHeight = height;
		// Replace attributes in document 
		MutableAttributeSet myAttr = new SimpleAttributeSet();
		myAttr.addAttribute(HTML.Attribute.WIDTH, Integer.toString(width));
		myAttr.addAttribute(HTML.Attribute.HEIGHT, Integer.toString(height));
		((StyledDocument) getDocument())
				.setCharacterAttributes(fElement.getStartOffset(), fElement.getEndOffset(), myAttr, false);
	} 
 
	// Mouse event handling ------------------------------------------------ 
 
	/** 
	 * Select or grow image when clicked. 
	 *  
	 * @param e 
	 *            MouseEvent to handle 
	 */ 
4
CodeRank
This code example shows how to use the following methods:getAttribute, addAttribute
        if (tag == HTML.Tag.FORM) {
           // All forms from sample will have the same form NAME. 
           // Jetspeed will add its own FORM depending on the type of portlet 
           // being used.  So if you have multiple forms, any Javascript will 
           // have to know which form to reference. 
           attrs.addAttribute("NAME","SampleForm");
        } 
 
        // INPUT Tag 
        if (tag == HTML.Tag.INPUT)
        { 
            Object o = attrs.getAttribute(HTML.Attribute.NAME);
            if (o != null) 
            { 
                String s = o.toString();
                if (s.equalsIgnoreCase("FormID"))
                { 
                    o = attrs.getAttribute(HTML.Attribute.VALUE);
                    if (o != null) 
                    { 

4
CodeRank
This code example shows how to use the following methods:getAttribute, addAttribute
         * Converts the given attribute to base URL, if not null 
         * 
         */ 
        private void addConvertedAttribute( HTML.Attribute attr,
                                            MutableAttributeSet attrs ) {
            if( attrs.getAttribute( attr ) != null ) {
                String attrSource =  attrs.getAttribute( attr ).toString();
                attrs.addAttribute( attr,
                                    generateNewUrl( attrSource ) );
            } 
        } 
               
               
        private String generateNewUrl(String oldURL) {
            try { 
                URL x = new URL(baseUrl,oldURL);
                return x.toString();
            } catch (Throwable t) {
                if (oldURL.toLowerCase().startsWith("javascript:")) {
                    return oldURL;
4
CodeRank
See Code Examples for Java 8 MutableAttributeSet Methods: