OSDN Git Service

am c660c608: Merge "add Toshiba usb driver link delete Fujitsu-Toshiba bug: 9755017...
[android-x86/frameworks-base.git] / core / java / android / widget / ValueEditor.java
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package android.widget;
18
19 import android.util.ValueModel;
20
21 /**
22  * An interface for editors of simple values. Classes implementing this interface are normally
23  * UI controls (subclasses of {@link android.view.View View}) that can provide a suitable
24  * user interface to display and edit values of the specified type. This interface is
25  * intended to describe editors for simple types, like {@code boolean}, {@code int} or
26  * {@code String}, where the values themselves are immutable.
27  * <p>
28  * For example, {@link android.widget.CheckBox CheckBox} implements
29  * this interface for the Boolean type as it is capable of providing an appropriate
30  * mechanism for displaying and changing the value of a Boolean property.
31  *
32  * @param <T> the value type that this editor supports
33  */
34 public interface ValueEditor<T> {
35     /**
36      * Return the last value model that was set. If no value model has been set, the editor
37      * should return the value {@link android.util.ValueModel#EMPTY}.
38      *
39      * @return the value model
40      */
41     public ValueModel<T> getValueModel();
42
43     /**
44      * Sets the value model for this editor. When the value model is set, the editor should
45      * retrieve the value from the value model, using {@link android.util.ValueModel#get()},
46      * and set its internal state accordingly. Likewise, when the editor's internal state changes
47      * it should update the value model by calling  {@link android.util.ValueModel#set(T)}
48      * with the appropriate value.
49      *
50      * @param valueModel the new value model for this editor.
51      */
52     public void setValueModel(ValueModel<T> valueModel);
53 }