KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > observable > masterdetail > MasterDetailObservables


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * Brad Reynolds - bug 147515
11  *******************************************************************************/

12
13 package org.eclipse.core.databinding.observable.masterdetail;
14
15 import org.eclipse.core.databinding.observable.list.IObservableList;
16 import org.eclipse.core.databinding.observable.set.IObservableSet;
17 import org.eclipse.core.databinding.observable.value.IObservableValue;
18 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableList;
19 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableSet;
20 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue;
21
22 /**
23  * Allows for the observation of an attribute, the detail, of an observable
24  * representing selection or another transient instance, the master.
25  *
26  * @since 1.0
27  */

28 public class MasterDetailObservables {
29     
30     /**
31      * Creates a detail observable value from a master observable value and a
32      * factory. This can be used to create observable values that represent a
33      * property of a selected object in a table.
34      *
35      * @param master
36      * the observable value to track
37      * @param detailFactory
38      * a factory for creating {@link IObservableValue} instances
39      * given a current value of the master
40      * @param detailType
41      * the value type of the detail observable value, typically of
42      * type java.lang.Class and can be <code>null</code>
43      * @return an observable value of the given value type that, for any current
44      * value of the given master value, behaves like the observable
45      * value created by the factory for that current value.
46      */

47     public static IObservableValue detailValue(IObservableValue master,
48             IObservableFactory detailFactory, Object JavaDoc detailType) {
49         return new DetailObservableValue(master, detailFactory, detailType);
50     }
51
52     /**
53      * Creates a detail observable list from a master observable value and a
54      * factory. This can be used to create observable lists that represent a
55      * list property of a selected object in a table.
56      *
57      * @param master
58      * the observable value to track
59      * @param detailFactory
60      * a factory for creating {@link IObservableList} instances given
61      * a current value of the master
62      * @param detailElementType
63      * the element type of the detail observable list, typically of
64      * type java.lang.Class and can be <code>null</code>
65      * @return an observable list with the given element type that, for any
66      * current value of the given master value, behaves like the
67      * observable list created by the factory for that current value.
68      */

69     public static IObservableList detailList(IObservableValue master,
70             IObservableFactory detailFactory, Object JavaDoc detailElementType) {
71         return new DetailObservableList(detailFactory, master,
72                 detailElementType);
73     }
74
75     /**
76      * Creates a detail observable set from a master observable value and a
77      * factory. This can be used to create observable sets that represent a set
78      * property of a selected object in a table.
79      *
80      * @param master
81      * the observable value to track
82      * @param detailFactory
83      * a factory for creating {@link IObservableSet} instances given
84      * a current value of the master
85      * @param detailElementType
86      * the element type of the detail observable set, typically of
87      * type java.lang.Class and can be <code>null</code>
88      * @return an observable set with the given element type that, for any
89      * current value of the given master value, behaves like the
90      * observable set created by the factory for that current value.
91      */

92     public static IObservableSet detailSet(IObservableValue master,
93             IObservableFactory detailFactory, Object JavaDoc detailElementType) {
94         return new DetailObservableSet(detailFactory, master, detailElementType);
95     }
96
97 }
98
Popular Tags