• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EditableValueHolder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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;
}
 
开发者ID:elielwaltrick,项目名称:ol3jsf,代码行数:30,代码来源:ComponentUtils.java


示例17: adjustState

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
/** 
 * Save the new paging state back to the given component (adjusting firstItem and lastItem first if necessary)
 */
private static void adjustState(FacesContext context, UIComponent component, int firstItem, int lastItem, int pageSize, int totalItems, int newFirstItem, int newLastItem, int newPageSize)
{
	// recalculate last item
	newLastItem = Math.min(newFirstItem + newPageSize, totalItems);
	if (newPageSize <= 0) 
	{
		// if displaying all items
		newFirstItem = 0;
		newLastItem = totalItems;
	}

	// we don't count lastItem changing as a full state change (value of this component doesn't change)
    if (newLastItem != lastItem) RendererUtil.setAttribute(context, component, "lastItem", new Integer(newLastItem));

    // send the newly changed values where they need to go
	if (newPageSize != pageSize) RendererUtil.setAttribute(context, component, "pageSize", new Integer(newPageSize));
	if (newFirstItem != firstItem) RendererUtil.setAttribute(context, component, "firstItem", new Integer(newFirstItem));
    	
	// Set value, which causes registered valueChangeListener to be called
	EditableValueHolder evh = (EditableValueHolder) component;
	String newValue = formatValue(newFirstItem, newPageSize);
	Object oldValue = (String)evh.getValue();
	if (!newValue.equals(oldValue))
	{
		if (oldValue != null) {
			evh.setSubmittedValue(newValue);
			evh.setValid(true);
		} else {
			// Need to initialize value string based on initial parameters.
			if (log.isDebugEnabled()) log.debug("initializing value to " + newValue);
			evh.setValue(newValue);
		}
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:38,代码来源:PagerRenderer.java


示例18: restoreChildState

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
private void restoreChildState(FacesContext faces, UIComponent c) {
	// reset id
	String id = c.getId();
	c.setId(id);

	// hack
	if (c instanceof EditableValueHolder) {
		EditableValueHolder evh = (EditableValueHolder) c;
		String clientId = c.getClientId(faces);
		SavedState ss = this.getChildState().get(clientId);
		if (ss != null) {
			ss.apply(evh);
		} else {
			String childId = clientId.substring(initialClientId.length() + 1);
			childId = childId.substring(childId.indexOf(getSeparatorChar(faces)) + 1);
			childId = initialClientId + getSeparatorChar(faces) + childId;
			if (initialChildState.containsKey(childId)) {
				SavedState initialState = initialChildState.get(childId);
				initialState.apply(evh);
			} else {
				NullState.apply(evh);
			}
		}
	}

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


示例19: saveInitialChildState

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
/**
 * Recursively create the initial state for the given component.
 * 
 * @param facesContext
 *            the Faces context.
 * @param component
 *            the UI component to save the state for.
 * @see #saveInitialChildState(javax.faces.context.FacesContext)
 */
private void saveInitialChildState(FacesContext facesContext, UIComponent component) {
	if (component instanceof EditableValueHolder && !component.isTransient()) {
		String clientId = component.getClientId(facesContext);
		SavedState state = new SavedState();
		initialChildState.put(clientId, state);
		state.populate((EditableValueHolder) component);
	}

	Iterator<UIComponent> iterator = component.getFacetsAndChildren();
	while (iterator.hasNext()) {
		saveChildState(facesContext, iterator.next());
	}
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:23,代码来源:TabRepeat.java


示例20: decode

import javax.faces.component.EditableValueHolder; //导入依赖的package包/类
@Override
    public void decode(FacesContext context, UIComponent component) {
        // SPR # LHEY9QHH58
        // Ensure that when a parent panel control is read-only
        // that we do not save "" (empty string) as the current field value.
//            super.decode(context, component);
        
        // We should reset the submitted value as it might be validated otherwise
        if(component instanceof EditableValueHolder) {
            ((EditableValueHolder)component).setSubmittedValue(null);
        }
    }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:13,代码来源:ReadOnlyRadioGroupRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OpenIntToDoubleHashMap类代码示例发布时间:2022-05-22
下一篇:
Java OFMeterFeatures类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap