public HtmlCommandButton() { super(); setRendererType("javax.faces.Button"); }
/** * <p>Set the value of the <code>accesskey</code> property.</p> * @param accesskey the new property value */ public void setAccesskey(java.lang.String accesskey) { getStateHelper().put(PropertyKeys.accesskey, accesskey); handleAttribute("accesskey", accesskey); }
protected String getImage(FacesContext context, HtmlCommandButton htmlCommandButton) { return htmlCommandButton.getImage(); }
private void handleAttribute(String name, Object value) { List<String> setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet"); if (setAttributes == null) { String cname = this.getClass().getName(); if (cname != null && cname.startsWith(OPTIMIZED_PACKAGE)) { setAttributes = new ArrayList<String>(6); this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes); } } if (setAttributes != null) { if (value == null) { ValueExpression ve = getValueExpression(name); if (ve == null) { setAttributes.remove(name); } } else if (!setAttributes.contains(name)) { setAttributes.add(name); } } }
/** * Gets The CSS class for this element. Corresponds to the HTML 'class' attribute. * * @return the new styleClass value */ public String getStyleClass() { if (_styleClass != null) { return _styleClass; } ValueExpression expression = getValueExpression("styleClass"); if (expression != null) { return (String)expression.getValue(getFacesContext().getELContext()); } return null; }
comp.setValueExpression("image", _image); comp.setValueExpression("type", _type); comp.setValueExpression("accesskey", _accesskey); comp.setValueExpression("onselect", _onselect); comp.setValueExpression("onclick", _onclick); comp.setValueExpression("ondblclick", _ondblclick); comp.setValueExpression("onkeydown", _onkeydown); comp.setValueExpression("onkeypress", _onkeypress); comp.setValueExpression("onkeyup", _onkeyup); comp.setValueExpression("onmousedown", _onmousedown); comp.setValueExpression("onmousemove", _onmousemove); comp.setValueExpression("onmouseout", _onmouseout); comp.setValueExpression("onmouseover", _onmouseover); comp.setValueExpression("onmouseup", _onmouseup); comp.setValueExpression("style", _style);
component = link; } else if ("commandButton".equals(renderType)) { final HtmlCommandButton button = new HtmlCommandButton(); button.setStyleClass(tableLink); button.setActionExpression(this.actionGenerated.getActionExpression()); button.addActionListener(new SetPropertyActionListener(this.actionGenerated.getTargetExpression(), this .getVariableReference(context))); component = button;
private String getType(UIComponent uiComponent) { if (uiComponent instanceof HtmlCommandButton) { return ((HtmlCommandButton)uiComponent).getType(); } return (String)uiComponent.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR); }
htmlCommandButton.setActionExpression(action); htmlCommandButton.addActionListener(new MethodExpressionActionListener(actionListener)); htmlCommandButton.setRendered(false); htmlCommandButton.addClientBehavior(defaultEventName, clientBehavior);
/** * <p>Set the value of the <code>image</code> property.</p> * @param image the new property value */ public void setImage(java.lang.String image) { getStateHelper().put(PropertyKeys.image, image); }
protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent) { //TODO: overwrite in extended HtmlButtonRenderer and check for enabledOnUserRole if (uiComponent instanceof HtmlCommandButton) { return ((HtmlCommandButton)uiComponent).isDisabled(); } return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute( uiComponent, HTML.DISABLED_ATTR, false); }
comp.setValueBinding("image", vb); comp.getAttributes().put("image", _image); comp.setValueBinding("type", vb); comp.getAttributes().put("type", _type); comp.setValueBinding("style", vb); comp.getAttributes().put("style", _style); comp.setValueBinding("styleClass", vb); comp.getAttributes().put("styleClass", _styleClass); comp.setValueBinding("alt", vb); comp.getAttributes().put("alt", _alt); comp.setValueBinding("tabindex", vb); comp.getAttributes().put("tabindex", _tabindex); comp.setValueBinding("onblur", vb); comp.getAttributes().put("onblur", _onblur); comp.setValueBinding("onfocus", vb);
protected void decodeHtmlCommandButton(FacesContext context, HtmlCommandButton htmlCommandButton) { Map paramMap = context.getExternalContext().getRequestParameterMap(); String clientId = htmlCommandButton.getClientId(context); if (paramMap.containsKey(clientId) || paramMap.containsKey(clientId + ".x") || paramMap.containsKey(clientId + ".y")) { if (JsfConstants.RESET_VALUE.equalsIgnoreCase(htmlCommandButton .getType())) { } else { enqueueEvent(htmlCommandButton); } } }
private void handleAttribute(String name, Object value) { List<String> setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet"); if (setAttributes == null) { String cname = this.getClass().getName(); if (cname != null && cname.startsWith(OPTIMIZED_PACKAGE)) { setAttributes = new ArrayList<String>(6); this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes); } } if (setAttributes != null) { if (value == null) { ValueExpression ve = getValueExpression(name); if (ve == null) { setAttributes.remove(name); } } else if (!setAttributes.contains(name)) { setAttributes.add(name); } } }
/** * Gets Specifies a script to be invoked when the element loses focus. * * @return the new onblur value */ public String getOnblur() { if (_onblur != null) { return _onblur; } ValueExpression expression = getValueExpression("onblur"); if (expression != null) { return (String)expression.getValue(getFacesContext().getELContext()); } return null; }
comp.setValueExpression("onselect", _onselect); comp.setValueExpression("title", _title); comp.setValueExpression("immediate", _immediate); comp.setValueExpression("style", _style); comp.setValueExpression("onfocus", _onfocus); comp.setValueExpression("tabindex", _tabindex); comp.addActionListener(new MethodExpressionActionListener(_actionListener)); comp.setValueExpression("readonly", _readonly); comp.setValueExpression("accesskey", _accesskey); comp.setValueExpression("type", _type); comp.setValueExpression("lang", _lang); comp.setValueExpression("styleClass", _styleClass); comp.setValueExpression("disabled", _disabled); comp.setValueExpression("onclick", _onclick); comp.setValueExpression("dir", _dir);
private String getType(UIComponent uiComponent) { if (uiComponent instanceof HtmlCommandButton) { return ((HtmlCommandButton)uiComponent).getType(); } return (String)uiComponent.getAttributes().get(org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR); }
htmlCommandButton.setActionExpression(action); htmlCommandButton.addActionListener(new MethodExpressionActionListener(actionListener)); htmlCommandButton.setRendered(false); htmlCommandButton.addClientBehavior(defaultEventName, clientBehavior);
/** * <p>Return the value of the <code>onfocus</code> property.</p> * @return the property value * <p>Contents: Javascript code executed when this element receives focus. */ public java.lang.String getOnfocus() { return (java.lang.String) getStateHelper().eval(PropertyKeys.onfocus); }
protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent) { //TODO: overwrite in extended HtmlButtonRenderer and check for enabledOnUserRole if (uiComponent instanceof HtmlCommandButton) { return ((HtmlCommandButton)uiComponent).isDisabled(); } return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute( uiComponent, HTML.DISABLED_ATTR, false); }