Search in sources :

Example 1 with HtmlOutputText

use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.

the class HtmlDataScrollerRenderer method getLink.

protected HtmlCommandLink getLink(FacesContext facesContext, HtmlDataScroller scroller, String text, int pageIndex) {
    String id = HtmlDataScrollerRenderer.PAGE_NAVIGATION + Integer.toString(pageIndex);
    Application application = facesContext.getApplication();
    // TOMAHAWK-596 Duplicate id exception for HtmlDataScrollerRenderer
    // For prevent this condition, try to detect if there is a component.
    // Theorically this method should always return null, but it is known
    // than in some cases (portlet) when the state manager is different from
    // the default one, transient components are saved on the component tree.
    // Really the error is on the jsf portlet bridge implementation used, but
    // do this does not cause any side effect.
    HtmlCommandLink link = (HtmlCommandLink) scroller.findComponent(scroller.getId() + id);
    if (link == null) {
        // See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
        // and http://issues.apache.org/jira/browse/MYFACES-1809
        link = new HtmlAriaCommandLink();
        link.setId(scroller.getId() + id);
        link.setTransient(true);
        List children = link.getChildren();
        if (text != null) {
            HtmlOutputText uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
            uiText.setId(scroller.getId() + id + "_text");
            uiText.setTransient(true);
            uiText.setValue(text);
            children.add(uiText);
        }
        scroller.getChildren().add(link);
    } else {
        UIOutput uiText = (UIOutput) link.findComponent(scroller.getId() + id + "_text");
        if (uiText != null) {
            // Update text value
            uiText.setValue(text);
        }
        removeParameterFromList(link.getChildren(), scroller.getId() + id + "_param");
    }
    UIParameter parameter = (UIParameter) application.createComponent(UIParameter.COMPONENT_TYPE);
    parameter.setId(scroller.getId() + id + "_param");
    parameter.setTransient(true);
    parameter.setName(scroller.getClientId(facesContext));
    parameter.setValue(id);
    List children = link.getChildren();
    children.add(parameter);
    return link;
}
Also used : UIParameter(javax.faces.component.UIParameter) UIOutput(javax.faces.component.UIOutput) HtmlAriaCommandLink(org.santfeliu.faces.component.HtmlAriaCommandLink) HtmlCommandLink(org.apache.myfaces.component.html.ext.HtmlCommandLink) List(java.util.List) HtmlOutputText(javax.faces.component.html.HtmlOutputText) Application(javax.faces.application.Application)

Example 2 with HtmlOutputText

use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.

the class QueryInstanceBean method addLabelComponents.

private void addLabelComponents(String label, String expression, List<Query.Parameter> parameters, HtmlPanelGroup exprPanelGroup) {
    int index1 = 0;
    int index2;
    for (Query.Parameter parameter : parameters) {
        String paramName = parameter.getName();
        String tag = "${" + paramName + "}";
        index2 = label.indexOf(tag, index1);
        if (index2 != -1) {
            String text = label.substring(index1, index2);
            id++;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setId("output_" + id);
            outputText.setValue(text);
            outputText.setStyleClass("part");
            exprPanelGroup.getChildren().add(outputText);
            index1 = index2 + tag.length();
            addParameterComponent(parameter, expression, exprPanelGroup);
        }
    }
    if (index1 < label.length()) {
        id++;
        String text = label.substring(index1);
        HtmlOutputText outputText = new HtmlOutputText();
        outputText.setId("output_" + id);
        outputText.setValue(text);
        outputText.setStyleClass("part");
        exprPanelGroup.getChildren().add(outputText);
    }
}
Also used : Query(org.santfeliu.misc.query.Query) HtmlOutputText(javax.faces.component.html.HtmlOutputText) WSEndpoint(org.matrix.util.WSEndpoint)

Example 3 with HtmlOutputText

use of javax.faces.component.html.HtmlOutputText in project empire-db by apache.

the class TextInputControl method createUnitLabel.

protected UIComponent createUnitLabel(String tagStyle, InputInfo ii, String value) {
    HtmlOutputText text = new HtmlOutputText();
    text.setValue(value);
    // wrap
    HtmlPanelGroup span = new HtmlPanelGroup();
    /* 
        --- dataTypeClass not needed --- 
        String dataTypeClass = TagEncodingHelper.getDataTypeClass(ii.getColumn().getDataType()); 
        String styleClass    = TagEncodingHelper.getTagStyleClass(tagStyle, dataTypeClass, null, null);
        */
    span.getAttributes().put("styleClass", tagStyle);
    span.getChildren().add(text);
    return span;
}
Also used : HtmlPanelGroup(javax.faces.component.html.HtmlPanelGroup) HtmlOutputText(javax.faces.component.html.HtmlOutputText)

Example 4 with HtmlOutputText

use of javax.faces.component.html.HtmlOutputText in project empire-db by apache.

the class TagEncodingHelper method addRequiredMark.

protected void addRequiredMark(HtmlOutputLabel label) {
    HtmlPanelGroup span = new HtmlPanelGroup();
    span.setStyleClass("required");
    HtmlOutputText text = new HtmlOutputText();
    text.setValue("*");
    span.getChildren().add(text);
    label.getChildren().add(span);
}
Also used : HtmlPanelGroup(javax.faces.component.html.HtmlPanelGroup) HtmlOutputText(javax.faces.component.html.HtmlOutputText)

Example 5 with HtmlOutputText

use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.

the class HtmlCalendarRenderer method writeLink.

/**
 * Create child components to represent a link to a specific date value, and render them.
 * <p>
 * For a disabled calendar, this just creates a Text component, attaches it as a child
 * of the calendar and renders it. The value of the component is the string returned by
 * valueForLink.getTime().
 * <p>
 * For a non-disabled calendar, create an HtmlCommandLink child that wraps the text
 * returned by valueForLink.getTime(), and add it to the component.
 */
private void writeLink(String content, UIInput component, FacesContext facesContext, Date valueForLink, String linkTitle) throws IOException {
    Converter converter = getConverter(component);
    Application application = facesContext.getApplication();
    HtmlOutputText text = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
    text.setValue(content);
    text.setId(component.getId() + "_" + valueForLink.getTime() + "_text");
    text.setTransient(true);
    HtmlInputCalendar calendar = (HtmlInputCalendar) component;
    if (isDisabled(facesContext, component) || calendar.isReadonly()) {
        component.getChildren().add(text);
        RendererUtils.renderChild(facesContext, text);
        return;
    }
    HtmlAriaCommandLink link = (HtmlAriaCommandLink) application.createComponent("HtmlAriaCommandLink");
    link.setId(component.getId() + "_" + valueForLink.getTime() + "_link");
    link.setTransient(true);
    link.setImmediate(component.isImmediate());
    if (linkTitle != null) {
        Locale locale = facesContext.getViewRoot().getLocale();
        ResourceBundle bundle = ResourceBundle.getBundle("org.santfeliu.faces.render.myfaces.calendar.resources.CalendarBundle", locale);
        link.setTitle(bundle.getString(linkTitle));
        link.setAriaLabel(bundle.getString(linkTitle));
    }
    UIParameter parameter = (UIParameter) application.createComponent(UIParameter.COMPONENT_TYPE);
    parameter.setId(component.getId() + "_" + valueForLink.getTime() + "_param");
    parameter.setTransient(true);
    parameter.setName(component.getClientId(facesContext));
    parameter.setValue(converter.getAsString(facesContext, component, valueForLink));
    RendererUtils.addOrReplaceChild(component, link);
    link.getChildren().add(parameter);
    link.getChildren().add(text);
    RendererUtils.renderChild(facesContext, link);
}
Also used : Locale(java.util.Locale) UIParameter(javax.faces.component.UIParameter) AbstractHtmlInputCalendar(org.apache.myfaces.custom.calendar.AbstractHtmlInputCalendar) HtmlInputCalendar(org.apache.myfaces.custom.calendar.HtmlInputCalendar) HtmlAriaCommandLink(org.santfeliu.faces.component.HtmlAriaCommandLink) DefaultDateBusinessConverter(org.apache.myfaces.custom.calendar.DefaultDateBusinessConverter) DateBusinessConverter(org.apache.myfaces.custom.calendar.DateBusinessConverter) DateTimeConverter(javax.faces.convert.DateTimeConverter) Converter(javax.faces.convert.Converter) ResourceBundle(java.util.ResourceBundle) HtmlOutputText(javax.faces.component.html.HtmlOutputText) Application(javax.faces.application.Application)

Aggregations

HtmlOutputText (javax.faces.component.html.HtmlOutputText)8 Application (javax.faces.application.Application)3 HtmlPanelGroup (javax.faces.component.html.HtmlPanelGroup)3 UIParameter (javax.faces.component.UIParameter)2 HtmlAriaCommandLink (org.santfeliu.faces.component.HtmlAriaCommandLink)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1 UIComponent (javax.faces.component.UIComponent)1 UIOutput (javax.faces.component.UIOutput)1 UISelectItems (javax.faces.component.UISelectItems)1 HtmlCommandButton (javax.faces.component.html.HtmlCommandButton)1 HtmlPanelGrid (javax.faces.component.html.HtmlPanelGrid)1 HtmlSelectOneMenu (javax.faces.component.html.HtmlSelectOneMenu)1 FacesContext (javax.faces.context.FacesContext)1 Converter (javax.faces.convert.Converter)1 DateTimeConverter (javax.faces.convert.DateTimeConverter)1 MethodBinding (javax.faces.el.MethodBinding)1