KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > factories > DefaultObservableFactory


1 /*******************************************************************************
2  * Copyright (c) 2006 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  ******************************************************************************/

11
12 package org.eclipse.jface.internal.databinding.provisional.factories;
13
14 import org.eclipse.jface.internal.databinding.provisional.DataBindingContext;
15 import org.eclipse.jface.internal.databinding.provisional.description.ListModelDescription;
16 import org.eclipse.jface.internal.databinding.provisional.description.TableModelDescription;
17 import org.eclipse.jface.internal.databinding.provisional.observable.IObservable;
18
19 /**
20  * @since 3.2
21  *
22  */

23 public class DefaultObservableFactory implements IObservableFactory {
24
25     private final DataBindingContext dataBindingContext;
26
27     /**
28      * @param dataBindingContext
29      * TODO
30      *
31      */

32     public DefaultObservableFactory(DataBindingContext dataBindingContext) {
33         this.dataBindingContext = dataBindingContext;
34     }
35
36     public IObservable createObservable(Object JavaDoc description) {
37         if (description instanceof ListModelDescription) {
38             ListModelDescription listModelDescription = (ListModelDescription) description;
39             TableModelDescription tableModelDescription = new TableModelDescription(
40                     listModelDescription.getCollectionProperty(),
41                     new Object JavaDoc[] { listModelDescription.getPropertyID() });
42             return dataBindingContext.createObservable(tableModelDescription);
43         }
44         return null;
45     }
46
47 }
48
Popular Tags