Package com.vaadin.ui

Examples of com.vaadin.ui.Form


  public void showUValue() {
    final Window window = new Window("Wartość U");
    window.setModal(true);
    window.setWidth(400, Sizeable.UNITS_PIXELS);
    window.center();
    final Form form = new Form();
    form.setFooter(new VerticalLayout());
    final InlineDateField dateField = new InlineDateField("Miesiąc");
    dateField.setResolution(DateField.RESOLUTION_MONTH);
    form.addField("month", dateField);
    final TextField textField = new TextField("Wartość");
    textField.setRequired(true);
    textField.setValue("100.99");
    textField.addValidator(new DoubleValidator("Tylko wartości liczbowe"));
    form.addField("value", textField);
    window.addComponent(form);
    Button button = new Button("Zapisz", form, "commit");
    button.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    button.addListener(new ClickListener() {

      public void buttonClick(final ClickEvent event) {
        double parseDouble = Double.parseDouble(textField.getValue().toString());
        Date date = (Date) dateField.getValue();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        DecimalPoint p = new DecimalPoint(new XYSeries("2008"), Double.parseDouble(date
            .getMonth() + ""), parseDouble);
        int year = calendar.get(Calendar.YEAR);
        Map<Integer, DecimalPoint> map = main.points.get(year);
        if (map == null) {
          main.points.put(year, new LinkedHashMap<Integer, DecimalPoint>());
          map = main.points.get(year);
        }
        map.put(date.getMonth(), p);

        main.refreshGraph();
        mainWindow.removeWindow(window);
      }

    });
    VerticalLayout formFooterLayout = new VerticalLayout();
    form.setFooter(formFooterLayout);
    form.getFooter().addComponent(button);
    formFooterLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);
    mainWindow.addWindow(window);

  }
View Full Code Here


      public void buttonClick(ClickEvent event) {
        Window dodajWindow = new Window("Dodaj");
        dodajWindow.setWidth(400, Form.UNITS_PIXELS);
        dodajWindow.center();
        final Form form = new Form();
        form.setCaption("asdas");
        dodajWindow.addComponent(form);
        form.setItemDataSource(new BeanItem(new Customer()));
        Button button = new Button("Zapisz", form, "commit");
        button.addListener(new ClickListener() {

          public void buttonClick(ClickEvent event) {
            System.out.println("klik");
            Object data = form.getItemDataSource();
            System.out.println(data);
          }
        });
        form.getFooter().addComponent(button);
        form.getField("id").setRequired(true);
        form.getField("id").setRequiredError("przypisz");
        window.addWindow(dodajWindow);
      }
    });
  }
View Full Code Here

    Panel userDetailsPanel = new Panel("Dane użytkownika");
    layout.addComponent(userDetailsPanel);
    layout.setExpandRatio(userDetailsPanel, 3);
    layout.setComponentAlignment(userDetailsPanel, Alignment.TOP_LEFT);

    Form form = new Form();

    form.setItemDataSource(userData);
    userData.getBean().addCaptions(form);
    userDetailsPanel.addComponent(form);
    userDetailsPanel.setWidth(350, Sizeable.UNITS_PIXELS);

    for (String id : UserData.FIELDS_ORDER) {
      form.getField(id).setReadOnly(true);
    }

    Button userSettings = new Button("Ustawienia");
    userSettings.setIcon(new ThemeResource("../runo/icons/16/settings.png"));
    final UserDataSettings userDataSettings = new UserDataSettings(this, request, response);
    userDataSettings.checkData();
    userSettings.addListener(new ClickListener() {

      public void buttonClick(final ClickEvent event) {
        userDataSettings.showSettingsWindow();
      }
    });
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);
    HorizontalLayout formLayout = new HorizontalLayout();
    verticalLayout.addComponent(formLayout);
    formLayout.setSpacing(true);
    form.setFooter(verticalLayout);
    formLayout.addComponent(userSettings);
    Button c = new Button("Drukuj");
    c.setIcon(new ThemeResource("../runo/icons/16/document-pdf.png"));
    c.addListener(new Button.ClickListener() {

      public void buttonClick(final ClickEvent event) {
        SchedulePdf schedulePdf = new SchedulePdf(month, userData.getBean().getName(), days
            .getItemIds());
        schedulePdf.schowScheduleWindow(mainWindow.getApplication());

      }
    });
    formLayout.addComponent(c);

    final InlineDateField dateField = new InlineDateField("Miesiąc");
    dateField.setResolution(DateField.RESOLUTION_MONTH);
    dateField.setImmediate(true);
    layout.addComponent(dateField);
    dateField.setWidth(200, Sizeable.UNITS_PIXELS);
    form.getFooter().addComponent(dateField);

    dateField.addListener(new ValueChangeListener() {

      @SuppressWarnings("deprecation")
      public void valueChange(final ValueChangeEvent event) {
View Full Code Here

        t.setVisibleColumns(new String[] { "nome", "index", "parent" });
        t.setSelectable(true);
        t.setSizeFull();
        t.setImmediate(true);
        TextField f = new TextField("Name");
        final Form form = new Form();
        // Property p = new ObjectProperty<String>("", String.class);
        // t.setPropertyDataSource(p); // UNCOMMENT THIS LINE TO SEE BUG
        // HAPPENING
        // f.setPropertyDataSource(p);
        // f.setImmediate(true);
        t.setPropertyDataSource(f);
        form.addField("table", t);
        form.addField("name", f);
        addComponent(form);

    }
View Full Code Here

            while (it.hasNext()) {
                errors = validateComponentRelativeSizes(it.next(), errors,
                        parent);
            }
        } else if (component instanceof Form) {
            Form form = (Form) component;
            if (form.getLayout() != null) {
                errors = validateComponentRelativeSizes(form.getLayout(),
                        errors, parent);
            }
            if (form.getFooter() != null) {
                errors = validateComponentRelativeSizes(form.getFooter(),
                        errors, parent);
            }
        }

        return errors;
View Full Code Here

    final TextField musteriTelefon = new TextField("Telefon");
    final TextField musteriTelefonTuru = new TextField("Telefon Türü");
    kaydetButton = new Button("Kaydet",this);

    Form musteriTemelBilgilerForm = new Form();
    Form musteriAdresBilgilerForm = new Form();
    Form musteriIletisimBilgilerForm = new Form();

    musteriTemelBilgilerForm.setImmediate(true);
    musteriAdresBilgilerForm.setImmediate(true);
    musteriIletisimBilgilerForm.setImmediate(true);

    musteriTemelBilgilerLayout.setWidth("100%");
    musteriTemelBilgilerLayout.setHeight("460px");
    musteriAdresBilgilerLayout.setWidth("100%");
    musteriAdresBilgilerLayout.setHeight("460px");
    musteriIletisimBilgilerLayout.setWidth("100%");
    musteriIletisimBilgilerLayout.setHeight("360px");

    musteriVdn.setWidth("200px");
    musteriVd.setWidth("200px");
    musteriAdi.setWidth("200px");
    musteriTuru.setWidth("200px");
    musteriTipi.setWidth("200px");
    musteriSektor.setWidth("200px");
    musteriAdres.setWidth("200px");
    musteriSemt.setWidth("200px");
    musteriIlce.setWidth("200px");
    musteriIl.setWidth("200px");
    musteriUlke.setWidth("200px");
    musteriMail.setWidth("200px");
    musteriWeb.setWidth("200px");
    musteriNot.setWidth("200px");
    // musteriTelefon.setWidth("200px");
    musteriTelefonTuru.setWidth("200px");

    // temelbilgiler
    musteriTemelBilgilerLayout.addComponent(musteriVdn, "left : 30px ; top : 50px");
    musteriTemelBilgilerLayout.addComponent(musteriVd, "left : 30px ; top : 100px");
    musteriTemelBilgilerLayout.addComponent(musteriAdi, "left : 30px ; top : 150px");
    musteriTemelBilgilerLayout.addComponent(musteriTuru, "left : 30px ; top : 200px");
    musteriTemelBilgilerLayout.addComponent(musteriTipi, "left : 30px ; top : 250px");
    musteriTemelBilgilerLayout.addComponent(musteriSektor, "left : 30px ; top : 300px");
    musteriTemelBilgilerLayout.addComponent(musteriNot, "left : 30px ; top : 350px");

    // AdresBilgiler
    musteriAdresBilgilerLayout.addComponent(musteriAdres, "left : 30px ; top : 50px");
    musteriAdresBilgilerLayout.addComponent(musteriSemt, "left : 30px ; top : 100px");
    musteriAdresBilgilerLayout.addComponent(musteriIlce, "left : 30px ; top : 150px");
    musteriAdresBilgilerLayout.addComponent(musteriIl, "left : 30px ; top : 200px");
    musteriAdresBilgilerLayout.addComponent(musteriUlke, "left : 30px ; top : 250px");

    // iletişimbilgileri

    musteriIletisimBilgilerLayout.addComponent(musteriMail, "left : 30px ; top : 50px");
    musteriIletisimBilgilerLayout.addComponent(musteriWeb, "left : 30px ; top : 100px");
    musteriIletisimBilgilerLayout.addComponent(musteriTelefon, "left : 30px ; top : 150px");
    musteriIletisimBilgilerLayout.addComponent(musteriTelefonTuru, "left : 30px ; top : 200px");
    musteriIletisimBilgilerLayout.addComponent(telefonAlaniLayout, "left : 330px ; top : 35px");
    musteriIletisimBilgilerLayout.addComponent(telefonEkleButton, "left : 535px ; top : 48px");
    telefonAlaniLayout.addComponent(musteriTelefon);

    musteriTemelBilgilerForm.setLayout(musteriTemelBilgilerLayout);
    musteriAdresBilgilerForm.setLayout(musteriAdresBilgilerLayout);
    musteriIletisimBilgilerForm.setLayout(musteriIletisimBilgilerLayout);

    // layoutlar
    tabSheet.addTab(musteriTemelBilgilerForm, "Müşteri Temel Bilgiler");
    tabSheet.addTab(musteriAdresBilgilerForm, "Müşteri Adres Bilgiler");
    tabSheet.addTab(musteriIletisimBilgilerForm, "Müşteri İletişim Bilgiler");
View Full Code Here

            while (it.hasNext()) {
                errors = validateComponentRelativeSizes(it.next(), errors,
                        parent);
            }
        } else if (component instanceof Form) {
            Form form = (Form) component;
            if (form.getLayout() != null) {
                errors = validateComponentRelativeSizes(form.getLayout(),
                        errors, parent);
            }
            if (form.getFooter() != null) {
                errors = validateComponentRelativeSizes(form.getFooter(),
                        errors, parent);
            }
        }

        return errors;
View Full Code Here

    public AddressField(Form parentForm) {
        if (parentForm != null) {
            addressForm = new EmbeddedForm(parentForm);
        } else {
            addressForm = new Form();
        }
        addressForm.setCaption("Address");
        addressForm.setWriteThrough(false);
        addressForm.setFormFieldFactory(new AddressFieldFormFactory());
        setCompositionRoot(addressForm);
View Full Code Here

        layout.setMargin(true);

        layout.addComponent(new Label(
                "A customized field (a two-state button) for editing a boolean value."));

        final Form form = new Form();
        form.setFormFieldFactory(new DefaultFieldFactory() {
            @Override
            public Field createField(Item item, Object propertyId,
                    Component uiContext) {
                if ("custom".equals(propertyId)) {
                    return new BooleanField();
                }
                return super.createField(item, propertyId, uiContext);
            }
        });
        final TwoBooleans data = new TwoBooleans();
        form.setItemDataSource(new BeanItem<TwoBooleans>(data));

        layout.addComponent(form);

        Button submit = new Button("Submit", new ClickListener() {
            public void buttonClick(ClickEvent event) {
                form.commit();
                layout.getWindow().showNotification(
                                "The custom boolean field value is "
                                        + data.isCustom()
                                        + ".<br>"
                                        + "The checkbox (default boolean field) value is "
View Full Code Here

                Component uiContext) {
            Field f = super.createField(item, propertyId, uiContext);
            if ("address".equals(propertyId)) {
                // create a custom field for the Address object
                if (addressField == null) {
                    Form form = (embeddedAddress && uiContext instanceof Form) ? (Form) uiContext
                            : null;
                    addressField = new AddressField(form);
                }
                f = addressField;
            }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Form

Copyright © 2018 www.massapicom. 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.