home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / Curso / binding.exe / SimpleForm.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-06-10  |  5.5 KB  |  141 lines

  1. import wfc.app.Application;
  2. import wfc.core.Container;
  3. import wfc.core.Event;
  4. import wfc.core.EventHandler;
  5. import wfc.core.ResourceManager;
  6. import wfc.data.ConnectionEvent;
  7. import wfc.data.ui.DataBinder;
  8. import wfc.data.ui.DataBinding;
  9. import wfc.data.ui.DataNavigator;
  10. import wfc.data.ui.DataSource;
  11. import wfc.ui.Bitmap;
  12. import wfc.ui.Color;
  13. import wfc.ui.Control;
  14. import wfc.ui.Cursor;
  15. import wfc.ui.Edit;
  16. import wfc.ui.Form;
  17. import wfc.ui.GroupBox;
  18. import wfc.ui.Label;
  19. import wfc.ui.PictureBox;
  20. import wfc.ui.Point;
  21.  
  22. public class SimpleForm extends Form {
  23.    Container components = new Container();
  24.    Label label1 = new Label();
  25.    Edit edit1 = new Edit();
  26.    Label label2 = new Label();
  27.    Edit edit2 = new Edit();
  28.    GroupBox groupBox1 = new GroupBox();
  29.    Label label3 = new Label();
  30.    Label label4 = new Label();
  31.    Label label5 = new Label();
  32.    Label label6 = new Label();
  33.    PictureBox pictureBox2 = new PictureBox();
  34.    public DataBinder dataBinder1;
  35.    DataNavigator dataNavigator1;
  36.    DataSource dataSource2;
  37.    PictureBox pictureBox1;
  38.  
  39.    private void SimpleForm_click(Object sender, Event e) {
  40.    }
  41.  
  42.    private void dataSource1_BeginTransComplete(Object sender, ConnectionEvent e) {
  43.    }
  44.  
  45.    public SimpleForm() {
  46.       this.dataBinder1 = new DataBinder(this.components);
  47.       this.dataNavigator1 = new DataNavigator();
  48.       this.dataSource2 = new DataSource(this.components);
  49.       this.pictureBox1 = new PictureBox();
  50.       this.initForm();
  51.    }
  52.  
  53.    private void initForm() {
  54.       ResourceManager resources = new ResourceManager(this, "SimpleForm");
  55.       ((Control)this).setBackColor(Color.CONTROL);
  56.       ((Control)this).setLocation(new Point(0, 0));
  57.       ((Control)this).setSize(new Point(488, 341));
  58.       ((Control)this).setTabIndex(-1);
  59.       ((Control)this).setTabStop(true);
  60.       ((Control)this).setText("WFC Data Binding");
  61.       ((Form)this).setAutoScaleBaseSize(13);
  62.       ((Form)this).setClientSize(new Point(480, 314));
  63.       ((Form)this).setStartPosition(1);
  64.       ((Control)this).addOnClick(new EventHandler(this, "SimpleForm_click"));
  65.       this.label1.setLocation(new Point(30, 170));
  66.       this.label1.setSize(new Point(76, 16));
  67.       this.label1.setText("Nombre:");
  68.       this.label1.setTabIndex(0);
  69.       this.edit1.setBackColor(Color.WINDOW);
  70.       this.edit1.setCursor(Cursor.IBEAM);
  71.       this.edit1.setLocation(new Point(120, 164));
  72.       this.edit1.setSize(new Point(172, 20));
  73.       this.edit1.setTabIndex(1);
  74.       this.edit1.setTabStop(true);
  75.       this.edit1.setText("Johnson");
  76.       this.edit1.setMaxLength(20);
  77.       this.label2.setLocation(new Point(30, 200));
  78.       this.label2.setSize(new Point(76, 16));
  79.       this.label2.setText("Apellido:");
  80.       this.label2.setTabIndex(3);
  81.       this.edit2.setBackColor(Color.WINDOW);
  82.       this.edit2.setCursor(Cursor.IBEAM);
  83.       this.edit2.setLocation(new Point(120, 200));
  84.       this.edit2.setSize(new Point(184, 20));
  85.       this.edit2.setTabIndex(2);
  86.       this.edit2.setTabStop(true);
  87.       this.edit2.setText("White");
  88.       this.edit2.setMaxLength(40);
  89.       this.groupBox1.setLocation(new Point(12, 12));
  90.       this.groupBox1.setSize(new Point(448, 120));
  91.       this.groupBox1.setTabIndex(4);
  92.       this.groupBox1.setTabStop(false);
  93.       this.groupBox1.setText("Pasos para la creaci├│n de una aplicaci├│n con Data Binding m├¡nima");
  94.       this.label3.setLocation(new Point(8, 20));
  95.       this.label3.setSize(new Point(424, 16));
  96.       this.label3.setText(" 1) Colocar en el formulario un DataSorce y un DataBinder");
  97.       this.label3.setTabIndex(3);
  98.       this.label4.setLocation(new Point(10, 40));
  99.       this.label4.setSize(new Point(420, 30));
  100.       this.label4.setText("2) Colocar controles WFC : un Edit y un DataNavigator.");
  101.       this.label4.setTabIndex(2);
  102.       this.label5.setLocation(new Point(8, 60));
  103.       this.label5.setSize(new Point(424, 16));
  104.       this.label5.setText("3) Modificar las propiedades del  DataSource");
  105.       this.label5.setTabIndex(1);
  106.       this.label6.setLocation(new Point(8, 80));
  107.       this.label6.setSize(new Point(424, 16));
  108.       this.label6.setText("4) modificar las propiedades del DataBinder");
  109.       this.label6.setTabIndex(0);
  110.       this.pictureBox2.setLocation(new Point(330, 210));
  111.       this.pictureBox2.setSize(new Point(120, 30));
  112.       this.pictureBox2.setImage((Bitmap)resources.getObject("pictureBox2_image"));
  113.       this.dataSource2.setConnectionString("Provider=MSDASQL.1;Data Source=Pubs");
  114.       this.dataSource2.setCommandText("select * from authors");
  115.       this.dataSource2.setCursorType(1);
  116.       this.dataSource2.setLockType(3);
  117.       this.dataSource2.setSort((String)null);
  118.       this.dataSource2.setUserId((String)null);
  119.       this.dataSource2.setPassword((String)null);
  120.       this.dataBinder1.setDataSource(this.dataSource2);
  121.       this.dataBinder1.setDataMember("");
  122.       this.dataBinder1.setBindings(new DataBinding[]{new DataBinding(this.edit1, "Text", "au_fname"), new DataBinding(this.edit2, "Text", "au_lname")});
  123.       this.dataNavigator1.setLocation(new Point(20, 230));
  124.       this.dataNavigator1.setSize(new Point(280, 30));
  125.       this.dataNavigator1.setTabIndex(6);
  126.       this.dataNavigator1.setTabStop(false);
  127.       this.dataNavigator1.setText("Navegaci├│n");
  128.       this.dataNavigator1.setDataSource(this.dataSource2);
  129.       this.pictureBox1.setLocation(new Point(320, 140));
  130.       this.pictureBox1.setSize(new Point(140, 60));
  131.       this.pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
  132.       ((Form)this).setNewControls(new Control[]{this.pictureBox2, this.pictureBox1, this.dataNavigator1, this.groupBox1, this.edit2, this.label2, this.edit1, this.label1});
  133.       this.groupBox1.setNewControls(new Control[]{this.label6, this.label5, this.label4, this.label3});
  134.       this.dataSource2.begin();
  135.    }
  136.  
  137.    public static void main(String[] args) {
  138.       Application.run(new SimpleForm());
  139.    }
  140. }
  141.