View Javadoc

1   /*
2    * @(#)$Id: BindingFactory.java 742 2009-08-15 17:15:49Z kurmannu $
3    *
4    * Author   : Ueli Kurmann, igesture@uelikurmann.ch
5    *                                   
6    *                                   
7    * Purpose  : 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date       Who     Reason
14   *
15   * 23.03.2008 ukurmann  Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  package org.ximtec.igesture.tool.binding;
27  
28  import javax.swing.JComponent;
29  import javax.swing.JLabel;
30  import javax.swing.JTextArea;
31  import javax.swing.JTextField;
32  
33  import org.ximtec.igesture.core.DataObject;
34  
35  
36  public class BindingFactory {
37  
38     public static DataBinding< ? > createInstance(JComponent component,
39           DataObject obj, String property) {
40        if (component instanceof JTextField) {
41           return new TextFieldBinding((JTextField)component, obj, property);
42        }else if (component instanceof JTextArea) {
43           return new TextAreaBinding((JTextArea)component, obj, property);
44        }else if (component instanceof JLabel) {
45           return new LabelBinding((JLabel)component, obj, property);
46        }
47        return null;
48     }
49  }