/** * If the component is an instance of {@link EditableValueHolder} and its old object value is equal to the * submitted value, then return immediately from the method and don't perform any validation. Otherwise, invoke * {@link #validateChangedObject(FacesContext, UIComponent, Object)} which may in turn do the necessary possibly * expensive DAO operations. */ @Override @SuppressWarnings("unchecked") public void validate(FacesContext context, UIComponent component, T submittedValue) { if (component instanceof EditableValueHolder) { T newValue = submittedValue; T oldValue = (T) ((EditableValueHolder) component).getValue(); if (Objects.equals(newValue, oldValue)) { return; } } validateChangedObject(context, component, submittedValue); }
/** * If the component is an instance of {@link EditableValueHolder} and its old object value is equal to the * submitted value, then return immediately from the method and don't perform any validation. Otherwise, invoke * {@link #validateChangedObject(FacesContext, UIComponent, Object)} which may in turn do the necessary possibly * expensive DAO operations. */ @Override @SuppressWarnings("unchecked") public void validate(FacesContext context, UIComponent component, T submittedValue) { if (component instanceof EditableValueHolder) { T newValue = submittedValue; T oldValue = (T) ((EditableValueHolder) component).getValue(); if (Objects.equals(newValue, oldValue)) { return; } } validateChangedObject(context, component, submittedValue); }
public VisitResult visit(VisitContext visitContext, UIComponent uiComponent) { if (uiComponent instanceof EditableValueHolder) { EditableValueHolder editableValueHolder = (EditableValueHolder) uiComponent; String clientId = uiComponent.getClientId(); validMap.put(clientId, editableValueHolder.isValid()); valueMap.put(clientId, editableValueHolder.getValue()); } // Indicate to the caller that the tree walk should continue and that the specified component's subtree // should be processed as well. return VisitResult.ACCEPT; }
public VisitResult visit(VisitContext visitContext, UIComponent uiComponent) { if (uiComponent instanceof EditableValueHolder) { EditableValueHolder editableValueHolder = (EditableValueHolder) uiComponent; String clientId = uiComponent.getClientId(); validMap.put(clientId, editableValueHolder.isValid()); valueMap.put(clientId, editableValueHolder.getValue()); } // Indicate to the caller that the tree walk should continue and that the specified component's subtree // should be processed as well. return VisitResult.ACCEPT; }
public VisitResult visit(VisitContext visitContext, UIComponent uiComponent) { if (uiComponent instanceof EditableValueHolder) { EditableValueHolder editableValueHolder = (EditableValueHolder) uiComponent; String clientId = uiComponent.getClientId(); validMap.put(clientId, editableValueHolder.isValid()); valueMap.put(clientId, editableValueHolder.getValue()); } // Indicate to the caller that the tree walk should continue and that the specified component's subtree // should be processed as well. return VisitResult.ACCEPT; }
/** * Gets the real value of the EditableValueHolder component. * This is necessary, because if the localValue is set, getValue() * normally returns the localValue and not the real value. * @param evh * @param target * @param localValue * @param elCtx * @return */ private Object _getRealValue(EditableValueHolder evh, UIComponent target, final Object localValue, ELContext elCtx) { Object value = evh.getValue(); if (localValue != null && localValue.equals(value)) { // getValue() normally returns the localValue, if it is set // --> try to get the real value from the ValueExpression ValueExpression valueExpression = target.getValueExpression("value"); if (valueExpression != null) { value = valueExpression.getValue(elCtx); } } return value; }
/** * Gets the real value of the EditableValueHolder component. * This is necessary, because if the localValue is set, getValue() * normally returns the localValue and not the real value. * @param evh * @param target * @param localValue * @param elCtx * @return */ private Object _getRealValue(EditableValueHolder evh, UIComponent target, final Object localValue, ELContext elCtx) { Object value = evh.getValue(); if (localValue != null && localValue.equals(value)) { // getValue() normally returns the localValue, if it is set // --> try to get the real value from the ValueExpression ValueExpression valueExpression = target.getValueExpression("value"); if (valueExpression != null) { value = valueExpression.getValue(elCtx); } } return value; }
/** * Gets the real value of the EditableValueHolder component. * This is necessary, because if the localValue is set, getValue() * normally returns the localValue and not the real value. * @param evh * @param target * @param localValue * @param elCtx * @return */ private Object _getRealValue(EditableValueHolder evh, UIComponent target, final Object localValue, ELContext elCtx) { Object value = evh.getValue(); if (localValue != null && localValue.equals(value)) { // getValue() normally returns the localValue, if it is set // --> try to get the real value from the ValueExpression ValueExpression valueExpression = target.getValueExpression("value"); if (valueExpression != null) { value = valueExpression.getValue(elCtx); } } return value; }
/** * If the component is an instance of {@link EditableValueHolder} and the string representation of its old object * value is equal to the submitted value, then immediately return its old object value unchanged. Otherwise, invoke * {@link #getAsChangedObject(FacesContext, UIComponent, String)} which may in turn do the necessary possibly * expensive DAO operations. * @throws ClassCastException When <code>T</code> is of wrong type. */ @Override @SuppressWarnings("unchecked") public T getAsObject(FacesContext context, UIComponent component, String submittedValue) { if (component instanceof EditableValueHolder) { String newStringValue = submittedValue; T oldObjectValue = (T) ((EditableValueHolder) component).getValue(); String oldStringValue = getAsString(context, component, oldObjectValue); if (Objects.equals(newStringValue, oldStringValue)) { return oldObjectValue; } } return getAsChangedObject(context, component, submittedValue); }
/** * If the component is an instance of {@link EditableValueHolder} and the string representation of its old object * value is equal to the submitted value, then immediately return its old object value unchanged. Otherwise, invoke * {@link #getAsChangedObject(FacesContext, UIComponent, String)} which may in turn do the necessary possibly * expensive DAO operations. * @throws ClassCastException When <code>T</code> is of wrong type. */ @Override @SuppressWarnings("unchecked") public T getAsObject(FacesContext context, UIComponent component, String submittedValue) { if (component instanceof EditableValueHolder) { String newStringValue = submittedValue; T oldObjectValue = (T) ((EditableValueHolder) component).getValue(); String oldStringValue = getAsString(context, component, oldObjectValue); if (Objects.equals(newStringValue, oldStringValue)) { return oldObjectValue; } } return getAsChangedObject(context, component, submittedValue); }
public void populate(EditableValueHolder evh) { this.value = evh.getValue(); this.valid = evh.isValid(); this.submittedValue = evh.getSubmittedValue(); this.localValueSet = evh.isLocalValueSet(); }
Collection value = (Collection) ((EditableValueHolder) component).getValue(); if (value instanceof Cloneable) {
Collection value = (Collection) ((EditableValueHolder) component).getValue(); if (value instanceof Cloneable) {
Object oldValue = (String)evh.getValue(); if (!newValue.equals(oldValue)) { if (oldValue != null) {
Object oldValue = (String)evh.getValue(); if (!newValue.equals(oldValue))
Object oldValue = (String)evh.getValue(); if (!newValue.equals(oldValue))
public Object getValue() { /** * If conversion already is done, return value */ if (editableValueHolder.isLocalValueSet()) { return editableValueHolder.getValue(); } /** * Convert submittet value */ Object submittedValue = editableValueHolder.getLocalValue(); if (submittedValue == null) { return null; } Object newValue = null; try { newValue = getConvertedValue(submittedValue); } catch (ConverterException ce) { // Any errors will be attached by JSF return null; } return newValue; }
final Object equalFieldValue = equalField.getSubmittedValue() != null ? equalField.getSubmittedValue() : equalField.getValue();
EditableValueHolder foreignEditableValueHolder = (EditableValueHolder) foreignComp; if (foreignEditableValueHolder.isRequired() && foreignEditableValueHolder.getValue()== null ) { return; if (foreignEditableValueHolder.isValid()) foreignValue = foreignEditableValueHolder.getValue(); if(foreignEditableValueHolder.getValue()==null || !foreignValue.toString().equals(value.toString()) )
Object value = editableValueHolder.getValue();