本文整理匯總了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
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void decode(FacesContext context, UIComponent component)
{
UIXProgress progressComponent = (UIXProgress)component;
Map<String, Object> 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();
}
}
}
}
示例2: Station
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public Station(
Train train,
UIComponent stamp,
int index,
Object rowKey,
boolean active)
{
Map<String, Object> 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;
}
示例3: decode
import javax.faces.component.UIComponent; //導入方法依賴的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);
}
示例4: changeComponent
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("deprecation")
public void changeComponent(UIComponent uiComponent)
{
Map<String, Object> 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);
}
}
示例5: encodeBegin
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<String, Object> 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);
}
示例6: decode
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<String, String> 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<String, Object> attrs = component.getAttributes();
if (Boolean.TRUE.equals(attrs.get("partialSubmit")))
{
PartialPageUtils.forcePartialRendering(context);
}
}
}
}
示例7: create
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<String, Object> 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);
}
示例8: changeComponent
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public void changeComponent(UIComponent component)
{
Map<String, Object> 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);
}
}
示例9: launchDialog
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public boolean launchDialog(
FacesContext context,
UIViewRoot targetRoot,
UIComponent source,
Map<String,Object> processParameters,
boolean useWindow,
Map<String,Object> 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<String,Object>();
// Copy properties from the source component to the dialog properties
if (source != null)
{
Map<String, Object> sourceAttrs = source.getAttributes();
_copyProperty(windowProperties, "width", sourceAttrs, "windowWidth");
_copyProperty(windowProperties, "height", sourceAttrs, "windowHeight");
}
Map<String, Object> 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;
}
示例10: _typeConvertAndDefaultAttrs
import javax.faces.component.UIComponent; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private boolean _typeConvertAndDefaultAttrs(
String regionType,
ComponentMetaData cmd)
{
boolean hasErrors = false;
UIComponent region = getComponentInstance();
Map<String, Object> compAttrs = region.getAttributes();
List<AttributeMetaData> attrs = cmd.getAttributes();
int sz = attrs.size();
for(int i=0; i<sz; 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;
}
示例11: renderValue
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<String, Object> 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);
}