本文整理汇总了Java中javax.faces.model.SelectItem.isDisabled方法的典型用法代码示例。如果您正苦于以下问题:Java SelectItem.isDisabled方法的具体用法?Java SelectItem.isDisabled怎么用?Java SelectItem.isDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.model.SelectItem
的用法示例。
在下文中一共展示了SelectItem.isDisabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _convertSelectItemListToIndices
import javax.faces.model.SelectItem; //导入方法依赖的package包/类
/**
* Rips through the list of SelectItems, and sets all item's
* values to their index
*/
static private void _convertSelectItemListToIndices(
List<SelectItem> itemsToConvert)
{
int length = itemsToConvert.size();
// loop through each item to convert.
for (int j=0; j < length; j++)
{
SelectItem oldSelectItem = itemsToConvert.get(j);
// We have to create a new item - the old ones are not
// necessarily ours, so we can't just mutate 'em
SelectItem newSelectItem = new SelectItem(j,
oldSelectItem.getLabel(),
oldSelectItem.getDescription(),
oldSelectItem.isDisabled());
itemsToConvert.set(j, newSelectItem);
}
}
示例2: encodeOption
import javax.faces.model.SelectItem; //导入方法依赖的package包/类
/**
* @todo Move to utility class?
*/
static public boolean encodeOption(
FacesContext context,
RenderingContext rc,
UIComponent component,
SelectItem item,
Converter converter,
boolean valuePassThru,
int index,
boolean isSelected
) throws IOException
{
if (item == null)
return false;
if (item.isDisabled())
{
if (!Boolean.TRUE.equals(rc.getAgent().getCapabilities().get(
TrinidadAgent.CAP_SUPPORTS_DISABLED_OPTIONS)))
return false;
}
Object itemValue = getItemValue(context,
component,
item,
converter,
valuePassThru,
index);
ResponseWriter writer = context.getResponseWriter();
writer.startElement("option", null);
if (item.isDisabled())
writer.writeAttribute("disabled", Boolean.TRUE, null);
// Never write out null, because that will result in the label
// getting submitted, instead of null.
if (itemValue == null)
itemValue="";
writer.writeAttribute("value", itemValue, null);
if (isSelected)
writer.writeAttribute("selected", Boolean.TRUE, null);
// For reasons that aren't especially clear to me, we're getting
// passed the empty string for our title.
String description = item.getDescription();
if ((description != null) && !"".equals(description))
writer.writeAttribute("title", description, null);
writer.writeText(item.getLabel(), null);
writer.endElement("option");
return true;
}
示例3: renderSelectItem
import javax.faces.model.SelectItem; //导入方法依赖的package包/类
/**
* Render a single select item.
* @param renderedOne true if an item has already been rendered
* @return false if nothing was rendered, true otherwise
*/
protected boolean renderSelectItem(
UIXRenderingContext context,
UINode node,
UIComponent component,
SelectItem item,
String value,
boolean isSelected,
boolean renderedOne,
int index) throws IOException
{
if (item == null)
return false;
boolean agentSupportsDisabledOptions = Boolean.TRUE
.equals(getAgentCapability(context,
TrinidadAgent.CAP_SUPPORTS_DISABLED_OPTIONS));
boolean isParentDisabled = Boolean.TRUE.equals(component.getAttributes()
.get(DISABLED_ATTR.getAttributeName()));
if (!isParentDisabled && item.isDisabled()
&& (!(agentSupportsDisabledOptions)))
return false;
//
FacesContext fContext = context.getFacesContext();
ResponseWriter out = fContext.getResponseWriter();
if (!renderAsElement(context, node))
{
if (isSelected)
{
if (renderedOne)
{
out.startElement("br", null);
out.endElement("br");
}
out.writeText(item.getLabel(), null);
return true;
}
}
else
{
out.startElement("option", null);
if (item.isDisabled())
out.writeAttribute("disabled", Boolean.TRUE, null);
out.writeAttribute("value", value, null);
if (isSelected)
out.writeAttribute("selected", Boolean.TRUE, null);
out.writeAttribute("title", item.getDescription(), null);
out.writeText(item.getLabel(), null);
out.endElement("option");
}
return false;
}