/* * Moonlight|3D Copyright (C) 2005 The Moonlight|3D team * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Created on Dec 29, 2005 */ package ml.core.preferences; import ml.core.exceptions.Exception; import ml.core.helper.NamedObject; import ml.core.helper.Property; import ml.core.helper.PropertyContainer; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class PreferencesGroup extends PropertyContainer implements Cloneable, NamedObject { protected String name; public PreferencesGroup() { super(); } public void setName(String name) { this.name=name; } public String getName() { return name; } public void setFrom(PreferencesGroup preferencesGroup) { for(String propertyName : preferencesGroup.getPropertyList()) { Property thisProperty=getProperty(propertyName); // if property doesn't exist in this group, skip it if(thisProperty==null) { continue; } Property thatProperty=preferencesGroup.getProperty(propertyName); if(thisProperty.getType()!=thatProperty.getType()) { continue; } thisProperty.copyFrom(thatProperty); } } public void readFromFile(Element groupNode) { NodeList propertyNodes=groupNode.getElementsByTagName("property"); for(int i=0;i