001 /* 002 * Copyright 2002-2004 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 005 * use this file except in compliance with the License. You may obtain a copy of 006 * the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations under 014 * the License. 015 */ 016 package org.springframework.richclient.settings; 017 018 import java.beans.PropertyChangeListener; 019 import java.io.IOException; 020 021 import org.springframework.core.enums.LabeledEnum; 022 023 /** 024 * @author Peter De Bruycker 025 */ 026 public interface Settings { 027 void setString(String key, String value); 028 029 String getString(String key); 030 031 void setDefaultString(String key, String value); 032 033 String getDefaultString(String key); 034 035 void setInt(String key, int value); 036 037 int getInt(String key); 038 039 void setLong(String key, long value); 040 041 long getLong(String key); 042 043 void setDefaultInt(String key, int value); 044 045 int getDefaultInt(String key); 046 047 void setDefaultLong(String key, long value); 048 049 long getDefaultLong(String key); 050 051 void setFloat(String key, float value); 052 053 float getFloat(String key); 054 055 void setDefaultFloat(String key, float value); 056 057 float getDefaultFloat(String key); 058 059 void setDouble(String key, double value); 060 061 double getDouble(String key); 062 063 void setDefaultDouble(String key, double value); 064 065 double getDefaultDouble(String key); 066 067 void setBoolean(String key, boolean value); 068 069 boolean getBoolean(String key); 070 071 void setDefaultBoolean(String key, boolean value); 072 073 boolean getDefaultBoolean(String key); 074 075 void setLabeledEnum(String key, LabeledEnum value); 076 077 LabeledEnum getLabeledEnum(String key); 078 079 void setDefaultLabeledEnum(String key, LabeledEnum value); 080 081 LabeledEnum getDefaultLabeledEnum(String key); 082 083 boolean isDefault(String key); 084 085 /** 086 * Returns the keys in this <code>Settings</code>. 087 * 088 * @return the keys 089 */ 090 String[] getKeys(); 091 092 /** 093 * Returns the registered default keys in this <code>Settings</code>. 094 * 095 * @return the keys 096 */ 097 String[] getDefaultKeys(); 098 099 /** 100 * Returns the "sum" of {link #getKeys()} and {link #getDefaultKeys()}. 101 * 102 * @return all keys 103 */ 104 String[] getAllKeys(); 105 106 void save() throws IOException; 107 108 void load() throws IOException; 109 110 Settings getSettings(String name); 111 112 /** 113 * Removes this <code>Settings</code> from the backing store. 114 */ 115 void removeSettings(); 116 117 String getName(); 118 119 Settings getParent(); 120 121 void addPropertyChangeListener(PropertyChangeListener l); 122 123 void addPropertyChangeListener(String key, PropertyChangeListener l); 124 125 void removePropertyChangeListener(PropertyChangeListener l); 126 127 void removePropertyChangeListener(String key, PropertyChangeListener l); 128 129 boolean contains(String key); 130 131 void remove(String key); 132 133 boolean isRoot(); 134 135 String[] getChildSettings(); 136 }