home *** CD-ROM | disk | FTP | other *** search
- import wfc.app.Application;
- import wfc.core.Container;
- import wfc.core.Event;
- import wfc.core.EventHandler;
- import wfc.core.ResourceManager;
- import wfc.data.ConnectionEvent;
- import wfc.data.ui.DataBinder;
- import wfc.data.ui.DataBinding;
- import wfc.data.ui.DataNavigator;
- import wfc.data.ui.DataSource;
- import wfc.ui.Bitmap;
- import wfc.ui.Color;
- import wfc.ui.Control;
- import wfc.ui.Cursor;
- import wfc.ui.Edit;
- import wfc.ui.Form;
- import wfc.ui.GroupBox;
- import wfc.ui.Label;
- import wfc.ui.PictureBox;
- import wfc.ui.Point;
-
- public class SimpleForm extends Form {
- Container components = new Container();
- Label label1 = new Label();
- Edit edit1 = new Edit();
- Label label2 = new Label();
- Edit edit2 = new Edit();
- GroupBox groupBox1 = new GroupBox();
- Label label3 = new Label();
- Label label4 = new Label();
- Label label5 = new Label();
- Label label6 = new Label();
- PictureBox pictureBox2 = new PictureBox();
- public DataBinder dataBinder1;
- DataNavigator dataNavigator1;
- DataSource dataSource2;
- PictureBox pictureBox1;
-
- private void SimpleForm_click(Object sender, Event e) {
- }
-
- private void dataSource1_BeginTransComplete(Object sender, ConnectionEvent e) {
- }
-
- public SimpleForm() {
- this.dataBinder1 = new DataBinder(this.components);
- this.dataNavigator1 = new DataNavigator();
- this.dataSource2 = new DataSource(this.components);
- this.pictureBox1 = new PictureBox();
- this.initForm();
- }
-
- private void initForm() {
- ResourceManager resources = new ResourceManager(this, "SimpleForm");
- ((Control)this).setBackColor(Color.CONTROL);
- ((Control)this).setLocation(new Point(0, 0));
- ((Control)this).setSize(new Point(488, 341));
- ((Control)this).setTabIndex(-1);
- ((Control)this).setTabStop(true);
- ((Control)this).setText("WFC Data Binding");
- ((Form)this).setAutoScaleBaseSize(13);
- ((Form)this).setClientSize(new Point(480, 314));
- ((Form)this).setStartPosition(1);
- ((Control)this).addOnClick(new EventHandler(this, "SimpleForm_click"));
- this.label1.setLocation(new Point(30, 170));
- this.label1.setSize(new Point(76, 16));
- this.label1.setText("Nombre:");
- this.label1.setTabIndex(0);
- this.edit1.setBackColor(Color.WINDOW);
- this.edit1.setCursor(Cursor.IBEAM);
- this.edit1.setLocation(new Point(120, 164));
- this.edit1.setSize(new Point(172, 20));
- this.edit1.setTabIndex(1);
- this.edit1.setTabStop(true);
- this.edit1.setText("Johnson");
- this.edit1.setMaxLength(20);
- this.label2.setLocation(new Point(30, 200));
- this.label2.setSize(new Point(76, 16));
- this.label2.setText("Apellido:");
- this.label2.setTabIndex(3);
- this.edit2.setBackColor(Color.WINDOW);
- this.edit2.setCursor(Cursor.IBEAM);
- this.edit2.setLocation(new Point(120, 200));
- this.edit2.setSize(new Point(184, 20));
- this.edit2.setTabIndex(2);
- this.edit2.setTabStop(true);
- this.edit2.setText("White");
- this.edit2.setMaxLength(40);
- this.groupBox1.setLocation(new Point(12, 12));
- this.groupBox1.setSize(new Point(448, 120));
- this.groupBox1.setTabIndex(4);
- this.groupBox1.setTabStop(false);
- this.groupBox1.setText("Pasos para la creación de una aplicación con Data Binding mínima");
- this.label3.setLocation(new Point(8, 20));
- this.label3.setSize(new Point(424, 16));
- this.label3.setText(" 1) Colocar en el formulario un DataSorce y un DataBinder");
- this.label3.setTabIndex(3);
- this.label4.setLocation(new Point(10, 40));
- this.label4.setSize(new Point(420, 30));
- this.label4.setText("2) Colocar controles WFC : un Edit y un DataNavigator.");
- this.label4.setTabIndex(2);
- this.label5.setLocation(new Point(8, 60));
- this.label5.setSize(new Point(424, 16));
- this.label5.setText("3) Modificar las propiedades del DataSource");
- this.label5.setTabIndex(1);
- this.label6.setLocation(new Point(8, 80));
- this.label6.setSize(new Point(424, 16));
- this.label6.setText("4) modificar las propiedades del DataBinder");
- this.label6.setTabIndex(0);
- this.pictureBox2.setLocation(new Point(330, 210));
- this.pictureBox2.setSize(new Point(120, 30));
- this.pictureBox2.setImage((Bitmap)resources.getObject("pictureBox2_image"));
- this.dataSource2.setConnectionString("Provider=MSDASQL.1;Data Source=Pubs");
- this.dataSource2.setCommandText("select * from authors");
- this.dataSource2.setCursorType(1);
- this.dataSource2.setLockType(3);
- this.dataSource2.setSort((String)null);
- this.dataSource2.setUserId((String)null);
- this.dataSource2.setPassword((String)null);
- this.dataBinder1.setDataSource(this.dataSource2);
- this.dataBinder1.setDataMember("");
- this.dataBinder1.setBindings(new DataBinding[]{new DataBinding(this.edit1, "Text", "au_fname"), new DataBinding(this.edit2, "Text", "au_lname")});
- this.dataNavigator1.setLocation(new Point(20, 230));
- this.dataNavigator1.setSize(new Point(280, 30));
- this.dataNavigator1.setTabIndex(6);
- this.dataNavigator1.setTabStop(false);
- this.dataNavigator1.setText("Navegaci├│n");
- this.dataNavigator1.setDataSource(this.dataSource2);
- this.pictureBox1.setLocation(new Point(320, 140));
- this.pictureBox1.setSize(new Point(140, 60));
- this.pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
- ((Form)this).setNewControls(new Control[]{this.pictureBox2, this.pictureBox1, this.dataNavigator1, this.groupBox1, this.edit2, this.label2, this.edit1, this.label1});
- this.groupBox1.setNewControls(new Control[]{this.label6, this.label5, this.label4, this.label3});
- this.dataSource2.begin();
- }
-
- public static void main(String[] args) {
- Application.run(new SimpleForm());
- }
- }
-