comparison org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/masterdetail/MasterDetailObservables.d @ 78:0a55d2d5a946

Added file for databinding
author Frank Benoit <benoit@tionex.de>
date Tue, 14 Apr 2009 11:35:29 +0200
parents
children 383ce7bd736b
comparison
equal deleted inserted replaced
76:f05e6e8b2f2d 78:0a55d2d5a946
1 /*******************************************************************************
2 * Copyright (c) 2006, 2008 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 * Matthew Hall - bug 221704
12 *******************************************************************************/
13
14 module org.eclipse.core.databinding.observable.masterdetail.MasterDetailObservables;
15
16 import java.lang.all;
17
18 import org.eclipse.core.databinding.observable.list.IObservableList;
19 import org.eclipse.core.databinding.observable.map.IObservableMap;
20 import org.eclipse.core.databinding.observable.set.IObservableSet;
21 import org.eclipse.core.databinding.observable.value.IObservableValue;
22 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableList;
23 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableMap;
24 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableSet;
25 import org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue;
26
27 /**
28 * Allows for the observation of an attribute, the detail, of an observable
29 * representing selection or another transient instance, the master.
30 *
31 * @since 1.0
32 */
33 public class MasterDetailObservables {
34
35 /**
36 * Creates a detail observable value from a master observable value and a
37 * factory. This can be used to create observable values that represent a
38 * property of a selected object in a table.
39 *
40 * @param master
41 * the observable value to track
42 * @param detailFactory
43 * a factory for creating {@link IObservableValue} instances
44 * given a current value of the master
45 * @param detailType
46 * the value type of the detail observable value, typically of
47 * type java.lang.Class and can be <code>null</code>
48 * @return an observable value of the given value type that, for any current
49 * value of the given master value, behaves like the observable
50 * value created by the factory for that current value.
51 */
52 public static IObservableValue detailValue(IObservableValue master,
53 IObservableFactory detailFactory, Object detailType) {
54 return new DetailObservableValue(master, detailFactory, detailType);
55 }
56
57 /**
58 * Creates a detail observable list from a master observable value and a
59 * factory. This can be used to create observable lists that represent a
60 * list property of a selected object in a table.
61 *
62 * @param master
63 * the observable value to track
64 * @param detailFactory
65 * a factory for creating {@link IObservableList} instances given
66 * a current value of the master
67 * @param detailElementType
68 * the element type of the detail observable list, typically of
69 * type java.lang.Class and can be <code>null</code>
70 * @return an observable list with the given element type that, for any
71 * current value of the given master value, behaves like the
72 * observable list created by the factory for that current value.
73 */
74 public static IObservableList detailList(IObservableValue master,
75 IObservableFactory detailFactory, Object detailElementType) {
76 return new DetailObservableList(detailFactory, master,
77 detailElementType);
78 }
79
80 /**
81 * Creates a detail observable set from a master observable value and a
82 * factory. This can be used to create observable sets that represent a set
83 * property of a selected object in a table.
84 *
85 * @param master
86 * the observable value to track
87 * @param detailFactory
88 * a factory for creating {@link IObservableSet} instances given
89 * a current value of the master
90 * @param detailElementType
91 * the element type of the detail observable set, typically of
92 * type java.lang.Class and can be <code>null</code>
93 * @return an observable set with the given element type that, for any
94 * current value of the given master value, behaves like the
95 * observable set created by the factory for that current value.
96 */
97 public static IObservableSet detailSet(IObservableValue master,
98 IObservableFactory detailFactory, Object detailElementType) {
99 return new DetailObservableSet(detailFactory, master, detailElementType);
100 }
101
102 /**
103 * Creates a detail observable map from a master observable value and a
104 * factory. This can be used to create observable maps that represent a map
105 * property of a selected object in a table.
106 *
107 * @param master
108 * the observable value to track
109 * @param detailFactory
110 * a factory for createing {@link IObservableMap} instances given
111 * a current value of the master
112 * @return an observable map that, for any current value of the given master
113 * value, behaves like the observable map created by the factory for
114 * that current value.
115 * @since 1.1
116 */
117 public static IObservableMap detailMap(IObservableValue master,
118 IObservableFactory detailFactory) {
119 return new DetailObservableMap(detailFactory, master);
120 }
121 }