/** * Copyright 1999-2009 The Pegadi Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.pegadi.model; import java.awt.*; import java.io.Serializable; /** * A class describing status of articles. * * @author Jørgen Binningsbø <jb@underdusken.no> * @version $Id$ */ public class ArticleStatus implements Serializable { /** * The ID of this articleStatus */ private Integer id; /** * The name of this Article-status */ private String name; /** * The description of this article-status */ private String description; /** * The color used when presenting this status */ private Color color; /** * Empty Constructor */ public ArticleStatus() { } /** * Constructor taking the id as an argument * * @param id the id of the ArticleStatus */ public ArticleStatus(Integer id) { this.id = id; } /** * Returns the ID of this ArticleStatus * * @return the ID */ public Integer getId() { return id; } /** * @param id The id to set. */ public void setId(Integer id) { this.id = id; } /** * Returns the name of this ArticleStatus * * @return the name */ public String getName() { return name; } /** * Sets the name of this article-status * * @param name the name */ public void setName(String name) { this.name = name; } /** * Returns the description of this ArticleStatus * * @return the description */ public String getDescription() { return description; } /** * Sets the description of this article-status * * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * Sets the color this status should be represented by * * @param color the color */ public void setColor(Color color) { this.color = color; } /** * Returns the color this status should be represented by * * @return the color */ public Color getColor() { return color; } public String getPrettyPrintedColor() { String str = Integer.toHexString(this.color.getRGB() & 0xFFFFFF); return "#" + "000000".substring(str.length()) + str.toUpperCase(); } /** * Clone this object. Will perform a deep clone. * * @return The clone. */ public Object clone() { ArticleStatus c = new ArticleStatus(id); c.name = name == null ? null : name; c.description = description == null ? null : description; return c; } /** * Returns a String representation of this ArticleStatus by calling * getName() * * @return the name of the article status */ public String toString() { return this.getName(); } }