Examples of HtmlSelectOneMenu


Examples of javax.faces.component.html.HtmlSelectOneMenu

  {
       
    FacesContext context = FacesContext.getCurrentInstance();
    Application application = context.getApplication();
   
    HtmlSelectOneMenu selectOneMenu = (HtmlSelectOneMenu) application.createComponent(HtmlSelectOneMenu.COMPONENT_TYPE);
   
    selectOneMenu.setId("selectOneMenu_" + displayValue)
    selectOneMenu.setTransient(true);
   
    selectOneMenu.setValueExpression("value", (ValueExpression) Utils.resolveExpression(bindingValue));
   
    // NOTA : cal que hi hagi una classe ValueChangeListener a vo.
    try {
      selectOneMenu.addValueChangeListener( (ValueChangeListener) Class.forName("vo." + classesValueChangeList).newInstance());
    } catch (InstantiationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
   
    afegirAjax(
        selectOneMenu,
        "valueChange",
        renderList,
        executeList);
   
    selectOneMenu.getChildren().add(buildSelectItems(
        displayValue,
        bindingValueSelItems));
   
     
    return selectOneMenu;
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

      case SELT:  // COMBO
       
        // HEM DE SABER QUIN COMBO ESTEM CONSTRUINT I PASSAR-LI EL VALUECHANGELISTENER
        // CORRESPONENT
       
        HtmlSelectOneMenu selectOneMenu = buildSelectOneMenu(
            nomColumna.toLowerCase() ,
            "#{" + nomColumna.toLowerCase() + ".valorActual}",
            Cadenes.primeraLletraMajuscula(nomColumna.toLowerCase()) + "Form" ,
            "#{" + nomColumna.toLowerCase() + "." + nomColumna.toLowerCase() + "}",
            new ArrayList<String>(){/**
 
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

  @SuppressWarnings("unchecked")
  public void testRISelectOneMenu() throws IOException
  {
    //
    HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
    menu.setValue(new Integer(2));
    for (int i = 0 ; i < 10; i++)
    {
      UISelectItem selectItem  = new UISelectItem();
      selectItem.setItemLabel("Item " + i);
      selectItem.setItemValue("" + i);
      menu.getChildren().add(selectItem);
    }

    UIViewRoot root = createTestTree(menu, "testRISelectOneMenu");
    renderRoot(root);
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

    @Override
    public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String rawValue) {
        Corporation result = null;
        if (uiComponent instanceof HtmlSelectOneMenu) {
            HtmlSelectOneMenu menu = (HtmlSelectOneMenu) uiComponent;
            UISelectItems items = (UISelectItems) menu.getChildren().get(0);
            List obj = (List) items.getValue();
            for (Iterator it = obj.iterator(); it.hasNext();) {
                Corporation corpo = (Corporation) it.next();
                if (corpo.getId().equals(Long.valueOf(rawValue))) {
                    result = corpo;
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

      mnameText.setValue(metric.getName());
      //add on parent
      parent.getChildren().add(mnameText);
     
      //2b) Select a math expression
      HtmlSelectOneMenu select2 = new HtmlSelectOneMenu();
    select2.setId("mathSelect"+metric.getInternalID());
    UISelectItems items2 = new UISelectItems();
    items2.setId("mathvals"+metric.getInternalID());
      items2.setValue(metric.getAllAvailableTypes());
    Class[] parms2 = new Class[]{ValueChangeEvent.class};
        ExpressionFactory ef = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
        MethodExpression mb = ef.createMethodExpression(FacesContext.getCurrentInstance().getELContext(),
                "#{AutoEvalSerUserConfigBean.processMathExprChange}", null, parms2);
        MethodExpressionValueChangeListener vcl = new MethodExpressionValueChangeListener(mb);
     select2.addValueChangeListener(vcl);
    select2.getChildren().add(items2);
    select2.setImmediate(true);
    
     //place an ajax support on the selectonemenu field
     HtmlAjaxSupport ajaxSupport2 = new HtmlAjaxSupport();
     //Class[] parms = new Class[]{ActionEvent.class};
     //ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
     ajaxSupport2.setEvent("onchange");
     //to add multiple ids for rerendering, separate them with a ","
     ajaxSupport2.setReRender(select2.getId());
     ajaxSupport2.setEventsQueue("foo");
     select2.getFacets().put("a4jsupport2", ajaxSupport2);
    
     //add to parent
     parent.getChildren().add(select2);
     
      //2c) For all input types except boolean values:
      if(metric.isHtmlInputTextUsed()){
        //enter a boundary value for a specific added metric
       HtmlInputText inputText = new HtmlInputText();
       inputText.setId("metricBoundary"+metric.getInternalID());
       inputText.setValue(metric.getEvalBoundary());
       inputText.setSize(10);
       Class[] parms = new Class[]{ValueChangeEvent.class};
          MethodExpression mb2 = ef.createMethodExpression(FacesContext.getCurrentInstance().getELContext(),
                  "#{AutoEvalSerUserConfigBean.processMetricBoundaryValueChange}", null, parms);
          MethodExpressionValueChangeListener vcl2 = new MethodExpressionValueChangeListener(mb2);
       inputText.addValueChangeListener(vcl2);
       inputText.setImmediate(true);
      
       //place an ajax support on the InputText field
       HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport();
       //Class[] parms = new Class[]{ActionEvent.class};
       //ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
       ajaxSupport.setEvent("onchange");
       //to add multiple ids for rerendering, separate them with a ","
       ajaxSupport.setReRender(inputText.getId());
       ajaxSupport.setEventsQueue("foo");
       inputText.getFacets().put("a4jsupport", ajaxSupport);
      
       //add to parent
       parent.getChildren().add(inputText);
      }
      else{
        // add a drop-down box for boolean values
        HtmlSelectOneMenu select = new HtmlSelectOneMenu();
        select.setId("booleanSelect"+metric.getInternalID());
        UISelectItems items = new UISelectItems();
        items.setId("vals"+metric.getInternalID());
        List<SelectItem> l = new ArrayList<SelectItem>();
              l.add(new SelectItem("true"));
              l.add(new SelectItem("false"));
          items.setValue(l);
        Class[] parms = new Class[]{ValueChangeEvent.class};
            MethodExpression mb3 = ef.createMethodExpression(FacesContext.getCurrentInstance().getELContext(),
                    "#{AutoEvalSerUserConfigBean.processMetricBoundaryValueChange}", null, parms);
            MethodExpressionValueChangeListener vcl3 = new MethodExpressionValueChangeListener(mb3);
            select.addValueChangeListener(vcl3);
        select.getChildren().add(items);
        select.setImmediate(true);
      
       //place an ajax support on the selectonemenu field
       HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport();
       //Class[] parms = new Class[]{ActionEvent.class};
       //ajaxSupport.setAction(FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{AutoEvalSerUserConfigBean.sliderValue}", parms));
       ajaxSupport.setEvent("onchange");
       //to add multiple ids for rerendering, separate them with a ","
       ajaxSupport.setReRender(select.getId());
       ajaxSupport.setEventsQueue("foo");
       select.getFacets().put("a4jsupport", ajaxSupport);
      
       //add to parent
       parent.getChildren().add(select);
      }
    
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

    }

   
    public void serviceSelectionChanged(ValueChangeEvent event) {
      //HtmlInplaceSelect sel = (HtmlInplaceSelect) event.getComponent();
      HtmlSelectOneMenu sel = (HtmlSelectOneMenu) event.getComponent();
      String selServiceEndpoint = (String)event.getNewValue();
     
      FacesContext context = FacesContext.getCurrentInstance();
    Object o1 = context.getExternalContext().getRequestParameterMap().get("selServiceID");
    String sForServiceID;
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

  }

  public void serviceSelectionChanged(ValueChangeEvent event) {
    this.currentTab = "editWorkflowTab";
    errorMessageString.clear();
    HtmlSelectOneMenu sel = (HtmlSelectOneMenu) event.getComponent();
    String selServiceId = sel.getLabel();
    String selServiceEndpoint = (String) event.getNewValue();
    ServiceBean theServiceBean = serviceLookup.get(selServiceId);
    // System.out.println("Called serviceSelectionChanged with id: "
    // + selServiceId + ", and endpoint: " + selServiceEndpoint);
    if (theServiceBean == null) {
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

* @return the UI component
*/
public UIComponent makeInputComponent(UiContext context,
                                      Section section,
                                      Parameter parameter) {
  HtmlSelectOneMenu component = makeSelectOneMenu(context,section,parameter,"");
  return applyHint(context,component);
}
View Full Code Here

Examples of javax.faces.component.html.HtmlSelectOneMenu

                                              Parameter parameter,
                                              String onchange) {
 
  // initialize the component
  MessageBroker msgBroker = context.extractMessageBroker();
  HtmlSelectOneMenu component = new HtmlSelectOneMenu();
  component.setId(getFacesId());
  component.setDisabled(!getEditable());
  component.setOnchange(getOnChange());
  component.setOnclick(getOnClick());
  setComponentValue(context,component,parameter);
  onchange = Val.chkStr(onchange);
  if (onchange.length() > 0) {
    component.setOnchange(onchange);
  }
 
  // add each code as a SelectItem
  ArrayList<SelectItem> codeItems = new ArrayList<SelectItem>();
  Codes codes = parameter.getContent().getCodes();
  for (Code code: codes.values()) {
    String sResKey = code.getResourceKey();
    String sLabel = code.getKey();
    if (sResKey.length() > 0) {
      sLabel = msgBroker.retrieveMessage(sResKey);
    }
    codeItems.add(new SelectItem(code.getKey(),sLabel));
  }
  UISelectItems uiItems = new UISelectItems();
  uiItems.setValue(codeItems);
  component.getChildren().add(uiItems);
  return component;
}
View Full Code Here

Examples of org.metawidget.statically.faces.component.html.widgetbuilder.HtmlSelectOneMenu

         panelGrid.putAttribute("columns", "2");
         panelGrid.putAttribute("columnClasses", ",remove-column");

         // Select menu at bottom

         HtmlSelectOneMenu select = new HtmlSelectOneMenu();
         String selectId = dataTable.getAttribute("id") + "Select";
         select.putAttribute("id", selectId);
         String requestScopedValue = "requestScope['" + selectId + "']";
         select.setValue(StaticFacesUtils.wrapExpression(requestScopedValue));
         String simpleComponentType = ClassUtils.getSimpleName(componentType);
         String controllerName = StringUtils.decapitalize(simpleComponentType);
         select.setConverter(StaticFacesUtils.wrapExpression(controllerName + "Bean.converter"));
         Map<String, String> emptyAttributes = CollectionUtils.newHashMap();
         addSelectItems(select, StaticFacesUtils.wrapExpression(controllerName + "Bean.all"), emptyAttributes);
         panelGrid.getChildren().add(select);

         // Create 'Add' button
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.