Package org.zkoss.zul

Examples of org.zkoss.zul.Datebox


     * Append a Datebox "init date" to row
     *
     * @param row
     */
    private void appendDateboxInitDate(final Row row) {
        Datebox initDateBox = new Datebox();
        bindDateboxInitDate(initDateBox, (HourCost) row.getValue());
        initDateBox.setConstraint("no empty:" + _("Start date cannot be empty"));
        row.appendChild(initDateBox);

        initDateBox.addEventListener("onChange", new EventListener() {

            @Override
            public void onEvent(Event event) {
                // Updates the constraint of the endDate box with the new date
                LocalDate initDate = ((HourCost)row.getValue()).getInitDate();
                Datebox endDateBox = (Datebox) row.getChildren().get(4);
                endDateBox.setConstraint("after " +
                        String.format("%04d", initDate.getYear()) +
                        String.format("%02d", initDate.getMonthOfYear()) +
                        String.format("%02d", initDate.getDayOfMonth()));
            }
        });
View Full Code Here


     * Append a Datebox "end date" to row
     *
     * @param row
     */
    private void appendDateboxEndDate(Row row) {
        Datebox endDateBox = new Datebox();
        bindDateboxEndDate(endDateBox, (HourCost) row.getValue());
        LocalDate initDate = ((HourCost)row.getValue()).getInitDate();
        if (initDate != null) {
            endDateBox.setConstraint("after " +
                    String.format("%04d", initDate.getYear()) +
                    String.format("%02d", initDate.getMonthOfYear()) +
                    String.format("%02d", initDate.getDayOfMonth()));
        }
        row.appendChild(endDateBox);
View Full Code Here

            row.appendChild(txtConcept);
        }

        private void appendDateInLines(Row row) {
            final ExpenseSheetLine expenseSheetLine = (ExpenseSheetLine) row.getValue();
            final Datebox dateboxExpense = new Datebox();
            Util.bind(dateboxExpense, new Util.Getter<Date>() {

                @Override
                public Date get() {
                    if (expenseSheetLine != null) {
                        if (expenseSheetLine.getDate() != null) {
                            return expenseSheetLine.getDate().toDateTimeAtStartOfDay().toDate();
                        }
                    }
                    return null;
                }

            }, new Util.Setter<Date>() {

                @Override
                public void set(Date value) {
                    if (expenseSheetLine != null) {
                        LocalDate newDate = null;
                        if (value != null) {
                            newDate = LocalDate.fromDateFields(value);
                        }
                        expenseSheetModel.keepSortedExpenseSheetLines(expenseSheetLine,
                                newDate);
                        reloadExpenseSheetLines();
                    }
                }
            });

            dateboxExpense.setConstraint("no empty:" + _("cannot be empty"));
            row.appendChild(dateboxExpense);
        }
View Full Code Here

            listcell.appendChild(component);
            item.appendChild(listcell);
        }

        private void appendDate(Listitem item, final Stretch stretch) {
            final Datebox tempDatebox = new Datebox();
            Datebox datebox = Util.bind(tempDatebox, new Util.Getter<Date>() {
                @Override
                public Date get() {
                    return stretchesFunctionModel.getStretchDate(stretch);
                }
            }, new Util.Setter<Date>() {
View Full Code Here

                exceptionTypes.setSelectedItem(item);
                break;
            }
        }

        Datebox dateboxStartDate = (Datebox) window
                .getFellow("exceptionStartDate");
        dateboxStartDate.setValue(toDate(selectedDay));
        Datebox dateboxEndDate = (Datebox) window.getFellow("exceptionEndDate");
        dateboxEndDate.setValue(toDate(selectedDay));
        capacityPicker.setValue(baseCalendarModel.getWorkableCapacity());
    }
View Full Code Here

                    _("Please, select type of exception"));
        } else {
            Clients.closeErrorBox(exceptionTypes);
        }

        Datebox dateboxStartDate = (Datebox) window
                .getFellow("exceptionStartDate");
        Date startDate = dateboxStartDate.getValue();
        if (startDate == null) {
            throw new WrongValueException(dateboxStartDate,
                    _("You should select a start date for the exception"));
        } else {
            Clients.closeErrorBox(dateboxStartDate);
        }
        Datebox dateboxEndDate = (Datebox) window.getFellow("exceptionEndDate");
        Date endDate = dateboxEndDate.getValue();
        if (endDate == null) {
            throw new WrongValueException(dateboxEndDate,
                    _("Please, select an End Date for the Exception"));
        } else {
            Clients.closeErrorBox(dateboxEndDate);
View Full Code Here

    public void updateException() {
        Combobox exceptionTypes = (Combobox) window.getFellow("exceptionTypes");
        CalendarExceptionType type = (CalendarExceptionType) exceptionTypes
                .getSelectedItem().getValue();

        Datebox dateboxStartDate = (Datebox) window
                .getFellow("exceptionStartDate");
        Date startDate = dateboxStartDate.getValue();
        if (startDate == null) {
            throw new WrongValueException(dateboxStartDate,
                    _("You should select a start date for the exception"));
        } else {
            Clients.closeErrorBox(dateboxStartDate);
        }
        Datebox dateboxEndDate = (Datebox) window.getFellow("exceptionEndDate");
        Date endDate = dateboxEndDate.getValue();
        if (endDate == null) {
            throw new WrongValueException(dateboxEndDate,
                    _("Please, select an End Date for the Exception"));
        } else {
            Clients.closeErrorBox(dateboxEndDate);
View Full Code Here

            listItem.appendChild(listCell);
        }

        private void appendStartDatebox(final Listitem listItem,
                final CalendarData version) {
            Datebox datebox = new Datebox();

            final LocalDate dateValidFrom = baseCalendarModel
                    .getValidFrom(version);
            if (dateValidFrom != null) {
                Util.bind(datebox, new Util.Getter<Date>() {
                    @Override
                    public Date get() {
                        return dateValidFrom.toDateTimeAtStartOfDay().toDate();
                    }
                });
                datebox.setDisabled(false);
            } else {
                datebox.setDisabled(true);
            }

            datebox.addEventListener(Events.ON_CHANGE, new EventListener() {
                @Override
                public void onEvent(Event event) throws Exception {
                    reloadWorkWeeksList();
                }
            });

            datebox.setConstraint(new Constraint() {
                @Override
                public void validate(Component comp, Object value)
                        throws WrongValueException {
                    try {
                        baseCalendarModel.checkAndChangeStartDate(version,
View Full Code Here

            listItem.appendChild(listCell);
        }

        private void appendExpiringDatebox(final Listitem listItem,
                final CalendarData version) {
            Datebox datebox = new Datebox();

            final LocalDate expiringDate = version.getExpiringDate();
            if (expiringDate != null) {
                datebox.setDisabled(false);
            } else {
                datebox.setDisabled(true);
            }

            Util.bind(datebox, new Util.Getter<Date>() {
                @Override
                public Date get() {
                    LocalDate expiringDate = version.getExpiringDate();
                    if (expiringDate != null) {
                        return expiringDate.minusDays(1)
                                .toDateTimeAtStartOfDay().toDate();
                    }
                    return null;
                }
            }, new Util.Setter<Date>() {
                @Override
                public void set(Date value) {
                    LocalDate expiringDate = null;
                    if (value != null) {
                        expiringDate = new LocalDate(value).plusDays(1);
                    }
                    version.setExpiringDate(expiringDate);
                }
            });

            datebox.addEventListener(Events.ON_CHANGE, new EventListener() {
                @Override
                public void onEvent(Event event) throws Exception {
                    reloadWorkWeeksList();
                }
            });

            datebox.setConstraint(new Constraint() {
                @Override
                public void validate(Component comp, Object value)
                        throws WrongValueException {
                    Date date = ((Date) value);
                    try {
View Full Code Here

        }

        private void appendDateboxDate(final Listitem listitem) {
            final AdvanceMeasurement advanceMeasurement = (AdvanceMeasurement) listitem
                    .getValue();
            final Datebox date = new Datebox();

            Listcell listcell = new Listcell();
            listcell.appendChild(date);
            listitem.appendChild(listcell);

            date.setDisabled(isReadOnlyAdvanceMeasurements()
                    || manageOrderElementAdvancesModel
                            .hasConsolidatedAdvances(advanceMeasurement)
                    || manageOrderElementAdvancesModel.isAlreadyReportedProgress(advanceMeasurement));

            date.addEventListener(Events.ON_CHANGE, new EventListener() {

                @Override
                public void onEvent(Event event) {
                    if (manageOrderElementAdvancesModel
                            .canRemoveOrChange(advanceMeasurement)) {
                        validateMeasurementDate(date, date.getValue());
                        setCurrentDate(listitem);
                    } else {
                        throw new WrongValueException(
                                date,
                                _("Progress Measurement cannot be deleted. Progress Measurement already consolidated"));
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Datebox

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.