本文整理汇总了Java中javax.faces.component.EditableValueHolder.isValid方法的典型用法代码示例。如果您正苦于以下问题:Java EditableValueHolder.isValid方法的具体用法?Java EditableValueHolder.isValid怎么用?Java EditableValueHolder.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.component.EditableValueHolder
的用法示例。
在下文中一共展示了EditableValueHolder.isValid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerInput
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
public void registerInput(final EditableValueHolder input, final Validator validator, final FacesContext context) {
inputs.add(input);
if (!input.isValid()) {
validationError = true;
}
// optimization to avoid loop if already flagged
else if (!validationError) {
Iterator<FacesMessage> it = context.getMessages(((UIComponent) input).getClientId(context));
while (it.hasNext()) {
if (it.next().getSeverity().compareTo(FacesMessage.SEVERITY_WARN) >= 0) {
validationError = true;
break;
}
}
}
}
示例2: _assertStampHonoursState
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
private boolean _assertStampHonoursState(EditableValueHolder evh)
{
return (evh.getSubmittedValue() == _submitted) &&
(evh.getLocalValue() == _local) &&
(evh.isLocalValueSet() == _localSet) &&
(evh.isValid() == _valid);
}
示例3: getValueToRender
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
public static String getValueToRender(FacesContext context, UIComponent component) {
if (component instanceof ValueHolder) {
if (component instanceof EditableValueHolder) {
EditableValueHolder input = (EditableValueHolder) component;
Object submittedValue = input.getSubmittedValue();
if (submittedValue == null && context.isValidationFailed() && !input.isValid()) {
return null;
} else if (submittedValue != null) {
return submittedValue.toString();
}
}
ValueHolder valueHolder = (ValueHolder) component;
Object value = valueHolder.getValue();
// format the value as string
if (value != null) {
return value.toString();
} else {
// component is a value holder but has no value
return null;
}
}
// component is not a value holder
return null;
}
示例4: getConvertedValue
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
@Override
public Object getConvertedValue(
FacesContext context,
UIComponent component,
Object submittedValue)
{
EditableValueHolder monthComp = (EditableValueHolder) component.getFacet("month");
EditableValueHolder yearComp = (EditableValueHolder) component.getFacet("year");
EditableValueHolder dayComp = (EditableValueHolder) component.getFacet("day");
if (!monthComp.isValid() ||
!yearComp.isValid() ||
!dayComp.isValid())
{
// =-=AEW What to do????????
//setValid(false);
return null;
}
int year = ((Number) yearComp.getValue()).intValue();
// We'll be 1970 - 2069. Good enough for a demo.
if (year < 70)
year += 100;
int month = ((Number) monthComp.getValue()).intValue() - 1;
int day = ((Number) dayComp.getValue()).intValue();
Date oldValue = (Date) ((EditableValueHolder) component).getValue();
//Date newValue = (Date) oldValue.clone();
Calendar calendar = Calendar.getInstance();
calendar.setLenient(true);
calendar.setTime(oldValue);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, day);
// Invalid day given the month
if (day != calendar.get(Calendar.DAY_OF_MONTH))
{
int numberOfDaysInMonth = day - calendar.get(Calendar.DAY_OF_MONTH);
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Invalid date.",
"This month only has " + numberOfDaysInMonth + " days!");
throw new ConverterException(message);
}
return calendar.getTime();
}
示例5: ChildStateHolder
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
public ChildStateHolder(EditableValueHolder evh) {
this.value = evh.getLocalValue();
this.valid = evh.isValid();
this.submittedValue = evh.getSubmittedValue();
this.localValueSet = evh.isLocalValueSet();
}
示例6: populate
import javax.faces.component.EditableValueHolder; //导入方法依赖的package包/类
public void populate(EditableValueHolder evh) {
this.value = evh.getLocalValue();
this.valid = evh.isValid();
this.submittedValue = evh.getSubmittedValue();
this.localValueSet = evh.isLocalValueSet();
}