本文整理汇总了Java中javax.faces.component.html.HtmlOutputLabel类的典型用法代码示例。如果您正苦于以下问题:Java HtmlOutputLabel类的具体用法?Java HtmlOutputLabel怎么用?Java HtmlOutputLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlOutputLabel类属于javax.faces.component.html包,在下文中一共展示了HtmlOutputLabel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponentsToRender
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
/**
* Gets the components to render.
*
* @return the components to render
*/
private List<UIComponent> getComponentsToRender() {
final List<UIComponent> children = this.fieldsRegion.getChildren();
final List<UIComponent> componentsToRender = new Vector();
for (final UIComponent uiComponent : children) {
if (uiComponent instanceof OutputLabel) {
uiComponent.setRendered(findComponent(((HtmlOutputLabel) uiComponent).getFor()).isRendered());
}
if (uiComponent.isRendered()) {
if (JKJsfUtil.getBooleanAttribute(uiComponent, TagAttributeConstants.ATTRIBUTE_EXPLODE_CHILDS, false)) {
componentsToRender.addAll(uiComponent.getChildren());
} else {
componentsToRender.add(uiComponent);
}
}
}
return componentsToRender;
}
示例2: processEvent
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
public void processEvent(SystemEvent event) throws AbortProcessingException {
if (event instanceof PostAddToViewEvent) {
for (UIComponent child : getChildren()) {
// Add form-label class to span children
if (child instanceof HtmlOutputLabel) {
HtmlOutputLabel label = (HtmlOutputLabel) child;
label.setStyleClass(StyleClass.of("form-label").add(label.getStyleClass()).toString());
}
// Add label from form-element to inputs with no label and vise-versa
else if (child instanceof UIInput) {
String elemLabel = getLabel();
String inputLabel = (String) child.getAttributes().get("label");
if (elemLabel != null && inputLabel == null)
child.getAttributes().put("label", elemLabel);
else if (elemLabel == null && inputLabel != null)
setLabel(inputLabel);
}
}
}
}
示例3: 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;
}
示例4: scan
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的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;
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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));
}
}
}
示例8: markOutputRequired
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
private void markOutputRequired(UIOutput comp) {
if (comp instanceof HtmlOutputText) {
HtmlOutputText hot = (HtmlOutputText) comp;
String style = hot.getStyleClass();
hot.setStyleClass(appendRequiredClass(style, REQUIRED_CLASS_LABEL));
}
if (comp instanceof HtmlOutputLabel) {
HtmlOutputLabel hol = (HtmlOutputLabel) comp;
hol.setStyleClass(appendRequiredClass(hol.getStyleClass(),
REQUIRED_CLASS_LABEL));
}
}
示例9: 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;
}
示例10: JsfLabelRenderer
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
public JsfLabelRenderer(JsfLabelModel model) {
super(HtmlOutputLabel.COMPONENT_TYPE, model, String.class);
bind("value", model.getLabel());
}
示例11: isSupportedComponent
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
@Override
public boolean isSupportedComponent(UIComponent uiComponent) {
return uiComponent instanceof HtmlOutputLabel;
}
示例12: testFindOneLevel
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
@Test
public void testFindOneLevel() throws Exception {
HtmlPanelGroup root = new HtmlPanelGroup();
root.setId("root");
HtmlOutputLabel label = new HtmlOutputLabel();
label.setId("label1");
HtmlOutputLabel sinId = new HtmlOutputLabel();
root.getChildren().add(sinId);
root.getChildren().add(label);
root.getChildren().add(new HtmlInputText());
assertEquals(label, JSFUtils.find("label1", root));
}
示例13: testFindTwoLevels
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
@Test
public void testFindTwoLevels() throws Exception {
HtmlPanelGroup root = new HtmlPanelGroup();
root.setId("root");
HtmlPanelGroup branch1 = new HtmlPanelGroup();
HtmlOutputLabel label = new HtmlOutputLabel();
label.setId("label1");
HtmlOutputLabel sinId = new HtmlOutputLabel();
root.getChildren().add(branch1);
branch1.getChildren().add(sinId);
branch1.getChildren().add(label);
branch1.getChildren().add(new HtmlInputText());
assertEquals(label, JSFUtils.find("label1", root));
}
示例14: 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;
}
示例15: getLabel
import javax.faces.component.html.HtmlOutputLabel; //导入依赖的package包/类
public HtmlOutputLabel getLabel() {
return label;
}