View Javadoc

1   /*
2    * $HeadURL: $
3    * $Date: $
4    * $Revision: $
5    * $Author: $
6    * 
7    * Copyright (c) 2005 MindTree Consulting Ltd. 
8    * 
9    * This file is part of Insight.
10   * 
11   * Insight is free software: you can redistribute it and/or modify it under the 
12   * terms of the GNU General Public License as published by the Free Software 
13   * Foundation, either version 3 of the License, or (at your option) any later 
14   * version.
15   * 
16   * Insight is distributed in the hope that it will be useful, but 
17   * WITHOUT ANY WARRANTY; without even the implied warranty of 
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 
19   * Public License for more details.
20   * 
21   * You should have received a copy of the GNU General Public License along with 
22   * Insight.  If not, see <http://www.gnu.org/licenses/>.
23   */
24  
25  package com.mindtree.techworks.insight.preferences.model;
26  
27  
28  /**
29   * To be used by the Preference and Preference Attributes to notify the manager
30   * of a change of value. The manager may then notify all interested parties
31   * about the change in value.
32   * 
33   * @author Bindul Bhowmik
34   * @version $Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
35   */
36  public interface PreferenceModelManager {
37  
38  	/**
39  	 * Operation to identify addition of a child preference
40  	 */
41  	public static final int OPERATION_CHILD_PREF_ADDED = 1;
42  
43  	/**
44  	 * Operation to identify removal of a child preference
45  	 */
46  	public static final int OPERATION_CHILD_PREF_REMOVED = 2;
47  	
48  	/**
49  	 * Operation to identify addition of a child preference
50  	 */
51  	public static final int OPERATION_PREF_ATTR_ADDED = 3;
52  
53  	/**
54  	 * Operation to identify removal of a child preference
55  	 */
56  	public static final int OPERATION_PREF_ATTR_REMOVED = 4;
57  
58  	/**
59  	 * Used by the Preference to notify the manager about a change in an
60  	 * attribute value. Notification is always done with the
61  	 * {@link Preference#getCompleteId() Complete Id}of the Preference.
62  	 * 
63  	 * @param preferenceId The Preference in which the value changed
64  	 * @param attributeId The Attribute whose value changed
65  	 * @param newValue The new value of the attribute
66  	 */
67  	public void attributeValueChanged (String preferenceId, String attributeId,
68  			String newValue);
69  
70  	/**
71  	 * This method is called on the Preference Model Manager by the Preference,
72  	 * whenever a child preference is added or deleted.
73  	 * 
74  	 * @param preferenceId The current Preference id (complete id)
75  	 * @param childPreferenceId The preference id of the child preference
76  	 * @param operation Operation type, denoted by
77  	 *            {@link PreferenceModelManager#OPERATION_CHILD_PREF_ADDED OPERATION_CHILD_PREF_ADDED}
78  	 *            or
79  	 *            {@link PreferenceModelManager#OPERATION_CHILD_PREF_REMOVED OPERATION_CHILD_PREF_REMOVED}
80  	 */
81  	public void childPreferenceChanged (String preferenceId,
82  			String childPreferenceId, int operation);
83  	
84  	/**
85  	 * This method is called on the Preference Model Manager by the Preference,
86  	 * whenever a child preference is added or deleted.
87  	 * 
88  	 * @param preferenceId The current Preference id (complete id)
89  	 * @param preferenceAttributeId The preference id of the child preference
90  	 * @param operation Operation type, denoted by
91  	 *            {@link PreferenceModelManager#OPERATION_PREF_ATTR_ADDED OPERATION_PREF_ATTR_REMOVED}
92  	 *            or
93  	 *            {@link PreferenceModelManager#OPERATION_PREF_ATTR_REMOVED OPERATION_PREF_ATTR_REMOVED}
94  	 */
95  	public void preferenceAttributeChanged (String preferenceId,
96  			String preferenceAttributeId, int operation);
97  	
98  }