All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.talk2object.plum.view.web.CSSAttributes Maven / Gradle / Ivy

The newest version!
package com.talk2object.plum.view.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class CSSAttributes {
	private Map map = new HashMap();

	public CSSAttributes() {		
	}
	
	public CSSAttributes(String text){
		String[] segments = text.split(";");
		for(String seg : segments){
			CSSAttribute attr = new CSSAttribute(seg);
			add(attr);			
		}
	}

	public void add(CSSAttribute attr) {
		map.put(attr.getName(), attr.getValue());
	}
	
	public void set(String name,String value){
		map.put(name, value);
	}
	
	public String get(String name){
		return map.get(name);
	}
	 
	public String toCssText() {
		StringBuilder sb = new StringBuilder();
		for (String name : map.keySet()) {
			String value = map.get(name);
			
			sb.append(name);
			sb.append(":");
			sb.append(value);
			sb.append(";");
		}
		return sb.toString();
	}	
	
	public boolean isEmpty(){
		return map.isEmpty();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy