package com.github.miachm.SODS.spreadsheet;


public final class Style implements Cloneable {
    private boolean bold;
    private boolean italic;
    private boolean underline;
    private Color fontColor;
    private Color backgroundColor;
    private int fontSize = -1;

    public Style() {

    }

    public Style(boolean bold, boolean italic, boolean underline, Color fontColor, Color backgroundColor) {
        this.bold = bold;
        this.italic = italic;
        this.underline = underline;
        this.fontColor = fontColor;
        this.backgroundColor = backgroundColor;
    }

    public boolean isDefault()
    {
        return this.equals(new Style());
    }
    
    public boolean isBold() {
        return bold;
    }

    public boolean isItalic() {
        return italic;
    }

    public Color getFontColor() {
        return fontColor;
    }

    public Color getBackgroundColor() {
        return backgroundColor;
    }

    public int getFontSize() {
        return fontSize;
    }

    public void setBackgroundColor(Color backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public void setFontColor(Color fontColor) {
        this.fontColor = fontColor;
    }

    public void setBold(boolean bold)
    {
        this.bold = bold;
    }

    public void setItalic(boolean italic)
    {
        this.italic = italic;
    }

    public boolean isUnderline() {
        return underline;
    }

    public void setUnderline(boolean underline) {
        this.underline = underline;
    }

    public void setFontSize(int fontSize) {
        if (fontSize < -1)
            throw new AssertionError("Error, font size can be less of -1");
        this.fontSize = fontSize;
    }

    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Style style = (Style) o;

        if (bold != style.bold) return false;
        if (italic != style.italic) return false;
        if (underline != style.underline) return false;
        if (fontSize != style.fontSize) return false;
        if (fontColor != null ? !fontColor.equals(style.fontColor) : style.fontColor != null) return false;
        return backgroundColor != null ? backgroundColor.equals(style.backgroundColor) : style.backgroundColor == null;
    }

    @Override
    public int hashCode() {
        int result = (bold ? 1 : 0);
        result = 31 * result + (italic ? 1 : 0);
        result = 31 * result + (underline ? 1 : 0);
        result = 31 * result + (fontColor != null ? fontColor.hashCode() : 0);
        result = 31 * result + (backgroundColor != null ? backgroundColor.hashCode() : 0);
        result = 31 * result + fontSize;
        return result;
    }
}

@@ -39,16 +39,65 @@
 heet;%0A%0A%0A
+import java.util.HashMap;%0Aimport java.util.Map;%0A%0A
 public f
@@ -2921,11 +2921,1083 @@
 t;%0A    %7D
+%0A%0A    public Map%3CString, String%3E getCssStyles()%0A    %7B%0A        Map%3CString, String%3E result = new HashMap%3C%3E();%0A        if (isBold())%0A            result.put(%22font-weight%22, %22bold%22);%0A%0A        if (isItalic())%0A            result.put(%22font-style%22, %22italic%22);%0A%0A        if (isUnderline())%0A            result.put(%22text-decoration%22, %22underline%22);%0A%0A        if (getFontSize() != -1)%0A            result.put(%22font-size%22, %22%22 + getFontSize());%0A%0A        if (getFontColor() != null)%0A            result.put(%22color%22, %22%22 + getFontColor().toString() + %22;%22);%0A%0A        if (getBackgroundColor() != null)%0A            result.put(%22background-color%22, getBackgroundColor().toString());%0A%0A        return result;%0A    %7D%0A%0A    @Override%0A    public String toString()%0A    %7B%0A        return toString(%22%22);%0A    %7D%0A%0A    public String toString(String prefix)%0A    %7B%0A        String result = %22%22;%0A        Map%3CString,String%3E styles = getCssStyles();%0A        for (Map.Entry%3CString,String%3E style : styles.entrySet())%0A            result += prefix + style.getKey() + %22: %22 + style.getValue() + %22;%5Cn%22;%0A%0A        return result;%0A    %7D
 %0A%7D%0A

Add CSS toString() representation to Style Class