当前位置: 首页>>代码示例>>Java>>正文


Java HtmlOutputLabel.setFor方法代码示例

本文整理汇总了Java中javax.faces.component.html.HtmlOutputLabel.setFor方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlOutputLabel.setFor方法的具体用法?Java HtmlOutputLabel.setFor怎么用?Java HtmlOutputLabel.setFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.component.html.HtmlOutputLabel的用法示例。


在下文中一共展示了HtmlOutputLabel.setFor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:24,代码来源:Label.java

示例2: 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;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:65,代码来源:InputSelectManyCheckbox.java


注:本文中的javax.faces.component.html.HtmlOutputLabel.setFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。