Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.WrongValueException


        Constraint newConstraint = new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if (((BigDecimal) value) == null) {
                    throw new WrongValueException(comp,
                            _("Value is not valid, the precision value must not be empty"));
                }

                if (!(advanceTypeModel.isPrecisionValid((BigDecimal) value))) {
                    throw new WrongValueException(
                            comp,
                            _("Invalid value. Precission value must be lower than the Default Max value."));
                }
            }
        };
View Full Code Here


        Constraint newConstraint = new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if (((BigDecimal) value) == null) {
                    throw new WrongValueException(comp,
                            _("Invalid value. Default Max Value cannot be empty"));
                }
                if (!(advanceTypeModel
                        .isDefaultMaxValueValid((BigDecimal) value))) {
                    throw new WrongValueException(
                            comp,
                            _("Value is not valid, the default max value must be greater than the precision value "));
                }
            }
        };
View Full Code Here

        Constraint newConstraint = new Constraint() {
            @Override
            public void validate(Component comp, Object value)
                    throws WrongValueException {
                if (((String) value).isEmpty()) {
                    throw new WrongValueException(comp,
                            _("The name is not valid, the name must not be null "));
                }
                if (!advanceTypeModel.distinctNames((String) value)) {
                    throw new WrongValueException(comp,
                            _("The name is not valid, there is another progress type with the same name. "));
                }
            }
        };
        return newConstraint;
View Full Code Here

            advanceTypeModel.setDefaultMaxValue(defaultMaxValue);
        } catch (IllegalArgumentException e) {
            Component component = editWindow.getFellow(
                    "defaultMaxValue");

            throw new WrongValueException(component, e.getMessage());
        }
    }
View Full Code Here

                if ((finishDate != null)
                        && (filterStartDateOrderElement.getValue() != null)
                        && (finishDate.compareTo(filterStartDateOrderElement
                                .getValue()) < 0)) {
                    filterFinishDateOrderElement.setValue(null);
                    throw new WrongValueException(comp,
                            _("must be after start date"));
                }
            }
        };
    }
View Full Code Here

                if ((startDate != null)
                        && (filterFinishDateOrderElement.getValue() != null)
                        && (startDate.compareTo(filterFinishDateOrderElement
                                .getValue()) > 0)) {
                    filterStartDateOrderElement.setValue(null);
                    throw new WrongValueException(comp,
                            _("must be lower than end date"));
                }
            }
        };
    }
View Full Code Here

    }

    public void onSelectOrder() {
        Order order = (Order) bdOrders.getSelectedElement();
        if (order == null) {
            throw new WrongValueException(bdOrders, _("please, select a project"));
        }
        boolean result = timeLineRequiredMaterialModel
                .addSelectedOrder(order);
        if (!result) {
            throw new WrongValueException(bdOrders,
                    _("This project has already been added."));
        } else {
            Util.reloadBindings(lbOrders);
        }
        bdOrders.clear();
View Full Code Here

            private int getIterations() {
                int iterations = ibIterations.getValue() != null ? ibIterations
                        .getValue().intValue() : 0;
                if (iterations == 0) {
                    throw new WrongValueException(ibIterations,
                            _("cannot be empty"));
                }
                if (iterations < 0 || iterations > MAX_NUMBER_ITERATIONS) {
                    throw new WrongValueException(ibIterations,
                            _("Number of iterations should be between 1 and {0}",
                                    MAX_NUMBER_ITERATIONS));
                }
                return iterations;
            }

            private void validateRowsPercentages() {
                Intbox intbox;

                int page = 0;
                int counter = 0;

                Rows rows = gridCriticalPathTasks.getRows();
                for (Object each : rows.getChildren()) {
                    Row row = (Row) each;
                    List<org.zkoss.zk.ui.Component> children = row
                            .getChildren();

                    Integer sum = 0;
                    intbox = (Intbox) children.get(3);
                    sum += intbox.getValue();
                    intbox = (Intbox) children.get(5);
                    sum += intbox.getValue();
                    intbox = (Intbox) children.get(7);
                    sum += intbox.getValue();

                    if (sum != 100) {
                        gridCriticalPathTasks.setActivePage(page);
                        throw new WrongValueException(row,
                                _("Percentages should sum 100"));
                    }

                    counter++;
                    if (counter % gridCriticalPathTasks.getPageSize() == 0) {
View Full Code Here

            showAt(comp, invalidValue);
        }
    }

    private static void showAt(Component comp, InvalidValue invalidValue) {
        throw new WrongValueException(comp, _(invalidValue.getMessage()));
    }
View Full Code Here

    private static void showAt(Grid comp, InvalidValue invalidValue) {
        Row row = ComponentsFinder.findRowByValue(comp,
                invalidValue.getInvalidValue());
        if (row != null) {
            throw new WrongValueException(row, _(invalidValue.getMessage()));
        }
    }
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.WrongValueException

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.