Package javax.faces.component

Examples of javax.faces.component.UIData


    writer.write("\n");
  }
 
  public void encodeChildren(FacesContext context, UIComponent component) throws IOException
 
    UIData uiData = (UIData)component;
   
    if(component.getChildCount()==0){return;}
   
    for(UIComponent uiChild : uiData.getChildren())
    {
      logger.debug(uiChild.getClass().getName());
      if(uiChild instanceof UIInputCheckboxes)
      {
        for(int index=0;index<uiData.getRowCount();index++)
        {
          uiData.setRowIndex(index);
          uiChild.encodeAll(context);
        }
      }
      else if(uiChild instanceof UIInputTexts)
      {
        for(int index=0;index<uiData.getRowCount();index++)
        {
          uiData.setRowIndex(index);
          uiChild.encodeAll(context);
        }
      }
      else{uiChild.encodeAll(context);}
    }
View Full Code Here


  public String getComponentType(){return "net.sf.jwan.Menu";}
 
  public void setProperties(UIComponent component)
  {
    super.setProperties(component);
    UIData uiDataComponent = (UIData)component;
    uiDataComponent.setValueExpression("title", title);
    uiDataComponent.setValueExpression("styleClass", styleClass);
    uiDataComponent.setValueExpression("value", value);
    uiDataComponent.setVar(var);
   
   
    if(actionListener!=null)
    {
      ((ActionSource)uiDataComponent).addActionListener(new MethodExpressionActionListener(actionListener));
View Full Code Here

  public String getComponentType(){return "net.sf.jwan.InputRadio";}
 
  public void setProperties(UIComponent component)
  {
    super.setProperties(component);
    UIData uiDataComponent = (UIData)component;
    uiDataComponent.setValueExpression("label", label);
    uiDataComponent.setValueExpression("value", value);
    uiDataComponent.setVar(var);
  }
View Full Code Here

  public String getComponentType(){return "net.sf.jwan.InputSelect";}
 
  public void setProperties(UIComponent component)
  {
    super.setProperties(component);
    UIData uiDataComponent = (UIData)component;
    uiDataComponent.setValueExpression("label", label);
    uiDataComponent.setValueExpression("value", value);
    uiDataComponent.setVar(var);
  }
View Full Code Here

  public String getComponentType(){return "net.sf.jwan.Fieldset";}
 
  public void setProperties(UIComponent component)
  {
    super.setProperties(component);
    UIData uiDataComponent = (UIData)component;
    uiDataComponent.setValueExpression("legend", legend);
    uiDataComponent.setValueExpression("value", value);
    uiDataComponent.setVar(var);
   
  }
View Full Code Here

  public String getComponentType(){return "net.sf.jwan.Area";}
 
  public void setProperties(UIComponent component)
  {
    super.setProperties(component);
    UIData uiDataComponent = (UIData)component;
    uiDataComponent.setValueExpression("type", type);
    uiDataComponent.setValueExpression("value", value);
    uiDataComponent.setVar(var);
   
   
    if(actionListener!=null)
    {
      ((ActionSource)uiDataComponent).addActionListener(new MethodExpressionActionListener(actionListener));
View Full Code Here

    }
    return null;
  }*/

  protected DefaultMutableTreeNode getRowData() {
    final UIData data = ComponentUtils.findAncestor(this, UIData.class);
    final Object rowData = data.getRowData();
    return (DefaultMutableTreeNode) rowData;
  }
View Full Code Here

    return node.getLevel();
  }

  public String nodeStateId(FacesContext facesContext) {
    final String clientId = getClientId(facesContext);
    final UIData data = ComponentUtils.findAncestor(this, UIData.class);
    String dataId = data.getClientId(facesContext);
    return clientId.substring(dataId.length() + 1);
  }
View Full Code Here

    dataModel = new OneSelectionTrackingListDataModel(rows);
  }

  public void testProcessActionWithUIData() {

    UIData dataTable = new UIData();
    dataTable.setValue(dataModel);
    UIColumn column = new UIColumn();
    UICommand commandButton = new UICommand();
    column.getChildren().add(commandButton);
    dataTable.getChildren().add(column);
    viewToTest.getChildren().add(dataTable);
    dataTable.setRowIndex(1);

    ActionEvent event = new ActionEvent(commandButton);

    selectionTrackingListener.processAction(event);
View Full Code Here

     * This method is separated from the encodeChildren so that it can be overridden by
     * subclasses. One class that uses this functionality is autoUpdateDataTable.
     */
     public void encodeInnerHtml(FacesContext facesContext, UIComponent component)throws IOException{

        UIData uiData = (UIData) component;
        ResponseWriter writer = facesContext.getResponseWriter();

        int rowCount = uiData.getRowCount();

        int newspaperColumns = getNewspaperColumns(component);

        if (rowCount == -1 && newspaperColumns == 1)
        {
            encodeInnerHtmlUnknownRowCount(facesContext, component);
            return;
        }
       
        if (rowCount == 0)
        {
            //nothing to render, to get valid xhtml we render an empty dummy row
            writer.startElement(HTML.TR_ELEM, uiData);
            writer.startElement(HTML.TD_ELEM, uiData);
            writer.endElement(HTML.TD_ELEM);
            writer.endElement(HTML.TR_ELEM);
            return;
        }

        // begin the table
        // get the CSS styles
        Styles styles = getStyles(uiData);

        int first = uiData.getFirst();
        int rows = uiData.getRows();
        int last;

        if (rows <= 0)
        {
           last = rowCount;
        }
        else
        {
           last = first + rows;
           if (last > rowCount)
           {
               last = rowCount;
           }
        }

        int newspaperRows;
        if((last - first) % newspaperColumns == 0)
        {
            newspaperRows = (last - first) / newspaperColumns;
        }
        else
        {
            newspaperRows = ((last - first) / newspaperColumns) + 1;
        }
        boolean newspaperHorizontalOrientation = isNewspaperHorizontalOrientation(component);

        // walk through the newspaper rows
        for(int nr = 0; nr < newspaperRows; nr++)
        {
            boolean rowStartRendered = false;
            // walk through the newspaper columns
            for(int nc = 0; nc < newspaperColumns; nc++)
            {

                // the current row in the 'real' table
                int currentRow;
                if (newspaperHorizontalOrientation)
                {
                    currentRow = nr * newspaperColumns + nc + first;
                }
                else
                {
                    currentRow = nc * newspaperRows + nr + first;
                }
               
                // if this row is not to be rendered
                if(currentRow >= last)
                {
                    continue;
                }

                // bail if any row does not exist
                uiData.setRowIndex(currentRow);
                if(!uiData.isRowAvailable())
                {
                    log.error("Row is not available. Rowindex = " + currentRow);
                    break;
                }
   
                if (nc == 0)
                {
                    // first column in table, start new row
                    beforeRow(facesContext, uiData);

                    HtmlRendererUtils.writePrettyLineSeparator(facesContext);
                    renderRowStart(facesContext, writer, uiData, styles, nr);
                    rowStartRendered = true;
                }

                List children = null;
                for (int j = 0, size = getChildCount(component); j < size; j++)
                {
                    if (children == null)
                    {
                        children = getChildren(component);
                    }
                    UIComponent child = (UIComponent) children.get(j);
                    if (child.isRendered())
                    {
                        boolean columnRendering = child instanceof UIColumn;
                       
                        if (columnRendering)
                        {
                            beforeColumn(facesContext, uiData, j);
                        }
                          
                        encodeColumnChild(facesContext, writer, uiData, child,
                                styles, nc * uiData.getChildCount() + j);                   
                      
                        if (columnRendering)
                        {
                            afterColumn(facesContext, uiData, j);
                        }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIData

Copyright © 2018 www.massapicom. 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.