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

net.anotheria.anosite.gen.aslayoutdata.data.PageStyleDocument Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** PageStyleDocument.java                                                   ***
 *** generated by AnoSiteGenerator (ASG), Version: 3.2.2                      ***
 *** Copyright (C) 2005 - 2023 Anotheria.net, www.anotheria.net               ***
 *** All Rights Reserved.                                                     ***
 ********************************************************************************
 *** Don't edit this code, if you aren't sure                                 ***
 *** that you do exactly know what you are doing!                             ***
 *** It's better to invest time in the generator, as into the generated code. ***
 ********************************************************************************
 */

package net.anotheria.anosite.gen.aslayoutdata.data;

import net.anotheria.asg.data.AbstractASGDocument;
import net.anotheria.util.crypt.MD5Util;
import net.anotheria.util.sorter.IComparable;
import net.anotheria.util.BasicComparable;

public class PageStyleDocument extends AbstractASGDocument implements PageStyle, IComparable{

	public PageStyleDocument() {
		super("");
	}

	public PageStyleDocument(String id){
		super(id);
	}

	public PageStyleDocument(PageStyleDocument toClone){
		super(toClone);
	}

	PageStyleDocument(PageStyleBuilder builder){
		super("");
		setName(builder.name);
		setCss(builder.css);
		setDescription(builder.description);
	}

	public String getName(){
		return getString(PROP_NAME);
	}

	public void setName(String value){
		setString(PROP_NAME, value);
	}

	public String getCss(){
		return getString(PROP_CSS);
	}

	public void setCss(String value){
		setString(PROP_CSS, value);
	}

	public String getDescription(){
		return getString(PROP_DESCRIPTION);
	}

	public void setDescription(String value){
		setString(PROP_DESCRIPTION, value);
	}


	public String toString(){
		String ret = "PageStyle ";
		ret += "["+getId()+"] ";
		ret += "name: "+getName();
		ret += ", ";
		ret += "css: "+getCss();
		ret += ", ";
		ret += "description: "+getDescription();
		return ret;
	}


	public int compareTo(PageStyle comparable){
		return compareTo(comparable, PageStyleSortType.SORT_BY_DEFAULT);
	}

	public int compareTo(IComparable anotherComparable, int method){
		PageStyleDocument anotherDoc = (PageStyleDocument) anotherComparable;
		switch(method){
			case PageStyleSortType.SORT_BY_ID:
				return BasicComparable.compareString(getId(), anotherDoc.getId());
			case PageStyleSortType.SORT_BY_NAME:
				return BasicComparable.compareString(getName(), anotherDoc.getName());
			case PageStyleSortType.SORT_BY_CSS:
				return BasicComparable.compareString(getCss(), anotherDoc.getCss());
			case PageStyleSortType.SORT_BY_DESCRIPTION:
				return BasicComparable.compareString(getDescription(), anotherDoc.getDescription());
			default:
				throw new RuntimeException("Sort method "+method+" is not supported.");
		}
	}

	public String getDefinedName(){
		return "PageStyle";
	}

	public String getDefinedParentName(){
		return "ASLayoutData";
	}

	public String getFootprint(){
		StringBuilder footprint = new StringBuilder();
		footprint.append(getName());
		footprint.append(getCss());
		footprint.append(getDescription());
		return MD5Util.getMD5Hash(footprint);
	}

	public boolean equals(Object o){
		return o == this || ((o instanceof PageStyleDocument) && ((PageStyleDocument)o).getId().equals(getId()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy