All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.myfaces.custom.suggestajax.tablesuggestajax.HtmlOutputText Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.myfaces.custom.suggestajax.tablesuggestajax;


import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;

import org.apache.myfaces.custom.inputAjax.Listener;
import org.apache.myfaces.custom.util.ComponentUtils;
import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;

/**
 * @author Gerald Muellan
 *         Date: 15.02.2006
 *         Time: 13:30:43
 */
public class HtmlOutputText extends org.apache.myfaces.component.html.ext.HtmlOutputText
{
    public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlOutputTextFor";

    private String _for;
    private String _forValue;
    private String _label;

    public HtmlOutputText()
    {
    }

    public void encodeBegin(FacesContext facesContext) throws IOException
    {
        super.encodeBegin(facesContext);
    }

    public void encodeEnd(FacesContext facesContext) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        writer.startElement(HTML.SPAN_ELEM, null);
        writer.writeAttribute("id", this.getClientId(facesContext), null);
        super.encodeEnd(facesContext);
        writer.endElement(HTML.SPAN_ELEM);
    }

    public boolean getRendersChildren()
    {
        return true;
    }

    public void encodeChildren(FacesContext facesContext) throws IOException
    {
        checkForListeners(facesContext, this);
        super.encodeChildren(facesContext);
    }

    private void checkForListeners(FacesContext context, UIComponent component)
    {
        // TODO: MOVE THIS UP THE TREE OR TO SOME OTHER LEVEL SO IT CAN WORK ON ANY COMPONENT
        List children = component.getChildren();
        if(children != null){
            for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy