/** * Determines if shadowed text is required. Default implementation is * simply to check for a null value. */ protected boolean needsShadowText(UICommand component) { return component.getValue() == null; }
@Override protected Object getValue(UIComponent component) { return ((UICommand) component).getValue(); }
@Override protected Object getValue(UIComponent component) { return ((UICommand) component).getValue(); }
@Override protected Object getValue(UIComponent component) { return ((UICommand) component).getValue(); }
@Override protected Object getValue(UIComponent component) { return ((UICommand) component).getValue(); }
@Override protected Object getValue(UIComponent component) { return ((UICommand) component).getValue(); }
protected void renderValueAttribute(FacesContext context, UICommand command, ResponseWriter writer) throws IOException { RendererUtil.renderAttribute(writer, JsfConstants.VALUE_ATTR, command .getValue()); }
protected boolean needsShadowText(UICommand component) { return component.getValue() == null && component.getChildCount() == 0; }
private void renderLinkText(UIComponent uiComponent, DOMContext domContext, Element root) { Object currentValue = ((UICommand) uiComponent).getValue(); String linkText = null; if (currentValue != null) { //no need to escape here as this is performed by createTextNode() linkText = currentValue.toString(); } // create a new or update the old text node for the label if (linkText != null && linkText.length() != 0) { Text labelNode = (Text) root.getFirstChild(); if (labelNode == null) { labelNode = domContext.createTextNode(linkText); root.appendChild(labelNode); } else { labelNode.setData(linkText); } } }
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException { super.encodeBegin(facesContext, component); //check for NP if (component instanceof UICommand) { renderCommandLinkStart(facesContext, component, component.getClientId(facesContext), ((UICommand) component).getValue(), getStyle(facesContext, component), getStyleClass(facesContext, component)); } else if (component instanceof UIOutput) { renderOutputLinkStart(facesContext, (UIOutput) component); } else { throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName()); } }
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException { super.encodeBegin(facesContext, component); //check for NP if (component instanceof UICommand) { renderCommandLinkStart(facesContext, component, component.getClientId(facesContext), ((UICommand) component).getValue(), getStyle(facesContext, component), getStyleClass(facesContext, component)); } else if (component instanceof UIOutput) { renderOutputLinkStart(facesContext, (UIOutput) component); } else { throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName()); } }
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException { super.encodeBegin(facesContext, component); //check for NP if (component instanceof UICommand) { renderCommandLinkStart(facesContext, component, component.getClientId(facesContext), ((UICommand)component).getValue(), getStyle(facesContext, component), getStyleClass(facesContext, component)); } else if (component instanceof UIOutput) { renderOutputLinkStart(facesContext, (UIOutput)component); } else { throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName()); } }
public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (UICommand.class.isAssignableFrom(component.getClass())) { ValueBinding valueBinding = component.getValueBinding(VALUE_PROP); //NOI18N UICommand command = (UICommand) component; Object value = command.getValue(); if (valueBinding != null && (value == null || value.toString().length() == 0)) { Object dummyValue = getDummyData(context, valueBinding); command.setValue(dummyValue); isTextSet = true; } else if (needsShadowText(command)) { command.setValue(getShadowText()); String styleClass = (String) component.getAttributes().get(STYLE_CLASS_PROP); component.getAttributes().put(STYLE_CLASS_PROP, addStyleClass(styleClass, UNINITITIALIZED_STYLE_CLASS)); isTextSet = true; isStyleSet = true; } } super.encodeBegin(context, component); }
protected Clicked wasClicked(final ValidationContext context, final UICommand command) { String clientId = command.getClientId(context.getFacesContext()); String value = context.getFacesContext().getExternalContext().getRequestParameterMap().get(clientId); if (value != null && (value.equals(clientId) || value.equals(command.getValue()))) { return new Clicked(true, clientId); } Clicked clicked = wasComponentWithRowIdClicked(context, command, clientId); if (clicked.isClicked()) { return clicked; } PartialViewContext partialContext = context.getFacesContext().getPartialViewContext(); if (partialContext != null && partialContext.isPartialRequest()) { // Is an ajax call partially processing the component tree Collection<String> execIds = partialContext.getExecuteIds(); return new Clicked(execIds.contains(clientId)); } return new Clicked(false); }
private void writeValue(final UIComponent component, final ResponseWriter writer) throws IOException { final HtmlCommandLink commandLink = (HtmlCommandLink) component; this.writeGlyphiconIfNecessary(commandLink, writer); writer.startElement("span", component); writer.writeAttribute("class", "butter-component-glyphicon-text", null); final Object value = ((UICommand) component).getValue(); if (value != null) { final String label = value.toString(); if (StringUtils.isNotEmpty(label)) { writer.writeText(label, component, null); } } writer.endElement("span"); this.writeWaitingDotsIfNecessary(commandLink, writer); }
private void writeValue(final UIComponent component, final ResponseWriter writer) throws IOException { final HtmlCommandLink commandLink = (HtmlCommandLink) component; this.writeGlyphiconIfNecessary(commandLink, writer); writer.startElement("span", component); writer.writeAttribute("class", "butter-component-glyphicon-text", null); final Object value = ((UICommand) component).getValue(); if (value != null) { final String label = value.toString(); if (StringUtils.isNotEmpty(label)) { writer.writeText(label, component, null); } } writer.endElement("span"); this.writeWaitingDotsIfNecessary(commandLink, writer); }
private void writeValue(final UIComponent component, final ResponseWriter writer) throws IOException { final HtmlCommandLink commandLink = (HtmlCommandLink) component; this.writeGlyphiconIfNecessary(commandLink, writer); writer.startElement("span", component); writer.writeAttribute("class", "butter-component-glyphicon-text", null); final Object value = ((UICommand) component).getValue(); if (value != null) { final String label = value.toString(); if (StringUtils.isNotEmpty(label)) { writer.writeText(label, component, null); } } writer.endElement("span"); this.writeWaitingDotsIfNecessary(commandLink, writer); }
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } if (!isDisabled(context, component) && !isCurrent( context, component )) { // use default rendering super.encodeChildren(context, component); } else { // render the text of the disabled/current link ourselves String label = ""; Object value = ((UICommand) component).getValue(); if (value != null) { label = value.toString(); } ResponseWriter writer = context.getResponseWriter(); writer.write(label); } }
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } if (!isDisabled(context, component) && !isCurrent( context, component )) { // use default rendering super.encodeChildren(context, component); } else { // render the text of the disabled/current link ourselves String label = ""; Object value = ((UICommand) component).getValue(); if (value != null) { label = value.toString(); } ResponseWriter writer = context.getResponseWriter(); writer.write(label); } }
protected void validateUICommand(final ValidationContext validationContext, final UICommand command, final Clicked clicked) { validationContext.acceptParameter(command.getClientId(validationContext.getFacesContext()), command.getValue()); if (clicked.getParamName() != null) { validationContext.acceptParameter(clicked.getParamName(), validationContext.getFacesContext().getExternalContext().getRequestParameterMap().get(clicked.getParamName())); } // Check CommandLink's parameters for (UIComponent childComp : command.getChildren()) { if (childComp instanceof UIParameter) { UIParameter param = (UIParameter) childComp; processParam(validationContext, param, clicked); } } }