Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "JFace Data Binding/PojoBindable/PojoBindableSVN"

(Pojo Bindable & EclipseLink)
(Pojo Bindable into OSGi context)
Line 29: Line 29:
 
== Pojo Bindable into OSGi context ==
 
== Pojo Bindable into OSGi context ==
  
You can find a basic sample with Pojo bindable into [http://dynaresume.googlecode.com/svn/trunk/JFace-Pojo-Bindable/examples/osgi-equinox/org.eclipse.core.examples.databinding.pojo.bindable.equinox/ org.eclipse.core.examples.databinding.pojo.bindable.equinox] bundle. This bundle has an Activator which create a basic PojoPerson coming from another bundle [https://dynaresume.googlecode.com/svn/trunk/JFace-Pojo-Bindable/examples/osgi-equinox/org.eclipse.core.examples.databinding.pojo.bindable.model/ org.eclipse.core.examples.databinding.pojo.bindable.model :  
+
You can find a basic sample with Pojo bindable into [http://dynaresume.googlecode.com/svn/trunk/JFace-Pojo-Bindable/examples/osgi-equinox/org.eclipse.core.examples.databinding.pojo.bindable.equinox/ org.eclipse.core.examples.databinding.pojo.bindable.equinox] bundle. This bundle has an Activator which create a basic PojoPerson coming from another bundle [http://dynaresume.googlecode.com/svn/trunk/JFace-Pojo-Bindable/examples/osgi-equinox/org.eclipse.core.examples.databinding.pojo.bindable.model/ org.eclipse.core.examples.databinding.pojo.bindable.model]:  
  
 
<source lang="java" >package org.eclipse.core.examples.databinding.pojo.bindable.model;
 
<source lang="java" >package org.eclipse.core.examples.databinding.pojo.bindable.model;

Revision as of 06:52, 12 April 2010

Pojo Bindable SVN

For the last version of Pojo Bindable you can (for the moment) get it from the SVN on Dynaresume project. You can find the whole Pojo bindable project at http://dynaresume.googlecode.com/svn/trunk/JFace-Pojo-Bindable/ :


Pojo Bindable into OSGi context

You can find a basic sample with Pojo bindable into org.eclipse.core.examples.databinding.pojo.bindable.equinox bundle. This bundle has an Activator which create a basic PojoPerson coming from another bundle org.eclipse.core.examples.databinding.pojo.bindable.model:

package org.eclipse.core.examples.databinding.pojo.bindable.model;
 
public class PojoPerson {
 
	String name = "HelloWorld";
 
	public String getName() {
		return name;
	}
 
	public void setName(String name) {
		this.name = name;
	}
}

and add it a listener :

public class Activator implements BundleActivator {
 
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
	 * )
	 */
	public void start(BundleContext context) throws Exception {
 
		// Create Pojo instance
		PojoPerson person = new PojoPerson();
 
		PropertyChangeListener listener = new PropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent event) {
				System.out.println("---------- Property User changed --------");
				System.out.println("  PropertyName=" + event.getPropertyName());
				System.out.println("  OldValue=" + event.getOldValue());
				System.out.println("  NewValue=" + event.getNewValue());
				System.out
						.println("------------------------------------------");
			}
		};
 
		// Add Listener
		try {
			Method m = person.getClass().getMethod("addPropertyChangeListener",
					String.class, PropertyChangeListener.class);
			m.invoke(person, "name", listener);
		} catch (Exception e) {
			e.printStackTrace();
		}
 
		// Change name property.
		person.setName("New name");
 
	}
...
}

You can notice thate there is no dependencies to Pojo Bindable in this code. When Pojo Bindable is well configured.

Pojo Bindable & EclipseLink

EclipseLink provider Dynamic Weaving Fragment for Equinox into org.eclipse.persistence.jpa.equinox.weaving fragment to transform bytecode.

Back to the top