home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / Curso / binding.exe / SimpleForm.java < prev    next >
Encoding:
Java Source  |  1998-06-10  |  5.5 KB  |  168 lines

  1. // SimpleForm.java
  2.  
  3. import wfc.app.*;
  4. import wfc.core.*;
  5. import wfc.ui.*;
  6.  
  7. public class SimpleForm extends Form
  8. {
  9.     private void SimpleForm_click(Object sender, Event e)
  10.     {
  11.  
  12.     }
  13.  
  14.     private void dataSource1_BeginTransComplete(Object sender, wfc.data.ConnectionEvent e)
  15.     {
  16.  
  17.     }
  18.  
  19.     public SimpleForm()
  20.     {
  21.         // Required for Visual J++ Form Designer support
  22.         initForm();        
  23.  
  24.         // TODO: Add any constructor code after initForm call
  25.     }
  26.  
  27.     /**
  28.      * The main entry point for the application. 
  29.      *
  30.      * @param args Array of parameters passed to the application
  31.      * via the command line.
  32.      */
  33.     public static void main(String args[])
  34.     {
  35.         Application.run(new SimpleForm());
  36.     }
  37.  
  38.  
  39.     /**
  40.     * NOTE: The following code is required by the Visual J++ form
  41.     * designer.  It can be modified using the form editor.  Do not
  42.     * modify it using the code editor.
  43.     */
  44.  
  45.     Container components = new Container();
  46.     Label label1 = new Label();
  47.     Edit edit1 = new Edit();
  48.     Label label2 = new Label();
  49.     Edit edit2 = new Edit();
  50.     GroupBox groupBox1 = new GroupBox();
  51.     Label label3 = new Label();
  52.     Label label4 = new Label();
  53.     Label label5 = new Label();
  54.     Label label6 = new Label();
  55.     PictureBox pictureBox2 = new PictureBox();
  56.     public wfc.data.ui.DataBinder dataBinder1 = new wfc.data.ui.DataBinder(components);
  57.     wfc.data.ui.DataNavigator dataNavigator1 = new wfc.data.ui.DataNavigator();
  58.     wfc.data.ui.DataSource dataSource2 = new wfc.data.ui.DataSource(components);
  59.     PictureBox pictureBox1 = new PictureBox();
  60.  
  61.     private void initForm()
  62.     {
  63.         ResourceManager resources = new ResourceManager(this, "SimpleForm");
  64.         this.setBackColor(Color.CONTROL);
  65.         this.setLocation(new Point(0, 0));
  66.         this.setSize(new Point(488, 341));
  67.         this.setTabIndex(-1);
  68.         this.setTabStop(true);
  69.         this.setText("WFC Data Binding");
  70.         this.setAutoScaleBaseSize(13);
  71.         this.setClientSize(new Point(480, 314));
  72.         this.setStartPosition(FormStartPosition.CENTER_SCREEN);
  73.         this.addOnClick(new EventHandler(this.SimpleForm_click));
  74.         label1.setLocation(new Point(30, 170));
  75.         label1.setSize(new Point(76, 16));
  76.         label1.setText("Nombre:");
  77.         label1.setTabIndex(0);
  78.         edit1.setBackColor(Color.WINDOW);
  79.         edit1.setCursor(Cursor.IBEAM);
  80.         edit1.setLocation(new Point(120, 164));
  81.         edit1.setSize(new Point(172, 20));
  82.         edit1.setTabIndex(1);
  83.         edit1.setTabStop(true);
  84.         edit1.setText("Johnson");
  85.         edit1.setMaxLength(20);
  86.         label2.setLocation(new Point(30, 200));
  87.         label2.setSize(new Point(76, 16));
  88.         label2.setText("Apellido:");
  89.         label2.setTabIndex(3);
  90.         edit2.setBackColor(Color.WINDOW);
  91.         edit2.setCursor(Cursor.IBEAM);
  92.         edit2.setLocation(new Point(120, 200));
  93.         edit2.setSize(new Point(184, 20));
  94.         edit2.setTabIndex(2);
  95.         edit2.setTabStop(true);
  96.         edit2.setText("White");
  97.         edit2.setMaxLength(40);
  98.         groupBox1.setLocation(new Point(12, 12));
  99.         groupBox1.setSize(new Point(448, 120));
  100.         groupBox1.setTabIndex(4);
  101.         groupBox1.setTabStop(false);
  102.         groupBox1.setText("Pasos para la creaci≤n de una aplicaci≤n con Data Binding mφnima");
  103.         label3.setLocation(new Point(8, 20));
  104.         label3.setSize(new Point(424, 16));
  105.         label3.setText(" 1) Colocar en el formulario un DataSorce y un DataBinder");
  106.         label3.setTabIndex(3);
  107.         label4.setLocation(new Point(10, 40));
  108.         label4.setSize(new Point(420, 30));
  109.         label4.setText("2) Colocar controles WFC : un Edit y un DataNavigator.");
  110.         label4.setTabIndex(2);
  111.         label5.setLocation(new Point(8, 60));
  112.         label5.setSize(new Point(424, 16));
  113.         label5.setText("3) Modificar las propiedades del  DataSource");
  114.         label5.setTabIndex(1);
  115.         label6.setLocation(new Point(8, 80));
  116.         label6.setSize(new Point(424, 16));
  117.         label6.setText("4) modificar las propiedades del DataBinder");
  118.         label6.setTabIndex(0);
  119.         pictureBox2.setLocation(new Point(330, 210));
  120.         pictureBox2.setSize(new Point(120, 30));
  121.         pictureBox2.setImage((Bitmap)resources.getObject("pictureBox2_image"));
  122.         dataSource2.setConnectionString("Provider=MSDASQL.1;Data Source=Pubs");
  123.         dataSource2.setCommandText("select * from authors");
  124.         dataSource2.setCursorType(wfc.data.AdoEnums.CursorType.KEYSET);
  125.         dataSource2.setLockType(wfc.data.AdoEnums.LockType.OPTIMISTIC);
  126.         dataSource2.setSort(null);
  127.         dataSource2.setUserId(null);
  128.         dataSource2.setPassword(null);
  129.         /* @designTimeOnly dataSource2.setLocation(new Point(150, 270)); */
  130.         dataBinder1.setDataSource(dataSource2);
  131.         dataBinder1.setDataMember("");
  132.         dataBinder1.setBindings(new wfc.data.ui.DataBinding[] {
  133.             new wfc.data.ui.DataBinding(edit1, "Text", "au_fname"), 
  134.             new wfc.data.ui.DataBinding(edit2, "Text", "au_lname")});
  135.         /* @designTimeOnly dataBinder1.setLocation(new Point(300, 270)); */
  136.         dataNavigator1.setLocation(new Point(20, 230));
  137.         dataNavigator1.setSize(new Point(280, 30));
  138.         dataNavigator1.setTabIndex(6);
  139.         dataNavigator1.setTabStop(false);
  140.         dataNavigator1.setText("Navegaci≤n");
  141.         dataNavigator1.setDataSource(dataSource2);
  142.         pictureBox1.setLocation(new Point(320, 140));
  143.         pictureBox1.setSize(new Point(140, 60));
  144.         pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
  145.         this.setNewControls(new Control[] {
  146.             pictureBox2, 
  147.             pictureBox1, 
  148.             dataNavigator1, 
  149.             groupBox1, 
  150.             edit2, 
  151.             label2, 
  152.             edit1, 
  153.             label1});
  154.         groupBox1.setNewControls(new Control[] {
  155.             label6, 
  156.             label5, 
  157.             label4, 
  158.             label3});
  159.         dataSource2.begin();
  160.     }
  161.     // NOTE: End of form designer support code
  162.  
  163.     public static class ClassInfo extends Form.ClassInfo
  164.     {
  165.         // TODO: Add your property and event infos here
  166.     }
  167. }
  168.