ArticlesTutorialsInterview Questions & AnswersCertificationsFree Books & Sample ChaptersTechnical Discussions  Your Account | Advertise with us | Feedback |
Few pages of this site are under construction and we are constantly trying to improve it. If you have any suggestions or ideas about how to improve the site, please Let us know.
Tomahawk DataScroller

 t:dataList Tomahawk Tag Home t:dataTable 

<t:dataScroller>


Contents

  1. Introduction
  2. Tag Attributes
  3. Example

Introduction

The t:dataScroller tag adds scrolling navigation to data components, such as t:dataTable and t:dataList.

Note :

  • DataScroller must be nested inside of an UIData component, or attribute "for" must be given so that corresponding uiData can be found.
  • The "row" attribute must be specified on the corresponding uiData.
  • The scope of pageIndexVar and pageCountVar is limited, and only direct children of DataScroller may see them.


Tag Attributes


AttributeDescription   Type    
actionListener The actionListener attribute accepts a method-binding expression for a backing bean action listener method that will be notified when this component is activated by the user. An action listener method must be a public method with an javax.faces.event.ActionEvent parameter and a void return type.The phase that this event is fired in can be controlled via the immediate attribute.String
binding The value-binding expression linking this component tag to a backing bean property.String
displayedRowsCountVar The displayedRowsCountVar attribute. String
enabledOnUserRole If user is in given role, this component will be rendered normally. If not, no hyperlink is rendered but all nested tags (=body) are rendered.String
fastStep The fastStep attribute defines how many pages to traverse forward or backwards for fastforward or fastrewind.String
firstRowIndexVar The firstRowIndexVar attribute sets a name that can be used to reference the firstRowIndexVar parameter. The first row index represents the DISPLAYED UI data component's first row. The firstRowIndexVar parameter is set during request scope.String
for The for attribute is the id of the component this component extends or is part of. This attribute is required by some tags. String
id The unique identifier value for this component. The value must be unique within the closest naming container (e.g.,h:form or f:subview).This value must be a static value.String
immediate A boolean value that identifies the phase during which action events should fire. During normal event processing, action methods and action listener methods are fired during the "invoke application" phase of request processing. If this attribute is set to "true", these methods are fired instead at the end of the "apply request values" phase.String
lastRowIndexVar The lastRowIndexVar attribute sets a name that can be used to reference the lastRowIndexVar parameter. The last row index represents the DISPLAYED UI data component's last row. The lastRowIndexVar parameter is set during request scope.String
pageCountVarThe pageCountVar attribute sets a name that can be used to reference the pageCountVar parameter. The pageCount represents the number of pages that the UI data component has. The pageCountVar parameter is set during request scope.String
pageIndexVarThe pageCountVar attribute sets a name that can be used to reference the pageCountVar parameter. The pageCount represents the number of pages that the UI data component has. The pageCountVar parameter is set during request scope.String
paginatorThe pageIndexVar attribute sets a name that can be used to reference the pageIndexVar parameter. The pageIndexVar represents the current page that is DISPLAYED of the UI data component. The pageCountVar parameter is set during request scope.String
paginatorThe paginator attribute renders the paginator is set to true.String
paginatorActiveColumnClassThe paginatorActiveColumnClass attribute sets the CSS style class to apply to the current page indicator.String
paginatorActiveColumnStyleThe paginatorActiveColumnStyle attribute sets the CSS style to apply to the current page indicator.String
paginatorColumnClassThe paginatorColumnClass attribute defines the CSS class applied to the paginator for this component.String
paginatorColumnStyleThe paginatorColumnStyle attribute defines the CSS style applied to the paginator for this component.String
paginatorMaxPagesThe paginatorMaxPages attribute sets the maximum number of pages to be selectable within the paginator.String
paginatorTableClassThe paginatorTableClass attribute defines the CSS class applied to the table for the paginator of this component.String
paginatorTableStyleThe paginatorTableStyle attribute defines the CSS style applied to the table for the paginator of this component.String
renderFacetsIfSinglePageThe renderFacetsIfSinglePage attribute expects a boolean value that, when true, causes the facets of this component to be rendered when the data contained by this component does not exceed one page. The default value is true.String
renderedA boolean value that indicates whether this component should be rendered.Default value: true.String
rowCountVarThe rowCountVar attribute specifies a request attribute name for the variable storing the row count value.String
styleThe style attribute sets the CSS style definition to be applied to this component when it is rendered.String
styleClassThe styleClass attribute sets the CSS class to apply to this component when it is rendered.String
titleAn advisory title for this element. Often used by the user agent as a tooltip.String
valueThe value attribute sets the current value for this component.String
var(required)The var attribute sets the name of a request-scope attribute exposing the data for each iteration over the rows in the underlying data model for this table.String
visibleOnUserRoleIf user is in given role, this component will be rendered normally. If not, nothing is rendered and the body of this tag will be skipped. String


Example



 As an example suppose we need to have list of car information to some of the entities in our application. First thing to do is to create the SimpleCar class with the id,type and color.


SimpleCar.java

package com.developersBook.tomahawk.examples.listExample;
import java.io.Serializable;
public class SimpleCar implements Serializable
{
private int id;
private String type;
private String color;
public SimpleCar(int id, String type, String color) {
super();
this.id = id;
this.type = type;
this.color = color;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}


DataScrollerList.java

package com.developersBook.tomahawk.examples.listExample;
import java.util.ArrayList;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
public class DataScrollerList
{
private Long rowCount = new Long(10);
public Long getRowCount() {
return rowCount;
}
public void setRowCount(Long rowCount) {
this.rowCount = rowCount;
}
private List carList = new ArrayList();
public DataScrollerList()
{
for (int i = 1; i < 995; i++)
{
carList.add(new SimpleCar(i, "Car Type " + i, "blue"));

  }
}
public List getList()
{
return carList;
}
public void scrollerAction(ActionEvent event)
{
ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
FacesContext.getCurrentInstance().getExternalContext().log(
"scrollerAction: facet: "
        + scrollerEvent.getScrollerfacet()
        + ", pageindex: "
        + scrollerEvent.getPageIndex());
  }

}

DataScrollerList.jsp

<f:view>
<h:form>
  <t:buffer into="#{buffer1}">
    <t:div><h:outputText value="BufferOne"/></t:div>
  </t:buffer>

  <t:buffer into="#{buffer2}">
    <t:div><h:outputText value="Buffer Two"/></t:div>
  </t:buffer>

  <h:outputText value="#{buffer2}" escape="false"/>
  <h:outputText value="#{buffer1}" escape="false"/>
  <h:outputText value="#{buffer2}" escape="false"/>

    <t:buffer into="#{table}">
    <t:dataTable id="data"
        styleClass="scrollerTable"
        headerClass="standardTable_Header"
        footerClass="standardTable_Header"
        rowClasses="standardTable_Row1,standardTable_Row2"

        var="car"
        value="#{scrollerList.list}"
        preserveDataModel="false"
        rows="10">
     <h:column>
       <f:facet name="header">
       </f:facet>
       <h:outputText value="#{car.id}" />
     </h:column>

     <h:column>
       <f:facet name="header">
         <h:outputText value="#{example_messages['label_cars']}" />
       </f:facet>
       <h:outputText value="#{car.type}" />
     </h:column>

    <h:column>
       <f:facet name="header">
         <h:outputText value="#{example_messages['label_color']}" />
       </f:facet>
       <h:outputText value="#{car.color}" />
     </h:column>

    </t:dataTable>
  </t:buffer>

  <t:buffer into="#{tableScroller}">
    <h:panelGrid columns="1" styleClass="scrollerTable2" columnClasses="standardTable_ColumnCentered" >
      <t:dataScroller id="scroll_1"
          for="data"
          fastStep="10"
          pageCountVar="pageCount"
          pageIndexVar="pageIndex"
          styleClass="scroller"
          paginator="true"
          paginatorMaxPages="9"
          paginatorTableClass="paginator"
          paginatorActiveColumnStyle="font-weight:bold;">
          <f:facet name="first" >
            <t:graphicImage url="images/arrow-first.gif" border="1" />
          </f:facet>
          <f:facet name="last">
            <t:graphicImage url="images/arrow-last.gif" border="1" />
          </f:facet>
          <f:facet name="previous">
            <t:graphicImage url="images/arrow-previous.gif" border="1" />
          </f:facet>
          <f:facet name="next">
            <t:graphicImage url="images/arrow-next.gif" border="1" />
          </f:facet>
          <f:facet name="fastforward">
            <t:graphicImage url="images/arrow-ff.gif" border="1" />
          </f:facet>
          <f:facet name="fastrewind">
            <t:graphicImage url="images/arrow-fr.gif" border="1" />
          </f:facet>
        </t:dataScroller>
        <t:dataScroller id="scroll_2"
            for="data"
            rowsCountVar="rowsCount"
            displayedRowsCountVar="displayedRowsCountVar"
            firstRowIndexVar="firstRowIndex"
            lastRowIndexVar="lastRowIndex"
            pageCountVar="pageCount"
            pageIndexVar="pageIndex">
            <h:outputFormat value="#{example_messages['dataScroller_pages']}" styleClass="standard" >
              <f:param value="#{rowsCount}" />
              <f:param value="#{displayedRowsCountVar}" />
              <f:param value="#{firstRowIndex}" />
              <f:param value="#{lastRowIndex}" />
              <f:param value="#{pageIndex}" />
              <f:param value="#{pageCount}" />
            </h:outputFormat>
        </t:dataScroller>
    </h:panelGrid>
  </t:buffer>

  <h:outputText value="#{tableScroller}" escape="false"/>
  <h:outputText value="#{table}" escape="false"/>
  <h:outputText value="#{tableScroller}" escape="false"/>

</h:form>
</f:view>


In the end, this is how it looks;




 t:dataList Tomahawk Tag Home t:dataTable 
Related Links

Tomahawk
t:aliasBean
t:aliasBeansScope
t:buffer
t:checkbox
t:collapsiblePanel
t:column
t:columns
t:commandButton
t:commandLink
t:commandNavigation
t:commandNavigation2
t:commandSortHeader
t:dataList
t:dataScroller
t:dataTable
t:div
t:document
t:documentBody
t:documentHead
t:dojoInitializer
t:graphicImage
t:headerLink
t:htmlTag
t:iconProvider
t:inputCalendar
t:inputDate
t:inputFileUpload
t:inputHidden
t:inputHtml
t:inputSecret
t:inputText
t:inputTextHelp
t:inputTextarea
t:jsValueChangeListener
t:jsValueSet
t:jscookMenu
t:message
t:messages
t:navigationMenuItem
t:navigationMenuItems
t:newspaperTable
t:outputLabel
t:outputText
t:panelGrid
t:panelGroup
t:panelLayout
t:panelNavigation
t:panelNavigation2
t:panelStack
t:panelTab
t:panelTabbedPane
t:popup
t:radio
t:saveState
t:schedule
t:selectBooleanCheckbox
t:selectItems
t:selectManyCheckbox
t:selectManyListbox
t:selectManyMenu
t:selectOneCountry
t:selectOneLanguage
t:selectOneListbox
t:selectOneMenu
t:selectOneRadio
t:stylesheet
t:swapImage
t:tabChangeListener
t:tree
t:tree2
t:treeCheckbox
t:treeColumn
t:treeSelectionListener
t:updateActionListener
t:validateCreditCard
t:validateEmail
t:validateEqual
t:validateRegExpr
Core Tags
f:actionListener
f:attribute
f:converter
f:convertDateTime
f:convertNumber
f:facet
f:loadBundle
f:param
f:selectitem
f:selectitems
f:subview
f:validateDoubleRange
f:validateLength
f:validateLongRange
f:validator
f:valueChangeListener
f:verbatim
f:view
HTML Tags
h:column
h:commandButton
h:commandLink
h:dataTable
h:form
h:graphicImage
h:inputHidden
h:inputSecret
h:inputText
h:inputTextarea
h:message
h:messages
h:outputFormat
h:outputLabel
h:outputLink
h:outputText
h:panelGrid
h:panelGroup
h:selectBooleanCheckbox
h:selectManyCheckbox
h:selectManyListbox
h:selectManyMenu
h:selectOneListbox
h:selectOneMenu
h:selectOneRadio
Tomahawk
t:aliasBean
t:aliasBeansScope
t:buffer
t:checkbox
t:collapsiblePanel
t:column
t:columns
t:commandButton
t:commandLink
t:commandNavigation
t:commandNavigation2
t:commandSortHeader
t:dataList
t:dataScroller
t:dataTable
t:div
t:document
t:documentBody
t:documentHead
t:dojoInitializer
t:graphicImage
t:headerLink
t:htmlTag
t:iconProvider
t:inputCalendar
t:inputDate
t:inputFileUpload
t:inputHidden
t:inputHtml
t:inputSecret
t:inputText
t:inputTextHelp
t:inputTextarea
t:jsValueChangeListener
t:jsValueSet
t:jscookMenu
t:message
t:messages
t:navigationMenuItem
t:navigationMenuItems
t:newspaperTable
t:outputLabel
t:outputText
t:panelGrid
t:panelGroup
t:panelLayout
t:panelNavigation
t:panelNavigation2
t:panelStack
t:panelTab
t:panelTabbedPane
t:popup
t:radio
t:saveState
t:schedule
t:selectBooleanCheckbox
t:selectItems
t:selectManyCheckbox
t:selectManyListbox
t:selectManyMenu
t:selectOneCountry
t:selectOneLanguage
t:selectOneListbox
t:selectOneMenu
t:selectOneRadio
t:stylesheet
t:swapImage
t:tabChangeListener
t:tree
t:tree2
t:treeCheckbox
t:treeColumn
t:treeSelectionListener
t:updateActionListener
t:validateCreditCard
t:validateEmail
t:validateEqual
t:validateRegExpr
Core Tags
f:actionListener
f:attribute
f:converter
f:convertDateTime
f:convertNumber
f:facet
f:loadBundle
f:param
f:selectitem
f:selectitems
f:subview
f:validateDoubleRange
f:validateLength
f:validateLongRange
f:validator
f:valueChangeListener
f:verbatim
f:view
HTML Tags
h:column
h:commandButton
h:commandLink
h:dataTable
h:form
h:graphicImage
h:inputHidden
h:inputSecret
h:inputText
h:inputTextarea
h:message
h:messages
h:outputFormat
h:outputLabel
h:outputLink
h:outputText
h:panelGrid
h:panelGroup
h:selectBooleanCheckbox
h:selectManyCheckbox
h:selectManyListbox
h:selectManyMenu
h:selectOneListbox
h:selectOneMenu
h:selectOneRadio

  ALSO SEE :

About Us | Our Mission | Terms of use | Author Terms |    Search        | Contact Us | Advertise With Us | Link to Us | Sitemap
Copyright © 2008 developersBOOK.COM. All rights reserved.