/** * 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)); } } }
@Override public void performApplyModel(Object model, LifecycleElement parent) { Object myBo = ObjectPropertyUtils.getPropertyValue( model, KcBindingInfo.getParentBindingInfo(getBindingInfo())); Answer answer = (Answer) myBo; setControl( (Control) ComponentFactory.getNewComponentInstance( getControlMappings().get(answer.getQuestion().getQuestionTypeId().toString()))); getControl().getCssClasses().add("answer"); if (StringUtils.isNotBlank(answer.getQuestion().getLookupClass())) { if (useSuggest) { getSuggest().setRender(true); getSuggest().setValuePropertyName(answer.getQuestion().getLookupReturn()); getSuggest() .getSuggestQuery() .setDataObjectClassName(answer.getQuestion().getLookupClass()); } getQuickfinder().setRender(true); getQuickfinder().setDataObjectClassName(answer.getQuestion().getLookupClass()); getQuickfinder() .getFieldConversions() .put(answer.getQuestion().getLookupReturn(), getPropertyName()); } super.performApplyModel(model, parent); }
/** * Invoked during the finalize phase to capture state of the component needs to support post * operations. */ @Override protected void addComponentPostMetadata() { super.addComponentPostMetadata(); Map<String, Map<String, Object>> lookupCriteriaFields = ViewLifecycle.getViewPostMetadata().getLookupCriteria(); Map<String, Object> criteriaAttributes = new HashMap<String, Object>(); criteriaAttributes.put(UifConstants.LookupCriteriaPostMetadata.COMPONENT_ID, this.getId()); if (this.isDisableWildcardsAndOperators()) { criteriaAttributes.put( UifConstants.LookupCriteriaPostMetadata.DISABLE_WILDCARDS_AND_OPERATORS, true); } if (this.getRequired()) { criteriaAttributes.put(UifConstants.LookupCriteriaPostMetadata.REQUIRED, true); } if (this.hasSecureValue()) { criteriaAttributes.put(UifConstants.LookupCriteriaPostMetadata.SECURE_VALUE, true); } ValidCharactersConstraint validCharactersConstraint = this.getValidCharactersConstraint(); if (validCharactersConstraint != null) { criteriaAttributes.put( UifConstants.LookupCriteriaPostMetadata.VALID_CHARACTERS_CONSTRAINT, validCharactersConstraint); } lookupCriteriaFields.put(this.getPropertyName(), criteriaAttributes); addHiddenComponentPostMetadata(lookupCriteriaFields); }