本文整理汇总了Java中javax.faces.component.html.HtmlOutputLabel.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlOutputLabel.setValue方法的具体用法?Java HtmlOutputLabel.setValue怎么用?Java HtmlOutputLabel.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.component.html.HtmlOutputLabel
的用法示例。
在下文中一共展示了HtmlOutputLabel.setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeEditorLabel
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
/**
* Makes a Faces HtmlOutputLabel for a metadata editor parameter.
* @param context the UI context
* @param section the parent section
* @param parameter the associated parameter
* @return the UI component
*/
public UIComponent makeEditorLabel(UiContext context,
Section section,
Parameter parameter) {
HtmlOutputLabel outLabel = new HtmlOutputLabel();
MessageBroker msgBroker = context.extractMessageBroker();
if (parameter.getInput() != null) {
// even label has to have unique id (for GlassFish)
outLabel.setId(parameter.getInput().getFacesId()+"label");
outLabel.setFor(parameter.getInput().getFacesId());
}
outLabel.setValue(msgBroker.retrieveMessage(getResourceKey()));
if (parameter.getValidation().getRequired()) {
outLabel.setStyleClass("requiredField");
}
return outLabel;
}
示例2: addOneRowToTable
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
private void addOneRowToTable(List<FormFieldMetadata> row, List<UIComponent> tableChildrens, int maxFieldCounts,
Map<String, Object> formRecordValueMap) {
for (FormFieldMetadata field : row) {
// Skip the reference field and non-printable field
if ((field.getReferToFormMetadataId() != null && field.getReferToFormMetadataId() > 0)
|| !field.getIsPrintable()) {
continue;
}
HtmlOutputLabel label = new HtmlOutputLabel();
label.setValue(field.getFieldLabel());
HtmlOutputText text = new HtmlOutputText();
Object value = formRecordValueMap.get(field.getColumnName());
if (value instanceof Date) {
value = simpleDateFormat.format(value);
}
text.setValue(value == null ? EMPTY_STRING : value.toString());
tableChildrens.add(label);
tableChildrens.add(text);
}
for (int i = row.size(); i < maxFieldCounts; i++) {
HtmlOutputText emptyLabel = new HtmlOutputText();
emptyLabel.setValue(EMPTY_STRING);
HtmlOutputText emptyValue = new HtmlOutputText();
emptyValue.setValue(EMPTY_STRING);
tableChildrens.add(emptyLabel);
tableChildrens.add(emptyValue);
}
}
示例3: writeContent
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
private static void writeContent(List<String> row, StringListResponseWriter writer, FacesContext facesContext,
int columnCount, UIComponent child) throws IOException {
if (child instanceof HtmlCommandLink) {
final HtmlOutputLabel label = new HtmlOutputLabel();
label.setValue(((HtmlCommandLink) child).getValue());
label.setRendered(child.isRendered());
label.encodeBegin(facesContext);
label.encodeEnd(facesContext);
} else if (child instanceof HtmlGraphicImage) {
writer.writeText("", "");
//} else if (child instanceof UIInstructions) {
// child.encodeBegin(facesContext);
// child.encodeEnd(facesContext);
// postCleanUp(row, columnCount);
} else if (child instanceof HtmlPanelGroup || child instanceof HtmlOutputLink) {
final UIComponentBase uiComponent = (UIComponentBase) child;
if (uiComponent.isRendered()) {
for (UIComponent uiChildComponent : uiComponent.getChildren()) {
writeContent(row, writer, facesContext, columnCount, uiChildComponent);
}
}
postCleanUp(row, columnCount);
} else {
child.encodeBegin(facesContext);
child.encodeEnd(facesContext);
}
}
示例4: configureComponent
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
@Override
public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData) {
HtmlOutputLabel label = (HtmlOutputLabel) uiComponent;
if (label.getFor() != null && !label.getFor().trim().isEmpty()) {
UIComponent targetComponent = label.findComponent(label.getFor());
if (targetComponent != null && targetComponent instanceof UIInput) {
informationManager.determineInformation(facesContext, targetComponent);
initializerManager.performInitialization(facesContext, targetComponent);
boolean required = ComponentUtils.isRequired(targetComponent, facesContext);
Object value = ComponentUtils.getValue(label, facesContext);
if (required) {
label.setValue(value + " *");
} else {
label.setValue(value);
}
} else {
logger.warn("target component specified in for ('" + label.getFor() + "') not found from component " + label.getClientId(facesContext));
}
}
}
示例5: makeResultsLabel
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
/**
* Makes an HtmlOutputLabel component for result text display.
* @param facesContext the active Faces context
* @param text the text to display
* @return the new HtmlOutputLabel component
*/
private HtmlOutputLabel makeResultsLabel(FacesContext facesContext, String text) {
HtmlOutputLabel outLabel = new HtmlOutputLabel();
outLabel.setEscape(false);
outLabel.setValue(text);
if (getResultStyleClass().length() > 0) {
outLabel.setStyleClass(getResultStyleClass());
}
return outLabel;
}
示例6: makeInputComponent
import javax.faces.component.html.HtmlOutputLabel; //导入方法依赖的package包/类
/**
* Makes a Faces HtmlPanelGroup of HtmlSelectBooleanCheckbox components
* for a parameter.
* <p/>
* The check boxes are based upon the defined codes for the parameter.
* <p/>
* The multiple values associated with the parameter
* (parameter.getMultipleValues()) are used to establish the
* selected/unselected status for each check box.
* @param context the UI context
* @param section the parent section
* @param parameter the associated parameter
* @return the UI component
*/
public UIComponent makeInputComponent(UiContext context,
Section section,
Parameter parameter) {
// initialize the panel
MessageBroker msgBroker = context.extractMessageBroker();
HtmlPanelGroup panel = new HtmlPanelGroup();
String sIdPfx = getFacesId();
panel.setId(sIdPfx);
// build a map of values
HashMap<String,String> valuesMap = new HashMap<String,String>();
for (ContentValue value: parameter.getContent().getMultipleValues()) {
valuesMap.put(value.getValue(),"");
}
// add a checkbox for each code
Codes codes = parameter.getContent().getCodes();
for (Code code: codes.values()) {
// make the checkbox
String sKey = code.getKey();
String sFKey = sKey.replace('.','_');
sFKey = sKey.replace(':','_');
String sId = sIdPfx+"-"+sFKey;
HtmlSelectBooleanCheckbox checkBox = new HtmlSelectBooleanCheckbox();
checkBox.setId(sId);
checkBox.setDisabled(!getEditable());
checkBox.setSelected(valuesMap.containsKey(sKey));
checkBox.setOnchange(getOnChange());
checkBox.setOnclick(getOnClick());
panel.getChildren().add(checkBox);
// make the label
String sLabel = sKey;
String sResKey = code.getResourceKey();
if (sResKey.length() > 0) {
sLabel = msgBroker.retrieveMessage(sResKey);
}
HtmlOutputLabel outLabel = new HtmlOutputLabel();
// even label has to have unique id (for GlassFish)
outLabel.setId(sId+"label");
outLabel.setFor(sId);
outLabel.setValue(sLabel);
panel.getChildren().add(outLabel);
panel.getChildren().add(makeBR());
}
return panel;
}