Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members

EmbeddedProfilRubric.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2005 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: openmobileis@e-care.fr
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  *  
00024  *  Modifications :
00025  *  2005 Creation P.Delrieu
00026  * 
00027  */
00028 
00029 package org.openmobileis.modules.profils.embedded.data;
00030 
00031 import java.util.*;
00032 
00040 public class EmbeddedProfilRubric {
00041 
00042   protected String name;
00043   protected String description;
00044   protected boolean isSelected = false;
00045   protected Hashtable propertiesList;
00046 
00047   public EmbeddedProfilRubric() {
00048     propertiesList = new Hashtable(5);
00049   }
00050 
00051   public EmbeddedProfilRubric(String rubName, String rubdescription) {
00052     this();
00053     this.name = rubName;
00054     this.description = rubdescription;
00055   }
00056 
00057   public void setName (String name) {
00058     this.name = name;
00059   }
00060 
00061   public String getName() {
00062     return name;
00063   }
00064 
00065   public String getDescription() {
00066     return description;
00067   }
00068 
00069   public void setDescription (String description) {
00070     this.description = description;
00071   }
00072 
00073   public void addProperty(String key, String value) {
00074     propertiesList.put(key, value);
00075   }
00076 
00077   public String getProperty(String key) {
00078     return (String)propertiesList.get(key);
00079   }
00080 
00081   public boolean removeProperty(String key) {
00082     return (propertiesList.remove(key) != null);
00083   }
00084 
00085   public void setSelection (boolean isSelected) {
00086     this.isSelected = isSelected;
00087   }
00088 
00089   public boolean isSelected () {
00090     return isSelected;
00091   }
00092 
00093   public String getXmlDescription() {
00094     StringBuffer buffer = new StringBuffer();
00095     buffer.append("<rubric>\n");
00096     buffer.append("<name>");
00097     buffer.append(name);
00098     buffer.append("</name>\n");
00099     buffer.append("<description>");
00100     buffer.append(description);
00101     buffer.append("</description>\n");
00102     if (isSelected)
00103       buffer.append("<selected/>\n");
00104     Enumeration propEnum = propertiesList.keys();
00105     while (propEnum.hasMoreElements())  {
00106       String key = (String) propEnum.nextElement();
00107       buffer.append("<property key=\"").append(key).append("\" value=\"").append(propertiesList.get(key)).append("\"/>\n");
00108     }
00109     buffer.append("</rubric>\n");
00110     return buffer.toString();
00111   }
00112 }

Generated on Thu Oct 6 10:06:32 2005 for OpenMobileIS by  doxygen 1.4.3