/** * The following actions are performed: * * <ul> * <li>Defaults maxLength, minLength (if not set) to maxLength of parent field * </ul> * * {@inheritDoc} */ @Override public void performFinalize(Object model, LifecycleElement parent) { super.performFinalize(model, parent); if (parent instanceof InputField) { InputField field = (InputField) parent; if (getMaxLength() == null) { setMaxLength(field.getMaxLength()); } if (getMinLength() == null) { setMinLength(field.getMinLength()); } } }
/** Test {@link ComponentUtils#cleanContextDeap} using a BreadcrumbItem object */ @Test public void testCleanContextDeap() { Map<String, Object> context = new HashMap<String, Object>(); context.put("contextkey", "value"); context.put("contextkey2", "value2"); BreadcrumbItem breadcrumbItem = new BreadcrumbItem(); breadcrumbItem.setContext(context); InputField inputField = new InputFieldBase(); inputField.setContext(context); Label fieldLabel = new Label(); fieldLabel.setContext(context); Tooltip labelTootlip = new Tooltip(); labelTootlip.setContext(context); fieldLabel.setToolTip(labelTootlip); inputField.setFieldLabel(fieldLabel); breadcrumbItem.setSiblingBreadcrumbComponent(inputField); Tooltip tooltip = new Tooltip(); tooltip.setContext(context); breadcrumbItem.setToolTip(tooltip); ComponentUtils.cleanContextDeap(breadcrumbItem); assertEquals(0, breadcrumbItem.getContext().size()); assertEquals(0, inputField.getContext().size()); assertEquals(0, fieldLabel.getContext().size()); assertEquals(0, labelTootlip.getContext().size()); assertEquals(0, tooltip.getContext().size()); }