/** * The following actions are performed: * * <ul> * <li>Add all option if enabled and control is multi-value * </ul> * * {@inheritDoc} */ @Override public void performFinalize(Object model, LifecycleElement parent) { super.performFinalize(model, parent); // if enabled add option to select all values if (addControlSelectAllOption && (getControl() != null) && getControl() instanceof MultiValueControl) { String allOptionText = KRADServiceLocatorWeb.getMessageService() .getMessageText(UifConstants.MessageKeys.OPTION_ALL); MultiValueControl multiValueControl = (MultiValueControl) getControl(); if (multiValueControl.getOptions() != null) { multiValueControl.getOptions().add(0, new ConcreteKeyValue("", allOptionText)); } if (multiValueControl.getRichOptions() != null) { Message message = ComponentFactory.getMessage(); message.setMessageText(allOptionText); message.setRenderWrapperTag(false); multiValueControl.getRichOptions().add(0, new KeyMessage("", allOptionText, message)); } } }
@Test public void testSanity() throws Throwable { try { Message message = ComponentFactory.getMessage(); assertEquals("uif-message", message.getCssClasses().get(0)); } catch (NullPointerException e) { Assume.assumeNoException("Missing required testing resources, skipping", e); } }