getAttribute实例例java,Java UIComponent.getAttributes方法代碼示例

本文详细介绍了Java中javax.faces.component.UIComponent.getAttributes方法的使用,包括在不同场景下的应用代码示例,如decode、Station、encodeBegin等方法的实现,涉及组件属性的获取、设置和验证等操作。通过对这些示例的学习,开发者可以更好地理解和掌握该方法的用法。
摘要由CSDN通过智能技术生成

本文整理匯總了Java中javax.faces.component.UIComponent.getAttributes方法的典型用法代碼示例。如果您正苦於以下問題:Java UIComponent.getAttributes方法的具體用法?Java UIComponent.getAttributes怎麽用?Java UIComponent.getAttributes使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.component.UIComponent的用法示例。

在下文中一共展示了UIComponent.getAttributes方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: decode

​點讚 3

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

@Override

public void decode(FacesContext context, UIComponent component)

{

UIXProgress progressComponent = (UIXProgress)component;

Map attrs = component.getAttributes();

Object modelValue= attrs.get(UIConstants.VALUE_PARAM);

if (modelValue instanceof BoundedRangeModel)

{

BoundedRangeModel model = (BoundedRangeModel) modelValue;

if (model != null)

{

long value = model.getValue();

long maximum = model.getMaximum();

if (maximum <= value)

//pu: This means the background task is complete.

{

(new ActionEvent(progressComponent)).queue();

}

}

}

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,

示例2: Station

​點讚 3

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

public Station(

Train train,

UIComponent stamp,

int index,

Object rowKey,

boolean active)

{

Map attributes = stamp.getAttributes();

_rowIndex = index;

_rowKey = rowKey;

_active = active;

_visited = _getBooleanAttribute(attributes, "visited", false);

_disabled = _getBooleanAttribute(attributes, "disabled", false);

_parentEnd = false;

_parentStart = false;

_train = train;

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:20,

示例3: decode

​點讚 3

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

@Override

public void decode(FacesContext context, UIComponent component)

{

_addChildren(context, component);

Map 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,

示例4: changeComponent

​點讚 3

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

/**

* {@inheritDoc}

*/

@Override

@SuppressWarnings("deprecation")

public void changeComponent(UIComponent uiComponent)

{

Map attributeMap = uiComponent.getAttributes();

// if the attributevalue is a ValueExpression or ValueBinding, use the

// appropriate setValueExpression/setValueBinding call and remove the

// current attribute value, if any, so that the ValueExpression/ValueBinding

// can take precedence

if (_attributeValue instanceof ValueExpression)

{

uiComponent.setValueExpression(_attributeName, (ValueExpression)_attributeValue);

attributeMap.remove(_attributeName);

}

else if (_attributeValue instanceof ValueBinding)

{

uiComponent.setValueBinding(_attributeName, (ValueBinding)_attributeValue);

attributeMap.remove(_attributeName);

}

else

{

attributeMap.put(_attributeName, _attributeValue);

}

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:29,

示例5: encodeBegin

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

@Override

public void encodeBegin(FacesContext context, UIComponent component)

throws IOException

{

//pu: This seems to be the best place to validate the model for the value

Map attrs = component.getAttributes();

Object modelObject = attrs.get(UIConstants.VALUE_PARAM);

if (modelObject == null || !(modelObject instanceof BoundedRangeModel))

{

_LOG.warning("COMPONENT_VALUE_IS_NOT_VALID_BOUNDEDRANGEMODEL_INSTANCE", component.getId());

}

super.encodeBegin(context, component);

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:15,

示例6: decode

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

@Override

public void decode(FacesContext context, UIComponent component)

{

RequestContext afContext = RequestContext.getCurrentInstance();

ReturnEvent returnEvent =

afContext.getDialogService().getReturnEvent(component);

if (returnEvent != null)

{

returnEvent.queue();

}

else

{

Map parameterMap =

context.getExternalContext().getRequestParameterMap();

Object source = parameterMap.get("source");

String clientId = component.getClientId(context);

if ((source != null) && source.equals(clientId))

{

(new ActionEvent(component)).queue();

Map attrs = component.getAttributes();

if (Boolean.TRUE.equals(attrs.get("partialSubmit")))

{

PartialPageUtils.forcePartialRendering(context);

}

}

}

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:31,

示例7: create

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

/**

* @param context gets the appropriate banding data from this context.

*/

@SuppressWarnings("unchecked")

public static BandingData create(TableRenderingContext context)

{

// using the variable name "hgrid" so that we don't forget that

// the table instance might infact be an hgrid:

UIComponent hgrid = context.getTable();

Map attrs = hgrid.getAttributes();

int row = _getInterval(attrs, CoreTable.ROW_BANDING_INTERVAL_KEY);

int col = _getInterval(attrs, CoreTable.COLUMN_BANDING_INTERVAL_KEY);

return new BandingData(col, row);

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:15,

示例8: changeComponent

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@Override

@SuppressWarnings("deprecation")

public void changeComponent(UIComponent component)

{

Map attributeMap = component.getAttributes();

Object newAttributeValue = getAttributeValue();

String attrName = getAttributeName();

if ((newAttributeValue instanceof RowKeySet) || (newAttributeValue == null))

{

// Specially handle RowKeySet case by replacing the contents of the RowKeySet in-place

// rather than replacing the entire object. This keeps the mutable object instance from

// changing

_updateRowKeySetInPlace(component, attrName, (RowKeySet)newAttributeValue);

}

else if (newAttributeValue instanceof ValueExpression)

{

// if the new attribute value is a ValueExpession, set it and remove the old value

// so that the ValueExpression takes precedence

component.setValueExpression(attrName, (ValueExpression)newAttributeValue);

attributeMap.remove(attrName);

}

else if (newAttributeValue instanceof ValueBinding)

{

// if the new attribute value is a ValueBinding, set it and remove the old value

// so that the ValueBinding takes precedence

component.setValueBinding(attrName, (ValueBinding)newAttributeValue);

attributeMap.remove(attrName);

}

else

{

// perform the default behavior

attributeMap.put(attrName, newAttributeValue);

}

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:37,

示例9: launchDialog

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

public boolean launchDialog(

FacesContext context,

UIViewRoot targetRoot,

UIComponent source,

Map processParameters,

boolean useWindow,

Map windowProperties)

{

// If we're not being asked to use a separate window,

// just fallback on the default launchDialog() code

if (!useWindow)

return false;

// And if we don't support separate windows at all, then bail

// there too

if (!_supportsSeparateWindow(context))

return false;

String sourceId = (source == null) ? null : source.getClientId(context);

String formId = RenderUtils.getFormId(context, source);

if (windowProperties == null)

windowProperties = new HashMap();

// Copy properties from the source component to the dialog properties

if (source != null)

{

Map sourceAttrs = source.getAttributes();

_copyProperty(windowProperties, "width", sourceAttrs, "windowWidth");

_copyProperty(windowProperties, "height", sourceAttrs, "windowHeight");

}

Map pageFlowScope =

RequestContext.getCurrentInstance().getPageFlowScope();

if (processParameters != null)

pageFlowScope.putAll(processParameters);

RequestContext rc = RequestContext.getCurrentInstance();

DialogRequest request = new DialogRequest(targetRoot,

sourceId,

formId,

windowProperties,

usePopupForDialog(context, rc));

_getDialogList(context, true).add(request);

return true;

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:49,

示例10: _typeConvertAndDefaultAttrs

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

private boolean _typeConvertAndDefaultAttrs(

String regionType,

ComponentMetaData cmd)

{

boolean hasErrors = false;

UIComponent region = getComponentInstance();

Map compAttrs = region.getAttributes();

List attrs = cmd.getAttributes();

int sz = attrs.size();

for(int i=0; i

{

AttributeMetaData attr = attrs.get(i);

String name = attr.getAttrName();

Class> klass = attr.getAttrClass();

if (region.getValueExpression(name) != null)

continue;

Object compValue = compAttrs.get(name);

if (compValue == null)

{

// if attribute value was not specified then try to default it:

String defaultValue = attr.getDefaultValue();

if (defaultValue != null)

{

hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);

}

// if no default value was found then make sure the attribute was not

// required:

else if (attr.isRequired())

{

_LOG.severe("COMPONENTTYPE_MISSING_ATTRIBUTE", new Object[] {name, regionType});

hasErrors = true;

}

}

// if a value was specified see if it needs to be type converted:

else if (compValue instanceof String)

{

hasErrors |= _typeConvert(compAttrs, name, (String) compValue, klass);

}

}

return hasErrors;

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:44,

示例11: renderValue

​點讚 2

import javax.faces.component.UIComponent; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

@Override

protected void renderValue(

UIXRenderingContext context,

UINode node,

Object value

)throws IOException

{

boolean agentSupportsDisabledOptions = Boolean.TRUE

.equals(getAgentCapability(context,

TrinidadAgent.CAP_SUPPORTS_DISABLED_OPTIONS));

if (!(agentSupportsDisabledOptions))

{

boolean isReadOnly = BaseLafUtils.getLocalBooleanAttribute(context,

node,

READ_ONLY_ATTR,

false);

boolean isDisabled = BaseLafUtils.getLocalBooleanAttribute(context,

node,

DISABLED_ATTR,

false);

if (isReadOnly || isDisabled)

return;

}

UIComponent component = node.getUIComponent() ;

Map attributes = component.getAttributes();

Object destination = node.getAttributeValue(context, DESTINATION_ATTR);

if ( destination != null)

{

value = '#' + encodeActionURL(context, destination);

}

else if ( value != null)

{

boolean immediate = Boolean.TRUE.equals(

attributes.get("immediate"));

String validate = immediate?"0":"1";

value = value.toString() + '[' + validate + ']';

}

renderAttribute(context, VALUE_ATTRIBUTE, value);

}

開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:48,

注:本文中的javax.faces.component.UIComponent.getAttributes方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值