package com.digi.config.util; import java.awt.Color; import java.util.Hashtable; import java.util.StringTokenizer; /** * This class keeps track of all changed values */ public class ModifiedSettings { private Hashtable sections=new Hashtable(); /** * Constructor */ public ModifiedSettings() { super(); } /** * This method gets property and returns a boolean value *

* @param section Section name * @param tag Key name * @return true or false */ public boolean getBooleanProperty(String section, String tag) { return Boolean.valueOf(getProperty(section, tag)).booleanValue(); } /** * This method gets the profile property for a color *

* @param section Section name * @param tag Key name * @return the color */ public Color getColorProperty(String section, String tag) { String clr=getProperty(section, tag); Color c=Color.red; if (clr!=null) { int r =255; int g =0; int b =0; StringTokenizer st=new StringTokenizer(clr, ",", false); try { r=Integer.parseInt(st.nextToken()); g=Integer.parseInt(st.nextToken()); b=Integer.parseInt(st.nextToken()); c=new Color(r, g, b); } catch (Exception e) { } } return c; } /** * This method gets property *

* @param Section Section name * @param key name of property * @return Property value */ public String getProperty(String Section, String key) { Hashtable ht=(Hashtable)sections.get(Section); return ((ht==null)?null:(String)ht.get(key)); } /** * This method returns the section hashtable *

* @return Hashtable */ public Hashtable getSections() { return sections; } /** * This method checks if a profile property is changed * @param section Section name * @param key name of property * @return true or false */ public boolean hasPropertyChanged(String section, String key) { String val=getProperty(section, key); return (val!=null)?true:false; } /** * This method checks if a section is changed * @param section Section name * @return true or false */ public boolean hasSectionChanged(String section) { Hashtable ht=(Hashtable)sections.get(section); if (ht!=null) { int cnt=ht.size(); if (cnt>0) { return true; } } return false; } }