Package org.richfaces.component

Examples of org.richfaces.component.UIColumn


        public void encodeBegin(FacesContext context, ResponseWriter writer,
                UIComponent column, String facetName, boolean sortableColumn)
                throws IOException {
            if (column instanceof UIColumn) {
                UIColumn dataColumn = (UIColumn) column;
                String clientId = dataColumn.getClientId(context);// +
                // facetName;
                writer.writeAttribute("id", clientId, null);
                column.getAttributes().put("columnClientId", clientId);
                boolean sortable = sortableColumn && dataColumn.isSelfSorted();
                if (sortable) {
                    /*
                     * writer.writeAttribute(HTML.onclick_ATTRIBUTE,
                     * buildAjaxFunction( context, column, true,
                     * getOnAjaxCompleteFunction(context, (UIDataTable)
                     * column.getParent())) .toString(), null);
                     */
                    writer.writeAttribute(HTML.style_ATTRIBUTE,
                            "cursor: pointer;", null);
                }
                writer.writeAttribute("sortable", String.valueOf(sortable),
                        null);
                // column.getAttributes().put("sortable",Boolean.valueOf(sortable));
                // drag source area
                writer.startElement(HTML.DIV_ELEM, dataColumn);
                writer.writeAttribute(HTML.id_ATTRIBUTE, dataColumn.getParent()
                        .getClientId(context)
                        + "_hdrag_" + dataColumn.getId(), null);

                writer.startElement(HTML.DIV_ELEM, dataColumn);
                writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + ":sortDiv",
                        null);
                AjaxContext.getCurrentInstance().addRenderedArea(
View Full Code Here


        public void encodeEnd(FacesContext context, ResponseWriter writer,
                UIComponent column, String facetName, boolean sortableColumn)
                throws IOException {
            if (column instanceof UIColumn) {
                UIColumn dataColumn = (UIColumn) column;
                String clientId = dataColumn.getClientId(context) + facetName;
                String tableId = dataColumn.getParent().getClientId(context);

                String imageUrl = null;
                if (sortableColumn) {
                    if (Ordering.ASCENDING.equals(dataColumn.getSortOrder())) {
                        if (null != dataColumn.getSortIconAscending()) {
                            imageUrl = dataColumn.getSortIconAscending();
                        } else {
                            imageUrl = getResource(
                                    TriangleIconUp.class.getName()).getUri(
                                    context, null);
                        }
                    } else if (Ordering.DESCENDING.equals(dataColumn
                            .getSortOrder())) {
                        if (null != dataColumn.getSortIconDescending()) {
                            imageUrl = dataColumn.getSortIconDescending();
                        } else {
                            imageUrl = getResource(
                                    TriangleIconDown.class.getName()).getUri(
                                    context, null);
                        }
                    } else if (dataColumn.isSelfSorted()) {
                        if (null != dataColumn.getSortIcon()) {
                            imageUrl = dataColumn.getSortIcon();
                        } else {
                            imageUrl = getResource(
                                    DataTableIconSortNone.class.getName())
                                    .getUri(context, null);
                        }
                    }
                }
                else{
                  //set empty image
                  imageUrl = getResource("/org/richfaces/renderkit/html/images/s.gif").getUri(context, null);
                }
                if (imageUrl != null) {
                    writer.startElement(HTML.IMG_ELEMENT, column);
                    writer.writeAttribute(HTML.src_ATTRIBUTE, imageUrl,
                            null);
                    writer.writeAttribute(HTML.class_ATTRIBUTE,
                            "extdt-header-sort-img", null);
                    writer.endElement(HTML.IMG_ELEMENT);
                }
                writer.endElement(HTML.SPAN_ELEM);

                writer.endElement(HTML.DIV_ELEM);

                // drag source area
                writer.endElement(HTML.DIV_ELEM);
                String dragSourceId = tableId + "_hdrag_" + dataColumn.getId();
                String indicatorId = tableId + ":dataTable_indicator";
                renderDragSupport(context, dataColumn, dragSourceId,
                        indicatorId, (String)dataColumn.getAttributes().get("label"));

                // separator area
                writer.startElement(HTML.SPAN_ELEM, column);
                writer.writeAttribute(HTML.id_ATTRIBUTE, clientId + ":sepSpan",
                        null);
                writer
                        .writeAttribute(HTML.class_ATTRIBUTE, "extdt-hsep",
                                null);
                writer.endElement(HTML.SPAN_ELEM);

                // drop target area LEFT
                String spanId = tableId + "_hdrop_" + dataColumn.getId()
                        + "left";
                writer.startElement(HTML.SPAN_ELEM, column);
                writer.writeAttribute(HTML.id_ATTRIBUTE, spanId, null);
                writer.writeAttribute(HTML.class_ATTRIBUTE, "extdt-hdrop",
                        null);
                writer.writeAttribute(HTML.style_ATTRIBUTE,
                        "visibility: hidden;", null);
                writer.startElement(HTML.SPAN_ELEM, column);
                writer.writeAttribute(HTML.class_ATTRIBUTE,
                        "extdt-hdrop-top extdt-hdrop-top-left", null);
                writer.writeAttribute(HTML.style_ATTRIBUTE,
                        "visibility: hidden;", null);
                writer.endElement(HTML.SPAN_ELEM);
                writer.startElement(HTML.SPAN_ELEM, column);
                writer.writeAttribute(HTML.class_ATTRIBUTE,
                        "extdt-hdrop-bottom extdt-hdrop-bottom-left", null);
                writer.writeAttribute(HTML.style_ATTRIBUTE,
                        "visibility: hidden;", null);
                writer.endElement(HTML.SPAN_ELEM);
                writer.endElement(HTML.SPAN_ELEM);
                renderDropSupport(context, dataColumn, spanId, true);

                // drop target area RIGHT
                spanId = tableId + "_hdrop_" + dataColumn.getId() + "right";
                writer.startElement(HTML.SPAN_ELEM, column);
                writer.writeAttribute(HTML.id_ATTRIBUTE, spanId, null);
                writer.writeAttribute(HTML.class_ATTRIBUTE, "extdt-hdrop",
                        null);
                writer.writeAttribute(HTML.style_ATTRIBUTE,
View Full Code Here

    public void testAddInplaceInput() {
//        UIColumn column = (UIColumn) application
//                .createComponent(UIColumn.COMPONENT_TYPE);
//        column.setId("columnId");
      UIColumn column = (UIColumn)RendererUtils.getInstance().findComponentFor(table, "columnId0");
        column.setFilterValue("test");
        // filter event == null
        try {
            setupResponseWriter();
            renderer.addInplaceInput(facesContext, column);
            UIInput input = (UIInput) column.getFacets()
                    .get("filterValueInput");
            //assertEquals("buffer", input.getAttributes().get("onchange"));
            assertTrue(((String)input.getAttributes().get("onchange")).length()>0);
            assertEquals("test", input.getValue());
        } catch (IOException e) {
            fail(e.getMessage());
        }
        // with set filter event
        column.getAttributes().put("filterEvent", "testEvent");
        try {
            setupResponseWriter();
            renderer.addInplaceInput(facesContext, column);
            UIInput input = (UIInput) column.getFacets()
                    .get("filterValueInput");
            assertTrue(((String)input.getAttributes().get("testEvent")).length()>0);
            //assertEquals("buffer", input.getAttributes().get("testEvent"));
            assertEquals("test", input.getValue());
        } catch (IOException e) {
            fail(e.getMessage());
        }
        column.setFilterValue(null);
    }
View Full Code Here

        // setUp
        final Map<String, Object> attributes = dataTable.getAttributes();
        attributes.put("columnsWidth", "400px,200px");
        attributes.put("onRowMouseOver", "onRowMouseOver");
       
        UIColumn column3 = (UIColumn) application.createComponent("org.richfaces.Column");
        column3.setId("local_column3");
        dataTable.getChildren().add(column3);
        UIOutput text = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        text.setValue("Column");
        column3.getChildren().add(text);
        column3.setBreakBefore(true);

        UIColumn column4 = (UIColumn) application.createComponent("org.richfaces.Column");
        column4.setId("local_column4");
        dataTable.getChildren().add(column4);
        UIOutput text2 = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        text.setValue("Column2");
        column4.getChildren().add(text2);
        column4.setRendered(false);

        // test
        HtmlPage page = renderView();
//        System.out.println(page.asXml());
       
View Full Code Here

       
        UIColumnGroup header1 = (UIColumnGroup) application.createComponent("org.richfaces.ColumnGroup");
        header1.getAttributes().put("columnClasses", "cola, colb");
        dataTable.getFacets().put("header", header1);

        UIColumn headerColumn1 = (UIColumn) application.createComponent("org.richfaces.Column");
        UIOutput headerText1 = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        headerText1.setValue("Header Column1");
        headerColumn1.getChildren().add(headerText1);
        header1.getChildren().add(headerColumn1);

        UIOutput column1header = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        column1header.setValue("Column1 Header");
        headerColumn1.getFacets().put("header", column1header);

        UIColumn headerColumn2 = (UIColumn) application.createComponent("org.richfaces.Column");
        UIOutput headerText2 = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        headerText2.setValue("Header Column2");
        headerColumn2.getChildren().add(headerText2);
        header1.getChildren().add(headerColumn2);

        UIOutput column2header = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        column2header.setValue("Column2 Header");
        headerColumn2.getFacets().put("header", column2header);

        UIOutput caption = (UIOutput) createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
        dataTable.getFacets().put("caption", caption);
        caption.setValue("Caption");
View Full Code Here

        facesContext.getViewRoot().getChildren().add(table);
        table.setId("extDT");

        for (int i = 0; i < 4; i++) {
            UIColumn column = (UIColumn) application
                    .createComponent(UIColumn.COMPONENT_TYPE);
            column.setId("columnId" + i);
            column.setRendered(true);
            column.setSortable(true);
            UIOutput text = (UIOutput) createComponent(
                    HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class
                            .getName(), null, null, null);
            column.getFacets().put("header", text);
            column.getFacets().put("footer", text);
            if (i == 0) {
                column.setSortOrder(Ordering.ASCENDING);
            }

            table.getChildren().add(column);
        }
View Full Code Here

    parentTag.doEndTag();

    assertNotNull(dataTable);
    assertTrue(dataTable.getChildCount() == columnsCount);

    UIColumn column = (UIColumn) dataTable.getChildren().get(0);
    assertNotNull(column);
    assertTrue(column.getParent().equals(dataTable));
  }
View Full Code Here

       
        //Create data table
        table = (UIExtendedDataTable) application.createComponent(UIExtendedDataTable.COMPONENT_TYPE);
        table.setId("table");
       
        UIColumn column = (UIColumn) createComponent(
                UIColumn.COMPONENT_TYPE,
                "org.richfaces.component.Column",
                null, null, null
        );
       
        column.setFilterValue("field");
       
        UIOutput output = (UIOutput) createComponent(
                UIOutput.COMPONENT_TYPE,
                HtmlOutputText.class.getName(),
                null, null, null
        );
       
        column.getChildren().add(output);
       
       
        table.getChildren().add(column);
       
        facesContext.getViewRoot().getChildren().add(table);
View Full Code Here

        return sort;
    }

    public void cycleSorting(ColumnSortCompositeComponent columnSort) {
        UIColumn column = columnSort.getParentColumn();
        SortOrder currentSort = getSorting(column.getId());
        SortOrder newSort = SortOrder.unsorted;

        if (currentSort == null || currentSort == SortOrder.unsorted
                || currentSort == SortOrder.descending) {
            newSort = SortOrder.ascending;
        } else if (currentSort == SortOrder.ascending) {
            newSort = SortOrder.descending;
        }

        for (UIColumn col : columnSort.getTableColumns()) {
            // Clicked column gets the new sort order
            if (col.getId().equals(column.getId())) {
                col.setSortOrder(newSort);
                sortingOrder.put(col.getId(), newSort);
            }
            // Other columns get unsorted
            else {
View Full Code Here

      Iterator<Caracteristiques> caracteristiquesIter = lc.iterator();
      while (caracteristiquesIter.hasNext())
      {
        Caracteristiques caracteristica = (Caracteristiques) caracteristiquesIter.next();
       
        UIColumn columna = buildColumn(
            caracteristica.getCaracteristicaKey() ,
            "#{item.caractInmobles[" + caracteristica.getCaracteristicaKey() + "]}",
            "#{inmobleForm.columnesVisibles[" + caracteristica.getNom() + "]}",
            caracteristica.getNom(),
            caracteristica.getTtpbasic().getBdtype(),
View Full Code Here

TOP

Related Classes of org.richfaces.component.UIColumn

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.