/** * Adapt an {@link IObservableList} to an {@link ObservableList} * * @param list * the eclipse db list * @param <E> * the list type * @return the javafx observable list */ public static <E> ObservableList<E> adapt(IObservableList list) { return new WrappedList<E>(list); }
/** * Initializes started application (for instance creates a default realm). */ @SuppressWarnings("static-method") protected void initialize() { JFXRealm.createDefault(); } }
/** * Adapt an {@link IObservableValue} to an {@link ObservableWritableValue} * * @param value * the eclipse db value * @param <E> * the list type * @return the javafx observable */ public static <E> ObservableWritableValue<E> adapt(IObservableValue value) { return new WrappedValue<E>(value); }
@NonNull String[] propertyNames = split(propertyName); if (propertyNames.length > 1) { valueType = null; if (beanClass == null) { propertyDescriptor = null; property = new AnonymousFXBeanValueProperty(propertyNames[0], valueType); } else { propertyDescriptor = FXBeanPropertyHelper.getPropertyDescriptor(beanClass, propertyNames[0]); property = new FXBeanValueProperty(propertyDescriptor, valueType); IJFXBeanValueProperty beanProperty = new FXBeanValuePropertyDecorator(property, propertyDescriptor); for (int i = 1; i < propertyNames.length; i++) { beanProperty = beanProperty.value(propertyNames[i]);
/** * Create a default realm * * @return the defaul realm */ @NonNull public static Realm createDefault() { JFXRealm jfxRealm = new JFXRealm(); setDefault(jfxRealm); return jfxRealm; }
@SuppressWarnings("null") @Override public IJFXBeanValueProperty value(IJFXBeanValueProperty property) { return new FXBeanValuePropertyDecorator(super.value(property), property.getPropertyDescriptor()); }
private IValueProperty getClassDelegate(Class<?> beanClass) { if (this.delegates.containsKey(beanClass)) return this.delegates.get(beanClass); IValueProperty delegate; try { delegate = JFXBeanProperties.value(beanClass, this.propertyName, (Class<?>) getValueType()); } catch (IllegalArgumentException noSuchProperty) { delegate = null; } this.delegates.put(beanClass, delegate); return delegate; }
final ReadonlyWritableList target = new ReadonlyWritableList(source.getRealm()); target.add(converter.call((S) o));
/** * Bind an javafx observable value to a eclipse db observable * * @param fxObs * the javafx observable * @param dbObs * the eclipse db observable * @param initialSync * the initial sync direction * @param <E> * the value type * @param <F> * the observable value type */ @SuppressWarnings("unchecked") public static <E, F extends ObservableValue<E> & WritableValue<E>> void bind(F fxObs, IObservableValue dbObs, InitialSync initialSync) { if (initialSync == InitialSync.FX_TO_DB) { dbObs.setValue(fxObs.getValue()); } else { fxObs.setValue((E) dbObs.getValue()); } ObservableWritableValue<E> wrapped = adapt(dbObs); do_bind(fxObs, wrapped); }
/** * Create a single value property without a type * * @param propertyName * the name of the property (nested properties are separated with a .) * @return the property */ public static @NonNull IJFXBeanValueProperty value(@NonNull String propertyName) { return value(null, propertyName, null); }
@Override public void exec(Runnable runnable) { if (isCurrent()) { runnable.run(); } else { Platform.runLater(runnable); } } }
/** * Bind a JavaFX observable list to an Eclipse DB observable list * * @param fxObs * the fx observable * @param dbObs * the eclipse db observable * @param initialSync * the initial sync direction * @param <E> * the list type */ public static <E> void bind(ObservableList<E> fxObs, IObservableList dbObs, InitialSync initialSync) { ObservableList<E> dbList = adapt(dbObs); if (initialSync == InitialSync.FX_TO_DB) { Bindings.bindContent(dbList, fxObs); } else { Bindings.bindContentBidirectional(fxObs, dbList); } }
property.addListener((o, ov, nv) -> fireValueChange(Diffs.createValueDiff(ov, nv)));
@Override protected Realm createRealm(IEclipseContext appContext) { return JFXRealm.createDefault(); }
/** * Create a single value property with a type * * @param propertyName * the name of the property (nested properties are separated with a .) * @param valueType * the type * @return the property */ public static @NonNull IJFXBeanValueProperty value(@NonNull String propertyName, Class<?> valueType) { return value(null, propertyName, valueType); }
@SuppressWarnings("null") @Override public void start(final Stage primaryStage) throws Exception { this.applicationContext = this.osgiApp.applicationContext; JFXRealm.createDefault(); this.osgiApp.jfxStart(this.applicationContext, JFXApp.this, primaryStage); if (this.osgiApp.eventAdmin != null) { Map<String, Object> map = new HashMap<String, Object>(); // map.put("name", value); this.osgiApp.eventAdmin.sendEvent(new Event("efxapp/applicationLaunched", map)); //$NON-NLS-1$ } }