Examples of DateBox


Examples of com.google.gwt.user.datepicker.client.DateBox

  private static void setViaDatePicker(DateBox db, Date d) {
    db.getDatePicker().setValue(d, true);
  }

  public void testFireNullValues() {
    DateBox db = new DateBox();
    db.setFireNullValues(true);
    assertTrue(db.getFireNullValues());
    RootPanel.get().add(db);
    @SuppressWarnings("unchecked")
    final ValueChangeEvent<Date>[] eventHolder = new ValueChangeEvent[1];
    final boolean[] wasCalled = new boolean[1];
    db.addValueChangeHandler(new ValueChangeHandler<Date>() {
      @Override
      public void onValueChange(ValueChangeEvent<Date> event) {
        wasCalled[0] = true;
        eventHolder[0] = event;
      }
    });

    // test that an empty string fires an event
    db.setValue(new Date(1976,1,20));
    db.getTextBox().setText("");
    NativeEvent e = Document.get().createBlurEvent();
    db.getTextBox().getElement().dispatchEvent(e);
    assertTrue(wasCalled[0]);
    assertNull(eventHolder[0].getValue());
   
    // test that an invalid date string fires an event, and leaves the text in
    // the textbox
    db.setValue(new Date(1976,1,20));
    db.getTextBox().setText("abcd");
    e = Document.get().createBlurEvent();
    db.getTextBox().getElement().dispatchEvent(e);
    assertTrue(wasCalled[0]);
    assertNull(eventHolder[0].getValue());
    assertEquals("abcd", db.getTextBox().getText());
  }
View Full Code Here

Examples of com.google.gwt.widgetideas.datepicker.client.DateBox

  private Widget dateRange() {
    VerticalPanel v = new VerticalPanel();
    HorizontalPanel p = new HorizontalPanel();
    v.add(p);
    start = new DateBox();
    final DateBox end = new DateBox();

    start.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent e) {
        if (e.getKeyCode() == KEY_RIGHT
            && start.getCursorPos() == start.getText().length()) {
          start.hideDatePicker();
          end.setFocus(true);
        }
      }
    });

    end.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent e) {
        if ((e.getKeyCode() == KEY_LEFT) && end.getCursorPos() == 0) {
          start.setFocus(true);
          end.hideDatePicker();
        }
      }
    });

    end.getDatePicker().addChangeHandler(new ChangeHandler<Date>() {
      public void onChange(ChangeEvent<Date> event) {
        start.removeStyleName("user-modified");
      }
    });

    start.showDate(new Date());

    p.add(start);
    Label l = new Label(" - ");
    l.setStyleName("filler");
    p.add(l);
    p.add(end);
    HorizontalPanel h2 = new HorizontalPanel();
    v.add(h2);
    h2.add(new Button("Short format", new ClickListener() {

      public void onClick(Widget sender) {
        start.setDateFormat(DateTimeFormat.getShortDateFormat());
        end.setDateFormat(DateTimeFormat.getShortDateFormat());
      }
    }));
    h2.add(new Button("Long format", new ClickListener() {

      public void onClick(Widget sender) {
        start.setDateFormat(DateTimeFormat.getLongDateFormat());
        end.setDateFormat(DateTimeFormat.getLongDateFormat());
      }
    }));
    return v;
  }
View Full Code Here

Examples of org.zkoss.zul.Datebox

                r.setChecked(true);
            }
        }


        Datebox birthdayDB = (Datebox) getFellow("birthday");
        Textbox homePhoneTB = (Textbox) getFellow("homePhone");
        Textbox mobileTB = (Textbox) getFellow("mobile");
        Textbox informPeopleTB = (Textbox) getFellow("informPeople");
        Textbox relationTB = (Textbox) getFellow("relation");

        birthdayDB.setValue(form.getBirthday());
        homePhoneTB.setText(form.getHomePhone());
        mobileTB.setText(form.getMobile());
        informPeopleTB.setText(form.getInformPeople());
        relationTB.setText(form.getRelation());
View Full Code Here

Examples of org.zkoss.zul.Datebox

            var.setCompany((Org) companyCB.getSelectedItem().getValue());
        }
        var.setSex(sexRG.getSelectedItem().getValue());


        Datebox birthdayDB = (Datebox) getFellow("birthday");
        Textbox homePhoneTB = (Textbox) getFellow("homePhone");
        Textbox mobileTB = (Textbox) getFellow("mobile");
        Textbox informPeopleTB = (Textbox) getFellow("informPeople");
        Textbox relationTB = (Textbox) getFellow("relation");

        var.setBirthday(birthdayDB.getValue());
        var.setHomePhone(homePhoneTB.getText());
        var.setMobile(mobileTB.getText());
        var.setInformPeople(informPeopleTB.getText());
        var.setRelation(relationTB.getText());
View Full Code Here

Examples of org.zkoss.zul.Datebox

    public void objToView(Object obj) {
        RequestMaintainForm form = (RequestMaintainForm) obj;

        Textbox requestByTB = (Textbox) getFellow("requestBy");
        Datebox requestAtDate = (Datebox) getFellow("requestAtDate");
        Timebox requestAtTime = (Timebox) getFellow("requestAtTime");
        Combobox statusCB = (Combobox) getFellow("status");
        Textbox requestMobilePhoneTB = (Textbox) getFellow("requestMobilePhone");
        Combobox urgentLevelCB = (Combobox) getFellow("urgentLevel");

        requestByTB.setText(form.getRequestBy());
        requestAtDate.setValue(form.getRequestAt());
        requestAtTime.setValue(form.getRequestAt());
        Iterator statusCBItr = statusCB.getItems().iterator();
        while (statusCBItr.hasNext()) {
            Comboitem item = (Comboitem) statusCBItr.next();
            if (item.getValue().toString().equals(form.getStatus())) {
                statusCB.setSelectedItem(item);
            }
        }
        requestMobilePhoneTB.setText(form.getRequestMobilePhone());

        Textbox requestMaintainNoTB = (Textbox) getFellow("requestMaintainNo");
        Combobox buildingCB = (Combobox) getFellow("building");
        Textbox requestReasonTB = (Textbox) getFellow("requestReason");
        Datebox firstResponseAtDate = (Datebox) getFellow("firstResponseAtDate");
        Timebox firstResponseAtTime = (Timebox) getFellow("firstResponseAtTime");
        Textbox responseMessageTB = (Textbox) getFellow("responseMessage");

        requestMaintainNoTB.setText(form.getRequestMaintainNo());
        Iterator buildingCBItr = buildingCB.getItems().iterator();
        while (buildingCBItr.hasNext()) {
            Comboitem item = (Comboitem) buildingCBItr.next();
            Building building = (Building) item.getValue();
            if (building.getBuildingId().toString().equals(form.getBuildingId().toString())) {
                buildingCB.setSelectedItem(item);
            }
        }
        requestReasonTB.setText(form.getRequestReason());
        firstResponseAtDate.setValue(form.getFirstResponseAt());
        firstResponseAtTime.setValue(form.getFirstResponseAt());
        responseMessageTB.setText(form.getResponseMessage());

        Datebox responseSolutionAtDate = (Datebox) getFellow("responseSolutionAtDate");
        Timebox responseSolutionAtTime = (Timebox) getFellow("responseSolutionAtTime");
        Textbox solutionMessageTB = (Textbox) getFellow("solutionMessage");

        responseSolutionAtDate.setValue(form.getResponseSolutionAt());
        responseSolutionAtTime.setValue(form.getResponseSolutionAt());
        solutionMessageTB.setText(form.getSolutionMessage());


View Full Code Here

Examples of org.zkoss.zul.Datebox

                iae.printStackTrace();
            }
        }

        Textbox requestByTB = (Textbox) getFellow("requestBy");
        Datebox requestAtDate = (Datebox) getFellow("requestAtDate");
        Timebox requestAtTime = (Timebox) getFellow("requestAtTime");
        Combobox statusCB = (Combobox) getFellow("status");
        Textbox requestMobilePhoneTB = (Textbox) getFellow("requestMobilePhone");
        Combobox urgentLevelCB = (Combobox) getFellow("urgentLevel");

        var.setRequestBy(requestByTB.getText());
        if (requestAtDate.getValue() != null
                && requestAtTime.getValue() != null) {
            Timestamp requestAt = new Timestamp(requestAtDate.getValue().getTime());
            requestAt.setHours(requestAtTime.getValue().getHours());
            requestAt.setMinutes(requestAtTime.getValue().getMinutes());
            var.setRequestAt(requestAt);
        }
        var.setStatus(statusCB.getSelectedItem().getValue().toString());
        var.setRequestMobilePhone(requestMobilePhoneTB.getText());
        var.setUrgentLevel(urgentLevelCB.getSelectedItem().getValue().toString());

        Textbox requestMaintainNoTB = (Textbox) getFellow("requestMaintainNo");
        Combobox buildingCB = (Combobox) getFellow("building");
        Textbox requestReasonTB = (Textbox) getFellow("requestReason");
        Datebox firstResponseAtDate = (Datebox) getFellow("firstResponseAtDate");
        Timebox firstResponseAtTime = (Timebox) getFellow("firstResponseAtTime");
        Textbox responseMessageTB = (Textbox) getFellow("responseMessage");

        var.setRequestMaintainNo(requestMaintainNoTB.getText());
        var.setBuilding((Building) buildingCB.getSelectedItem().getValue());
        var.setRequestReason(requestReasonTB.getText());
        if (firstResponseAtDate.getValue() != null
                && firstResponseAtTime.getValue() != null) {
            Timestamp firstResponseAt = new Timestamp(firstResponseAtDate.getValue().getTime());
            firstResponseAt.setHours(firstResponseAtTime.getValue().getHours());
            firstResponseAt.setMinutes(firstResponseAtTime.getValue().getMinutes());
            var.setFirstResponseAt(firstResponseAt);
        }


        var.setResponseMessage(responseMessageTB.getText());

        Datebox responseSolutionAtDate = (Datebox) getFellow("responseSolutionAtDate");
        Timebox responseSolutionAtTime = (Timebox) getFellow("responseSolutionAtTime");
        Textbox solutionMessageTB = (Textbox) getFellow("solutionMessage");

        if (responseSolutionAtDate.getValue() != null
                && responseSolutionAtTime.getValue() != null) {
            Timestamp responseSolutionAt = new Timestamp(responseSolutionAtDate.getValue().getTime());
            responseSolutionAt.setHours(responseSolutionAtTime.getValue().getHours());
            responseSolutionAt.setMinutes(responseSolutionAtTime.getValue().getMinutes());
            var.setResponseSolutionAt(responseSolutionAt);
        }
        var.setSolutionMessage(solutionMessageTB.getText());
View Full Code Here

Examples of org.zkoss.zul.Datebox

            if (authForm.getAuthId().toString().equals(obj.getAuthId().toString())) {
                authListbox.setSelectedItem(item);
            }
        }

        Datebox validAfterDate = (Datebox) getFellow("validAfterDate");
        Timebox validAfterTime = (Timebox) getFellow("validAfterTime");
        if (obj.getValidAfter() != null) {
            validAfterDate.setValue(obj.getValidAfter());
            validAfterTime.setValue(obj.getValidAfter());
        }

        Datebox validBeforeDate = (Datebox) getFellow("validBeforeDate");
        Timebox validBeforeTime = (Timebox) getFellow("validBeforeTime");
        if (obj.getValidBefore() != null) {
            validBeforeDate.setValue(obj.getValidBefore());
            validBeforeTime.setValue(obj.getValidBefore());
        }

    }
View Full Code Here

Examples of org.zkoss.zul.Datebox

        var.setUser(user);
        Listbox authListbox = (Listbox) getFellow("auth");
        var.setAuth((Auth) (authListbox.getSelectedItem()).getValue());

        Datebox validAfterDate = (Datebox) getFellow("validAfterDate");
        Timebox validAfterTime = (Timebox) getFellow("validAfterTime");
        if (validAfterDate.getValue() != null
                && validAfterTime.getValue() != null) {
            Timestamp validAfter = new Timestamp(validAfterDate.getValue().getTime());
            validAfter.setHours(validAfterTime.getValue().getHours());
            validAfter.setMinutes(validAfterTime.getValue().getMinutes());
            var.setValidAfter(validAfter);
        }

        Datebox validBeforeDate = (Datebox) getFellow("validBeforeDate");
        Timebox validBeforeTime = (Timebox) getFellow("validBeforeTime");
        if (validBeforeDate.getValue() != null
                && validBeforeTime.getValue() != null) {
            Timestamp validBefore = new Timestamp(validBeforeDate.getValue().getTime());
            validBefore.setHours(validBeforeTime.getValue().getHours());
            validBefore.setMinutes(validBeforeTime.getValue().getMinutes());
            var.setValidBefore(validBefore);
        }
View Full Code Here

Examples of org.zkoss.zul.Datebox

        private void appendValidFromListcell(Listitem item,
                final CalendarAvailability calendarAvailability) {
            Listcell listcell = new Listcell();

            final Datebox datebox = new Datebox();
            Datebox dateboxValidFrom = Util.bind(datebox,
                    new Util.Getter<Date>() {

                        @Override
                        public Date get() {
                            LocalDate startDate = calendarAvailability
View Full Code Here

Examples of org.zkoss.zul.Datebox

        private void appendExpirationDateListcell(Listitem item,
                final CalendarAvailability calendarAvailability) {
            Listcell listcell = new Listcell();

            final Datebox datebox = new Datebox();
            Datebox dateboxExpirationDate = Util.bind(datebox,
                    new Util.Getter<Date>() {

                        @Override
                        public Date get() {
                            LocalDate endDate = calendarAvailability
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.