Skip to main content
summaryrefslogtreecommitdiffstats
blob: e9bf107a27f21236f9761e0e81643befaaab30c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/******************************************************************************* 
 * Copyright (c) 2012 TESIS DYNAware GmbH and others. 
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution, and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 *     Torsten Sommer <torsten.sommer@tesis.de> - initial API and implementation 
 *******************************************************************************/
package org.eclipse.fx.emf.edit.ui;

import javafx.beans.value.ObservableValue;
import javafx.beans.value.ObservableValueBase;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
import javafx.util.Callback;

/**
 *	A cell value factory that simply forwards {@link CellDataFeatures#getValue()} as an {@link ObservableValue}. 
 */
public class ProxyCellValueFactory<S, T> implements Callback<TableColumn.CellDataFeatures<S, T>, ObservableValue<T>> {

	@Override
	public ObservableValue<T> call(final CellDataFeatures<S, T> features) {

		//TODO add notifications on update
	
		return new ObservableValueBase<T>() {

			@Override
			@SuppressWarnings("unchecked")
			public T getValue() {
				return (T) features.getValue();
			}

		};

	}

}

Back to the top