Package net.xoetrope.swt

Source Code of net.xoetrope.swt.SwtDataBindingFactory

package net.xoetrope.swt;

import java.util.Hashtable;
import net.xoetrope.swt.tree.XTreeBinding;
import net.xoetrope.xui.PageSupport;
import net.xoetrope.xui.data.XDataBinding;
import net.xoetrope.xui.data.XDataBindingFactory;
import net.xoetrope.xui.XProject;

/**
* A data binding factory for the additional swing bindings
* <p>
* Copyright: Copyright (c) Xoetrope Ltd., 2001-2004
* </p>
* <p>
* $Revision: 2.3 $
* </p>
* License see license.txt
*/
public class SwtDataBindingFactory extends XDataBindingFactory
{
  private static SwtDataBindingFactory instance = null;

  private SwtDataBindingFactory( XProject project )
  {
    super( project );
  }

  /**
   * Register an instance of this binding factory.
   */
  public static void register( XProject project )
  {
    if ( instance == null )
      instance = new SwtDataBindingFactory( project );
    project.registerBindingFactory( instance );
  }

  /**
   * Try to get a binding factory to construct the binding
   * @param page the page that will own the binding
   * @param comp the target component
   * @param instanceConfig the attributes of the binding instance
   * @return the new binding if one could be constructed
   */
  public XDataBinding getBinding( PageSupport page, Object comp, Hashtable instanceConfig )
  {
    XDataBinding binding = null;
    if ( comp instanceof XTree )
      binding = new XTreeBinding();

    if ( binding != null )
      binding.setup( currentProject, comp, null, instanceConfig );
    return binding;
  }
}
TOP

Related Classes of net.xoetrope.swt.SwtDataBindingFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.