当前位置: 首页>>代码示例>>Java>>正文


Java EditableValueHolder类代码示例

本文整理汇总了Java中javax.faces.component.EditableValueHolder的典型用法代码示例。如果您正苦于以下问题:Java EditableValueHolder类的具体用法?Java EditableValueHolder怎么用?Java EditableValueHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EditableValueHolder类属于javax.faces.component包,在下文中一共展示了EditableValueHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void decode(FacesContext context, UIComponent component)
{
  _addChildren(context, component);

  Map<String, Object> attrs = component.getAttributes();
  if (Boolean.TRUE.equals(attrs.get("readOnly")) ||
      Boolean.TRUE.equals(attrs.get("disabled")))
    return;

  // Just clue in component that we have been "submitted" so
  // that it doesn't short-circuit anything
  EditableValueHolder evh = (EditableValueHolder) component;
  evh.setSubmittedValue(Boolean.TRUE);

  // Because these components weren't around during processDecodes(),
  // they didn't get decoded.  So, run that now.
  component.getFacet("month").processDecodes(context);
  component.getFacet("year").processDecodes(context);
  component.getFacet("day").processDecodes(context);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:23,代码来源:DateFieldAsRenderer.java

示例2: _createState

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private static RowState _createState(UIComponent child)
{
  RowState state;
  if (child instanceof EditableValueHolder)
  {
    state = new EVHState();
    state.saveRowState(child);
  }
  else if (child instanceof UIXCollection)
  {
    state = new TableState();
    state.saveRowState(child);
  }
  else if (child instanceof UIXShowDetail)
  {
    state = SDState.getState((UIXShowDetail) child);
  }
  else
  {
    state = null;
  }

  return state;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:25,代码来源:StampState.java

示例3: visit

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@Override
public VisitResult visit(VisitContext context, UIComponent target) {
	FacesContext facesContext = context.getFacesContext();
	Collection<String> executeIds = facesContext.getPartialViewContext().getExecuteIds();

	if (executeIds.contains(target.getClientId(facesContext))) {
		return VisitResult.REJECT;
	}

	if (target instanceof EditableValueHolder) {
		((EditableValueHolder) target).resetValue();
	}
	else if (context.getIdsToVisit() != VisitContext.ALL_IDS) {
		// Render ID didn't specifically point an EditableValueHolder. Visit all children as well.
		if (!SKIP_COMPONENTS.contains(target.getClass())) {
			try {
				target.visitTree(createVisitContext(facesContext, null, context.getHints()), VISIT_CALLBACK);
			} catch (Exception e) {
				// e.printStackTrace();
			}
		}
	}

	return VisitResult.ACCEPT;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:26,代码来源:ResetInputAjaxActionListener.java

示例4: saveChildState

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private void saveChildState(FacesContext faces, UIComponent c) {

		if (c instanceof EditableValueHolder && !c.isTransient()) {
			String clientId = c.getClientId(faces);
			SavedState ss = this.getChildState().get(clientId);
			if (ss == null) {
				ss = new SavedState();
				this.getChildState().put(clientId, ss);
			}
			ss.populate((EditableValueHolder) c);
		}

		// continue hack
		Iterator itr = c.getFacetsAndChildren();
		while (itr.hasNext()) {
			saveChildState(faces, (UIComponent) itr.next());
		}
	}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:19,代码来源:TabRepeat.java

示例5: scan

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
/**
 * Walk the component tree branch built by the composite component and locate the input container elements.
 *
 * @return a composite object of the input container elements
 */
protected InputContainerElements scan(final UIComponent component, InputContainerElements elements,
                                      final FacesContext context) {
    if (elements == null) {
        elements = new InputContainerElements();
    }

    // NOTE we need to walk the tree ignoring rendered attribute because it's condition
    // could be based on what we discover
    if ((elements.getLabel() == null) && (component instanceof HtmlOutputLabel)) {
        elements.setLabel((HtmlOutputLabel) component);
    } else if (component instanceof EditableValueHolder) {
        elements.registerInput((EditableValueHolder) component, getDefaultValidator(context), context);
    } else if (component instanceof UIMessage) {
        elements.registerMessage((UIMessage) component);
    }
    // may need to walk smarter to ensure "element of least suprise"
    for (UIComponent child : component.getChildren()) {
        scan(child, elements, context);
    }

    return elements;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:28,代码来源:UIInputContainer.java

示例6: 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;
            }
        }
    }
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:18,代码来源:UIInputContainer.java

示例7: decode

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@Override
protected void decode(
  FacesContext facesContext,
  UIComponent  component,
  @SuppressWarnings("unused")
  FacesBean    facesBean,
  String       clientId)
{
  if (skipDecode(facesContext))
    return;

  Object submittedValue;
  if (!wasSubmitted(facesContext, component))
    submittedValue = null;
  else
  {
    if (clientId == null)
    {
      clientId = component.getClientId(facesContext);
    }
    submittedValue = getSubmittedValue(facesContext, component, clientId);
  }

  if (_LOG.isFinest())
  {
    if (clientId == null)
    {
      clientId = component.getClientId(facesContext);
    }
    _LOG.finest("Value submitted for ID {0} is {1}",
      new Object[]{clientId, submittedValue});
  }

  EditableValueHolder evh = (EditableValueHolder) component;
  evh.setSubmittedValue(submittedValue);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:37,代码来源:EditableValueRenderer.java

示例8: _resetChildren

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void _resetChildren(UIComponent comp)
{
  Iterator<UIComponent> kids = comp.getFacetsAndChildren();

  while (kids.hasNext())
  {
    UIComponent kid = kids.next();
    
    if (kid instanceof UIXEditableValue)
    {
      ((UIXEditableValue) kid).resetValue();
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }
    else if (kid instanceof EditableValueHolder)
    {
      _resetEditableValueHolder((EditableValueHolder) kid);
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }
    else if (kid instanceof UIXCollection)
    {
      ((UIXCollection) kid).resetStampState();
      RequestContext.getCurrentInstance().addPartialTarget(kid);
    }

    _resetChildren(kid);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:29,代码来源:ResetActionListener.java

示例9: _resetEditableValueHolder

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private void _resetEditableValueHolder(EditableValueHolder evh)
{
  evh.setValue(null);
  evh.setSubmittedValue(null);
  evh.setLocalValueSet(false);
  evh.setValid(true);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:8,代码来源:ResetActionListener.java

示例10: _addChildren

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void _addChildren(FacesContext context, UIComponent component)
{
  // If the components are already there, bail.
  if (component.getFacet("month") != null)
    return;

  String id = component.getId();
  if (id == null)
  {
    id = context.getViewRoot().createUniqueId();
    component.setId(id);
  }

  Map<String, UIComponent> facets = component.getFacets();
  facets.clear();

  Date value = (Date) ((EditableValueHolder) component).getValue();
  Calendar calendar = null;
  if(value != null)
  {
    calendar = Calendar.getInstance();
    calendar.setLenient(true);
    calendar.setTime(value);
  }

  CoreInputText month = _createTwoDigitInput(context);
  month.setShortDesc("Month");
  month.setId(id + "_month");

  LongRangeValidator monthRange = _createLongRangeValidator(context);
  monthRange.setMinimum(1);
  monthRange.setMaximum(12);
  month.addValidator(monthRange);
  if (value != null)
    month.setValue(new Integer(calendar.get(Calendar.MONTH) + 1));
  facets.put("month", month);

  CoreInputText day = _createTwoDigitInput(context);
  day.setShortDesc("Day");
  day.setId(id + "_day");
  LongRangeValidator dayRange = _createLongRangeValidator(context);
  dayRange.setMinimum(1);
  dayRange.setMaximum(31);
  day.addValidator(dayRange);
  if (value != null)
    day.setValue(new Integer(calendar.get(Calendar.DAY_OF_MONTH)));
  facets.put("day", day);

  CoreInputText year = _createTwoDigitInput(context);
  year.setShortDesc("Year");
  year.setId(id + "_year");
  if (value != null)
  {
    int yearValue = calendar.get(Calendar.YEAR) - 1900;
    if (yearValue >= 100)
      yearValue -= 100;
    year.setValue(new Integer(yearValue));
  }

  facets.put("year", year);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:63,代码来源:DateFieldAsRenderer.java

示例11: doStartTag

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@Override
public int doStartTag() throws JspException
{
    UIComponentClassicTagBase componentTag = UIComponentELTag.getParentUIComponentClassicTagBase(pageContext);

    if (componentTag == null)
    {
        throw new JspException("no parent UIComponentTag found");
    }

    if (!componentTag.getCreated())
    {
        return Tag.SKIP_BODY;
    }

    Validator validator = createValidator();

    UIComponent component = componentTag.getComponentInstance();
    if (component == null)
    {
        throw new JspException("parent UIComponentTag has no UIComponent");
    }

    if (!(component instanceof EditableValueHolder))
    {
        throw new JspException("UIComponent is no EditableValueHolder");
    }
    ((EditableValueHolder)component).addValidator(validator);

    return Tag.SKIP_BODY;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:32,代码来源:TrinidadValidatorELTag.java

示例12: _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);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:8,代码来源:StampState.java

示例13: doTestUpdateModelValues

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
/**
 * Tests the update-model-values lifecycle phase.
 */
protected void doTestUpdateModelValues(
  UIViewRoot  root,
  UIComponent component)
{

  Mock mockRenderkit = getMockRenderKitWrapper().getMock();

  Mock mockRenderer = mock(Renderer.class);
  Renderer renderer = (Renderer) mockRenderer.proxy();
  mockRenderkit.stubs().method("getRenderer").will(returnValue(renderer));

  Mock mockBinding = mock(ValueBinding.class);
  ValueBinding binding = (ValueBinding) mockBinding.proxy();

  setCurrentContext(facesContext);

  // if the component is an EditableValueHolder, then the value binding
  // must be updated with the new value before this phase completes.
  if (component instanceof EditableValueHolder)
  {
    EditableValueHolder editable = (EditableValueHolder)component;
    component.setValueBinding("value", binding);
    editable.setValue("newValue");
    mockBinding.expects(atLeastOnce()).method("setValue").with(eq(facesContext), eq("newValue"));

    assertEquals(true, editable.isLocalValueSet());
  }

  doTestUpdateModelValues(facesContext, root, component);

  setCurrentContext(null);

  mockRenderer.verify();
  mockBinding.verify();
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:39,代码来源:UIComponentTestCase.java

示例14: _setEVHData

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private void _setEVHData(
  EditableValueHolder testComp,
  String value,
  boolean isValid)
{
  testComp.setSubmittedValue("submitedValue-"+value);
  testComp.setValue("Value-"+value);
  testComp.setValid(isValid);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:UIXTableTest.java

示例15: _testEVHData

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private void _testEVHData(
  EditableValueHolder testComp,
  String value,
  boolean isValid)
{
  assertEquals("submitedValue-"+value, testComp.getSubmittedValue());
  assertEquals("Value-"+value, testComp.getLocalValue());
  assertEquals(isValid, testComp.isValid());
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:10,代码来源:UIXTableTest.java


注:本文中的javax.faces.component.EditableValueHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。