You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by daniel ccss <da...@gmail.com> on 2007/07/03 05:42:43 UTC

Tomahawk+DataScroller+WorkingWithLargeTables

Hi all, I'm new in this mailing list, and I new using My Faces, hope you can
help me.

Things to know: i'm using JDeveloper 10.1.3.1, last My Faces, last Tomahawk
implementation version

I made the following things:
1-The datascroller example (http://www.irian.at/myfaces/dataScroller.jsf)
and all works fine.
2- Then I read and implemented the article in the wiki call:
WorkingWithLargeTables
(http://wiki.apache.org/myfaces/WorkingWithLargeTables ) and all works fine,
the number of links, the method who brings each DataPage, the data that is
displaying in each page, all fine.

But I noticed that when I put a System.out.println in the method that brings
the DataPage, the method that bring the DataPage from the database is
invoked several times, for example the System.outs that appear in my console
when I: load the page, click in page2 link, and click in page3 are:

... LINENUM BETWEEN 0 AND 2
... LINENUM BETWEEN 0 AND 2
... LINENUM BETWEEN 0 AND 2
... LINENUM BETWEEN 0 AND 2
... LINENUM BETWEEN 2 AND 4
... LINENUM BETWEEN 2 AND 4
... LINENUM BETWEEN 2 AND 4
... LINENUM BETWEEN 5 AND 7

Why this happen? I put a breakpoint in the fetchPage(int startRow, int
pageSize) method, and in fact it is call several times for each DataPage
that is show.

The DataPage<T> class and the PagedListDataModel<T> class are the same that
appears in the WorkingWithLargeTables article from wiki.

This is the code of my bean class:

public class PacienteBean {

    DataModel dataModel = null;
    private DataPage<Paciente> getDataPage(int inicio, int regPorPagina) {
        PacienteEJB paciente = null;
        try {
            final Context context = new InitialContext();
            paciente = (PacienteEJB)context.lookup("PacienteEJB");
        } catch (NamingException e) {
            System.out.println(e.getMessage());
        }
        return paciente.obtenerPacientes (inicio, regPorPagina);
    }

    public DataModel getDataModel() {
        if (dataModel == null) {
            dataModel = new LocalDataModel(2);
        }
        return dataModel;
    }

    private class LocalDataModel extends PagedListDataModel {
        public LocalDataModel(int pageSize) {
            super(pageSize);
        }

        public DataPage<Paciente> fetchPage(int startRow, int pageSize) {
            return getDataPage(startRow, pageSize);
        }
    }
    public String mostrarPacientes() {
        return "success";
    }
}

The only clue that I have is that something is happening in the jsp,
beacause the wiki article don´t explains how the jsp have to be, in fact I
leave it the same as the datascroller example jsp, only changing the value
of the DataTable value="#{PacienteBean.dataModel}" and putting the
preserveDataModel="false" because I want that for each page the DataPage be
loaded from the DataBase. This is my jsp:

<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk " prefix="t"%>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type"
                  content="text/html; charset=windows-1252"/>
            <title>listaPacientes</title>
        </head>
        <body><h:form>
                <h:panelGroup id="body">
                    <t:dataTable id="data" styleClass="scrollerTable"
                                 headerClass="standardTable_Header"
                                 footerClass="standardTable_Header"

rowClasses="standardTable_Row1,standardTable_Row2"

columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
                                 var="tablaPacientes"
                                 value="#{ PacienteBean.dataModel}"
                                 preserveDataModel="false" rows="2">
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:outputText value="#{tablaPacientes.numIdent
}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:outputText value="#{tablaPacientes.nombre}"/>
                        </h:column>
                    </t:dataTable>
                    <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;"
                                        immediate="true">
                            <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"
                                        immediate="true"
                                        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>
                </h:panelGroup>
                <t:commandLink value="test" immediate="true"/>
            </h:form></body>
    </html>
</f:view>
Please help me with this, we are actually deciding which implementation of
myfaces to use, and I really trust in apache work, I don´t want that other
implementation be choose for our applications, thanks!!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Sorry, Vladimir... it's 02:50 and my brain certainly needs to be 
rebooted :) I've thinking "Vladimir" and "vlad" are two different user.

Vladimir Isakovich schrieb:
> Another bothering issue. Why in Paul's catching method there is a 
> check on pageSize, is not it gonna be the same every time?
It's because in my application the user can change this value 'on the 
fly' (see attached image). This feature is not completely implemented 
yet. The idea behind is to adjust page size dynamically to fill screen 
with more or less items, if user changes the size of thumbnails (left 
slider). It is pretty easy with AJAX (and that's another one reason to 
maintain internal buffer larger than displayed page). Just ignore this 
stuff. Maybe, some day I'll get enough time to put it together into some 
article or tutorial.

Regards,
paul


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Strange, I think I lose some mails... Paul can you answer this last email
that I send, not sure if you already answered it, but something strange
happen, thanks, sorry :-(

Thanks for your answers, yes actually when I implemented your filter the
call to the DB reduce to 2 :), and then Vladimir says that with the
backing_bean in session all works fine, and yes, all works fine :), the only
problem is that when I implemented the add, delete, and the edit actions the
data in the data scroller is not update until I click on any page link of
the table (1,2,3). I think that this happen because of the filter (if) that
you did (great) so what I need now is a way to do the fetch no matter what
after and add/delete/edit action is made. So I was thinking in add another
condition to the if(.... || (doNomatherWhat) ...doFech). What I dont know is
where define this variable, and where to assign it the value to true after
the add/delete/edit method was called. Can you help me on this?

I think Vladimir write ideas about this I'm going to read then, and I will
wait for yours too thank you and thanks Vladimir!!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
...any time :) I have also to go home...
Regards,
paul
daniel ccss schrieb:
> Thanks Paul, ok, I will try it tomorrow, I'm not in my work right now 
> and I have my project there, I let you know how I did it, thanks for 
> all!!!
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Thanks Paul, ok, I will try it tomorrow, I'm not in my work right now and I
have my project there, I let you know how I did it, thanks for all!!!

On 7/5/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> test answer :)
> daniel ccss schrieb:
> > Hi Paul!!!!
> >
> > Thanks for your answers, yes actually when I implemented your filter
> > the call to the DB reduce to 2 :), and then Vladimir says that with
> > the backing_bean in session all works fine, and yes, all works fine
> > :), the only problem is that when I implemented the add, delete, and
> > the edit actions the data in the data scroller is not update until I
> > click on any page link of the table (1,2,3). I think that this happen
> > because of the filter (if) that you did (great) so what I need now is
> > a way to do the fetch no matter what after and add/delete/edit action
> > is made. So I was thinking in add another condition to the if(.... ||
> > (doNomatherWhat) ...doFech). What I dont know is where define this
> > variable, and where to assign it the value to true after the
> > add/delete/edit method was called. Can you help me on this?
> >
> > I think Vladimir write ideas about this I'm going to read then, and I
> > will wait for yours too thank you and thanks Vladimir!!!
> >
> > On 7/5/07, *Paul Iov * <paul@voller-ernst.de
> > <ma...@voller-ernst.de>> wrote:
> >
> >     Hi Vladimir and Daniel,
> >
> >     just read my post in parallel subthread ;)
> >
> >     regards,
> >     paul
> >     Vladimir Isakovich schrieb:
> >     > Daniel, I have not tried yet to perform actions like
> add/edit/delete
> >     > from the sroller.
> >     >
> >     > So, my thoughts only:
> >     > since your bean is session scoped now, you may have your boolean
> >     as an
> >     > instance variable.
> >     > Actually, you need to call for re-populating page when editing and
> >     > deleting, and when adding on the last page, if it has a vacant
> line.
> >     > Also you will need to adjust your total counter on add/delete
> >     >
> >     > You know, I'm still have some confusion about the current code.
> >     As I
> >     > understand, the custom tag is calling fetchPage() supplying it
> with
> >     > the pageSize, so why do I need to supply the pageSize when
> >     > instantiating DataModel.
> >     > I've tried to change the pageSize in my jsp only, and it got
> >     changed -
> >     > I did not see a problem. So, it seems the pageSize hardcoded in
> >     > getDataModel() is mute. I'm always afraid of those duplicate
> >     > definitions - who knows what will happen when you upgrade to a new
> >     > version of tomahawk.
> >     >
> >     > Another bothering issue. Why in Paul's catching method there is a
> >     > check on pageSize, is not it gonna be the same every time?
> >     >
> >     > vlad
> >     >
> >     >
> >     > On 7/5/07, *daniel ccss* < danielccss2@gmail.com
> >     <ma...@gmail.com>
> >     > <mailto: danielccss2@gmail.com <ma...@gmail.com>>>
> >     wrote:
> >     >
> >     >     I think is for the filter:
> >     >
> >     >                 if ((_lastPage == null) || (_lastStartRow !=
> >     startRow)
> >     >     || (_lastPageSize != pageSize)) {
> >     >                         _log.debug("**Fetch: required ->
> >     fetching...");
> >     >                         obligar = false;
> >     >                         _lastPage = fetchPage(startRow, pageSize);
> >     >                         _lastStartRow = startRow;
> >     >                         _lastPageSize = pageSize;
> >     >                 }else{
> >     >                         _log.debug("**Fetch: not required (already
> >     >     fetched)!");
> >     >                 }
> >     >                 return _lastPage;
> >     >
> >     >
> >     >
> >     >     I need that when an action like add, delete or edit occurs
> >     always
> >     >     enter to this if, what do you think is the best way to do
> this,
> >     >     add another condition to the if, lets say a boolen
> >     condition? that
> >     >     after the method that do the delete/add/edit action this
> >     boolen be
> >     >     set to true, if so where this boolean variable have to be, and
> >     >     where it have to be set, i´m thinking in something like this:
> >     >
> >     >     backing_bean
> >     >                 call delete method
> >     >                 set some variable to true
> >     >                 call the fetch method
> >     >     PagedListDataModel
> >     >                 add code to the if: if(..... || valiable=true)
> >     >                put the variable again in false
> >     >
> >     >     What I don´t have clear is where the boolean variable have to
> be
> >     >     define, and where to set his value.
> >     >
> >     >
> >     >
> >     >
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
test answer :)
daniel ccss schrieb:
> Hi Paul!!!!
>
> Thanks for your answers, yes actually when I implemented your filter 
> the call to the DB reduce to 2 :), and then Vladimir says that with 
> the backing_bean in session all works fine, and yes, all works fine 
> :), the only problem is that when I implemented the add, delete, and 
> the edit actions the data in the data scroller is not update until I 
> click on any page link of the table (1,2,3). I think that this happen 
> because of the filter (if) that you did (great) so what I need now is 
> a way to do the fetch no matter what after and add/delete/edit action 
> is made. So I was thinking in add another condition to the if(.... || 
> (doNomatherWhat) ...doFech). What I dont know is where define this 
> variable, and where to assign it the value to true after the 
> add/delete/edit method was called. Can you help me on this?
>
> I think Vladimir write ideas about this I'm going to read then, and I 
> will wait for yours too thank you and thanks Vladimir!!!
>
> On 7/5/07, *Paul Iov * <paul@voller-ernst.de 
> <ma...@voller-ernst.de>> wrote:
>
>     Hi Vladimir and Daniel,
>
>     just read my post in parallel subthread ;)
>
>     regards,
>     paul
>     Vladimir Isakovich schrieb:
>     > Daniel, I have not tried yet to perform actions like add/edit/delete
>     > from the sroller.
>     >
>     > So, my thoughts only:
>     > since your bean is session scoped now, you may have your boolean
>     as an
>     > instance variable.
>     > Actually, you need to call for re-populating page when editing and
>     > deleting, and when adding on the last page, if it has a vacant line.
>     > Also you will need to adjust your total counter on add/delete
>     >
>     > You know, I'm still have some confusion about the current code.
>     As I
>     > understand, the custom tag is calling fetchPage() supplying it with
>     > the pageSize, so why do I need to supply the pageSize when
>     > instantiating DataModel.
>     > I've tried to change the pageSize in my jsp only, and it got
>     changed -
>     > I did not see a problem. So, it seems the pageSize hardcoded in
>     > getDataModel() is mute. I'm always afraid of those duplicate
>     > definitions - who knows what will happen when you upgrade to a new
>     > version of tomahawk.
>     >
>     > Another bothering issue. Why in Paul's catching method there is a
>     > check on pageSize, is not it gonna be the same every time?
>     >
>     > vlad
>     >
>     >
>     > On 7/5/07, *daniel ccss* < danielccss2@gmail.com
>     <ma...@gmail.com>
>     > <mailto: danielccss2@gmail.com <ma...@gmail.com>>>
>     wrote:
>     >
>     >     I think is for the filter:
>     >
>     >                 if ((_lastPage == null) || (_lastStartRow !=
>     startRow)
>     >     || (_lastPageSize != pageSize)) {
>     >                         _log.debug("**Fetch: required ->
>     fetching...");
>     >                         obligar = false;
>     >                         _lastPage = fetchPage(startRow, pageSize);
>     >                         _lastStartRow = startRow;
>     >                         _lastPageSize = pageSize;
>     >                 }else{
>     >                         _log.debug("**Fetch: not required (already
>     >     fetched)!");
>     >                 }
>     >                 return _lastPage;
>     >
>     >
>     >
>     >     I need that when an action like add, delete or edit occurs
>     always
>     >     enter to this if, what do you think is the best way to do this,
>     >     add another condition to the if, lets say a boolen
>     condition? that
>     >     after the method that do the delete/add/edit action this
>     boolen be
>     >     set to true, if so where this boolean variable have to be, and
>     >     where it have to be set, i´m thinking in something like this:
>     >
>     >     backing_bean
>     >                 call delete method
>     >                 set some variable to true
>     >                 call the fetch method
>     >     PagedListDataModel
>     >                 add code to the if: if(..... || valiable=true)
>     >                put the variable again in false
>     >
>     >     What I don´t have clear is where the boolean variable have to be
>     >     define, and where to set his value.
>     >
>     >
>     >
>     >
>
>


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi Paul!!!!

Thanks for your answers, yes actually when I implemented your filter the
call to the DB reduce to 2 :), and then Vladimir says that with the
backing_bean in session all works fine, and yes, all works fine :), the only
problem is that when I implemented the add, delete, and the edit actions the
data in the data scroller is not update until I click on any page link of
the table (1,2,3). I think that this happen because of the filter (if) that
you did (great) so what I need now is a way to do the fetch no matter what
after and add/delete/edit action is made. So I was thinking in add another
condition to the if(.... || (doNomatherWhat) ...doFech). What I dont know is
where define this variable, and where to assign it the value to true after
the add/delete/edit method was called. Can you help me on this?

I think Vladimir write ideas about this I'm going to read then, and I will
wait for yours too thank you and thanks Vladimir!!!

On 7/5/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Hi Vladimir and Daniel,
>
> just read my post in parallel subthread ;)
>
> regards,
> paul
> Vladimir Isakovich schrieb:
> > Daniel, I have not tried yet to perform actions like add/edit/delete
> > from the sroller.
> >
> > So, my thoughts only:
> > since your bean is session scoped now, you may have your boolean as an
> > instance variable.
> > Actually, you need to call for re-populating page when editing and
> > deleting, and when adding on the last page, if it has a vacant line.
> > Also you will need to adjust your total counter on add/delete
> >
> > You know, I'm still have some confusion about the current code. As I
> > understand, the custom tag is calling fetchPage() supplying it with
> > the pageSize, so why do I need to supply the pageSize when
> > instantiating DataModel.
> > I've tried to change the pageSize in my jsp only, and it got changed -
> > I did not see a problem. So, it seems the pageSize hardcoded in
> > getDataModel() is mute. I'm always afraid of those duplicate
> > definitions - who knows what will happen when you upgrade to a new
> > version of tomahawk.
> >
> > Another bothering issue. Why in Paul's catching method there is a
> > check on pageSize, is not it gonna be the same every time?
> >
> > vlad
> >
> >
> > On 7/5/07, *daniel ccss* < danielccss2@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     I think is for the filter:
> >
> >                 if ((_lastPage == null) || (_lastStartRow != startRow)
> >     || (_lastPageSize != pageSize)) {
> >                         _log.debug("**Fetch: required -> fetching...");
> >                         obligar = false;
> >                         _lastPage = fetchPage(startRow, pageSize);
> >                         _lastStartRow = startRow;
> >                         _lastPageSize = pageSize;
> >                 }else{
> >                         _log.debug("**Fetch: not required (already
> >     fetched)!");
> >                 }
> >                 return _lastPage;
> >
> >
> >
> >     I need that when an action like add, delete or edit occurs always
> >     enter to this if, what do you think is the best way to do this,
> >     add another condition to the if, lets say a boolen condition? that
> >     after the method that do the delete/add/edit action this boolen be
> >     set to true, if so where this boolean variable have to be, and
> >     where it have to be set, i´m thinking in something like this:
> >
> >     backing_bean
> >                 call delete method
> >                 set some variable to true
> >                 call the fetch method
> >     PagedListDataModel
> >                 add code to the if: if(..... || valiable=true)
> >                put the variable again in false
> >
> >     What I don´t have clear is where the boolean variable have to be
> >     define, and where to set his value.
> >
> >
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi Vladimir and Daniel,

just read my post in parallel subthread ;)

regards,
paul
Vladimir Isakovich schrieb:
> Daniel, I have not tried yet to perform actions like add/edit/delete 
> from the sroller.
>  
> So, my thoughts only:
> since your bean is session scoped now, you may have your boolean as an 
> instance variable.
> Actually, you need to call for re-populating page when editing and 
> deleting, and when adding on the last page, if it has a vacant line.
> Also you will need to adjust your total counter on add/delete
>  
> You know, I'm still have some confusion about the current code. As I 
> understand, the custom tag is calling fetchPage() supplying it with 
> the pageSize, so why do I need to supply the pageSize when 
> instantiating DataModel.
> I've tried to change the pageSize in my jsp only, and it got changed - 
> I did not see a problem. So, it seems the pageSize hardcoded in 
> getDataModel() is mute. I'm always afraid of those duplicate 
> definitions - who knows what will happen when you upgrade to a new 
> version of tomahawk.
>  
> Another bothering issue. Why in Paul's catching method there is a 
> check on pageSize, is not it gonna be the same every time?
>  
> vlad
>
>  
> On 7/5/07, *daniel ccss* <danielccss2@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     I think is for the filter:
>
>                 if ((_lastPage == null) || (_lastStartRow != startRow)
>     || (_lastPageSize != pageSize)) {
>                         _log.debug("**Fetch: required -> fetching...");
>                         obligar = false;
>                         _lastPage = fetchPage(startRow, pageSize);
>                         _lastStartRow = startRow;
>                         _lastPageSize = pageSize;
>                 }else{
>                         _log.debug("**Fetch: not required (already
>     fetched)!");
>                 }
>                 return _lastPage;
>
>
>
>     I need that when an action like add, delete or edit occurs always
>     enter to this if, what do you think is the best way to do this,
>     add another condition to the if, lets say a boolen condition? that
>     after the method that do the delete/add/edit action this boolen be
>     set to true, if so where this boolean variable have to be, and
>     where it have to be set, i´m thinking in something like this:
>
>     backing_bean
>                 call delete method
>                 set some variable to true
>                 call the fetch method
>     PagedListDataModel
>                 add code to the if: if(..... || valiable=true)
>                put the variable again in false
>
>     What I don´t have clear is where the boolean variable have to be
>     define, and where to set his value.
>
>
>
>


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Daniel, I have not tried yet to perform actions like add/edit/delete from
the sroller.

So, my thoughts only:
since your bean is session scoped now, you may have your boolean as an
instance variable.
Actually, you need to call for re-populating page when editing and deleting,
and when adding on the last page, if it has a vacant line.
Also you will need to adjust your total counter on add/delete

You know, I'm still have some confusion about the current code. As I
understand, the custom tag is calling fetchPage() supplying it with the
pageSize, so why do I need to supply the pageSize when instantiating
DataModel.
I've tried to change the pageSize in my jsp only, and it got changed - I did
not see a problem. So, it seems the pageSize hardcoded in getDataModel() is
mute. I'm always afraid of those duplicate definitions - who knows what will
happen when you upgrade to a new version of tomahawk.

Another bothering issue. Why in Paul's catching method there is a check on
pageSize, is not it gonna be the same every time?

vlad


On 7/5/07, daniel ccss <da...@gmail.com> wrote:
>
> I think is for the filter:
>
>             if ((_lastPage == null) || (_lastStartRow != startRow) ||
> (_lastPageSize != pageSize)){
>                     _log.debug("**Fetch: required -> fetching...");
>                     obligar = false;
>                     _lastPage = fetchPage(startRow, pageSize);
>                     _lastStartRow = startRow;
>                     _lastPageSize = pageSize;
>             }else{
>                     _log.debug("**Fetch: not required (already
> fetched)!");
>             }
>             return _lastPage;
>
>
>
> I need that when an action like add, delete or edit occurs always enter to
> this if, what do you think is the best way to do this, add another condition
> to the if, lets say a boolen condition? that after the method that do the
> delete/add/edit action this boolen be set to true, if so where this boolean
> variable have to be, and where it have to be set, i´m thinking in something
> like this:
>
> backing_bean
>             call delete method
>             set some variable to true
>             call the fetch method
> PagedListDataModel
>             add code to the if: if(..... || valiable=true)
>            put the variable again in false
>
> What I don´t have clear is where the boolean variable have to be define,
> and where to set his value.
>
>
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
I think is for the filter:

            if ((_lastPage == null) || (_lastStartRow != startRow) ||
(_lastPageSize != pageSize)){
                    _log.debug("**Fetch: required -> fetching...");
                    obligar = false;
                    _lastPage = fetchPage(startRow, pageSize);
                    _lastStartRow = startRow;
                    _lastPageSize = pageSize;
            }else{
                    _log.debug("**Fetch: not required (already fetched)!");
            }
            return _lastPage;



I need that when an action like add, delete or edit occurs always enter to
this if, what do you think is the best way to do this, add another condition
to the if, lets say a boolen condition? that after the method that do the
delete/add/edit action this boolen be set to true, if so where this boolean
variable have to be, and where it have to be set, i´m thinking in something
like this:

backing_bean
            call delete method
            set some variable to true
            call the fetch method
PagedListDataModel
            add code to the if: if(..... || valiable=true)
           put the variable again in false

What I don´t have clear is where the boolean variable have to be define, and
where to set his value.

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
All works fine now, only one call!!! THANK YOU PAUL THANK YOU VLAD!!!

New Question :P

My DataTable has a delete and edit links and the JSF also has an add button
(see image), but since the bean is in session when I delete, add or edit a
Patient the data no is refresh until I click a number link of the table
(1,2,3,...) My question is after call any of the method what method I have
to call to the data to be ubdate?


Vlad, for the moment, when I bring the PageData of a Patient I also select
the number of Patients, and set it in the DataPage that is returned, i donpt
know if it is a better way, but for
the moment I´m concentrate in the view part, this is the code:

....
                String selectCantidad = "SELECT COUNT(*) AS CANTIDAD FROM
IDEN_PACIENTE";
                ResultSet rsCantidad = accesoDatos.ejecutaSQLRetornaRS
(selectCantidad);
                rsCantidad.next();
                cantidad = rsCantidad.getInt("CANTIDAD");

            }
            catch (SQLException e) {
                ....
            }
            catch (SIGNOSException e) {
                .....
            }

DataPage<Paciente> dataPage = new DataPage<Paciente>(cantidad
,inicio,pacientes);

        return dataPage;

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by vlad10 <iv...@yahoo.com>.
Daniel,
I've a question for you. From your postings I did not see that you've had a
problem getting the total number of records (what is expected by DataPage). 
Culd you explain, how you were getting it (was it a additional call to DB?).

vlad


daniel ccss wrote:
> 
> Ok I gonna do that!! Thank´s God I´m not alone in this, I think I was the
> only person that can´t implement all this right. Ok Vlad I´m gonna
> implement
> what Paul send. Paul explained  that  the DataModel was called two times
> because of the DataTable and the Scroller maybe is that what is happening
> to
> you:
> 
> 
> One more thing to be clearly explained here: the getDataModel() of
> 'enclosing' nested class (PagedListFoto in my case)  MUST BE CALLED
> TWICE, since you have two components in your JSP -> the DataTable and
> the Scroller and both are accessing this property. So you have to handle
> this situation yourself, i.e. directly in getter
> 
> I talk to you soon, I´m gonna implement what Paul send.
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11453062
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Ok I gonna do that!! Thank´s God I´m not alone in this, I think I was the
only person that can´t implement all this right. Ok Vlad I´m gonna implement
what Paul send. Paul explained  that  the DataModel was called two times
because of the DataTable and the Scroller maybe is that what is happening to
you:


One more thing to be clearly explained here: the getDataModel() of
'enclosing' nested class (PagedListFoto in my case)  MUST BE CALLED
TWICE, since you have two components in your JSP -> the DataTable and
the Scroller and both are accessing this property. So you have to handle
this situation yourself, i.e. directly in getter

I talk to you soon, I´m gonna implement what Paul send.

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by vlad10 <iv...@yahoo.com>.
Daniel,
thanks for opening this discussion. I'm also new to JSF and whant to start a
new JSF project for my client.

I just wanted to point that if you added that filtering method that Paul've
suggested, it will reduce the number of DB calls from 4 to 2. Still better.
I'll try making my bean session wide, will see if it helps.

vlad


daniel ccss wrote:
> 
> Anybody??
> 
> On 7/3/07, daniel ccss <da...@gmail.com> wrote:
>>
>> Hi Mike, thank you for your answer, you are the fist that suggest
>> something, I read the info of the getter called few times, but I have the
>> same problem that the person that asked, because I can´t use the lazy
>> list,
>> I need to go to the database to bring each page of the dataScroller, I
>> don´t
>> want to bring all the list beacuse is too large. I erase the second data
>> scroller as you say but I get the same results. These are my outputs of
>> going for this pages: 1,2,3,4,3,2,1 (paging 4 in 4).
>>
>> LINENUM BETWEEN 0 AND 4
>> LINENUM BETWEEN 0 AND 4
>> LINENUM BETWEEN 0 AND 4
>> LINENUM BETWEEN 0 AND 4
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 9 AND 13
>> LINENUM BETWEEN 8 AND 12
>> LINENUM BETWEEN 8 AND 12
>> LINENUM BETWEEN 12 AND 16
>> LINENUM BETWEEN 12 AND 16
>> LINENUM BETWEEN 8 AND 12
>> LINENUM BETWEEN 8 AND 12
>> LINENUM BETWEEN 8 AND 12
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 4 AND 8
>> LINENUM BETWEEN 0 AND 4
>>
>> Any Help? Tell me if you need more info, thanks!!
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11452326
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Anybody??

On 7/3/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi Mike, thank you for your answer, you are the fist that suggest
> something, I read the info of the getter called few times, but I have the
> same problem that the person that asked, because I can´t use the lazy list,
> I need to go to the database to bring each page of the dataScroller, I don´t
> want to bring all the list beacuse is too large. I erase the second data
> scroller as you say but I get the same results. These are my outputs of
> going for this pages: 1,2,3,4,3,2,1 (paging 4 in 4).
>
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 9 AND 13
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 12 AND 16
> LINENUM BETWEEN 12 AND 16
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 0 AND 4
>
> Any Help? Tell me if you need more info, thanks!!
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by vlad10 <iv...@yahoo.com>.
Hi Daniel,
I've made my bean session-scope, and with the help of Pauls catching method
(doFetchPage()) I got to the point, that there is only one DB call per page.
(see my earlier posting to this thread with the log).

Martin, talking about stopping dup calls to fetchPage() on the DataModel, I
thought this is rather a bug in tomahawk/myfaces custom tag. Unless ...
every developer starts extending dataScroller.

vlad


Martin Marinschek wrote:
> 
> Hi Daniel,
> 
> look at this:
> 
>         public DataPage<Paciente> fetchPage(int startRow, int pageSize) {
>             return getDataPage(startRow, pageSize);
>         }
> 
> if you make sure you call getDataPage only once for any given
> startRow/pageSize, you'll be save - so you need some caching there.
> 
> regards,
> 
> Martin
> 
> On 7/4/07, daniel ccss <da...@gmail.com> wrote:
>> Since everything works fine, I think that the problem is in the JSP
>> t:dataScroller and t:dataTable properties, something is calling the
>> backing
>> bean several times (the fetchPage), I'm new in this, can anyone check the
>> JSP and see if I´m doing something wrong on it causing the multiple
>> calls?
>>
>>
>>
>> <%@ page contentType="text/html;charset=windows-1252"%>
>> <%@ taglib uri=" http://java.sun.com/jsf/html" prefix="h"%>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
>> <%@ taglib uri=" http://myfaces.apache.org/tomahawk "
>> prefix="t"%>
>> <f:view>
>>     <html>
>>         <head>
>>             <meta http-equiv="Content-Type"
>>                   content="text/html; charset=windows-1252"/>
>>             <title>listaPacientes</title>
>>         </head>
>>         <body><h:form>
>>                 <h:panelGroup id="body">
>>                     <t:dataTable id="data" styleClass="scrollerTable"
>>
>> headerClass="standardTable_Header"
>>
>> footerClass="standardTable_Header"
>>
>> rowClasses="standardTable_Row1,standardTable_Row2"
>>
>> columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
>>                                  var="tablaPacientes"
>>                                  value="#{
>> PacienteBean.dataModel}"
>>                                  preserveDataModel="false"
>> rows="2">
>>                         <h:column>
>>                             <f:facet name="header"></f:facet>
>>                             <h:outputText
>> value="#{tablaPacientes.numIdent}"/>
>>                         </h:column>
>>                         <h:column>
>>                             <f:facet name="header"></f:facet>
>>                             <h:outputText
>> value="#{tablaPacientes.nombre}"/>
>>                         </h:column>
>>                     </t:dataTable>
>>                     <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;"
>>                                         immediate="true">
>>                             <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"
>>                                         immediate="true"
>>
>> 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>
>>                 </h:panelGroup>
>>                 <t:commandLink value="test" immediate="true"/>
>>             </h:form></body>
>>     </html>
>> </f:view>
>>
>>
>> On 7/3/07, daniel ccss < danielccss2@gmail.com> wrote:
>> > I really need help with this, nobody has implemented succesfuly the
>> datascroller +  WorkingWithLargeTables article? How do you people
>> implement
>> the pagination with a Tomahawk dataScroller, without bring all the
>> records?
>> For me all works fine my problem is that the method that brings the data
>> is
>> call several times for each DataPage.
>> >
>> >
>> >
>> > On 7/3/07, daniel ccss < danielccss2@gmail.com> wrote:
>> > > Ok let's see, the backing bean is in request:
>> > >
>> > > <managed-bean>
>> > >  <description>Pacientes
>> > >  </description>
>> > >  <managed-bean-name>PacienteBean</managed-bean-name>
>> > >
>> <managed-bean-class>controller.pacientes.PacienteBean</managed-bean-class>
>> > >  <managed-bean-scope>request</managed-bean-scope>
>> > >  </managed-bean>
>> > >
>> > > How can I use the cache for a Backing Bean? Some Guru that can help
>> me?
>> I can give you all my Jdeveloper project and you can test it?
>> > >
>> > > Any other idea, thanks!!
>> > >
>> >
>> >
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11452786
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Daniel,

look at this:

        public DataPage<Paciente> fetchPage(int startRow, int pageSize) {
            return getDataPage(startRow, pageSize);
        }

if you make sure you call getDataPage only once for any given
startRow/pageSize, you'll be save - so you need some caching there.

regards,

Martin

On 7/4/07, daniel ccss <da...@gmail.com> wrote:
> Since everything works fine, I think that the problem is in the JSP
> t:dataScroller and t:dataTable properties, something is calling the backing
> bean several times (the fetchPage), I'm new in this, can anyone check the
> JSP and see if I´m doing something wrong on it causing the multiple calls?
>
>
>
> <%@ page contentType="text/html;charset=windows-1252"%>
> <%@ taglib uri=" http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri=" http://myfaces.apache.org/tomahawk "
> prefix="t"%>
> <f:view>
>     <html>
>         <head>
>             <meta http-equiv="Content-Type"
>                   content="text/html; charset=windows-1252"/>
>             <title>listaPacientes</title>
>         </head>
>         <body><h:form>
>                 <h:panelGroup id="body">
>                     <t:dataTable id="data" styleClass="scrollerTable"
>
> headerClass="standardTable_Header"
>
> footerClass="standardTable_Header"
>
> rowClasses="standardTable_Row1,standardTable_Row2"
>
> columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
>                                  var="tablaPacientes"
>                                  value="#{
> PacienteBean.dataModel}"
>                                  preserveDataModel="false"
> rows="2">
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText
> value="#{tablaPacientes.numIdent}"/>
>                         </h:column>
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText value="#{tablaPacientes.nombre}"/>
>                         </h:column>
>                     </t:dataTable>
>                     <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;"
>                                         immediate="true">
>                             <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"
>                                         immediate="true"
>
> 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>
>                 </h:panelGroup>
>                 <t:commandLink value="test" immediate="true"/>
>             </h:form></body>
>     </html>
> </f:view>
>
>
> On 7/3/07, daniel ccss < danielccss2@gmail.com> wrote:
> > I really need help with this, nobody has implemented succesfuly the
> datascroller +  WorkingWithLargeTables article? How do you people implement
> the pagination with a Tomahawk dataScroller, without bring all the records?
> For me all works fine my problem is that the method that brings the data is
> call several times for each DataPage.
> >
> >
> >
> > On 7/3/07, daniel ccss < danielccss2@gmail.com> wrote:
> > > Ok let's see, the backing bean is in request:
> > >
> > > <managed-bean>
> > >  <description>Pacientes
> > >  </description>
> > >  <managed-bean-name>PacienteBean</managed-bean-name>
> > >
> <managed-bean-class>controller.pacientes.PacienteBean</managed-bean-class>
> > >  <managed-bean-scope>request</managed-bean-scope>
> > >  </managed-bean>
> > >
> > > How can I use the cache for a Backing Bean? Some Guru that can help me?
> I can give you all my Jdeveloper project and you can test it?
> > >
> > > Any other idea, thanks!!
> > >
> >
> >
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Since everything works fine, I think that the problem is in the JSP
t:dataScroller and t:dataTable properties, something is calling the backing
bean several times (the fetchPage), I'm new in this, can anyone check the
JSP and see if I´m doing something wrong on it causing the multiple calls?


<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri=" http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri=" http://myfaces.apache.org/tomahawk " prefix="t"%>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type"
                  content="text/html; charset=windows-1252"/>
            <title>listaPacientes</title>
        </head>
        <body><h:form>
                <h:panelGroup id="body">
                    <t:dataTable id="data" styleClass="scrollerTable"
                                 headerClass="standardTable_Header"
                                 footerClass="standardTable_Header"

rowClasses="standardTable_Row1,standardTable_Row2"

columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
                                 var="tablaPacientes"
                                 value="#{ PacienteBean.dataModel}"
                                 preserveDataModel="false" rows="2">
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:outputText value="#{tablaPacientes.numIdent
}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header"></f:facet>
                            <h:outputText value="#{tablaPacientes.nombre}"/>
                        </h:column>
                    </t:dataTable>
                    <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;"
                                        immediate="true">
                            <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"
                                        immediate="true"
                                        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>
                </h:panelGroup>
                <t:commandLink value="test" immediate="true"/>
            </h:form></body>
    </html>
</f:view>

On 7/3/07, daniel ccss <da...@gmail.com> wrote:
>
> I really need help with this, nobody has implemented succesfuly the
> datascroller +  WorkingWithLargeTables article? How do you people implement
> the pagination with a Tomahawk dataScroller, without bring all the records?
> For me all works fine my problem is that the method that brings the data is
> call several times for each DataPage. **
>
> On 7/3/07, daniel ccss <da...@gmail.com> wrote:
> >
> > Ok let's see, the backing bean is in request:
> >
> > <managed-bean>
> >  <description>Pacientes
> >  </description>
> >  <managed-bean-name>PacienteBean</managed-bean-name>
> >  <managed-bean-class>controller.pacientes.PacienteBean
> > </managed-bean-class>
> >  <managed-bean-scope>request</managed-bean-scope>
> >  </managed-bean>
> >
> > How can I use the cache for a Backing Bean? Some Guru that can help me?
> > I can give you all my Jdeveloper project and you can test it?
> >
> > Any other idea, thanks!!
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Paul do you recived my large email  where I explain you my situation?

Regards, Daniel

On 7/6/07, daniel ccss <da...@gmail.com> wrote:
>
> Vladimir I will start with that jar also, I was looking and IMHO that is
> the better. What do you think Paul. In fact I think that Red Hat buy JBoss,
> and I listen that they are developing an IDE, that will be in the market in
> December
>
> On 7/6/07, Vladimir Isakovich <iv...@gmail.com> wrote:
> >
> > Paul,
> > I believe, you've attached your app to one of your messages a couple of
> > days ago. I'll try to look at it.
> > Also, I've just started looking into ajax, and they offer another
> > mechanizm: just pushing the bean from one request to another, what may be a
> > good case for the scroller.
> > BTW, I found only jboss-ajax4jsf jar, (cause Jboss somehow got that that
> > company), I guess I'll go with this one for my ajax studies. Or you have a
> > better choice?
> >
> > vlad
> >
> > On 7/6/07, Paul Iov <paul@voller-ernst.de > wrote:
> > >
> > > Vladimir Isakovich schrieb:
> > > > Yes, I have just one call getting through to my DB, the session
> > > scoped
> > > > bean with Paul's blocking method worked. The drawback with this
> > > > approach, we may start thinking on cleaning session off of the
> > > unused
> > > > objects, otherwise our app may consume too much cache on the server.
> > >
> > > >
> > > > vlad
> > > That's why I don't utilize the JSF backing bean facility. It's not
> > > flexibly enough to maintain high dynamically applications.
> > > I've implement own session controller and it's the only backing bean I
> > >
> > > have to declare in my faces-config.xml ;) The other part of magic is
> > > application wide controller (started with ServletContextListener) to
> > > maintain some global issues and, first of all the sessions, which I
> > > catch with HTTPSessionListener.
> > >
> > > Just a little hint: you can 'inject' your beans into session without
> > > declaring it in config.
> > >
> > > <managed-bean>
> > >      <managed-bean-name>MyBean</managed-bean-name>
> > >      <managed-bean-class> my.MyClass</managed-bean-class>
> > >      <managed-bean-scope>session</managed-bean-scope>
> > > </managed-bean>
> > >
> > > is equal to:
> > >
> > > FacesContext fCtx    = FacesContext.getCurrentInstance();
> > > ExternalContext eCtx    = _fCtx.getExternalContext();
> > > ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> > > HttpSession session = (HttpSession)_eCtx.getSession(false);
> > > ...
> > > MyClass myInstance = new MyClass();
> > > session.setAttribute("MyBean", myInstance);//put MBean to session
> > >
> > >
> > >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Vladimir I will start with that jar also, I was looking and IMHO that is the
better. What do you think Paul. In fact I think that Red Hat buy JBoss, and
I listen that they are developing an IDE, that will be in the market in
December

On 7/6/07, Vladimir Isakovich <iv...@gmail.com> wrote:
>
> Paul,
> I believe, you've attached your app to one of your messages a couple of
> days ago. I'll try to look at it.
> Also, I've just started looking into ajax, and they offer another
> mechanizm: just pushing the bean from one request to another, what may be a
> good case for the scroller.
> BTW, I found only jboss-ajax4jsf jar, (cause Jboss somehow got that that
> company), I guess I'll go with this one for my ajax studies. Or you have a
> better choice?
>
> vlad
>
> On 7/6/07, Paul Iov <paul@voller-ernst.de > wrote:
> >
> > Vladimir Isakovich schrieb:
> > > Yes, I have just one call getting through to my DB, the session scoped
> >
> > > bean with Paul's blocking method worked. The drawback with this
> > > approach, we may start thinking on cleaning session off of the unused
> > > objects, otherwise our app may consume too much cache on the server.
> > >
> > > vlad
> > That's why I don't utilize the JSF backing bean facility. It's not
> > flexibly enough to maintain high dynamically applications.
> > I've implement own session controller and it's the only backing bean I
> > have to declare in my faces-config.xml ;) The other part of magic is
> > application wide controller (started with ServletContextListener) to
> > maintain some global issues and, first of all the sessions, which I
> > catch with HTTPSessionListener.
> >
> > Just a little hint: you can 'inject' your beans into session without
> > declaring it in config.
> >
> > <managed-bean>
> >      <managed-bean-name>MyBean</managed-bean-name>
> >      <managed-bean-class> my.MyClass</managed-bean-class>
> >      <managed-bean-scope>session</managed-bean-scope>
> > </managed-bean>
> >
> > is equal to:
> >
> > FacesContext fCtx    = FacesContext.getCurrentInstance();
> > ExternalContext eCtx    = _fCtx.getExternalContext();
> > ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> > HttpSession session = (HttpSession)_eCtx.getSession(false);
> > ...
> > MyClass myInstance = new MyClass();
> > session.setAttribute("MyBean", myInstance);//put MBean to session
> >
> >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Paul,
I believe, you've attached your app to one of your messages a couple of days
ago. I'll try to look at it.
Also, I've just started looking into ajax, and they offer another mechanizm:
just pushing the bean from one request to another, what may be a good case
for the scroller.
BTW, I found only jboss-ajax4jsf jar, (cause Jboss somehow got that that
company), I guess I'll go with this one for my ajax studies. Or you have a
better choice?

vlad

On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Vladimir Isakovich schrieb:
> > Yes, I have just one call getting through to my DB, the session scoped
> > bean with Paul's blocking method worked. The drawback with this
> > approach, we may start thinking on cleaning session off of the unused
> > objects, otherwise our app may consume too much cache on the server.
> >
> > vlad
> That's why I don't utilize the JSF backing bean facility. It's not
> flexibly enough to maintain high dynamically applications.
> I've implement own session controller and it's the only backing bean I
> have to declare in my faces-config.xml ;) The other part of magic is
> application wide controller (started with ServletContextListener) to
> maintain some global issues and, first of all the sessions, which I
> catch with HTTPSessionListener.
>
> Just a little hint: you can 'inject' your beans into session without
> declaring it in config.
>
> <managed-bean>
>      <managed-bean-name>MyBean</managed-bean-name>
>      <managed-bean-class> my.MyClass</managed-bean-class>
>      <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
>
> is equal to:
>
> FacesContext fCtx    = FacesContext.getCurrentInstance();
> ExternalContext eCtx    = _fCtx.getExternalContext();
> ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> HttpSession session = (HttpSession)_eCtx.getSession(false);
> ...
> MyClass myInstance = new MyClass();
> session.setAttribute("MyBean", myInstance);//put MBean to session
>
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by song <so...@hotmail.com>.
hi ,daniel ccss ,thank for your suggestion. i hope they will see this
message.


daniel ccss wrote:
> 
> Paul another thing,  I made a binding variable of the dataTable and I
> erased
> the dropScroller method and instead i made dataTable.setFirst(0) on my
> bean
> and works great :) I only need to do that on the erase method :)
> 
> On 7/17/07, daniel ccss <da...@gmail.com> wrote:
>>
>> Hi all, sorry I don´t write, I made the presentation on my work and all
>> works fine, I solve the last issue with a window.location in a
>> javascript.
>> All was a success :) Thanks all
>>
>> Song I think that Paul is working on it, he is the correct person to do
>> that, because he knows many about this, Paul and Vladimir thanks again
>> for
>> all of your help.
>>
>> On 7/14/07, song <so...@hotmail.com> wrote:
>> >
>> > hello all,i have read all your mail, i'm ireally has the same troubles
>> > in Tomahawk+DataScroller+WorkingWithLargeTables now. with your
>> discussion,i
>> > have know there are some thing wrong in state properties. i hope some
>> one of
>> > you update the wiki document in link:
>> > http://wiki.apache.org/myfaces/WorkingWithLargeTables thks for all.
>> >
>> > Paul Iov wrote:
>> >
>> > daniel ccss wrote:
>> >  On 7/9/07, daniel ccss wrote: > IT WORKS!!!!
>> >
>> > Congratulation !
>> >
>> > daniel ccss wrote:
>> >  > I have to debug to see the correct id of the datatable, and I found
>> > that > was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller
>> to
>> > work > because I sent the true Id of the DataTable: data
>> >
>> > Daniel, I have no ideas why do you get this IDs. It seems to be the ID
>> > of some child element - not of the table itself. Anyway, you cad put
>> this
>> > debug statements to track exactly what happening. private void
>> > dropScroller(String dataTableId) { _log.info("dropScroller called");
>> > FacesContext context = FacesContext.getCurrentInstance(); UIComponent
>> > component = findComponent(context.getViewRoot(), ":"+ dataTableId,
>> > context, *false*); if (component instanceof UIData){ ((UIData)
>> > component).setFirst(0); //set datatable to FIRST page }else if (null ==
>> > component){ _log.error("no dataTable fount!"); } else {
>> _log.error("Found
>> > component with id "+component.getClientId()+" is not an instance of
>> > UIData"); } } Pay attention to this FALSE param. It controls HOW the ID
>> > should be matched - exact or against endsWith(). So, if you supply
>> "data",
>> > it will search in tree for ":data".
>> >
>> > daniel ccss wrote:
>> >  > 1- How I can access the PagedList properties from my bean, to do
>> what
>> > you > said about the _invalidated to true after a delete/add/edit
>> action
>> >
>> > Once again... 1. Define the method public void Invalidate(){
>> > this._invalidated=true;} i your PagedList class. 2. Declare a bean's
>> member,
>> > i.e. private PagedList myList = new PagedList(?); 3. After modification
>> > of list/DB/whatever just call in your bean this.myList.Invalidate(); If
>> > you have not implemented the internal storage like me, you have to
>> supply
>> > the total record count each time the fetching take place. I relay on
>> the
>> > list itself, because it hase all IDs in array and already 'knows', own
>> size
>> > - you have to perform "select count(*)..." after each DB modification
>> (at
>> > least delete/insert) and put this count back to PagedList (as property
>> of
>> > returning DataPage istance). It means, you have to modify the code to
>> store
>> > this returned value, because I have no such code ;) The only task to
>> > accomplish then is to ensure, that the page will be refetched next time
>> ->
>> > _invalidated flag.
>> >
>> > daniel ccss wrote:
>> >  > 3- Can you send me your ajax jar, It seems that now the ajax data
>> > table is > only in rich faces?? Which jar to use.
>> >
>> > Daniel, I use the regular t:dataTable. The rest does a4j which you can
>> > download directly from JBoss site. It's not an replacement component
>> library
>> > - just an additional one. regards, paul
>> >
>> >
>> > ------------------------------
>> > View this message in context: Re:
>> > Tomahawk+DataScroller+WorkingWithLargeTables
>> >
>> <http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11595556>
>> > Sent from the MyFaces - Users mailing list
>> archive<http://www.nabble.com/MyFaces---Users-f181.html>at
>> > Nabble.com.
>> >
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11700688
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Paul another thing,  I made a binding variable of the dataTable and I erased
the dropScroller method and instead i made dataTable.setFirst(0) on my bean
and works great :) I only need to do that on the erase method :)

On 7/17/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi all, sorry I don´t write, I made the presentation on my work and all
> works fine, I solve the last issue with a window.location in a javascript.
> All was a success :) Thanks all
>
> Song I think that Paul is working on it, he is the correct person to do
> that, because he knows many about this, Paul and Vladimir thanks again for
> all of your help.
>
> On 7/14/07, song <so...@hotmail.com> wrote:
> >
> > hello all,i have read all your mail, i'm ireally has the same troubles
> > in Tomahawk+DataScroller+WorkingWithLargeTables now. with your discussion,i
> > have know there are some thing wrong in state properties. i hope some one of
> > you update the wiki document in link:
> > http://wiki.apache.org/myfaces/WorkingWithLargeTables thks for all.
> >
> > Paul Iov wrote:
> >
> > daniel ccss wrote:
> >  On 7/9/07, daniel ccss wrote: > IT WORKS!!!!
> >
> > Congratulation !
> >
> > daniel ccss wrote:
> >  > I have to debug to see the correct id of the datatable, and I found
> > that > was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to
> > work > because I sent the true Id of the DataTable: data
> >
> > Daniel, I have no ideas why do you get this IDs. It seems to be the ID
> > of some child element - not of the table itself. Anyway, you cad put this
> > debug statements to track exactly what happening. private void
> > dropScroller(String dataTableId) { _log.info("dropScroller called");
> > FacesContext context = FacesContext.getCurrentInstance(); UIComponent
> > component = findComponent(context.getViewRoot(), ":"+ dataTableId,
> > context, *false*); if (component instanceof UIData){ ((UIData)
> > component).setFirst(0); //set datatable to FIRST page }else if (null ==
> > component){ _log.error("no dataTable fount!"); } else { _log.error("Found
> > component with id "+component.getClientId()+" is not an instance of
> > UIData"); } } Pay attention to this FALSE param. It controls HOW the ID
> > should be matched - exact or against endsWith(). So, if you supply "data",
> > it will search in tree for ":data".
> >
> > daniel ccss wrote:
> >  > 1- How I can access the PagedList properties from my bean, to do what
> > you > said about the _invalidated to true after a delete/add/edit action
> >
> > Once again... 1. Define the method public void Invalidate(){
> > this._invalidated=true;} i your PagedList class. 2. Declare a bean's member,
> > i.e. private PagedList myList = new PagedList(?); 3. After modification
> > of list/DB/whatever just call in your bean this.myList.Invalidate(); If
> > you have not implemented the internal storage like me, you have to supply
> > the total record count each time the fetching take place. I relay on the
> > list itself, because it hase all IDs in array and already 'knows', own size
> > - you have to perform "select count(*)..." after each DB modification (at
> > least delete/insert) and put this count back to PagedList (as property of
> > returning DataPage istance). It means, you have to modify the code to store
> > this returned value, because I have no such code ;) The only task to
> > accomplish then is to ensure, that the page will be refetched next time ->
> > _invalidated flag.
> >
> > daniel ccss wrote:
> >  > 3- Can you send me your ajax jar, It seems that now the ajax data
> > table is > only in rich faces?? Which jar to use.
> >
> > Daniel, I use the regular t:dataTable. The rest does a4j which you can
> > download directly from JBoss site. It's not an replacement component library
> > - just an additional one. regards, paul
> >
> >
> > ------------------------------
> > View this message in context: Re:
> > Tomahawk+DataScroller+WorkingWithLargeTables
> > <http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11595556>
> > Sent from the MyFaces - Users mailing list archive<http://www.nabble.com/MyFaces---Users-f181.html>at
> > Nabble.com.
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi all, sorry I don´t write, I made the presentation on my work and all
works fine, I solve the last issue with a window.location in a javascript.
All was a success :) Thanks all

Song I think that Paul is working on it, he is the correct person to do
that, because he knows many about this, Paul and Vladimir thanks again for
all of your help.

On 7/14/07, song <so...@hotmail.com> wrote:
>
> hello all,i have read all your mail, i'm ireally has the same troubles in
> Tomahawk+DataScroller+WorkingWithLargeTables now. with your discussion,i
> have know there are some thing wrong in state properties. i hope some one of
> you update the wiki document in link:
> http://wiki.apache.org/myfaces/WorkingWithLargeTables thks for all.
>
> Paul Iov wrote:
>
> daniel ccss wrote:
>  On 7/9/07, daniel ccss wrote: > IT WORKS!!!!
>
> Congratulation !
>
> daniel ccss wrote:
>  > I have to debug to see the correct id of the datatable, and I found
> that > was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to
> work > because I sent the true Id of the DataTable: data
>
> Daniel, I have no ideas why do you get this IDs. It seems to be the ID of
> some child element - not of the table itself. Anyway, you cad put this debug
> statements to track exactly what happening. private void dropScroller(String
> dataTableId) { _log.info("dropScroller called"); FacesContext context =
> FacesContext.getCurrentInstance(); UIComponent component = findComponent(
> context.getViewRoot(), ":"+ dataTableId, context, *false*); if (component
> instanceof UIData){ ((UIData) component).setFirst(0); //set datatable to
> FIRST page }else if (null == component){ _log.error("no dataTable fount!");
> } else { _log.error("Found component with id "+component.getClientId()+" is
> not an instance of UIData"); } } Pay attention to this FALSE param. It
> controls HOW the ID should be matched - exact or against endsWith(). So, if
> you supply "data", it will search in tree for ":data".
>
> daniel ccss wrote:
>  > 1- How I can access the PagedList properties from my bean, to do what
> you > said about the _invalidated to true after a delete/add/edit action
>
> Once again... 1. Define the method public void Invalidate(){
> this._invalidated=true;} i your PagedList class. 2. Declare a bean's member,
> i.e. private PagedList myList = new PagedList(?); 3. After modification of
> list/DB/whatever just call in your bean this.myList.Invalidate(); If you
> have not implemented the internal storage like me, you have to supply the
> total record count each time the fetching take place. I relay on the list
> itself, because it hase all IDs in array and already 'knows', own size - you
> have to perform "select count(*)..." after each DB modification (at least
> delete/insert) and put this count back to PagedList (as property of
> returning DataPage istance). It means, you have to modify the code to store
> this returned value, because I have no such code ;) The only task to
> accomplish then is to ensure, that the page will be refetched next time ->
> _invalidated flag.
>
> daniel ccss wrote:
>  > 3- Can you send me your ajax jar, It seems that now the ajax data table
> is > only in rich faces?? Which jar to use.
>
> Daniel, I use the regular t:dataTable. The rest does a4j which you can
> download directly from JBoss site. It's not an replacement component library
> - just an additional one. regards, paul
>
>
> ------------------------------
> View this message in context: Re:
> Tomahawk+DataScroller+WorkingWithLargeTables<http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11595556>
> Sent from the MyFaces - Users mailing list archive<http://www.nabble.com/MyFaces---Users-f181.html>at
> Nabble.com.
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by song <so...@hotmail.com>.
hello all,i have read all your mail,
i'm ireally has the same troubles  in
Tomahawk+DataScroller+WorkingWithLargeTables now.
with your discussion,i have know there are some thing wrong in state
properties.

i hope some one of you update the wiki document in 
link:http://wiki.apache.org/myfaces/WorkingWithLargeTables

thks for all.


Paul Iov wrote:
> 
> 
> daniel ccss wrote:
>> 
>> On 7/9/07, daniel ccss  wrote:
>>> IT WORKS!!!!
>> 
> Congratulation !
> 
> daniel ccss wrote:
>> 
>>> I have to debug to see the correct id of the datatable, and I found that
>>> was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to work
>>> because I sent the true Id of the DataTable: data
>> 
> Daniel, I have no ideas why do you get this IDs. It seems to be the ID of
> some child element - not of the table itself. Anyway, you cad put this
> debug statements to track exactly what happening.
> 
> private void dropScroller(String dataTableId) {
> 
>             _log.info("dropScroller called");
>             FacesContext context = FacesContext.getCurrentInstance();
>             UIComponent component = findComponent(context.getViewRoot(),
> ":"+ dataTableId, 
>                                                                         
> context, false);
>             if (component instanceof UIData){
>                 ((UIData) component).setFirst(0); //set datatable to FIRST
> page
>             }else if (null == component){
>               _log.error("no dataTable fount!");
>             } else {
>               _log.error("Found component with id
> "+component.getClientId()+" is not an instance of UIData");
>             }
> }
> Pay attention to this FALSE param. It controls HOW the ID should be
> matched - exact or against endsWith(). So, if you supply "data", it will
> search in tree for ":data". 
> 
> 
> daniel ccss wrote:
>> 
>>> 1- How I can access the PagedList properties from my bean, to do what
>>> you
>>> said about the _invalidated to true after a delete/add/edit action
>> 
> Once again...
> 1. Define the method public void Invalidate(){ this._invalidated=true;} i
> your PagedList class.
> 2. Declare a bean's member, i.e.
> private PagedList myList = new PagedList(?);
> 3. After modification of list/DB/whatever just call in your bean
> this.myList.Invalidate();
> 
> If you have not implemented the internal storage like me, you have to
> supply the total record count each time the fetching take place. I relay
> on the list itself, because it hase all IDs in array and already 'knows',
> own size - you have to perform "select count(*)..." after each DB
> modification (at least delete/insert) and put this count back to PagedList
> (as property of returning DataPage istance). It means, you have to modify
> the code to store this returned value, because I have no such code ;)
> The only task to accomplish then is to ensure, that the page will be
> refetched next time -> _invalidated flag.
> 
> 
> daniel ccss wrote:
>> 
>>> 3- Can you send me your ajax jar, It seems that now the ajax data table
>>> is
>>> only in rich faces?? Which jar to use.
>> 
> Daniel, I use the regular t:dataTable. The rest does a4j which you can
> download directly from JBoss site. It's not an replacement component
> library - just an additional one.
> 
> regards,
> paul
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11595556
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@arcor.de>.

daniel ccss wrote:
> 
> On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>> IT WORKS!!!!
> 
Congratulation !

daniel ccss wrote:
> 
>> I have to debug to see the correct id of the datatable, and I found that
>> was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to work
>> because I sent the true Id of the DataTable: data
> 
Daniel, I have no ideas why do you get this IDs. It seems to be the ID of
some child element - not of the table itself. Anyway, you cad put this debug
statements to track exactly what happening.

private void dropScroller(String dataTableId) {

            _log.info("dropScroller called");
            FacesContext context = FacesContext.getCurrentInstance();
            UIComponent component = findComponent(context.getViewRoot(),
":"+ dataTableId, 
                                                                        
context, false);
            if (component instanceof UIData){
                ((UIData) component).setFirst(0); //set datatable to FIRST
page
            }else if (null == component){
              _log.error("no dataTable fount!");
            } else {
              _log.error("Found component with id
"+component.getClientId()+" is not an instance of UIData");
            }
}
Pay attention to this FALSE param. It controls HOW the ID should be matched
- exact or against endsWith(). So, if you supply "data", it will search in
tree for ":data". 


daniel ccss wrote:
> 
>> 1- How I can access the PagedList properties from my bean, to do what you
>> said about the _invalidated to true after a delete/add/edit action
> 
Once again...
1. Define the method public void Invalidate(){ this._invalidated=true;} i
your PagedList class.
2. Declare a bean's member, i.e.
private PagedList myList = new PagedList(?);
3. After modification of list/DB/whatever just call in your bean
this.myList.Invalidate();

If you have not implemented the internal storage like me, you have to supply
the total record count each time the fetching take place. I relay on the
list itself, because it hase all IDs in array and already 'knows', own size
- you have to perform "select count(*)..." after each DB modification (at
least delete/insert) and put this count back to PagedList (as property of
returning DataPage istance). It means, you have to modify the code to store
this returned value, because I have no such code ;)
The only task to accomplish then is to ensure, that the page will be
refetched next time -> _invalidated flag.


daniel ccss wrote:
> 
>> 3- Can you send me your ajax jar, It seems that now the ajax data table
>> is
>> only in rich faces?? Which jar to use.
> 
Daniel, I use the regular t:dataTable. The rest does a4j which you can
download directly from JBoss site. It's not an replacement component library
- just an additional one.

regards,
paul
-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11512522
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
I mean I had to debug...

Sorry I wrote that quickly I´m happy now! THANKS PAUL!!!!

On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>
> IT WORKS!!!!
>
> I have to debug to see the correct id of the datatable, and I found that
> was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to work
> because I sent the true Id of the DataTable: data
>
>
> <t:dataTable  id="data" styleClass="scrollerTable"
>
> When I send this id it works fine, Paul from where comes this ID? I also
> see that it changes sometimes, I have to see if it depends of the DataPage
> or other thing.
>
> I have other questions:
>
> 1- How I can access the PagedList properties from my bean, to do what you
> said about the _invalidated to true after a delete/add/edit action
>
> 2- The ID question
>
> 3- Can you send me your ajax jar, It seems that now the ajax data table is
> only in rich faces?? Which jar to use.
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
IT WORKS!!!!

I have to debug to see the correct id of the datatable, and I found that
was: _id0:data:8 whyyyy?? Obviously I don´t get the dropScroller to work
because I sent the true Id of the DataTable: data


<t:dataTable  id="data" styleClass="scrollerTable"

When I send this id it works fine, Paul from where comes this ID? I also see
that it changes sometimes, I have to see if it depends of the DataPage or
other thing.

I have other questions:

1- How I can access the PagedList properties from my bean, to do what you
said about the _invalidated to true after a delete/add/edit action

2- The ID question

3- Can you send me your ajax jar, It seems that now the ajax data table is
only in rich faces?? Which jar to use.

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@arcor.de>.
Hi Daniel,

I'm fighting against Nabble :) I'm not at work now and can't post from my
address subscribed to maillist. The only you need now is to call .setFirst()
with apropriative item index (the first item of page2, calculate as
currentIndex - yourPageSize). It's the bug of DataModel.

daniel ccss wrote:
> 
> On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>>
>>
>> Yes in my bean I have this method. I have another question, that may help
>> me with this, also, How in my bean I can access the variables of the
>> PagedListDataModel, for example for change the value of the variable
>> _invalidated of that class?
> Well, exactly like any other class member :) Just define getter/setter for
> this property, i.e.
> public boolean isInvalidated(){
>   return _invalidated;
> }
> public void setInvalidated(boolean bInv){
>   this._invalidated = bInv;
> }
> 
> but I'm not sure if you need both... I'd add just
> public void Invalidate(){
>   this.invalidated = true;
> }
> I haven't this because my List is populated from external, but you are
> free to extend the code as you need :)
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11510971
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Paul where are you :P

On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>
>     public DataModel getDataModel() {
>         if (dataModel == null) {
>             dataModel = new LocalDataModel(_PageSize);
>         }
>         return dataModel;
>     }
>
> Yes in my bean I have this method. I have another question, that may help
> me with this, also, How in my bean I can access the variables of the
> PagedListDataModel, for example for change the value of the variable
> _invalidated of that class? Do I have to extend of it on my bean, or how I
> can set the value of that variable on that class?? I´m confuse on how I can
> use that class from my backing_bean
>
> On 7/9/07, Vladimir Isakovich <iv...@gmail.com> wrote:
> >
> > Did you call that method Paul sent few days ago for updating dataModel
> > something like getDataModel(0), I just could not find it quick.
> >
> > On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > >
> > > where says appear read appears, where says alse read also :P
> > >
> > > On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > > >
> > > > Exactly Vladimir, that is what i was doing, BUT the following
> > > > happens (see images)
> > > >
> > > >
> > > >
> > > > On 7/9/07, Vladimir Isakovich < ivlad10@gmail.com > wrote:
> > > > >
> > > > > Hi Daniel,
> > > > > I think this logic should do:
> > > > > if(rowIndex >= dataSize && [list.size()==0]) - I mean the page
> > > > > came empty
> > > > >   rowIndex = rowIndex - pageSize;
> > > > >   if(rowIndex <0) rowIndex = 0;
> > > > >   call DB for getting records (or what it was some wrapping
> > > > > method)
> > > > >
> > > > > vlad
> > > > >
> > > > >  On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > > > > >
> > > > > > Hi Paul, Vladimir, and other readers!!
> > > > > >
> > > > > > Paul in my case all what I need now, to finish this, is know how
> > > > > > I can go to other DataPage from code. When I delete the last row of a
> > > > > > DataPage I want go to the previus DataPage. I want do this when I enter to
> > > > > > this if:
> > > > > >
> > > > > > if(rowIndex >= dataSize)
> > > > > >
> > > > > > What I have now is this: I add a Patient and the DataTable is
> > > > > > updated :), I delete a Patient (no the last of a PageData) and all works
> > > > > > fine :), I edit a Patient and all works fine :). When I delete the last
> > > > > > Patient of a DataPage, for example the DataPage 3 The indexes of the pages
> > > > > > are update, I mean, in the case of 3 dataPages, after delete the last row of
> > > > > > the DataPage3 only 1 and 2 links appear and not the 3, thats Fine!! But The
> > > > > > DataPage doesn´t change to the DataPage before it.
> > > > > >
> > > > > > The only thing that I need is that when the last patient of the
> > > > > > DataPage3 is erased (when enter to the if(rowIndex >= dataSize)) I can show
> > > > > > the DataPage2, what I need to do that??
> > > > > >
> > > > > > See the images that I attach in this mail, in this order image1,
> > > > > > image2 and image3
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
    public DataModel getDataModel() {
        if (dataModel == null) {
            dataModel = new LocalDataModel(_PageSize);
        }
        return dataModel;
    }

Yes in my bean I have this method. I have another question, that may help me
with this, also, How in my bean I can access the variables of the
PagedListDataModel, for example for change the value of the variable
_invalidated of that class? Do I have to extend of it on my bean, or how I
can set the value of that variable on that class?? I´m confuse on how I can
use that class from my backing_bean

On 7/9/07, Vladimir Isakovich <iv...@gmail.com> wrote:
>
> Did you call that method Paul sent few days ago for updating dataModel
> something like getDataModel(0), I just could not find it quick.
>
> On 7/9/07, daniel ccss <da...@gmail.com> wrote:
> >
> > where says appear read appears, where says alse read also :P
> >
> > On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > >
> > > Exactly Vladimir, that is what i was doing, BUT the following happens
> > > (see images)
> > >
> > >
> > >
> > > On 7/9/07, Vladimir Isakovich < ivlad10@gmail.com > wrote:
> > > >
> > > > Hi Daniel,
> > > > I think this logic should do:
> > > > if(rowIndex >= dataSize && [list.size()==0]) - I mean the page came
> > > > empty
> > > >   rowIndex = rowIndex - pageSize;
> > > >   if(rowIndex <0) rowIndex = 0;
> > > >   call DB for getting records (or what it was some wrapping method)
> > > >
> > > > vlad
> > > >
> > > >  On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > > > >
> > > > > Hi Paul, Vladimir, and other readers!!
> > > > >
> > > > > Paul in my case all what I need now, to finish this, is know how I
> > > > > can go to other DataPage from code. When I delete the last row of a DataPage
> > > > > I want go to the previus DataPage. I want do this when I enter to this if:
> > > > >
> > > > > if(rowIndex >= dataSize)
> > > > >
> > > > > What I have now is this: I add a Patient and the DataTable is
> > > > > updated :), I delete a Patient (no the last of a PageData) and all works
> > > > > fine :), I edit a Patient and all works fine :). When I delete the last
> > > > > Patient of a DataPage, for example the DataPage 3 The indexes of the pages
> > > > > are update, I mean, in the case of 3 dataPages, after delete the last row of
> > > > > the DataPage3 only 1 and 2 links appear and not the 3, thats Fine!! But The
> > > > > DataPage doesn´t change to the DataPage before it.
> > > > >
> > > > > The only thing that I need is that when the last patient of the
> > > > > DataPage3 is erased (when enter to the if(rowIndex >= dataSize)) I can show
> > > > > the DataPage2, what I need to do that??
> > > > >
> > > > > See the images that I attach in this mail, in this order image1,
> > > > > image2 and image3
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Did you call that method Paul sent few days ago for updating dataModel
something like getDataModel(0), I just could not find it quick.

On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>
> where says appear read appears, where says alse read also :P
>
> On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> >
> > Exactly Vladimir, that is what i was doing, BUT the following happens
> > (see images)
> >
> >
> >
> > On 7/9/07, Vladimir Isakovich < ivlad10@gmail.com> wrote:
> > >
> > > Hi Daniel,
> > > I think this logic should do:
> > > if(rowIndex >= dataSize && [list.size()==0]) - I mean the page came
> > > empty
> > >   rowIndex = rowIndex - pageSize;
> > >   if(rowIndex <0) rowIndex = 0;
> > >   call DB for getting records (or what it was some wrapping method)
> > >
> > > vlad
> > >
> > >  On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > > >
> > > > Hi Paul, Vladimir, and other readers!!
> > > >
> > > > Paul in my case all what I need now, to finish this, is know how I
> > > > can go to other DataPage from code. When I delete the last row of a DataPage
> > > > I want go to the previus DataPage. I want do this when I enter to this if:
> > > >
> > > > if(rowIndex >= dataSize)
> > > >
> > > > What I have now is this: I add a Patient and the DataTable is
> > > > updated :), I delete a Patient (no the last of a PageData) and all works
> > > > fine :), I edit a Patient and all works fine :). When I delete the last
> > > > Patient of a DataPage, for example the DataPage 3 The indexes of the pages
> > > > are update, I mean, in the case of 3 dataPages, after delete the last row of
> > > > the DataPage3 only 1 and 2 links appear and not the 3, thats Fine!! But The
> > > > DataPage doesn´t change to the DataPage before it.
> > > >
> > > > The only thing that I need is that when the last patient of the
> > > > DataPage3 is erased (when enter to the if(rowIndex >= dataSize)) I can show
> > > > the DataPage2, what I need to do that??
> > > >
> > > > See the images that I attach in this mail, in this order image1,
> > > > image2 and image3
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
where says appear read appears, where says alse read also :P

On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>
> Exactly Vladimir, that is what i was doing, BUT the following happens (see
> images)
>
>
>
> On 7/9/07, Vladimir Isakovich < ivlad10@gmail.com> wrote:
> >
> > Hi Daniel,
> > I think this logic should do:
> > if(rowIndex >= dataSize && [list.size()==0]) - I mean the page came
> > empty
> >   rowIndex = rowIndex - pageSize;
> >   if(rowIndex <0) rowIndex = 0;
> >   call DB for getting records (or what it was some wrapping method)
> >
> > vlad
> >
> > On 7/9/07, daniel ccss <danielccss2@gmail.com > wrote:
> > >
> > > Hi Paul, Vladimir, and other readers!!
> > >
> > > Paul in my case all what I need now, to finish this, is know how I can
> > > go to other DataPage from code. When I delete the last row of a DataPage I
> > > want go to the previus DataPage. I want do this when I enter to this if:
> > >
> > > if(rowIndex >= dataSize)
> > >
> > > What I have now is this: I add a Patient and the DataTable is updated
> > > :), I delete a Patient (no the last of a PageData) and all works fine :), I
> > > edit a Patient and all works fine :). When I delete the last Patient of a
> > > DataPage, for example the DataPage 3 The indexes of the pages are update, I
> > > mean, in the case of 3 dataPages, after delete the last row of the DataPage3
> > > only 1 and 2 links appear and not the 3, thats Fine!! But The DataPage
> > > doesn´t change to the DataPage before it.
> > >
> > > The only thing that I need is that when the last patient of the
> > > DataPage3 is erased (when enter to the if(rowIndex >= dataSize)) I can show
> > > the DataPage2, what I need to do that??
> > >
> > > See the images that I attach in this mail, in this order image1,
> > > image2 and image3
> > >
> > >
> > >
> > >
> > >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Exactly Vladimir, that is what i was doing, BUT the following happens (see
images)



On 7/9/07, Vladimir Isakovich <iv...@gmail.com> wrote:
>
> Hi Daniel,
> I think this logic should do:
> if(rowIndex >= dataSize && [list.size()==0]) - I mean the page came empty
>   rowIndex = rowIndex - pageSize;
>   if(rowIndex <0) rowIndex = 0;
>   call DB for getting records (or what it was some wrapping method)
>
> vlad
>
> On 7/9/07, daniel ccss <da...@gmail.com> wrote:
> >
> > Hi Paul, Vladimir, and other readers!!
> >
> > Paul in my case all what I need now, to finish this, is know how I can
> > go to other DataPage from code. When I delete the last row of a DataPage I
> > want go to the previus DataPage. I want do this when I enter to this if:
> >
> > if(rowIndex >= dataSize)
> >
> > What I have now is this: I add a Patient and the DataTable is updated
> > :), I delete a Patient (no the last of a PageData) and all works fine :), I
> > edit a Patient and all works fine :). When I delete the last Patient of a
> > DataPage, for example the DataPage 3 The indexes of the pages are update, I
> > mean, in the case of 3 dataPages, after delete the last row of the DataPage3
> > only 1 and 2 links appear and not the 3, thats Fine!! But The DataPage
> > doesn´t change to the DataPage before it.
> >
> > The only thing that I need is that when the last patient of the
> > DataPage3 is erased (when enter to the if(rowIndex >= dataSize)) I can show
> > the DataPage2, what I need to do that??
> >
> > See the images that I attach in this mail, in this order image1, image2
> > and image3
> >
> >
> >
> >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Hi Daniel,
I think this logic should do:
if(rowIndex >= dataSize && [list.size()==0]) - I mean the page came empty
  rowIndex = rowIndex - pageSize;
  if(rowIndex <0) rowIndex = 0;
  call DB for getting records (or what it was some wrapping method)

vlad

On 7/9/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi Paul, Vladimir, and other readers!!
>
> Paul in my case all what I need now, to finish this, is know how I can go
> to other DataPage from code. When I delete the last row of a DataPage I want
> go to the previus DataPage. I want do this when I enter to this if:
>
> if(rowIndex >= dataSize)
>
> What I have now is this: I add a Patient and the DataTable is updated :),
> I delete a Patient (no the last of a PageData) and all works fine :), I edit
> a Patient and all works fine :). When I delete the last Patient of a
> DataPage, for example the DataPage 3 The indexes of the pages are update, I
> mean, in the case of 3 dataPages, after delete the last row of the DataPage3
> only 1 and 2 links appear and not the 3, thats Fine!! But The DataPage
> doesn´t change to the DataPage before it.
>
> The only thing that I need is that when the last patient of the DataPage3
> is erased (when enter to the if(rowIndex >= dataSize)) I can show the
> DataPage2, what I need to do that??
>
> See the images that I attach in this mail, in this order image1, image2
> and image3
>
>
>
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Hi Daniel,
Just got time to look thru my email.
It seems your problem with adding steams from the totalRecords not being
updated at the time of adding. I guess, incrementing this number prior to
RESTORE_VIEW should help.

vlad

On 7/12/07, daniel ccss <da...@gmail.com> wrote:
>
> Paul where are you? again :P
>
> On 7/11/07, daniel ccss <da...@gmail.com> wrote:
> >
> > Hi Paul
> >
> > 1- I did the boolean _invalidate insted the properties file (excelent)
> > :)
> > 2- I made a change on your dropscroller method, i used component.getId()
> > insted of component. getClientId(), in that way the data id was found :)
> >
> > 3-All works now, except for one thing: when I add a row to the dataSet,
> > I don´t see the last row, for example:
> >
> > I have the DataTable with this info:
> > 1 Daniel
> > 2 Paul
> >
> > Then I add Vladimir with code 3 and doesn´t appear (if I press F5 I can
> > see it, if I press an arrow or number link I can see it) other way not. If I
> > add another row with code 4 (without press f5, numbers or arrows) then the
> > row with the code 3 appears. If I add the code 5 the row with code 4
> > appears, and so on.
> >
> > Another fact, if I have the DataTable with this info:
> > 1 Daniel
> > 3 Paul
> >
> > An I add the code 2, then the DataTable changes and shows the row with
> > code 1 and the row with the code 2, and not the row with code 3. It means
> > the data is update well but the last row is not shown.
> >
> > Why I didn´t notice this before?, because I have to pages, and I add
> > data to the  DataPage 2, but it was redirect to the DataPage 1 (beacuse of
> > the setFirst(0) on the dropScroller) So then i Click on the page 2 link or
> > the arrow and the datapage 2 was updated correctly.
> >
> > I put the redirect attribute in true, in the navigation rule that goes
> > from the add page to the page that shows the dataPage, and it doesn´t works.
> > Also I put the code of the add page into the page that have the datatable
> > (for the dropscroller find the data component) and works the same way.
> >
> > This are some System outs that I made, on the DataPagedList:
> >
> > When the add button is press:
> >
> > 07/07/11 15:32:26 ROWINDEX: 0
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex
> > == page.getStartRow()
> > 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> > 07/07/11 15:32:26 ROWINDEX: 1
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ROWINDEX: 2
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ROWINDEX: 0
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex
> > == page.getStartRow ()
> > 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> > 07/07/11 15:32:26 ROWINDEX: 1
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ROWINDEX: 2
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ROWINDEX: 0
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex
> > == page.getStartRow()
> > 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> > 07/07/11 15:32:26 ROWINDEX: 1
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ROWINDEX: 2
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 Servidor de base de datos: jdbc/SignosPassOracleDS
> > 07/07/11 15:32:26 EjecutaSQL: INSERT INTO IDEN_PACIENTE_2
> > (TIP_IDENTIFICACION, NUM_IDENTIFICACION, NOM_PACIENTE)    VALUES (0, 4, 'f')
> > 07/07/11 15:32:26 data
> > 07/07/11 15:32:26 dropScroller called
> > 07/07/11 15:32:26 Requested UIC data returning:data
> > 07/07/11 15:32:26 ROWINDEX: 0
> > 07/07/11 15:32:26 DATASETSIZE: 3
> > 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex
> > == page.getStartRow()
> > 07/07/11 15:32:26 **Fetch: required -> fetching...
> > 07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT * FROM ( SELECT
> > ROW_NUMBER() OVER(ORDER BY NUM_IDENTIFICACION) LINENUM, NUM_IDENTIFICACION,
> > NOM_PACIENTE FROM IDEN_PACIENTE_2 ORDER BY NUM_IDENTIFICACION) WHERE LINENUM
> > BETWEEN 0 AND 4
> > 07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT COUNT(*) AS CANTIDAD FROM
> > IDEN_PACIENTE_2
> > 07/07/11 15:32:26 ROWINDEX: 1
> > 07/07/11 15:32:26 DATASETSIZE: 4
> > 07/07/11 15:32:26 ROWINDEX: 2
> > 07/07/11 15:32:26 DATASETSIZE: 4
> >
> > And then when I press F5:
> >
> > 07/07/11 15:36:16 ROWINDEX: 0
> > 07/07/11 15:36:16 DATASETSIZE: 4
> > 07/07/11 15:36:16 ***Fetch requested: in getRowData(), reason: rowIndex
> > == page.getStartRow()
> > 07/07/11 15:36:16 **Fetch: not required (already fetched)!
> > 07/07/11 15:36:16 ROWINDEX: 1
> > 07/07/11 15:36:16 DATASETSIZE: 4
> > 07/07/11 15:36:16 ROWINDEX: 2
> > 07/07/11 15:36:16 DATASETSIZE: 4
> > 07/07/11 15:36:16 ROWINDEX: 3
> > 07/07/11 15:36:16 DATASETSIZE: 4
> >
> > As you can see when I press f5 one more row is display (RowIndex 3). You
> > cn see also that the dropscroller is call and it works fine.
> >
> > Can you help me with this, I have to present this demo on Friday for
> > that the company for which i Works accepts the use of JSF with tomahawk.
> >
> > Paul thanks!!!! I hope you can help me with this, and remember I´m new,
> > sorry if maybe I didn´t do something you told me before that can fix this
> > problem. Thanks again, I will be waiting for your answer, thank you!!
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi Paul, Vladimir, and other readers!!

Paul in my case all what I need now, to finish this, is know how I can go to
other DataPage from code. When I delete the last row of a DataPage I want go
to the previus DataPage. I want do this when I enter to this if:

if(rowIndex >= dataSize)

What I have now is this: I add a Patient and the DataTable is updated :), I
delete a Patient (no the last of a PageData) and all works fine :), I edit a
Patient and all works fine :). When I delete the last Patient of a DataPage,
for example the DataPage 3 The indexes of the pages are update, I mean, in
the case of 3 dataPages, after delete the last row of the DataPage3 only 1
and 2 links appear and not the 3, thats Fine!! But The DataPage doesn´t
change to the DataPage before it.

The only thing that I need is that when the last patient of the DataPage3 is
erased (when enter to the if(rowIndex >= dataSize)) I can show the
DataPage2, what I need to do that??

See the images that I attach in this mail, in this order image1, image2 and
image3

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Paul where are you? again :P

On 7/11/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi Paul
>
> 1- I did the boolean _invalidate insted the properties file (excelent) :)
> 2- I made a change on your dropscroller method, i used component.getId() insted
> of component. getClientId(), in that way the data id was found :)
>
> 3-All works now, except for one thing: when I add a row to the dataSet, I
> don´t see the last row, for example:
>
> I have the DataTable with this info:
> 1 Daniel
> 2 Paul
>
> Then I add Vladimir with code 3 and doesn´t appear (if I press F5 I can
> see it, if I press an arrow or number link I can see it) other way not. If I
> add another row with code 4 (without press f5, numbers or arrows) then the
> row with the code 3 appears. If I add the code 5 the row with code 4
> appears, and so on.
>
> Another fact, if I have the DataTable with this info:
> 1 Daniel
> 3 Paul
>
> An I add the code 2, then the DataTable changes and shows the row with
> code 1 and the row with the code 2, and not the row with code 3. It means
> the data is update well but the last row is not shown.
>
> Why I didn´t notice this before?, because I have to pages, and I add data
> to the  DataPage 2, but it was redirect to the DataPage 1 (beacuse of the
> setFirst(0) on the dropScroller) So then i Click on the page 2 link or the
> arrow and the datapage 2 was updated correctly.
>
> I put the redirect attribute in true, in the navigation rule that goes
> from the add page to the page that shows the dataPage, and it doesn´t works.
> Also I put the code of the add page into the page that have the datatable
> (for the dropscroller find the data component) and works the same way.
>
> This are some System outs that I made, on the DataPagedList:
>
> When the add button is press:
>
> 07/07/11 15:32:26 ROWINDEX: 0
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
> page.getStartRow()
> 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> 07/07/11 15:32:26 ROWINDEX: 1
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ROWINDEX: 2
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ROWINDEX: 0
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
> page.getStartRow ()
> 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> 07/07/11 15:32:26 ROWINDEX: 1
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ROWINDEX: 2
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ROWINDEX: 0
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
> page.getStartRow()
> 07/07/11 15:32:26 **Fetch: not required (already fetched)!
> 07/07/11 15:32:26 ROWINDEX: 1
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ROWINDEX: 2
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 Servidor de base de datos: jdbc/SignosPassOracleDS
> 07/07/11 15:32:26 EjecutaSQL: INSERT INTO IDEN_PACIENTE_2
> (TIP_IDENTIFICACION, NUM_IDENTIFICACION, NOM_PACIENTE)    VALUES (0, 4, 'f')
> 07/07/11 15:32:26 data
> 07/07/11 15:32:26 dropScroller called
> 07/07/11 15:32:26 Requested UIC data returning:data
> 07/07/11 15:32:26 ROWINDEX: 0
> 07/07/11 15:32:26 DATASETSIZE: 3
> 07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
> page.getStartRow()
> 07/07/11 15:32:26 **Fetch: required -> fetching...
> 07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT * FROM ( SELECT ROW_NUMBER()
> OVER(ORDER BY NUM_IDENTIFICACION) LINENUM, NUM_IDENTIFICACION, NOM_PACIENTE
> FROM IDEN_PACIENTE_2 ORDER BY NUM_IDENTIFICACION) WHERE LINENUM BETWEEN 0
> AND 4
> 07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT COUNT(*) AS CANTIDAD FROM
> IDEN_PACIENTE_2
> 07/07/11 15:32:26 ROWINDEX: 1
> 07/07/11 15:32:26 DATASETSIZE: 4
> 07/07/11 15:32:26 ROWINDEX: 2
> 07/07/11 15:32:26 DATASETSIZE: 4
>
> And then when I press F5:
>
> 07/07/11 15:36:16 ROWINDEX: 0
> 07/07/11 15:36:16 DATASETSIZE: 4
> 07/07/11 15:36:16 ***Fetch requested: in getRowData(), reason: rowIndex ==
> page.getStartRow()
> 07/07/11 15:36:16 **Fetch: not required (already fetched)!
> 07/07/11 15:36:16 ROWINDEX: 1
> 07/07/11 15:36:16 DATASETSIZE: 4
> 07/07/11 15:36:16 ROWINDEX: 2
> 07/07/11 15:36:16 DATASETSIZE: 4
> 07/07/11 15:36:16 ROWINDEX: 3
> 07/07/11 15:36:16 DATASETSIZE: 4
>
> As you can see when I press f5 one more row is display (RowIndex 3). You
> cn see also that the dropscroller is call and it works fine.
>
> Can you help me with this, I have to present this demo on Friday for that
> the company for which i Works accepts the use of JSF with tomahawk.
>
> Paul thanks!!!! I hope you can help me with this, and remember I´m new,
> sorry if maybe I didn´t do something you told me before that can fix this
> problem. Thanks again, I will be waiting for your answer, thank you!!
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi Paul

1- I did the boolean _invalidate insted the properties file (excelent) :)
2- I made a change on your dropscroller method, i used component.getId() insted
of component.getClientId(), in that way the data id was found :)

3-All works now, except for one thing: when I add a row to the dataSet, I
don´t see the last row, for example:

I have the DataTable with this info:
1 Daniel
2 Paul

Then I add Vladimir with code 3 and doesn´t appear (if I press F5 I can see
it, if I press an arrow or number link I can see it) other way not. If I add
another row with code 4 (without press f5, numbers or arrows) then the row
with the code 3 appears. If I add the code 5 the row with code 4 appears,
and so on.

Another fact, if I have the DataTable with this info:
1 Daniel
3 Paul

An I add the code 2, then the DataTable changes and shows the row with code
1 and the row with the code 2, and not the row with code 3. It means the
data is update well but the last row is not shown.

Why I didn´t notice this before?, because I have to pages, and I add data to
the  DataPage 2, but it was redirect to the DataPage 1 (beacuse of the
setFirst(0) on the dropScroller) So then i Click on the page 2 link or the
arrow and the datapage 2 was updated correctly.

I put the redirect attribute in true, in the navigation rule that goes from
the add page to the page that shows the dataPage, and it doesn´t works. Also
I put the code of the add page into the page that have the datatable (for
the dropscroller find the data component) and works the same way.

This are some System outs that I made, on the DataPagedList:

When the add button is press:

07/07/11 15:32:26 ROWINDEX: 0
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
page.getStartRow()
07/07/11 15:32:26 **Fetch: not required (already fetched)!
07/07/11 15:32:26 ROWINDEX: 1
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ROWINDEX: 2
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ROWINDEX: 0
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
page.getStartRow()
07/07/11 15:32:26 **Fetch: not required (already fetched)!
07/07/11 15:32:26 ROWINDEX: 1
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ROWINDEX: 2
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ROWINDEX: 0
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
page.getStartRow()
07/07/11 15:32:26 **Fetch: not required (already fetched)!
07/07/11 15:32:26 ROWINDEX: 1
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ROWINDEX: 2
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 Servidor de base de datos: jdbc/SignosPassOracleDS
07/07/11 15:32:26 EjecutaSQL: INSERT INTO IDEN_PACIENTE_2
(TIP_IDENTIFICACION, NUM_IDENTIFICACION, NOM_PACIENTE)    VALUES (0, 4, 'f')
07/07/11 15:32:26 data
07/07/11 15:32:26 dropScroller called
07/07/11 15:32:26 Requested UIC data returning:data
07/07/11 15:32:26 ROWINDEX: 0
07/07/11 15:32:26 DATASETSIZE: 3
07/07/11 15:32:26 ***Fetch requested: in getRowData(), reason: rowIndex ==
page.getStartRow()
07/07/11 15:32:26 **Fetch: required -> fetching...
07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT * FROM ( SELECT ROW_NUMBER()
OVER(ORDER BY NUM_IDENTIFICACION) LINENUM, NUM_IDENTIFICACION, NOM_PACIENTE
FROM IDEN_PACIENTE_2 ORDER BY NUM_IDENTIFICACION) WHERE LINENUM BETWEEN 0
AND 4
07/07/11 15:32:26 EjecutaSQLRetornaRS: SELECT COUNT(*) AS CANTIDAD FROM
IDEN_PACIENTE_2
07/07/11 15:32:26 ROWINDEX: 1
07/07/11 15:32:26 DATASETSIZE: 4
07/07/11 15:32:26 ROWINDEX: 2
07/07/11 15:32:26 DATASETSIZE: 4

And then when I press F5:

07/07/11 15:36:16 ROWINDEX: 0
07/07/11 15:36:16 DATASETSIZE: 4
07/07/11 15:36:16 ***Fetch requested: in getRowData(), reason: rowIndex ==
page.getStartRow()
07/07/11 15:36:16 **Fetch: not required (already fetched)!
07/07/11 15:36:16 ROWINDEX: 1
07/07/11 15:36:16 DATASETSIZE: 4
07/07/11 15:36:16 ROWINDEX: 2
07/07/11 15:36:16 DATASETSIZE: 4
07/07/11 15:36:16 ROWINDEX: 3
07/07/11 15:36:16 DATASETSIZE: 4

As you can see when I press f5 one more row is display (RowIndex 3). You cn
see also that the dropscroller is call and it works fine.

Can you help me with this, I have to present this demo on Friday for that
the company for which i Works accepts the use of JSF with tomahawk.

Paul thanks!!!! I hope you can help me with this, and remember I´m new,
sorry if maybe I didn´t do something you told me before that can fix this
problem. Thanks again, I will be waiting for your answer, thank you!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@arcor.de>.
Hi Vladimir,

I have no experience with MySQL as DB storage, but I thought this kind of
problem should be solved rather at ORM level (Hybernate? driver?). To my
understanding, MySQL hase really flexible NLS/collation facility. I'm
wondering if it's not just a minor configuration issue. What if you ommit
this TZ stuff at all? Well your date in DB is meant EDT but the framework is
aimed to let the user in US and Europe see DIFFERENT output in browser
(accoding to local time zone EDT or CET) keeping the data constant. If you
just set it 'hard' at view level, both will see exactly the same. If you
make it configurable in your code, you have to maintain the conversion not
only befor renderind, but after posting too. Why don't let JS do the job
locally, at client? One more consideration.. precision. Have you tried
DATETIME, not DATE?
Anyway I have just a new MySQL instance at my test server. It's a good
occasion to play a bit with this for a sample scroller/paging application.

Regards,
paul


Vladimir Isakovich wrote:
> 
> Hi Paul,
> I am getting to the conclusion that it will be impossible to use hibernate
> generated pojos with jsf directly (I tried to change from date to
> timestamp
> in mySql - no better).
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11513466
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Hi Paul,
I am getting to the conclusion that it will be impossible to use hibernate
generated pojos with jsf directly (I tried to change from date to timestamp
in mySql - no better). Here is my example with the date issue:

<t:inputText value*="#{customers.date}"
*valueChangeListener="#{customers.orderChanged}">
 <f:convertDateTime pattern="MM/dd/yyyy" timeZone="EDT"/>
</t:inputText>

    static Date defaultDate;
    static {
        try {
            SimpleDateFormat sdt = new SimpleDateFormat("MM/dd/yyyy");
            sdt.setTimeZone(TimeZone.getTimeZone("EDT"));
            defaultDate = sdt.parse(sdt.format(new Date()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private Date* date* = defaultDate;

It works fine with jsf. In the log at submition:
...validate: previousValue: Sun Jul 08 20:00:00 EDT 2007 convertedValue: Sun
Jul 08 20:00:00 EDT 2007

Probably in this particular case I may not blame JSF. After all it gets this
j.u.Date from any source and is not responsible for formatting deficiencies
which are made by DB/hibernate (in my case). Once I supplied a Date
fromatted exactly to the same standard that I use in my custom tag, I have
no more problem (even there was no problem with *sligt* format difference).

Generally speaking, this is not anything new (additional data conversion
between 'model' and 'view'), in my last struts project we were using as a
standard approach a whole layer of POJOs on the top of hibernate pojos (not
to mention struts has it's own layer of ActionForm pojos). Well I don't like
the idea of multiplying dummy (mostly) pojos, but using this case with the
date and thinking of some more possible issues, I'm getting to the point of
creating an additional layer with some conversion logic between my hibernate
pojos and jsf 'view'.
I'll try to make some reusable map based pojo, those constants for
datePattern and timeZone may be stored in some interface and will be
accessable from my backing bean (so they may be and should be referred by
jsp custom tag). Later in development I may add some more smarts to this
class or if it gets too ugly, delegate some logic to additional util
classes.
I thought to avoid of doing this conversion, but that was idealistic
approach. Well, whatever works.

vlad

On 7/9/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Hi Vladimir,
>
> I was also tired with this converter stuff in my day. Yes, surely, there
> is converter facility in JSF! But to make such statement is IMO the only
> useful way, how one can utilize it :(  Take a look at topic
> "Converter.getAsString not called?" started by Toppac. I've studied
> source code of API and implementation for lot of hours and found, that
> it's just impossible to get it work properly without to change too many
> things in code. In fact this lack (indirectly in spec itself) is covered
> sometimes at component level, or else nowhere. That's why some (but not
> all!) components works with conversion correctly, and that's why
> "convert" brings hundreds of hit in this list. The date conversion is
> not only tender spot... just try to implement trivial tristate boolean
> (i.e. true-false-doesn't matter) with a standard checkbox or even to
> bind the checkbox not to boolean, but to String property wit simple
> conversion rules (YES - > true, NO or "" or null ->FALSE), and you will
> see, what I'm talking about :) Few months ago I've opened JIRA issue and
> had a long discussion about this, but it has end up with nothing. The
> workaround stay to maintain conversion yourself, in backing bean.
>
> My Date fields are more often the regular Oracle Date mapped to
> java.util.Date, but the values must be 'transported' in Strings. So, I'm
> using in this case just an inputText with extra JS calendar from
> http://www.dynarch.com/projects/calendar/ (because no one from Tomahawk
> works really correct with String ) I've written an extra class, which
> has getter and setter for each data type (String, Date, boolean) and
> makes conversion internally (when applicable). However you can try
> following to get your Date displayed properly:
>
> <f:convertDateTime *pattern*="dd.MM.yyyy"/> //'regular' Java format
> pattern as you would use with String.format()
>
> As input for Date I'm using:
> <t:inputDate value="#{myBean.dateValue}"
> popupCalendar="true"
> renderAsPopup="true"
> />
> I've no joy with getting t:inputCalendar to work correctly. There is
> also calendar component from Jenia project and some other "AJAX
> compatible", which are often suggested, but only difference is look and
> feel. The bugs are the same, although this time not with conversion: all
> of this components (except JS) are buggy with positioning of DIV, if you
> just get an idea to use some advanced CSS in your project. However -
> rehashing your idea - "one could not use CSS somehow" :) or use it with
> a lot of handicraft, i.e. with JS calendar from
> http://www.dynarch.com/projects/calendar/:
>
> <h:inputText
>                 id="cal-field-1"
>                 value="#{myBean.myDateValue}"/>
> <img id="cal-button-1" src="tools/calendar/calendar_icon_1.gif"
> style="cursor: pointer; border: none;margin-top:2px;margin-left:2px;" />
> <script  id="scriptInitCa-l">
>                Calendar.setup({
>                  inputField    : "searchform:cal-field-1", //we need
> here "formID:inputTextID" !
>                  button        : "cal-button-1",
>                  ifFormat      : "%d.%m.%Y",  //another one format
> pattern to maintain in config :(!
>                  align         : "Tr"
>                });
> </script>
>
> Looks terrible, but if you are using Facelet, you can declare custom
> namespace and pack this code in separate file, i.e.:
> <facelet-taglib>
>    <namespace>http://my.url</namespace>
>
>    <!-- my:inputDate  -->
>    <tag>
>        <tag-name>inputDate</tag-name>
>        <source>../includes/inputDate.xhtml</source>
>    </tag>
> </facelet-taglib>
>
>
> regards,
> paul
>
>
> Vladimir Isakovich schrieb:
> > I was trying not to massage the incoming data in any way, but using
> > the attributes in convertDateTime only. What I found so far, this
> > approach works with the following setting:
> >
> > <t:inputText value="#{customers.date }"
> > valueChangeListener="#{customers.orderChanged}">
> >             <f:convertDateTime type="both" dateStyle="default"
> > timeStyle="default" timeZone="EST"/>
> > </t:inputText>
> >
> > The most important I think is type=both, then I can see exact match
> > and no event is fired:
> > ...validate: previousValue: Sun Jul 08 19:45:23 EDT 2007
> > convertedValue: Sun Jul 08 19:45:23 EDT 2007
> >
> > However this for me is not acceptable for the date entry, I'd like to
> > see something simple like Jul 08 2007 - no time or timezone at all.
> > Well I'll play with this isssue some more.
> >
> > vlad
> >
> >
> > On 7/8/07, *daniel ccss* <danielccss2@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> >     Vladimir you can´t use a Calendar to pick the date in the format
> >     you want?
> >
> >
> >     On 7/8/07, *Vladimir Isakovich* <ivlad10@gmail.com
> >     <ma...@gmail.com>> wrote:
> >
> >         Paul,
> >         may be you know how to deal with this problem. On a date field
> >         I'm using valueChangeListener (I have java.util.Date in the
> >         backing bean). This listener is firing on submit no matter if
> >         the value is changed or not . In UIInput I see:
> >
> >             public void validate(FacesContext context)
> >             {
> >                 if (context == null) throw new
> >         NullPointerException("context");
> >                 Object submittedValue = getSubmittedValue();
> >                 System.out.println("...validate: submittedValue:
> >         "+submittedValue);
> >                 if (submittedValue == null) return;
> >
> >                 Object convertedValue = getConvertedValue(context,
> >         submittedValue);
> >
> >                 if (!isValid()) return;
> >
> >                 validateValue(context, convertedValue);
> >
> >                 if (!isValid()) return;
> >
> >                 Object previousValue = getValue();
> >                 System.out.println("...validate: previousValue:
> >         "+previousValue+ " convertedValue: "+convertedValue);
> >                 try{    //-I added this
> >                     Converter converter =
> >         _SharedRendererUtils.findUIOutputConverter(context, this);
> >                     if (converter != null)
> >                     {
> >                         System.out.println("...validate: previousValue
> >         converted: "+converter.getAsString(context,this,
> previousValue));
> >                     }
> >                 }catch(Exception e){
> >                     e.printStackTrace ();
> >                 }
> >                 setValue(convertedValue);
> >                 setSubmittedValue(null);
> >                 if (compareValues(previousValue, convertedValue))
> >                 {
> >                     queueEvent(new ValueChangeEvent(this,
> >         previousValue, convertedValue));
> >                 }
> >             }
> >
> >         In my log:
> >         ...validate: submittedValue:
> >         org.apache.myfaces.custom.date.HtmlInputDate$UserData@14feea
> >         ...validate: previousValue: 2007-01-02 00:00:00.0
> >         convertedValue: Tue Jan 02 00:00:00 EST 2007
> >         ...validate: previousValue converted: Jan 2, 2007
> >
> >         As you can see, the values are not the same, so here I'm
> >         getting the event.
> >         In my page:
> >                               <t:inputDate value="#{order.orderDate }"
> >         type="date" dateStyle="default" timeZone="EST"
> >
> >         valueChangeListener="#{customers.orderChanged}" id="orderDate">
> >                                     <!--f:convertDateTime type="date"
> >         dateStyle="default" timeZone="EST"/-->
> >                               </t:inputDate>
> >
> >         I tried t:inputText with the converter first, and that time
> >         the first log was showing exact same value as the 3rd one.
> >
> >         But I think, that I'm making some basic mistake with the use
> >         of date field, my init value from the DB has no timezone, and
> >         may be something else is missed. See the 'prevoiusValue'.
> >         Even so I get through this issue with the valueChangeEvent,
> >         I'm facing the loading the new value into the DB, and this one
> >         has obviously a different format.
> >
> >         I guess the solution should be in adjusting the date format in
> >         the DB somehow. (I'm using mySql now). When retrieved from DB,
> >         my date should read: Tue Jan 02 00:00:00 EST 2007 - not
> >         2007-01-02 00:00:00.0
> >
> >         Your thoughts???
> >
> >         thanks
> >         vlad
> >
> >
> >         On 7/8/07, *Paul Iov* < paul@voller-ernst.de
> >         <ma...@voller-ernst.de>> wrote:
> >
> >             Daniel, I think your approach is ok. But... why do you
> >             need some properties-file? You can just extend my class
> >             with something like
> >
> >             private boolean _invalidated = true;
> >
> >             public void Invalidate(){
> >               this._invalidated = true;
> >             }
> >             and then in
> >
> >             private DataPage<T> doFetchPage(int startRow, int pageSize){
> >                     if ((_lastPage == null) || (_lastStartRow !=
> >             startRow) || (_lastPageSize != pageSize) || *_invalidated*){
> >                         _log.debug("**Fetch: required -> fetching...");
> >                         _lastPage = fetchPage(startRow, pageSize);
> >                         _lastStartRow = startRow;
> >                         _lastPageSize = pageSize;
> >                        _invalidated = false;//don't vorget to set it
> >             to FALSE
> >                     }else{
> >                         _log.debug("**Fetch: not required (already
> >             fetched)!");
> >                     }
> >                     return _lastPage;
> >                 }
> >
> >
> >             Just call this Invalidate() method from your bean after
> >             making changes, and the current page becomes refetched
> >             during next access at rendering phase. (It's exactly what
> >             you are doing now with the property file :)) The
> >             _invalidated flag 'overrides' any other condition and
> >             forces the page to be refetched just once.
> >
> >             Unfortunately I have not enough time right now to explain
> >             the approach in my implementation in detail (because I
> >             have to switch to another nonJSF-project), but I plan to
> >             build small example application next week, you have asked
> >             for. It would be nice, if someone be able then to correct
> >             my terrible English and publish it at Wiki...
> >
> >             Just few tips about delete/edit situation:
> >             - If you delete some record, you have to 'reload' at least
> >             the total count value (since the stored in instance of
> >             paged list value becomes incorrect). (The worst case: you
> >             land at incorrect page number, if you delete the only one
> >             item being at the LAST page.)
> >             - If you edit something, what (due to your sorting order)
> >             can affect the subset of items being displayed at current
> >             page, you have to reload the page as well. (This can lead
> >             into situation, when your just edited item 'disappears'
> >             from the current page.)
> >
> >             regards,
> >             paul
> >
> >             daniel ccss schrieb:
> >>             Ok Paul, this is the thing,
> >>
> >>             Since I´m new in this and in my work they are asking for
> >>             results from the Tomahawk investigation that i'm doing
> >>             implementing a simple maintain module, I think that I
> >>             can´t impplement all that you have done, at least in this
> >>             moment.
> >>
> >>             This is what i have done until now, I changed the
> >>             PagedList class from the wiki for yours, that was the
> >>             only class that Ichanged, the other change was to put the
> >>             bean in session (Vladimir idea) (by the way nice tip, you
> >>             gave for put it in session from code). Until now all
> >>             works fine.
> >>
> >>             Then i made my delete, add and edit methods, they simple
> >>             recived the Patient id and call an EJB that calls to the
> >>             DAOs methods to do that. They are called from an
> >>             actionlistener on the JSP. They all works fine, but I
> >>             don`t saw the changes on the DataTable, in the moment,
> >>             but when I click on the pages numbers I saw the changes.
> >>
> >>             What I need, is from code, and after call a
> >>             delte/add/edit method, fetch the data(as happen when i
> >>             click on a page number) from my backing bean, and of
> >>             course always pass for the filter to do the fetch after
> >>             this methods are called, something like:
> >>
> >>             backing_bean:
> >>             public void delete()
> >>             ...
> >>             EJB.deletePatient(...)
> >>             fetch data
> >>
> >>             I made a hardcore test ( I need to do it for test my idea
> >>             :( ) I made a properties file, and put a key call
> >>             forceToFetch = false, and in the dofetch method I get
> >>             this property then in your filter (If) I add this:
> >>             if(.... || forceToFetch). Inside the if I ask if the
> >>             forceToFetch is true and put it again in false in the
> >>             properties file.Then in the backing_bean after call the
> >>             add/delete/edit methods I put the value in the properties
> >>             in true, and as I thought it wors fine, I can saw all the
> >>             changes on the DataTable. Can you give a way to do this
> >>             witout use the properties file?  Can you give me an step
> >>             by step solution since I`m new in this and I still
> >>             understanding all your code.
> >>
> >>             Other thing I see a problem with this solution when I
> >>             delete the last row of a DataPage (example the last row
> >>             of the second DataPage) or when I delete the last row of
> >>             the first DataPage, I recived a row index exception. How
> >>             can I fix this issue, can you explain me. If I delete the
> >>             last row of dataPage 3 how can I show, from code, the
> >>             dataPage2 and in the case of the last row of the first
> >>             DataPage how can I delete that last row and show the
> >>             First DataPage without data? Can you also explain me this
> >>             step by step?
> >>
> >>             Paul really really sorry for all this, but I think that
> >>             your are the person that more knows of this, you are a
> >>             Guru on this, and I really need help, also thanks to you
> >>             Vladimir!!
> >>
> >>
> >>
> >>             On 7/6/07, *Paul Iov* <paul@voller-ernst.de
> >>             <ma...@voller-ernst.de>> wrote:
> >>
> >>                 Vladimir Isakovich schrieb:
> >>                 > Yes, I have just one call getting through to my DB,
> >>                 the session scoped
> >>                 > bean with Paul's blocking method worked. The
> >>                 drawback with this
> >>                 > approach, we may start thinking on cleaning session
> >>                 off of the unused
> >>                 > objects, otherwise our app may consume too much
> >>                 cache on the server.
> >>                 >
> >>                 > vlad
> >>                 That's why I don't utilize the JSF backing bean
> >>                 facility. It's not
> >>                 flexibly enough to maintain high dynamically
> >>                 applications.
> >>                 I've implement own session controller and it's the
> >>                 only backing bean I
> >>                 have to declare in my faces-config.xml ;) The other
> >>                 part of magic is
> >>                 application wide controller (started with
> >>                 ServletContextListener) to
> >>                 maintain some global issues and, first of all the
> >>                 sessions, which I
> >>                 catch with HTTPSessionListener.
> >>
> >>                 Just a little hint: you can 'inject' your beans into
> >>                 session without
> >>                 declaring it in config.
> >>
> >>                 <managed-bean>
> >>                       <managed-bean-name>MyBean</managed-bean-name>
> >>                       <managed-bean-class>my.MyClass
> </managed-bean-class>
> >>                       <managed-bean-scope>session</managed-bean-scope>
> >>                 </managed-bean>
> >>
> >>                 is equal to:
> >>
> >>                 FacesContext fCtx    = FacesContext.getCurrentInstance
> ();
> >>                 ExternalContext eCtx    = _fCtx.getExternalContext();
> >>                 ServletContext srvCtx  =
> >>                 (ServletContext)_eCtx.getContext();
> >>                 HttpSession session =
> >>                 (HttpSession)_eCtx.getSession(false);
> >>                 ...
> >>                 MyClass myInstance = new MyClass();
> >>                 session.setAttribute("MyBean", myInstance);//put
> >>                 MBean to session
> >>
> >>
> >>
> >
> >
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi Vladimir,

I was also tired with this converter stuff in my day. Yes, surely, there 
is converter facility in JSF! But to make such statement is IMO the only 
useful way, how one can utilize it :(  Take a look at topic 
"Converter.getAsString not called?" started by Toppac. I've studied 
source code of API and implementation for lot of hours and found, that 
it's just impossible to get it work properly without to change too many 
things in code. In fact this lack (indirectly in spec itself) is covered 
sometimes at component level, or else nowhere. That's why some (but not 
all!) components works with conversion correctly, and that's why 
"convert" brings hundreds of hit in this list. The date conversion is 
not only tender spot... just try to implement trivial tristate boolean 
(i.e. true-false-doesn't matter) with a standard checkbox or even to 
bind the checkbox not to boolean, but to String property wit simple 
conversion rules (YES - > true, NO or "" or null ->FALSE), and you will 
see, what I'm talking about :) Few months ago I've opened JIRA issue and 
had a long discussion about this, but it has end up with nothing. The 
workaround stay to maintain conversion yourself, in backing bean.

My Date fields are more often the regular Oracle Date mapped to 
java.util.Date, but the values must be 'transported' in Strings. So, I'm 
using in this case just an inputText with extra JS calendar from 
http://www.dynarch.com/projects/calendar/ (because no one from Tomahawk 
works really correct with String ) I've written an extra class, which 
has getter and setter for each data type (String, Date, boolean) and 
makes conversion internally (when applicable). However you can try 
following to get your Date displayed properly:

<f:convertDateTime *pattern*="dd.MM.yyyy"/> //'regular' Java format 
pattern as you would use with String.format()

As input for Date I'm using:
<t:inputDate value="#{myBean.dateValue}"
 popupCalendar="true"
 renderAsPopup="true"
/>
I've no joy with getting t:inputCalendar to work correctly. There is 
also calendar component from Jenia project and some other "AJAX 
compatible", which are often suggested, but only difference is look and 
feel. The bugs are the same, although this time not with conversion: all 
of this components (except JS) are buggy with positioning of DIV, if you 
just get an idea to use some advanced CSS in your project. However - 
rehashing your idea - "one could not use CSS somehow" :) or use it with 
a lot of handicraft, i.e. with JS calendar from 
http://www.dynarch.com/projects/calendar/:

<h:inputText
                 id="cal-field-1"
                 value="#{myBean.myDateValue}"/>
<img id="cal-button-1" src="tools/calendar/calendar_icon_1.gif" 
style="cursor: pointer; border: none;margin-top:2px;margin-left:2px;" />
<script  id="scriptInitCa-l">
                Calendar.setup({
                  inputField    : "searchform:cal-field-1", //we need 
here "formID:inputTextID" !
                  button        : "cal-button-1",
                  ifFormat      : "%d.%m.%Y",  //another one format 
pattern to maintain in config :(!
                  align         : "Tr"
                });
</script>

Looks terrible, but if you are using Facelet, you can declare custom 
namespace and pack this code in separate file, i.e.:
<facelet-taglib>
    <namespace>http://my.url</namespace>

    <!-- my:inputDate  -->
    <tag>
        <tag-name>inputDate</tag-name>
        <source>../includes/inputDate.xhtml</source>
    </tag>
</facelet-taglib>


regards,
paul


Vladimir Isakovich schrieb:
> I was trying not to massage the incoming data in any way, but using 
> the attributes in convertDateTime only. What I found so far, this 
> approach works with the following setting:
>
> <t:inputText value="#{customers.date }"
> valueChangeListener="#{customers.orderChanged}">
>             <f:convertDateTime type="both" dateStyle="default" 
> timeStyle="default" timeZone="EST"/>
> </t:inputText>
>
> The most important I think is type=both, then I can see exact match 
> and no event is fired:
> ...validate: previousValue: Sun Jul 08 19:45:23 EDT 2007 
> convertedValue: Sun Jul 08 19:45:23 EDT 2007
>
> However this for me is not acceptable for the date entry, I'd like to 
> see something simple like Jul 08 2007 - no time or timezone at all.
> Well I'll play with this isssue some more.
>
> vlad
>
>
> On 7/8/07, *daniel ccss* <danielccss2@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Vladimir you can´t use a Calendar to pick the date in the format
>     you want?
>
>
>     On 7/8/07, *Vladimir Isakovich* <ivlad10@gmail.com
>     <ma...@gmail.com>> wrote:
>
>         Paul,
>         may be you know how to deal with this problem. On a date field
>         I'm using valueChangeListener (I have java.util.Date in the
>         backing bean). This listener is firing on submit no matter if
>         the value is changed or not . In UIInput I see:
>
>             public void validate(FacesContext context)
>             {
>                 if (context == null) throw new
>         NullPointerException("context");
>                 Object submittedValue = getSubmittedValue();
>                 System.out.println("...validate: submittedValue:
>         "+submittedValue);
>                 if (submittedValue == null) return;
>
>                 Object convertedValue = getConvertedValue(context,
>         submittedValue);
>
>                 if (!isValid()) return;
>
>                 validateValue(context, convertedValue);
>
>                 if (!isValid()) return;
>
>                 Object previousValue = getValue();
>                 System.out.println("...validate: previousValue:
>         "+previousValue+ " convertedValue: "+convertedValue);
>                 try{    //-I added this
>                     Converter converter =
>         _SharedRendererUtils.findUIOutputConverter(context, this);
>                     if (converter != null)
>                     {
>                         System.out.println("...validate: previousValue
>         converted: "+converter.getAsString(context,this, previousValue));
>                     }
>                 }catch(Exception e){
>                     e.printStackTrace ();
>                 }
>                 setValue(convertedValue);
>                 setSubmittedValue(null);
>                 if (compareValues(previousValue, convertedValue))
>                 {
>                     queueEvent(new ValueChangeEvent(this,
>         previousValue, convertedValue));
>                 }
>             }
>
>         In my log:
>         ...validate: submittedValue:
>         org.apache.myfaces.custom.date.HtmlInputDate$UserData@14feea
>         ...validate: previousValue: 2007-01-02 00:00:00.0
>         convertedValue: Tue Jan 02 00:00:00 EST 2007
>         ...validate: previousValue converted: Jan 2, 2007
>
>         As you can see, the values are not the same, so here I'm
>         getting the event.
>         In my page:
>                               <t:inputDate value="#{order.orderDate }"
>         type="date" dateStyle="default" timeZone="EST"
>                                                  
>         valueChangeListener="#{customers.orderChanged}" id="orderDate">
>                                     <!--f:convertDateTime type="date"
>         dateStyle="default" timeZone="EST"/-->
>                               </t:inputDate>
>
>         I tried t:inputText with the converter first, and that time
>         the first log was showing exact same value as the 3rd one.
>
>         But I think, that I'm making some basic mistake with the use
>         of date field, my init value from the DB has no timezone, and
>         may be something else is missed. See the 'prevoiusValue'.
>         Even so I get through this issue with the valueChangeEvent,
>         I'm facing the loading the new value into the DB, and this one
>         has obviously a different format.
>
>         I guess the solution should be in adjusting the date format in
>         the DB somehow. (I'm using mySql now). When retrieved from DB,
>         my date should read: Tue Jan 02 00:00:00 EST 2007 - not
>         2007-01-02 00:00:00.0
>
>         Your thoughts???
>
>         thanks
>         vlad
>
>
>         On 7/8/07, *Paul Iov* < paul@voller-ernst.de
>         <ma...@voller-ernst.de>> wrote:
>
>             Daniel, I think your approach is ok. But... why do you
>             need some properties-file? You can just extend my class
>             with something like
>
>             private boolean _invalidated = true;
>
>             public void Invalidate(){
>               this._invalidated = true;
>             }
>             and then in
>
>             private DataPage<T> doFetchPage(int startRow, int pageSize){
>                     if ((_lastPage == null) || (_lastStartRow !=
>             startRow) || (_lastPageSize != pageSize) || *_invalidated*){
>                         _log.debug("**Fetch: required -> fetching...");
>                         _lastPage = fetchPage(startRow, pageSize);
>                         _lastStartRow = startRow;
>                         _lastPageSize = pageSize;
>                        _invalidated = false;//don't vorget to set it
>             to FALSE
>                     }else{
>                         _log.debug("**Fetch: not required (already
>             fetched)!");
>                     }
>                     return _lastPage;
>                 }
>
>
>             Just call this Invalidate() method from your bean after
>             making changes, and the current page becomes refetched
>             during next access at rendering phase. (It's exactly what
>             you are doing now with the property file :)) The
>             _invalidated flag 'overrides' any other condition and
>             forces the page to be refetched just once.
>
>             Unfortunately I have not enough time right now to explain
>             the approach in my implementation in detail (because I
>             have to switch to another nonJSF-project), but I plan to
>             build small example application next week, you have asked
>             for. It would be nice, if someone be able then to correct
>             my terrible English and publish it at Wiki...
>
>             Just few tips about delete/edit situation:
>             - If you delete some record, you have to 'reload' at least
>             the total count value (since the stored in instance of
>             paged list value becomes incorrect). (The worst case: you
>             land at incorrect page number, if you delete the only one
>             item being at the LAST page.)
>             - If you edit something, what (due to your sorting order)
>             can affect the subset of items being displayed at current
>             page, you have to reload the page as well. (This can lead
>             into situation, when your just edited item 'disappears'
>             from the current page.)
>
>             regards,
>             paul
>
>             daniel ccss schrieb:
>>             Ok Paul, this is the thing,
>>
>>             Since I´m new in this and in my work they are asking for
>>             results from the Tomahawk investigation that i'm doing
>>             implementing a simple maintain module, I think that I
>>             can´t impplement all that you have done, at least in this
>>             moment.
>>
>>             This is what i have done until now, I changed the
>>             PagedList class from the wiki for yours, that was the
>>             only class that Ichanged, the other change was to put the
>>             bean in session (Vladimir idea) (by the way nice tip, you
>>             gave for put it in session from code). Until now all
>>             works fine.
>>
>>             Then i made my delete, add and edit methods, they simple
>>             recived the Patient id and call an EJB that calls to the
>>             DAOs methods to do that. They are called from an
>>             actionlistener on the JSP. They all works fine, but I
>>             don`t saw the changes on the DataTable, in the moment,
>>             but when I click on the pages numbers I saw the changes.
>>
>>             What I need, is from code, and after call a
>>             delte/add/edit method, fetch the data(as happen when i
>>             click on a page number) from my backing bean, and of
>>             course always pass for the filter to do the fetch after
>>             this methods are called, something like:
>>
>>             backing_bean:
>>             public void delete()
>>             ...
>>             EJB.deletePatient(...)
>>             fetch data
>>
>>             I made a hardcore test ( I need to do it for test my idea
>>             :( ) I made a properties file, and put a key call
>>             forceToFetch = false, and in the dofetch method I get
>>             this property then in your filter (If) I add this:
>>             if(.... || forceToFetch). Inside the if I ask if the
>>             forceToFetch is true and put it again in false in the
>>             properties file.Then in the backing_bean after call the
>>             add/delete/edit methods I put the value in the properties
>>             in true, and as I thought it wors fine, I can saw all the
>>             changes on the DataTable. Can you give a way to do this
>>             witout use the properties file?  Can you give me an step
>>             by step solution since I`m new in this and I still
>>             understanding all your code.
>>
>>             Other thing I see a problem with this solution when I
>>             delete the last row of a DataPage (example the last row
>>             of the second DataPage) or when I delete the last row of
>>             the first DataPage, I recived a row index exception. How
>>             can I fix this issue, can you explain me. If I delete the
>>             last row of dataPage 3 how can I show, from code, the
>>             dataPage2 and in the case of the last row of the first
>>             DataPage how can I delete that last row and show the
>>             First DataPage without data? Can you also explain me this
>>             step by step?
>>
>>             Paul really really sorry for all this, but I think that
>>             your are the person that more knows of this, you are a
>>             Guru on this, and I really need help, also thanks to you
>>             Vladimir!!
>>
>>
>>
>>             On 7/6/07, *Paul Iov* <paul@voller-ernst.de
>>             <ma...@voller-ernst.de>> wrote:
>>
>>                 Vladimir Isakovich schrieb:
>>                 > Yes, I have just one call getting through to my DB,
>>                 the session scoped
>>                 > bean with Paul's blocking method worked. The
>>                 drawback with this
>>                 > approach, we may start thinking on cleaning session
>>                 off of the unused
>>                 > objects, otherwise our app may consume too much
>>                 cache on the server.
>>                 >
>>                 > vlad
>>                 That's why I don't utilize the JSF backing bean
>>                 facility. It's not
>>                 flexibly enough to maintain high dynamically
>>                 applications.
>>                 I've implement own session controller and it's the
>>                 only backing bean I
>>                 have to declare in my faces-config.xml ;) The other
>>                 part of magic is
>>                 application wide controller (started with
>>                 ServletContextListener) to
>>                 maintain some global issues and, first of all the
>>                 sessions, which I
>>                 catch with HTTPSessionListener.
>>
>>                 Just a little hint: you can 'inject' your beans into
>>                 session without
>>                 declaring it in config.
>>
>>                 <managed-bean>
>>                       <managed-bean-name>MyBean</managed-bean-name>
>>                       <managed-bean-class>my.MyClass</managed-bean-class>
>>                       <managed-bean-scope>session</managed-bean-scope>
>>                 </managed-bean>
>>
>>                 is equal to:
>>
>>                 FacesContext fCtx    = FacesContext.getCurrentInstance();
>>                 ExternalContext eCtx    = _fCtx.getExternalContext();
>>                 ServletContext srvCtx  =
>>                 (ServletContext)_eCtx.getContext();
>>                 HttpSession session =
>>                 (HttpSession)_eCtx.getSession(false);
>>                 ...
>>                 MyClass myInstance = new MyClass();
>>                 session.setAttribute("MyBean", myInstance);//put
>>                 MBean to session
>>
>>
>>
>
>
>
>


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
I was trying not to massage the incoming data in any way, but using the
attributes in convertDateTime only. What I found so far, this approach works
with the following setting:

<t:inputText value="#{customers.date}"
valueChangeListener="#{customers.orderChanged}">
            <f:convertDateTime type="both" dateStyle="default"
timeStyle="default" timeZone="EST"/>
</t:inputText>

The most important I think is type=both, then I can see exact match and no
event is fired:
...validate: previousValue: Sun Jul 08 19:45:23 EDT 2007 convertedValue: Sun
Jul 08 19:45:23 EDT 2007

However this for me is not acceptable for the date entry, I'd like to see
something simple like Jul 08 2007 - no time or timezone at all.
Well I'll play with this isssue some more.

vlad


On 7/8/07, daniel ccss <da...@gmail.com> wrote:
>
> Vladimir you can´t use a Calendar to pick the date in the format you want?
>
> On 7/8/07, Vladimir Isakovich <ivlad10@gmail.com > wrote:
> >
> > Paul,
> > may be you know how to deal with this problem. On a date field I'm using
> > valueChangeListener (I have java.util.Date in the backing bean). This
> > listener is firing on submit no matter if the value is changed or not .
> > In UIInput I see:
> >
> >     public void validate(FacesContext context)
> >     {
> >         if (context == null) throw new NullPointerException("context");
> >         Object submittedValue = getSubmittedValue();
> >         System.out.println("...validate: submittedValue:
> > "+submittedValue);
> >         if (submittedValue == null) return;
> >
> >         Object convertedValue = getConvertedValue(context,
> > submittedValue);
> >
> >         if (!isValid()) return;
> >
> >         validateValue(context, convertedValue);
> >
> >         if (!isValid()) return;
> >
> >         Object previousValue = getValue();
> >         System.out.println("...validate: previousValue: "+previousValue+
> > " convertedValue: "+convertedValue);
> >         try{    //-I added this
> >             Converter converter =
> > _SharedRendererUtils.findUIOutputConverter(context, this);
> >             if (converter != null)
> >             {
> >                 System.out.println("...validate: previousValue
> > converted: "+converter.getAsString(context,this, previousValue));
> >             }
> >         }catch(Exception e){
> >             e.printStackTrace ();
> >         }
> >         setValue(convertedValue);
> >         setSubmittedValue(null);
> >         if (compareValues(previousValue, convertedValue))
> >         {
> >             queueEvent(new ValueChangeEvent(this, previousValue,
> > convertedValue));
> >         }
> >     }
> >
> > In my log:
> > ...validate: submittedValue:
> > org.apache.myfaces.custom.date.HtmlInputDate$UserData@14feea
> > ...validate: previousValue: 2007-01-02 00:00:00.0 convertedValue: Tue
> > Jan 02 00:00:00 EST 2007
> > ...validate: previousValue converted: Jan 2, 2007
> >
> > As you can see, the values are not the same, so here I'm getting the
> > event.
> > In my page:
> >                       <t:inputDate value="#{order.orderDate }"
> > type="date" dateStyle="default" timeZone="EST"
> >                                           valueChangeListener="#{
> > customers.orderChanged}" id="orderDate">
> >                             <!--f:convertDateTime type="date"
> > dateStyle="default" timeZone="EST"/-->
> >                       </t:inputDate>
> >
> > I tried t:inputText with the converter first, and that time the first
> > log was showing exact same value as the 3rd one.
> >
> > But I think, that I'm making some basic mistake with the use of date
> > field, my init value from the DB has no timezone, and may be something else
> > is missed. See the 'prevoiusValue'.
> > Even so I get through this issue with the valueChangeEvent, I'm facing
> > the loading the new value into the DB, and this one has obviously a
> > different format.
> >
> > I guess the solution should be in adjusting the date format in the DB
> > somehow. (I'm using mySql now). When retrieved from DB, my date should read:
> > Tue Jan 02 00:00:00 EST 2007 - not 2007-01-02 00:00:00.0
> >
> > Your thoughts???
> >
> > thanks
> > vlad
> >
> > On 7/8/07, Paul Iov < paul@voller-ernst.de> wrote:
> > >
> > >  Daniel, I think your approach is ok. But... why do you need some
> > > properties-file? You can just extend my class with something like
> > >
> > > private boolean _invalidated = true;
> > >
> > > public void Invalidate(){
> > >   this._invalidated = true;
> > > }
> > > and then in
> > >
> > > private DataPage<T> doFetchPage(int startRow, int pageSize){
> > >         if ((_lastPage == null) || (_lastStartRow != startRow) ||
> > > (_lastPageSize != pageSize) || *_invalidated*){
> > >             _log.debug("**Fetch: required -> fetching...");
> > >             _lastPage = fetchPage(startRow, pageSize);
> > >             _lastStartRow = startRow;
> > >             _lastPageSize = pageSize;
> > >            _invalidated = false;//don't vorget to set it to FALSE
> > >         }else{
> > >             _log.debug("**Fetch: not required (already fetched)!");
> > >         }
> > >         return _lastPage;
> > >     }
> > >
> > >
> > > Just call this Invalidate() method from your bean after making
> > > changes, and the current page becomes refetched during next access at
> > > rendering phase. (It's exactly what you are doing now with the property file
> > > :)) The _invalidated flag 'overrides' any other condition and forces the
> > > page to be refetched just once.
> > >
> > > Unfortunately I have not enough time right now to explain the approach
> > > in my implementation in detail (because I have to switch to another
> > > nonJSF-project), but I plan to build small example application next week,
> > > you have asked for. It would be nice, if someone be able then to correct my
> > > terrible English and publish it at Wiki...
> > >
> > > Just few tips about delete/edit situation:
> > > - If you delete some record, you have to 'reload' at least the total
> > > count value (since the stored in instance of paged list value becomes
> > > incorrect). (The worst case: you land at incorrect page number, if you
> > > delete the only one item being at the LAST page.)
> > > - If you edit something, what (due to your sorting order) can affect
> > > the subset of items being displayed at current page, you have to reload the
> > > page as well. (This can lead into situation, when your just edited item
> > > 'disappears' from the current page.)
> > >
> > > regards,
> > > paul
> > >
> > > daniel ccss schrieb:
> > >
> > > Ok Paul, this is the thing,
> > >
> > > Since I´m new in this and in my work they are asking for results from
> > > the Tomahawk investigation that i'm doing implementing a simple maintain
> > > module, I think that I can´t impplement all that you have done, at least in
> > > this moment.
> > >
> > > This is what i have done until now, I changed the PagedList class from
> > > the wiki for yours, that was the only class that Ichanged, the other change
> > > was to put the bean in session (Vladimir idea) (by the way nice tip, you
> > > gave for put it in session from code). Until now all works fine.
> > >
> > > Then i made my delete, add and edit methods, they simple recived the
> > > Patient id and call an EJB that calls to the DAOs methods to do that. They
> > > are called from an actionlistener on the JSP. They all works fine, but I
> > > don`t saw the changes on the DataTable, in the moment, but when I click on
> > > the pages numbers I saw the changes.
> > >
> > > What I need, is from code, and after call a delte/add/edit method,
> > > fetch the data(as happen when i click on a page number) from my backing
> > > bean, and of course always pass for the filter to do the fetch after this
> > > methods are called, something like:
> > >
> > > backing_bean:
> > > public void delete()
> > > ...
> > > EJB.deletePatient(...)
> > > fetch data
> > >
> > > I made a hardcore test ( I need to do it for test my idea :( ) I made
> > > a properties file, and put a key call forceToFetch = false, and in the
> > > dofetch method I get this property then in your filter (If) I add this:
> > > if(.... || forceToFetch). Inside the if I ask if the forceToFetch is true
> > > and put it again in false in the properties file.Then in the
> > > backing_bean after call the add/delete/edit methods I put the value in the
> > > properties in true, and as I thought it wors fine, I can saw all the changes
> > > on the DataTable. Can you give a way to do this witout use the properties
> > > file?  Can you give me an step by step solution since I`m new in this and I
> > > still understanding all your code.
> > >
> > > Other thing I see a problem with this solution when I delete the last
> > > row of a DataPage (example the last row of the second DataPage) or when I
> > > delete the last row of the first DataPage, I recived a row index exception.
> > > How can I fix this issue, can you explain me. If I delete the last row of
> > > dataPage 3 how can I show, from code, the dataPage2 and in the case of the
> > > last row of the first DataPage how can I delete that last row and show the
> > > First DataPage without data? Can you also explain me this step by step?
> > >
> > > Paul really really sorry for all this, but I think that your are the
> > > person that more knows of this, you are a Guru on this, and I really need
> > > help, also thanks to you Vladimir!!
> > >
> > >
> > >
> > > On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
> > > >
> > > > Vladimir Isakovich schrieb:
> > > > > Yes, I have just one call getting through to my DB, the session
> > > > scoped
> > > > > bean with Paul's blocking method worked. The drawback with this
> > > > > approach, we may start thinking on cleaning session off of the
> > > > unused
> > > > > objects, otherwise our app may consume too much cache on the
> > > > server.
> > > > >
> > > > > vlad
> > > > That's why I don't utilize the JSF backing bean facility. It's not
> > > > flexibly enough to maintain high dynamically applications.
> > > > I've implement own session controller and it's the only backing bean
> > > > I
> > > > have to declare in my faces-config.xml ;) The other part of magic is
> > > > application wide controller (started with ServletContextListener) to
> > > >
> > > > maintain some global issues and, first of all the sessions, which I
> > > > catch with HTTPSessionListener.
> > > >
> > > > Just a little hint: you can 'inject' your beans into session without
> > > > declaring it in config.
> > > >
> > > > <managed-bean>
> > > >       <managed-bean-name>MyBean</managed-bean-name>
> > > >       <managed-bean-class>my.MyClass</managed-bean-class>
> > > >       <managed-bean-scope>session</managed-bean-scope>
> > > > </managed-bean>
> > > >
> > > > is equal to:
> > > >
> > > > FacesContext fCtx    = FacesContext.getCurrentInstance();
> > > > ExternalContext eCtx    = _fCtx.getExternalContext();
> > > > ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> > > > HttpSession session = (HttpSession)_eCtx.getSession(false);
> > > > ...
> > > > MyClass myInstance = new MyClass();
> > > > session.setAttribute("MyBean", myInstance);//put MBean to session
> > > >
> > > >
> > > >
> > >
> > >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Thanks again Paul, Ok tomorrow (monday) I will change the use of the
property file, in fact I use it the Friday only to saw if what I was
thinking of a way to force to do the fetch will work.

Ok the other thing, the most critical for me right now, when I delete the
last row I enter to the following if, and recived the exception:


        //When the last row of a DataPage is deleted:
        if (rowIndex < 0) {
            throw new IllegalArgumentException(
                "Invalid rowIndex for PagedListDataModel; not within page");
        }

        //When the last item of all collection is deleted:

        if (rowIndex >= datasetSize) {
            throw new IllegalArgumentException("Invalid rowIndex");
        }

Can you explain me how to mannage this, as you said, "'reload' at least the
total count value". What I should call or what variables should I change
inside this ifs to get the correct DataPage??  How  if I delete the last row
of the dataPage 3 can show the dataPage 2 insted of recived the exception
when I enter to this if.

THATS A GREAT IDEA, REALLY!!! we all, the new people working with this, need
a base project in the WIKI that explains how to do all this, and if a Guru
like you can do it, BETTER!!!, by the way sorry for my english too :P

Thanks

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Vladimir you can´t use a Calendar to pick the date in the format you want?

On 7/8/07, Vladimir Isakovich <iv...@gmail.com> wrote:
>
> Paul,
> may be you know how to deal with this problem. On a date field I'm using
> valueChangeListener (I have java.util.Date in the backing bean). This
> listener is firing on submit no matter if the value is changed or not . In
> UIInput I see:
>
>     public void validate(FacesContext context)
>     {
>         if (context == null) throw new NullPointerException("context");
>         Object submittedValue = getSubmittedValue();
>         System.out.println("...validate: submittedValue:
> "+submittedValue);
>         if (submittedValue == null) return;
>
>         Object convertedValue = getConvertedValue(context,
> submittedValue);
>
>         if (!isValid()) return;
>
>         validateValue(context, convertedValue);
>
>         if (!isValid()) return;
>
>         Object previousValue = getValue();
>         System.out.println("...validate: previousValue: "+previousValue+ "
> convertedValue: "+convertedValue);
>         try{    //-I added this
>             Converter converter =
> _SharedRendererUtils.findUIOutputConverter(context, this);
>             if (converter != null)
>             {
>                 System.out.println("...validate: previousValue converted:
> "+converter.getAsString(context,this, previousValue));
>             }
>         }catch(Exception e){
>             e.printStackTrace ();
>         }
>         setValue(convertedValue);
>         setSubmittedValue(null);
>         if (compareValues(previousValue, convertedValue))
>         {
>             queueEvent(new ValueChangeEvent(this, previousValue,
> convertedValue));
>         }
>     }
>
> In my log:
> ...validate: submittedValue:
> org.apache.myfaces.custom.date.HtmlInputDate$UserData@14feea
> ...validate: previousValue: 2007-01-02 00:00:00.0 convertedValue: Tue Jan
> 02 00:00:00 EST 2007
> ...validate: previousValue converted: Jan 2, 2007
>
> As you can see, the values are not the same, so here I'm getting the
> event.
> In my page:
>                       <t:inputDate value="#{order.orderDate }" type="date"
> dateStyle="default" timeZone="EST"
>                                           valueChangeListener="#{
> customers.orderChanged}" id="orderDate">
>                             <!--f:convertDateTime type="date"
> dateStyle="default" timeZone="EST"/-->
>                       </t:inputDate>
>
> I tried t:inputText with the converter first, and that time the first log
> was showing exact same value as the 3rd one.
>
> But I think, that I'm making some basic mistake with the use of date
> field, my init value from the DB has no timezone, and may be something else
> is missed. See the 'prevoiusValue'.
> Even so I get through this issue with the valueChangeEvent, I'm facing the
> loading the new value into the DB, and this one has obviously a different
> format.
>
> I guess the solution should be in adjusting the date format in the DB
> somehow. (I'm using mySql now). When retrieved from DB, my date should read:
> Tue Jan 02 00:00:00 EST 2007 - not 2007-01-02 00:00:00.0
>
> Your thoughts???
>
> thanks
> vlad
>
> On 7/8/07, Paul Iov <pa...@voller-ernst.de> wrote:
> >
> >  Daniel, I think your approach is ok. But... why do you need some
> > properties-file? You can just extend my class with something like
> >
> > private boolean _invalidated = true;
> >
> > public void Invalidate(){
> >   this._invalidated = true;
> > }
> > and then in
> >
> > private DataPage<T> doFetchPage(int startRow, int pageSize){
> >         if ((_lastPage == null) || (_lastStartRow != startRow) ||
> > (_lastPageSize != pageSize) || *_invalidated*){
> >             _log.debug("**Fetch: required -> fetching...");
> >             _lastPage = fetchPage(startRow, pageSize);
> >             _lastStartRow = startRow;
> >             _lastPageSize = pageSize;
> >            _invalidated = false;//don't vorget to set it to FALSE
> >         }else{
> >             _log.debug("**Fetch: not required (already fetched)!");
> >         }
> >         return _lastPage;
> >     }
> >
> >
> > Just call this Invalidate() method from your bean after making changes,
> > and the current page becomes refetched during next access at rendering
> > phase. (It's exactly what you are doing now with the property file :)) The
> > _invalidated flag 'overrides' any other condition and forces the page to be
> > refetched just once.
> >
> > Unfortunately I have not enough time right now to explain the approach
> > in my implementation in detail (because I have to switch to another
> > nonJSF-project), but I plan to build small example application next week,
> > you have asked for. It would be nice, if someone be able then to correct my
> > terrible English and publish it at Wiki...
> >
> > Just few tips about delete/edit situation:
> > - If you delete some record, you have to 'reload' at least the total
> > count value (since the stored in instance of paged list value becomes
> > incorrect). (The worst case: you land at incorrect page number, if you
> > delete the only one item being at the LAST page.)
> > - If you edit something, what (due to your sorting order) can affect the
> > subset of items being displayed at current page, you have to reload the page
> > as well. (This can lead into situation, when your just edited item
> > 'disappears' from the current page.)
> >
> > regards,
> > paul
> >
> > daniel ccss schrieb:
> >
> > Ok Paul, this is the thing,
> >
> > Since I´m new in this and in my work they are asking for results from
> > the Tomahawk investigation that i'm doing implementing a simple maintain
> > module, I think that I can´t impplement all that you have done, at least in
> > this moment.
> >
> > This is what i have done until now, I changed the PagedList class from
> > the wiki for yours, that was the only class that Ichanged, the other change
> > was to put the bean in session (Vladimir idea) (by the way nice tip, you
> > gave for put it in session from code). Until now all works fine.
> >
> > Then i made my delete, add and edit methods, they simple recived the
> > Patient id and call an EJB that calls to the DAOs methods to do that. They
> > are called from an actionlistener on the JSP. They all works fine, but I
> > don`t saw the changes on the DataTable, in the moment, but when I click on
> > the pages numbers I saw the changes.
> >
> > What I need, is from code, and after call a delte/add/edit method, fetch
> > the data(as happen when i click on a page number) from my backing bean, and
> > of course always pass for the filter to do the fetch after this methods are
> > called, something like:
> >
> > backing_bean:
> > public void delete()
> > ...
> > EJB.deletePatient(...)
> > fetch data
> >
> > I made a hardcore test ( I need to do it for test my idea :( ) I made a
> > properties file, and put a key call forceToFetch = false, and in the dofetch
> > method I get this property then in your filter (If) I add this: if(.... ||
> > forceToFetch). Inside the if I ask if the forceToFetch is true and put it
> > again in false in the properties file.Then in the backing_bean after
> > call the add/delete/edit methods I put the value in the properties in true,
> > and as I thought it wors fine, I can saw all the changes on the DataTable.
> > Can you give a way to do this witout use the properties file?  Can you give
> > me an step by step solution since I`m new in this and I still understanding
> > all your code.
> >
> > Other thing I see a problem with this solution when I delete the last
> > row of a DataPage (example the last row of the second DataPage) or when I
> > delete the last row of the first DataPage, I recived a row index exception.
> > How can I fix this issue, can you explain me. If I delete the last row of
> > dataPage 3 how can I show, from code, the dataPage2 and in the case of the
> > last row of the first DataPage how can I delete that last row and show the
> > First DataPage without data? Can you also explain me this step by step?
> >
> > Paul really really sorry for all this, but I think that your are the
> > person that more knows of this, you are a Guru on this, and I really need
> > help, also thanks to you Vladimir!!
> >
> >
> >
> > On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
> > >
> > > Vladimir Isakovich schrieb:
> > > > Yes, I have just one call getting through to my DB, the session
> > > scoped
> > > > bean with Paul's blocking method worked. The drawback with this
> > > > approach, we may start thinking on cleaning session off of the
> > > unused
> > > > objects, otherwise our app may consume too much cache on the server.
> > > >
> > > > vlad
> > > That's why I don't utilize the JSF backing bean facility. It's not
> > > flexibly enough to maintain high dynamically applications.
> > > I've implement own session controller and it's the only backing bean I
> > > have to declare in my faces-config.xml ;) The other part of magic is
> > > application wide controller (started with ServletContextListener) to
> > > maintain some global issues and, first of all the sessions, which I
> > > catch with HTTPSessionListener.
> > >
> > > Just a little hint: you can 'inject' your beans into session without
> > > declaring it in config.
> > >
> > > <managed-bean>
> > >       <managed-bean-name>MyBean</managed-bean-name>
> > >       <managed-bean-class>my.MyClass</managed-bean-class>
> > >       <managed-bean-scope>session</managed-bean-scope>
> > > </managed-bean>
> > >
> > > is equal to:
> > >
> > > FacesContext fCtx    = FacesContext.getCurrentInstance();
> > > ExternalContext eCtx    = _fCtx.getExternalContext();
> > > ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> > > HttpSession session = (HttpSession)_eCtx.getSession(false);
> > > ...
> > > MyClass myInstance = new MyClass();
> > > session.setAttribute("MyBean", myInstance);//put MBean to session
> > >
> > >
> > >
> >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Paul,
may be you know how to deal with this problem. On a date field I'm using
valueChangeListener (I have java.util.Date in the backing bean). This
listener is firing on submit no matter if the value is changed or not. In
UIInput I see:

    public void validate(FacesContext context)
    {
        if (context == null) throw new NullPointerException("context");
        Object submittedValue = getSubmittedValue();
        System.out.println("...validate: submittedValue: "+submittedValue);
        if (submittedValue == null) return;

        Object convertedValue = getConvertedValue(context, submittedValue);

        if (!isValid()) return;

        validateValue(context, convertedValue);

        if (!isValid()) return;

        Object previousValue = getValue();
        System.out.println("...validate: previousValue: "+previousValue+ "
convertedValue: "+convertedValue);
        try{    //-I added this
            Converter converter =
_SharedRendererUtils.findUIOutputConverter(context, this);
            if (converter != null)
            {
                System.out.println("...validate: previousValue converted:
"+converter.getAsString(context,this, previousValue));
            }
        }catch(Exception e){
            e.printStackTrace();
        }
        setValue(convertedValue);
        setSubmittedValue(null);
        if (compareValues(previousValue, convertedValue))
        {
            queueEvent(new ValueChangeEvent(this, previousValue,
convertedValue));
        }
    }

In my log:
...validate: submittedValue:
org.apache.myfaces.custom.date.HtmlInputDate$UserData@14feea
...validate: previousValue: 2007-01-02 00:00:00.0 convertedValue: Tue Jan 02
00:00:00 EST 2007
...validate: previousValue converted: Jan 2, 2007

As you can see, the values are not the same, so here I'm getting the event.
In my page:
                      <t:inputDate value="#{order.orderDate}" type="date"
dateStyle="default" timeZone="EST"
                                          valueChangeListener="#{
customers.orderChanged}" id="orderDate">
                            <!--f:convertDateTime type="date"
dateStyle="default" timeZone="EST"/-->
                      </t:inputDate>

I tried t:inputText with the converter first, and that time the first log
was showing exact same value as the 3rd one.

But I think, that I'm making some basic mistake with the use of date field,
my init value from the DB has no timezone, and may be something else is
missed. See the 'prevoiusValue'.
Even so I get through this issue with the valueChangeEvent, I'm facing the
loading the new value into the DB, and this one has obviously a different
format.

I guess the solution should be in adjusting the date format in the DB
somehow. (I'm using mySql now). When retrieved from DB, my date should read:
Tue Jan 02 00:00:00 EST 2007 - not 2007-01-02 00:00:00.0

Your thoughts???

thanks
vlad

On 7/8/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
>  Daniel, I think your approach is ok. But... why do you need some
> properties-file? You can just extend my class with something like
>
> private boolean _invalidated = true;
>
> public void Invalidate(){
>   this._invalidated = true;
> }
> and then in
>
> private DataPage<T> doFetchPage(int startRow, int pageSize){
>         if ((_lastPage == null) || (_lastStartRow != startRow) ||
> (_lastPageSize != pageSize) || *_invalidated*){
>             _log.debug("**Fetch: required -> fetching...");
>             _lastPage = fetchPage(startRow, pageSize);
>             _lastStartRow = startRow;
>             _lastPageSize = pageSize;
>            _invalidated = false;//don't vorget to set it to FALSE
>         }else{
>             _log.debug("**Fetch: not required (already fetched)!");
>         }
>         return _lastPage;
>     }
>
>
> Just call this Invalidate() method from your bean after making changes,
> and the current page becomes refetched during next access at rendering
> phase. (It's exactly what you are doing now with the property file :)) The
> _invalidated flag 'overrides' any other condition and forces the page to be
> refetched just once.
>
> Unfortunately I have not enough time right now to explain the approach in
> my implementation in detail (because I have to switch to another
> nonJSF-project), but I plan to build small example application next week,
> you have asked for. It would be nice, if someone be able then to correct my
> terrible English and publish it at Wiki...
>
> Just few tips about delete/edit situation:
> - If you delete some record, you have to 'reload' at least the total count
> value (since the stored in instance of paged list value becomes incorrect).
> (The worst case: you land at incorrect page number, if you delete the only
> one item being at the LAST page.)
> - If you edit something, what (due to your sorting order) can affect the
> subset of items being displayed at current page, you have to reload the page
> as well. (This can lead into situation, when your just edited item
> 'disappears' from the current page.)
>
> regards,
> paul
>
> daniel ccss schrieb:
>
> Ok Paul, this is the thing,
>
> Since I´m new in this and in my work they are asking for results from the
> Tomahawk investigation that i'm doing implementing a simple maintain module,
> I think that I can´t impplement all that you have done, at least in this
> moment.
>
> This is what i have done until now, I changed the PagedList class from the
> wiki for yours, that was the only class that Ichanged, the other change was
> to put the bean in session (Vladimir idea) (by the way nice tip, you gave
> for put it in session from code). Until now all works fine.
>
> Then i made my delete, add and edit methods, they simple recived the
> Patient id and call an EJB that calls to the DAOs methods to do that. They
> are called from an actionlistener on the JSP. They all works fine, but I
> don`t saw the changes on the DataTable, in the moment, but when I click on
> the pages numbers I saw the changes.
>
> What I need, is from code, and after call a delte/add/edit method, fetch
> the data(as happen when i click on a page number) from my backing bean, and
> of course always pass for the filter to do the fetch after this methods are
> called, something like:
>
> backing_bean:
> public void delete()
> ...
> EJB.deletePatient(...)
> fetch data
>
> I made a hardcore test ( I need to do it for test my idea :( ) I made a
> properties file, and put a key call forceToFetch = false, and in the dofetch
> method I get this property then in your filter (If) I add this: if(.... ||
> forceToFetch). Inside the if I ask if the forceToFetch is true and put it
> again in false in the properties file.Then in the backing_bean after call
> the add/delete/edit methods I put the value in the properties in true, and
> as I thought it wors fine, I can saw all the changes on the DataTable. Can
> you give a way to do this witout use the properties file?  Can you give me
> an step by step solution since I`m new in this and I still understanding all
> your code.
>
> Other thing I see a problem with this solution when I delete the last row
> of a DataPage (example the last row of the second DataPage) or when I delete
> the last row of the first DataPage, I recived a row index exception. How can
> I fix this issue, can you explain me. If I delete the last row of dataPage 3
> how can I show, from code, the dataPage2 and in the case of the last row of
> the first DataPage how can I delete that last row and show the First
> DataPage without data? Can you also explain me this step by step?
>
> Paul really really sorry for all this, but I think that your are the
> person that more knows of this, you are a Guru on this, and I really need
> help, also thanks to you Vladimir!!
>
>
>
> On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
> >
> > Vladimir Isakovich schrieb:
> > > Yes, I have just one call getting through to my DB, the session scoped
> > > bean with Paul's blocking method worked. The drawback with this
> > > approach, we may start thinking on cleaning session off of the unused
> > > objects, otherwise our app may consume too much cache on the server.
> > >
> > > vlad
> > That's why I don't utilize the JSF backing bean facility. It's not
> > flexibly enough to maintain high dynamically applications.
> > I've implement own session controller and it's the only backing bean I
> > have to declare in my faces-config.xml ;) The other part of magic is
> > application wide controller (started with ServletContextListener) to
> > maintain some global issues and, first of all the sessions, which I
> > catch with HTTPSessionListener.
> >
> > Just a little hint: you can 'inject' your beans into session without
> > declaring it in config.
> >
> > <managed-bean>
> >       <managed-bean-name>MyBean</managed-bean-name>
> >       <managed-bean-class>my.MyClass</managed-bean-class>
> >       <managed-bean-scope>session</managed-bean-scope>
> > </managed-bean>
> >
> > is equal to:
> >
> > FacesContext fCtx    = FacesContext.getCurrentInstance();
> > ExternalContext eCtx    = _fCtx.getExternalContext();
> > ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> > HttpSession session = (HttpSession)_eCtx.getSession(false);
> > ...
> > MyClass myInstance = new MyClass();
> > session.setAttribute("MyBean", myInstance);//put MBean to session
> >
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Ok Paul, this is the thing,

Since I´m new in this and in my work they are asking for results from the
Tomahawk investigation that i'm doing implementing a simple maintain module,
I think that I can´t impplement all that you have done, at least in this
moment.

This is what i have done until now, I changed the PagedList class from the
wiki for yours, that was the only class that Ichanged, the other change was
to put the bean in session (Vladimir idea) (by the way nice tip, you gave
for put it in session from code). Until now all works fine.

Then i made my delete, add and edit methods, they simple recived the Patient
id and call an EJB that calls to the DAOs methods to do that. They are
called from an actionlistener on the JSP. They all works fine, but I don`t
saw the changes on the DataTable, in the moment, but when I click on the
pages numbers I saw the changes.

What I need, is from code, and after call a delte/add/edit method, fetch the
data(as happen when i click on a page number) from my backing bean, and of
course always pass for the filter to do the fetch after this methods are
called, something like:

backing_bean:
public void delete()
...
EJB.deletePatient(...)
fetch data

I made a hardcore test ( I need to do it for test my idea :( ) I made a
properties file, and put a key call forceToFetch = false, and in the dofetch
method I get this property then in your filter (If) I add this: if(.... ||
forceToFetch). Inside the if I ask if the forceToFetch is true and put it
again in false in the properties file.Then in the backing_bean after call
the add/delete/edit methods I put the value in the properties in true, and
as I thought it wors fine, I can saw all the changes on the DataTable. Can
you give a way to do this witout use the properties file?  Can you give me
an step by step solution since I`m new in this and I still understanding all
your code.

Other thing I see a problem with this solution when I delete the last row of
a DataPage (example the last row of the second DataPage) or when I delete
the last row of the first DataPage, I recived a row index exception. How can
I fix this issue, can you explain me. If I delete the last row of dataPage 3
how can I show, from code, the dataPage2 and in the case of the last row of
the first DataPage how can I delete that last row and show the First
DataPage without data? Can you also explain me this step by step?

Paul really really sorry for all this, but I think that your are the person
that more knows of this, you are a Guru on this, and I really need help,
also thanks to you Vladimir!!



On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Vladimir Isakovich schrieb:
> > Yes, I have just one call getting through to my DB, the session scoped
> > bean with Paul's blocking method worked. The drawback with this
> > approach, we may start thinking on cleaning session off of the unused
> > objects, otherwise our app may consume too much cache on the server.
> >
> > vlad
> That's why I don't utilize the JSF backing bean facility. It's not
> flexibly enough to maintain high dynamically applications.
> I've implement own session controller and it's the only backing bean I
> have to declare in my faces-config.xml ;) The other part of magic is
> application wide controller (started with ServletContextListener) to
> maintain some global issues and, first of all the sessions, which I
> catch with HTTPSessionListener.
>
> Just a little hint: you can 'inject' your beans into session without
> declaring it in config.
>
> <managed-bean>
>       <managed-bean-name>MyBean</managed-bean-name>
>       <managed-bean-class>my.MyClass</managed-bean-class>
>       <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
>
> is equal to:
>
> FacesContext fCtx    = FacesContext.getCurrentInstance();
> ExternalContext eCtx    = _fCtx.getExternalContext();
> ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
> HttpSession session = (HttpSession)_eCtx.getSession(false);
> ...
> MyClass myInstance = new MyClass();
> session.setAttribute("MyBean", myInstance);//put MBean to session
>
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Vladimir Isakovich schrieb:
> Yes, I have just one call getting through to my DB, the session scoped 
> bean with Paul's blocking method worked. The drawback with this 
> approach, we may start thinking on cleaning session off of the unused 
> objects, otherwise our app may consume too much cache on the server.
>  
> vlad
That's why I don't utilize the JSF backing bean facility. It's not 
flexibly enough to maintain high dynamically applications.
I've implement own session controller and it's the only backing bean I 
have to declare in my faces-config.xml ;) The other part of magic is 
application wide controller (started with ServletContextListener) to 
maintain some global issues and, first of all the sessions, which I 
catch with HTTPSessionListener.

Just a little hint: you can 'inject' your beans into session without 
declaring it in config.

<managed-bean>
      <managed-bean-name>MyBean</managed-bean-name>
      <managed-bean-class>my.MyClass</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

is equal to:

FacesContext fCtx    = FacesContext.getCurrentInstance();
ExternalContext eCtx    = _fCtx.getExternalContext();
ServletContext srvCtx  = (ServletContext)_eCtx.getContext();
HttpSession session = (HttpSession)_eCtx.getSession(false);
...
MyClass myInstance = new MyClass();
session.setAttribute("MyBean", myInstance);//put MBean to session



Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Yes, I have just one call getting through to my DB, the session scoped bean
with Paul's blocking method worked. The drawback with this approach, we may
start thinking on cleaning session off of the unused objects, otherwise our
app may consume too much cache on the server.

vlad


On 7/6/07, daniel ccss <da...@gmail.com> wrote:
>
> Now I see your long answer, i´m going to read it, Vladimir you still have
> two calls to the DB, but you was the one who give me the tip of put the
> backing_bean on sesion to avoid that. I only have one call now.
>
>
>
> On 7/6/07, vlad10 <iv...@yahoo.com> wrote:
> >
> >
> > Paul,
> > I hope you did not miss my email from late yesterday with 6 items.
> > I just discovered something in addition to this discussion. I have a
> > page
> > with a dataTable but no scroller, and I've noticed, that my method for
> > accessing DB was called twice right on start. That means the bug with
> > dup
> > calls is hidden in dataTable rather than dataScroller.
> >
> > vlad
> >
> >
> > Paul Iov wrote:
> > >
> > > Hi Daniel,
> > >
> > > have you read my long post about how the data are handled in internal
> > > storage? Do you have the same approach and what do you mean exactly
> > with
> > > "delete"? If you just delete the record from DB (i.e. via JDBC/SQL),
> > you
> > > have to set also _invalidated flag in my class, to force the internal
> > > storage to be reloaded. (It's not especially efficient but it should
> > > work.) If you have implemented your own delete(_whatever_) method in
> > > this class, this method have to delete the ID from internal storage
> > and
> > > then ensure, that the page will be refetched next time (i.e. with some
> > > extra boolean flag; in my code I just store the last ID-list generated
> > > during fetching of page and if it becomes changed [something was
> > > deleted/sorted in internal storage], I force the page to be
> > refetched).
> > > This should be the better way, since after delete/edit of an item only
> > > the current page of data will be refetched - not the whole dataset AND
> >
> > > the current page. ...and first after this comes the issue with
> > > dropScroller :). Probably, you don't need then this method at all.
> > >
> > >
> > > daniel ccss schrieb:
> > >> Hi Paul, I put your code in my backing_bean and call the method
> > >> dropScroller(String dataTableId) after the delete method was called,
> > I
> > >> send to this method the id of the data table:
> > >>
> > >>                 <t:dataTable id="data" styleClass="scrollerTable" ...
> >
> > >>
> > >>
> > >> But the dataTable doesn´t update, in my console I recived the
> > message:
> > >> " dropScroller called" but nothing happen. What else do I should do,
> > >> or what I'm doing bad.
> > >>
> > >> Also:
> > >> I guess Daniel, you are using event listener in your backing bean to
> > >> edit data directly in PagedList? It's the only way to have actual
> > copy
> > >> displayed without to reload this page.
> > >>
> > >> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB
> > each
> > >> time the PageData change. When I didn´t have your improved class
> > >> PagedList, it works fine, since the fetch was doing many times for
> > >> each action and the data update in the DataTable. For that I was
> > >> thinking in some way put another condition on your filter for the
> > >> fetch where after I called the add/delete/edit method put that
> > >> variable in true and enter to the if to do the fetch, because I see
> > >> that when I click in the page number (a fetch is doing) the data
> > >> update in the DataTable. I hope your solution works for me It looks
> > >> pretty nice.
> > >>
> > >> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com
> > >> <mailto: ivlad10@gmail.com >> wrote:
> > >>
> > >>     Paul,
> > >>     many thanks for your answers.
> > >>
> > >>     1. Interestigly enough, after the warning the border is  still
> > >>     applied. If I try to do the same with style=..., there is no
> > effect.
> > >>     this has nothing to do with the data fetching.
> > >>     2. I have a guess about two calls to fetchPage() in the
> > DataModel.
> > >>     May be it's because we have 2 UIComponents called DataScroller
> > >>     (one with buttons and another with the message). Shuld it be
> > >>     posted as a bug on dataScroller? I've seen the defects page on
> > >>     myFaces, but not familiar with the procedure of addin to that
> > list.
> > >>     3. I've got it why you have your pageSize being analized and used
> > >>     in getDataModel(), your page explains it. I'll try to implement
> > >>     the same with an additional inputText.
> > >>     4. I also noticed on your page - the dataScroller has just 2
> > >>     buttons plus numbers in between. This way your strategy of
> > >>     fetching data chunks should work. I am using the "standard"
> > >>     scroller which has in addition fast forward/backward and
> > >>     first/last buttons, and in this case I think I'm better of
> > calling
> > >>     DB every time (I've no way of predicting what page will be
> > >>     requested next).
> > >>     5. Probably next thing I'll try to implement: edit/delete/add,
> > and
> > >>     after that I'm planning to implement Ajax datascroller. It's not
> > a
> > >>     good user experiense, when the whole page gets re-rendered on
> > >>     every action.
> > >>     6. Although I've experience with javaScript, at least when I
> > >>     compare myself with the java developers I've worked with, but
> > I've
> > >>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
> > >>     Ajax', but it was a diappointment after loading and gettin
> > running
> > >>     their example to find out that it's based on some proprietary
> > >>     jars. Since you're using this ajax dataScroller, could you please
> >
> > >>     enlight me on any existing standard for ajax (are there some
> > >>     'standard' jars I can use as a base of my app)?
> > >>
> > >>     thanks, vlad
> > >>
> > >>
> > >>     On 7/5/07, *Paul Iov* < paul@voller-ernst.de
> > >>     <mailto: paul@voller-ernst.de>> wrote:
> > >>
> > >>         Well... just a bit refining
> > >>         Vladimir Isakovich schrieb:
> > >>>
> > >>>         Jul 5, 2007 1:12:09 PM
> > com.sun.facelets.tag.jsf.ComponentRule
> > >>>         warnAttr
> > >>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
> > >>>         border="1" Property 'border' is not on type:
> > >>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
> > >>>
> > >>>         2. I also can see a warning...
> > >>>
> > >>         It's correct. The old good border="0" for image is deprecated
> > >>         with HTML4. We should use CSS instead.
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11470790
> >
> > Sent from the MyFaces - Users mailing list archive at Nabble.com<http://nabble.com/>
> > .
> >
> >
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Paul,
I was wrong about applying style=.. to dataScroller buttons. Your style
works.
With Ajax... I will try to implement some functionality on me prototype
pages, may be next week.

thanks
vlad


On 7/6/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> vlad10 schrieb:
> > Paul,
> > I hope you did not miss my email from late yesterday with 6 items.
> > I just discovered something in addition to this discussion. I have a
> page
> > with a dataTable but no scroller, and I've noticed, that my method for
> > accessing DB was called twice right on start. That means the bug with
> dup
> > calls is hidden in dataTable rather than dataScroller.
> >
> > vlad
> >
> >
> Hi Vladimir...
> I was just writing the answer, so I'm replying now to this message:
> ---
>
> It was a really big challenge to implement this approach right and I'm
> glad that my experience can help someone else - I've thinking to be one,
> who are using JSF for something more then simple "Hello world"-play
> around ;) Regarding your questions:
>
> 1+2+4
> here's my JSP again:
> <ac:ajaxDataScroller
>            rendered="#{Recherche.data.rowCount gt 0}"
>            id="scroller"
>            for="tblData"
>            fastStep="10"
>            renderCurrentAsText="false"
>            maxPages="9"
> />
>
>            <f:facet  name="first">
>                <h:graphicImage
> value="constellations/images/dreieck_links.gif" *style="border:none"
> *alt="first"/>
>            </f:facet>
>            <f:facet name="last">
>                <h:graphicImage
> value="constellations/images/dreieck_rechts.gif" style="border:none"
> alt="last"/>
>            </f:facet>
>            <f:facet  name="next">
>                next
>            </f:facet>
>            <f:facet  name="previous">
>                prev
>            </f:facet>
> </ac:ajaxDataScroller>
> My red arrows ARE first/last. If you wish to set the border, it should
> be something like style="border: #FFAA00 1px solid;"
> I've also added next/prev as text in the same scroller and then one more
> scroller with buttons only for the same DataTable... and all still works
> as expected.
> It should be no difference, because the only things the scroller perform
> with DataModel is to call ((UIData) component).*setFirst*() on
> navigation to new page and to obtain *getRowIndex*()/*getRowCount*().
> The rest is in responsibility of DataModel implementing class itself.
>
> The multiple calls to fetchPage() are harmless since the doFetchPage()
> handles the caching correct. I'm not more familiar wit t:DataScroller
> source code (it was few months ago), but I suspect the most of them are
> caused by DataTable, not by DataScroller. I'm also not sure if reporting
> this bug(?) makes any sense. The best bet would be IMO to redesign this
> component 'from scratch'.
>
> Regarding AJAX. There are few good and stable enough implementations.
> Sure, you can program all manually with JS/DOM, but if you choose to use
> some framework, you don't have to deal with XMLHttpRequest directly. It
> may be a bit oversized for one or to pages with few AJAX-like gimmicks
> but is very useful for big project. I'm using AJAX4JSF (aka A4J, by
> Exadel, now moved to JBoss) and some native JS libraries like
> Scriptaculous. (Early denoted ac:AjaxDataScroller is based on A4J
> commandLink too, so you need this library to get it work.) Some of
> Incubator/Tomahawk components as well Tobago (formerly Oracle's
> ADF-Fases) as well utilize AJAX in diverse way.
>
> regards,
> paul
>
> Vladimir Isakovich schrieb:
> > Paul,
> > many thanks for your answers.
> >
> > 1. Interestigly enough, after the warning the border is  still
> > applied. If I try to do the same with style=..., there is no effect.
> > this has nothing to do with the data fetching.
> > 2. I have a guess about two calls to fetchPage() in the DataModel. May
> > be it's because we have 2 UIComponents called DataScroller (one with
> > buttons and another with the message). Shuld it be posted as a bug on
> > dataScroller? I've seen the defects page on myFaces, but not familiar
> > with the procedure of addin to that list.
> > 3. I've got it why you have your pageSize being analized and used in
> > getDataModel(), your page explains it. I'll try to implement the same
> > with an additional inputText.
> > 4. I also noticed on your page - the dataScroller has just 2 buttons
> > plus numbers in between. This way your strategy of fetching data
> > chunks should work. I am using the "standard" scroller which has in
> > addition fast forward/backward and first/last buttons, and in this
> > case I think I'm better of calling DB every time (I've no way of
> > predicting what page will be requested next).
> > 5. Probably next thing I'll try to implement: edit/delete/add, and
> > after that I'm planning to implement Ajax datascroller. It's not a
> > good user experiense, when the whole page gets re-rendered on every
> > action.
> > 6. Although I've experience with javaScript, at least when I compare
> > myself with the java developers I've worked with, but I've never tried
> > using XmlHttpRequest. I have this book: 'Pro JSF and Ajax', but it was
> > a diappointment after loading and gettin running their example to find
> > out that it's based on some proprietary jars. Since you're using this
> > ajax dataScroller, could you please enlight me on any existing
> > standard for ajax (are there some 'standard' jars I can use as a base
> > of my app)?
> >
> > thanks, vlad
> >
> >
> > On 7/5/07, *Paul Iov* <paul@voller-ernst.de
> > <ma...@voller-ernst.de>> wrote:
> >
> >     Well... just a bit refining
> >     Vladimir Isakovich schrieb:
> >>
> >>     Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
> >>     warnAttr
> >>     WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
> >>     border="1" Property 'border' is not on type:
> >>     org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
> >>
> >>     2. I also can see a warning...
> >>
> >     It's correct. The old good border="0" for image is deprecated with
> >     HTML4. We should use CSS instead.
> >
> >
> >
>
>
> > Paul Iov wrote:
> >
> >> Hi Daniel,
> >>
> >> have you read my long post about how the data are handled in internal
> >> storage? Do you have the same approach and what do you mean exactly
> with
> >> "delete"? If you just delete the record from DB (i.e. via JDBC/SQL),
> you
> >> have to set also _invalidated flag in my class, to force the internal
> >> storage to be reloaded. (It's not especially efficient but it should
> >> work.) If you have implemented your own delete(_whatever_) method in
> >> this class, this method have to delete the ID from internal storage and
> >> then ensure, that the page will be refetched next time (i.e. with some
> >> extra boolean flag; in my code I just store the last ID-list generated
> >> during fetching of page and if it becomes changed [something was
> >> deleted/sorted in internal storage], I force the page to be refetched).
> >> This should be the better way, since after delete/edit of an item only
> >> the current page of data will be refetched - not the whole dataset AND
> >> the current page. ...and first after this comes the issue with
> >> dropScroller :). Probably, you don't need then this method at all.
> >>
> >>
> >> daniel ccss schrieb:
> >>
> >>> Hi Paul, I put your code in my backing_bean and call the method
> >>> dropScroller(String dataTableId) after the delete method was called, I
> >>> send to this method the id of the data table:
> >>>
> >>>                 <t:dataTable id="data" styleClass="scrollerTable" ...
> >>>
> >>>
> >>> But the dataTable doesn´t update, in my console I recived the message:
> >>> " dropScroller called" but nothing happen. What else do I should do,
> >>> or what I'm doing bad.
> >>>
> >>> Also:
> >>> I guess Daniel, you are using event listener in your backing bean to
> >>> edit data directly in PagedList? It's the only way to have actual copy
> >>> displayed without to reload this page.
> >>>
> >>> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each
> >>> time the PageData change. When I didn´t have your improved class
> >>> PagedList, it works fine, since the fetch was doing many times for
> >>> each action and the data update in the DataTable. For that I was
> >>> thinking in some way put another condition on your filter for the
> >>> fetch where after I called the add/delete/edit method put that
> >>> variable in true and enter to the if to do the fetch, because I see
> >>> that when I click in the page number (a fetch is doing) the data
> >>> update in the DataTable. I hope your solution works for me It looks
> >>> pretty nice.
> >>>
> >>> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com
> >>> <ma...@gmail.com>> wrote:
> >>>
> >>>     Paul,
> >>>     many thanks for your answers.
> >>>
> >>>     1. Interestigly enough, after the warning the border is  still
> >>>     applied. If I try to do the same with style=..., there is no
> effect.
> >>>     this has nothing to do with the data fetching.
> >>>     2. I have a guess about two calls to fetchPage() in the DataModel.
> >>>     May be it's because we have 2 UIComponents called DataScroller
> >>>     (one with buttons and another with the message). Shuld it be
> >>>     posted as a bug on dataScroller? I've seen the defects page on
> >>>     myFaces, but not familiar with the procedure of addin to that
> list.
> >>>     3. I've got it why you have your pageSize being analized and used
> >>>     in getDataModel(), your page explains it. I'll try to implement
> >>>     the same with an additional inputText.
> >>>     4. I also noticed on your page - the dataScroller has just 2
> >>>     buttons plus numbers in between. This way your strategy of
> >>>     fetching data chunks should work. I am using the "standard"
> >>>     scroller which has in addition fast forward/backward and
> >>>     first/last buttons, and in this case I think I'm better of calling
> >>>     DB every time (I've no way of predicting what page will be
> >>>     requested next).
> >>>     5. Probably next thing I'll try to implement: edit/delete/add, and
> >>>     after that I'm planning to implement Ajax datascroller. It's not a
> >>>     good user experiense, when the whole page gets re-rendered on
> >>>     every action.
> >>>     6. Although I've experience with javaScript, at least when I
> >>>     compare myself with the java developers I've worked with, but I've
> >>>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
> >>>     Ajax', but it was a diappointment after loading and gettin running
> >>>     their example to find out that it's based on some proprietary
> >>>     jars. Since you're using this ajax dataScroller, could you please
> >>>     enlight me on any existing standard for ajax (are there some
> >>>     'standard' jars I can use as a base of my app)?
> >>>
> >>>     thanks, vlad
> >>>
> >>>
> >>>     On 7/5/07, *Paul Iov* <paul@voller-ernst.de
> >>>     <ma...@voller-ernst.de>> wrote:
> >>>
> >>>         Well... just a bit refining
> >>>         Vladimir Isakovich schrieb:
> >>>
> >>>>         Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
> >>>>         warnAttr
> >>>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
> >>>>         border="1" Property 'border' is not on type:
> >>>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
> >>>>
> >>>>         2. I also can see a warning...
> >>>>
> >>>>
> >>>         It's correct. The old good border="0" for image is deprecated
> >>>         with HTML4. We should use CSS instead.
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Now I see your long answer, i´m going to read it, Vladimir you still have
two calls to the DB, but you was the one who give me the tip of put the
backing_bean on sesion to avoid that. I only have one call now.



On 7/6/07, vlad10 <iv...@yahoo.com> wrote:
>
>
> Paul,
> I hope you did not miss my email from late yesterday with 6 items.
> I just discovered something in addition to this discussion. I have a page
> with a dataTable but no scroller, and I've noticed, that my method for
> accessing DB was called twice right on start. That means the bug with dup
> calls is hidden in dataTable rather than dataScroller.
>
> vlad
>
>
> Paul Iov wrote:
> >
> > Hi Daniel,
> >
> > have you read my long post about how the data are handled in internal
> > storage? Do you have the same approach and what do you mean exactly with
> > "delete"? If you just delete the record from DB (i.e. via JDBC/SQL), you
> > have to set also _invalidated flag in my class, to force the internal
> > storage to be reloaded. (It's not especially efficient but it should
> > work.) If you have implemented your own delete(_whatever_) method in
> > this class, this method have to delete the ID from internal storage and
> > then ensure, that the page will be refetched next time (i.e. with some
> > extra boolean flag; in my code I just store the last ID-list generated
> > during fetching of page and if it becomes changed [something was
> > deleted/sorted in internal storage], I force the page to be refetched).
> > This should be the better way, since after delete/edit of an item only
> > the current page of data will be refetched - not the whole dataset AND
> > the current page. ...and first after this comes the issue with
> > dropScroller :). Probably, you don't need then this method at all.
> >
> >
> > daniel ccss schrieb:
> >> Hi Paul, I put your code in my backing_bean and call the method
> >> dropScroller(String dataTableId) after the delete method was called, I
> >> send to this method the id of the data table:
> >>
> >>                 <t:dataTable id="data" styleClass="scrollerTable" ...
> >>
> >>
> >> But the dataTable doesn´t update, in my console I recived the message:
> >> " dropScroller called" but nothing happen. What else do I should do,
> >> or what I'm doing bad.
> >>
> >> Also:
> >> I guess Daniel, you are using event listener in your backing bean to
> >> edit data directly in PagedList? It's the only way to have actual copy
> >> displayed without to reload this page.
> >>
> >> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each
> >> time the PageData change. When I didn´t have your improved class
> >> PagedList, it works fine, since the fetch was doing many times for
> >> each action and the data update in the DataTable. For that I was
> >> thinking in some way put another condition on your filter for the
> >> fetch where after I called the add/delete/edit method put that
> >> variable in true and enter to the if to do the fetch, because I see
> >> that when I click in the page number (a fetch is doing) the data
> >> update in the DataTable. I hope your solution works for me It looks
> >> pretty nice.
> >>
> >> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com
> >> <mailto:ivlad10@gmail.com >> wrote:
> >>
> >>     Paul,
> >>     many thanks for your answers.
> >>
> >>     1. Interestigly enough, after the warning the border is  still
> >>     applied. If I try to do the same with style=..., there is no
> effect.
> >>     this has nothing to do with the data fetching.
> >>     2. I have a guess about two calls to fetchPage() in the DataModel.
> >>     May be it's because we have 2 UIComponents called DataScroller
> >>     (one with buttons and another with the message). Shuld it be
> >>     posted as a bug on dataScroller? I've seen the defects page on
> >>     myFaces, but not familiar with the procedure of addin to that list.
>
> >>     3. I've got it why you have your pageSize being analized and used
> >>     in getDataModel(), your page explains it. I'll try to implement
> >>     the same with an additional inputText.
> >>     4. I also noticed on your page - the dataScroller has just 2
> >>     buttons plus numbers in between. This way your strategy of
> >>     fetching data chunks should work. I am using the "standard"
> >>     scroller which has in addition fast forward/backward and
> >>     first/last buttons, and in this case I think I'm better of calling
> >>     DB every time (I've no way of predicting what page will be
> >>     requested next).
> >>     5. Probably next thing I'll try to implement: edit/delete/add, and
> >>     after that I'm planning to implement Ajax datascroller. It's not a
> >>     good user experiense, when the whole page gets re-rendered on
> >>     every action.
> >>     6. Although I've experience with javaScript, at least when I
> >>     compare myself with the java developers I've worked with, but I've
> >>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
> >>     Ajax', but it was a diappointment after loading and gettin running
> >>     their example to find out that it's based on some proprietary
> >>     jars. Since you're using this ajax dataScroller, could you please
> >>     enlight me on any existing standard for ajax (are there some
> >>     'standard' jars I can use as a base of my app)?
> >>
> >>     thanks, vlad
> >>
> >>
> >>     On 7/5/07, *Paul Iov* < paul@voller-ernst.de
> >>     <ma...@voller-ernst.de>> wrote:
> >>
> >>         Well... just a bit refining
> >>         Vladimir Isakovich schrieb:
> >>>
> >>>         Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
> >>>         warnAttr
> >>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
> >>>         border="1" Property 'border' is not on type:
> >>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
> >>>
> >>>         2. I also can see a warning...
> >>>
> >>         It's correct. The old good border="0" for image is deprecated
> >>         with HTML4. We should use CSS instead.
> >>
> >>
> >>
> >>
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11470790
>
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
vlad10 schrieb:
> Paul, 
> I hope you did not miss my email from late yesterday with 6 items.
> I just discovered something in addition to this discussion. I have a page
> with a dataTable but no scroller, and I've noticed, that my method for
> accessing DB was called twice right on start. That means the bug with dup
> calls is hidden in dataTable rather than dataScroller.
>
> vlad
>
>   
Hi Vladimir...
I was just writing the answer, so I'm replying now to this message:
---

It was a really big challenge to implement this approach right and I'm 
glad that my experience can help someone else - I've thinking to be one, 
who are using JSF for something more then simple "Hello world"-play 
around ;) Regarding your questions:

1+2+4
here's my JSP again:
<ac:ajaxDataScroller
            rendered="#{Recherche.data.rowCount gt 0}"
            id="scroller"
            for="tblData"
            fastStep="10"
            renderCurrentAsText="false"
            maxPages="9"
/>
           
            <f:facet  name="first">
                <h:graphicImage 
value="constellations/images/dreieck_links.gif" *style="border:none" 
*alt="first"/>
            </f:facet>
            <f:facet name="last">
                <h:graphicImage 
value="constellations/images/dreieck_rechts.gif" style="border:none" 
alt="last"/>
            </f:facet>
            <f:facet  name="next">
                next
            </f:facet>
            <f:facet  name="previous">
                prev
            </f:facet>
 </ac:ajaxDataScroller>
My red arrows ARE first/last. If you wish to set the border, it should 
be something like style="border: #FFAA00 1px solid;"
I've also added next/prev as text in the same scroller and then one more 
scroller with buttons only for the same DataTable... and all still works 
as expected.
It should be no difference, because the only things the scroller perform 
with DataModel is to call ((UIData) component).*setFirst*() on 
navigation to new page and to obtain *getRowIndex*()/*getRowCount*(). 
The rest is in responsibility of DataModel implementing class itself.

The multiple calls to fetchPage() are harmless since the doFetchPage() 
handles the caching correct. I'm not more familiar wit t:DataScroller 
source code (it was few months ago), but I suspect the most of them are 
caused by DataTable, not by DataScroller. I'm also not sure if reporting 
this bug(?) makes any sense. The best bet would be IMO to redesign this 
component 'from scratch'.

Regarding AJAX. There are few good and stable enough implementations. 
Sure, you can program all manually with JS/DOM, but if you choose to use 
some framework, you don't have to deal with XMLHttpRequest directly. It 
may be a bit oversized for one or to pages with few AJAX-like gimmicks 
but is very useful for big project. I'm using AJAX4JSF (aka A4J, by 
Exadel, now moved to JBoss) and some native JS libraries like 
Scriptaculous. (Early denoted ac:AjaxDataScroller is based on A4J 
commandLink too, so you need this library to get it work.) Some of 
Incubator/Tomahawk components as well Tobago (formerly Oracle's 
ADF-Fases) as well utilize AJAX in diverse way.

regards,
paul

Vladimir Isakovich schrieb:
> Paul,
> many thanks for your answers.
>  
> 1. Interestigly enough, after the warning the border is  still 
> applied. If I try to do the same with style=..., there is no effect.
> this has nothing to do with the data fetching.
> 2. I have a guess about two calls to fetchPage() in the DataModel. May 
> be it's because we have 2 UIComponents called DataScroller (one with 
> buttons and another with the message). Shuld it be posted as a bug on 
> dataScroller? I've seen the defects page on myFaces, but not familiar 
> with the procedure of addin to that list.
> 3. I've got it why you have your pageSize being analized and used in 
> getDataModel(), your page explains it. I'll try to implement the same 
> with an additional inputText.
> 4. I also noticed on your page - the dataScroller has just 2 buttons 
> plus numbers in between. This way your strategy of fetching data 
> chunks should work. I am using the "standard" scroller which has in 
> addition fast forward/backward and first/last buttons, and in this 
> case I think I'm better of calling DB every time (I've no way of 
> predicting what page will be requested next).
> 5. Probably next thing I'll try to implement: edit/delete/add, and 
> after that I'm planning to implement Ajax datascroller. It's not a 
> good user experiense, when the whole page gets re-rendered on every 
> action.
> 6. Although I've experience with javaScript, at least when I compare 
> myself with the java developers I've worked with, but I've never tried 
> using XmlHttpRequest. I have this book: 'Pro JSF and Ajax', but it was 
> a diappointment after loading and gettin running their example to find 
> out that it's based on some proprietary jars. Since you're using this 
> ajax dataScroller, could you please enlight me on any existing 
> standard for ajax (are there some 'standard' jars I can use as a base 
> of my app)?
>  
> thanks, vlad
>
>  
> On 7/5/07, *Paul Iov* <paul@voller-ernst.de 
> <ma...@voller-ernst.de>> wrote:
>
>     Well... just a bit refining
>     Vladimir Isakovich schrieb:
>>
>>     Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
>>     warnAttr
>>     WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
>>     border="1" Property 'border' is not on type:
>>     org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
>>
>>     2. I also can see a warning...
>>
>     It's correct. The old good border="0" for image is deprecated with
>     HTML4. We should use CSS instead.
>      
>
>


> Paul Iov wrote:
>   
>> Hi Daniel,
>>
>> have you read my long post about how the data are handled in internal 
>> storage? Do you have the same approach and what do you mean exactly with 
>> "delete"? If you just delete the record from DB (i.e. via JDBC/SQL), you 
>> have to set also _invalidated flag in my class, to force the internal 
>> storage to be reloaded. (It's not especially efficient but it should 
>> work.) If you have implemented your own delete(_whatever_) method in 
>> this class, this method have to delete the ID from internal storage and 
>> then ensure, that the page will be refetched next time (i.e. with some 
>> extra boolean flag; in my code I just store the last ID-list generated 
>> during fetching of page and if it becomes changed [something was 
>> deleted/sorted in internal storage], I force the page to be refetched). 
>> This should be the better way, since after delete/edit of an item only 
>> the current page of data will be refetched - not the whole dataset AND 
>> the current page. ...and first after this comes the issue with 
>> dropScroller :). Probably, you don't need then this method at all.
>>
>>
>> daniel ccss schrieb:
>>     
>>> Hi Paul, I put your code in my backing_bean and call the method 
>>> dropScroller(String dataTableId) after the delete method was called, I 
>>> send to this method the id of the data table:
>>>
>>>                 <t:dataTable id="data" styleClass="scrollerTable" ...
>>>
>>>
>>> But the dataTable doesn´t update, in my console I recived the message: 
>>> " dropScroller called" but nothing happen. What else do I should do, 
>>> or what I'm doing bad.
>>>
>>> Also:
>>> I guess Daniel, you are using event listener in your backing bean to 
>>> edit data directly in PagedList? It's the only way to have actual copy 
>>> displayed without to reload this page.
>>>
>>> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each 
>>> time the PageData change. When I didn´t have your improved class 
>>> PagedList, it works fine, since the fetch was doing many times for 
>>> each action and the data update in the DataTable. For that I was 
>>> thinking in some way put another condition on your filter for the 
>>> fetch where after I called the add/delete/edit method put that 
>>> variable in true and enter to the if to do the fetch, because I see 
>>> that when I click in the page number (a fetch is doing) the data 
>>> update in the DataTable. I hope your solution works for me It looks 
>>> pretty nice.
>>>
>>> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com 
>>> <ma...@gmail.com>> wrote:
>>>
>>>     Paul,
>>>     many thanks for your answers.
>>>      
>>>     1. Interestigly enough, after the warning the border is  still
>>>     applied. If I try to do the same with style=..., there is no effect.
>>>     this has nothing to do with the data fetching.
>>>     2. I have a guess about two calls to fetchPage() in the DataModel.
>>>     May be it's because we have 2 UIComponents called DataScroller
>>>     (one with buttons and another with the message). Shuld it be
>>>     posted as a bug on dataScroller? I've seen the defects page on
>>>     myFaces, but not familiar with the procedure of addin to that list.
>>>     3. I've got it why you have your pageSize being analized and used
>>>     in getDataModel(), your page explains it. I'll try to implement
>>>     the same with an additional inputText.
>>>     4. I also noticed on your page - the dataScroller has just 2
>>>     buttons plus numbers in between. This way your strategy of
>>>     fetching data chunks should work. I am using the "standard"
>>>     scroller which has in addition fast forward/backward and
>>>     first/last buttons, and in this case I think I'm better of calling
>>>     DB every time (I've no way of predicting what page will be
>>>     requested next).
>>>     5. Probably next thing I'll try to implement: edit/delete/add, and
>>>     after that I'm planning to implement Ajax datascroller. It's not a
>>>     good user experiense, when the whole page gets re-rendered on
>>>     every action.
>>>     6. Although I've experience with javaScript, at least when I
>>>     compare myself with the java developers I've worked with, but I've
>>>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
>>>     Ajax', but it was a diappointment after loading and gettin running
>>>     their example to find out that it's based on some proprietary
>>>     jars. Since you're using this ajax dataScroller, could you please
>>>     enlight me on any existing standard for ajax (are there some
>>>     'standard' jars I can use as a base of my app)?
>>>      
>>>     thanks, vlad
>>>
>>>      
>>>     On 7/5/07, *Paul Iov* <paul@voller-ernst.de
>>>     <ma...@voller-ernst.de>> wrote:
>>>
>>>         Well... just a bit refining
>>>         Vladimir Isakovich schrieb:
>>>       
>>>>         Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
>>>>         warnAttr
>>>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
>>>>         border="1" Property 'border' is not on type:
>>>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
>>>>
>>>>         2. I also can see a warning...
>>>>
>>>>         
>>>         It's correct. The old good border="0" for image is deprecated
>>>         with HTML4. We should use CSS instead.
>>>          
>>>
>>>
>>>
>>>       
>>
>>     
>
>   


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by vlad10 <iv...@yahoo.com>.
Paul, 
I hope you did not miss my email from late yesterday with 6 items.
I just discovered something in addition to this discussion. I have a page
with a dataTable but no scroller, and I've noticed, that my method for
accessing DB was called twice right on start. That means the bug with dup
calls is hidden in dataTable rather than dataScroller.

vlad


Paul Iov wrote:
> 
> Hi Daniel,
> 
> have you read my long post about how the data are handled in internal 
> storage? Do you have the same approach and what do you mean exactly with 
> "delete"? If you just delete the record from DB (i.e. via JDBC/SQL), you 
> have to set also _invalidated flag in my class, to force the internal 
> storage to be reloaded. (It's not especially efficient but it should 
> work.) If you have implemented your own delete(_whatever_) method in 
> this class, this method have to delete the ID from internal storage and 
> then ensure, that the page will be refetched next time (i.e. with some 
> extra boolean flag; in my code I just store the last ID-list generated 
> during fetching of page and if it becomes changed [something was 
> deleted/sorted in internal storage], I force the page to be refetched). 
> This should be the better way, since after delete/edit of an item only 
> the current page of data will be refetched - not the whole dataset AND 
> the current page. ...and first after this comes the issue with 
> dropScroller :). Probably, you don't need then this method at all.
> 
> 
> daniel ccss schrieb:
>> Hi Paul, I put your code in my backing_bean and call the method 
>> dropScroller(String dataTableId) after the delete method was called, I 
>> send to this method the id of the data table:
>>
>>                 <t:dataTable id="data" styleClass="scrollerTable" ...
>>
>>
>> But the dataTable doesn´t update, in my console I recived the message: 
>> " dropScroller called" but nothing happen. What else do I should do, 
>> or what I'm doing bad.
>>
>> Also:
>> I guess Daniel, you are using event listener in your backing bean to 
>> edit data directly in PagedList? It's the only way to have actual copy 
>> displayed without to reload this page.
>>
>> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each 
>> time the PageData change. When I didn´t have your improved class 
>> PagedList, it works fine, since the fetch was doing many times for 
>> each action and the data update in the DataTable. For that I was 
>> thinking in some way put another condition on your filter for the 
>> fetch where after I called the add/delete/edit method put that 
>> variable in true and enter to the if to do the fetch, because I see 
>> that when I click in the page number (a fetch is doing) the data 
>> update in the DataTable. I hope your solution works for me It looks 
>> pretty nice.
>>
>> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com 
>> <ma...@gmail.com>> wrote:
>>
>>     Paul,
>>     many thanks for your answers.
>>      
>>     1. Interestigly enough, after the warning the border is  still
>>     applied. If I try to do the same with style=..., there is no effect.
>>     this has nothing to do with the data fetching.
>>     2. I have a guess about two calls to fetchPage() in the DataModel.
>>     May be it's because we have 2 UIComponents called DataScroller
>>     (one with buttons and another with the message). Shuld it be
>>     posted as a bug on dataScroller? I've seen the defects page on
>>     myFaces, but not familiar with the procedure of addin to that list.
>>     3. I've got it why you have your pageSize being analized and used
>>     in getDataModel(), your page explains it. I'll try to implement
>>     the same with an additional inputText.
>>     4. I also noticed on your page - the dataScroller has just 2
>>     buttons plus numbers in between. This way your strategy of
>>     fetching data chunks should work. I am using the "standard"
>>     scroller which has in addition fast forward/backward and
>>     first/last buttons, and in this case I think I'm better of calling
>>     DB every time (I've no way of predicting what page will be
>>     requested next).
>>     5. Probably next thing I'll try to implement: edit/delete/add, and
>>     after that I'm planning to implement Ajax datascroller. It's not a
>>     good user experiense, when the whole page gets re-rendered on
>>     every action.
>>     6. Although I've experience with javaScript, at least when I
>>     compare myself with the java developers I've worked with, but I've
>>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
>>     Ajax', but it was a diappointment after loading and gettin running
>>     their example to find out that it's based on some proprietary
>>     jars. Since you're using this ajax dataScroller, could you please
>>     enlight me on any existing standard for ajax (are there some
>>     'standard' jars I can use as a base of my app)?
>>      
>>     thanks, vlad
>>
>>      
>>     On 7/5/07, *Paul Iov* <paul@voller-ernst.de
>>     <ma...@voller-ernst.de>> wrote:
>>
>>         Well... just a bit refining
>>         Vladimir Isakovich schrieb:
>>>
>>>         Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
>>>         warnAttr
>>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
>>>         border="1" Property 'border' is not on type:
>>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
>>>
>>>         2. I also can see a warning...
>>>
>>         It's correct. The old good border="0" for image is deprecated
>>         with HTML4. We should use CSS instead.
>>          
>>
>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomahawk%2BDataScroller%2BWorkingWithLargeTables-tf4016097.html#a11470790
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi Daniel,

have you read my long post about how the data are handled in internal 
storage? Do you have the same approach and what do you mean exactly with 
"delete"? If you just delete the record from DB (i.e. via JDBC/SQL), you 
have to set also _invalidated flag in my class, to force the internal 
storage to be reloaded. (It's not especially efficient but it should 
work.) If you have implemented your own delete(_whatever_) method in 
this class, this method have to delete the ID from internal storage and 
then ensure, that the page will be refetched next time (i.e. with some 
extra boolean flag; in my code I just store the last ID-list generated 
during fetching of page and if it becomes changed [something was 
deleted/sorted in internal storage], I force the page to be refetched). 
This should be the better way, since after delete/edit of an item only 
the current page of data will be refetched - not the whole dataset AND 
the current page. ...and first after this comes the issue with 
dropScroller :). Probably, you don't need then this method at all.


daniel ccss schrieb:
> Hi Paul, I put your code in my backing_bean and call the method 
> dropScroller(String dataTableId) after the delete method was called, I 
> send to this method the id of the data table:
>
>                 <t:dataTable id="data" styleClass="scrollerTable" ...
>
>
> But the dataTable doesn´t update, in my console I recived the message: 
> " dropScroller called" but nothing happen. What else do I should do, 
> or what I'm doing bad.
>
> Also:
> I guess Daniel, you are using event listener in your backing bean to 
> edit data directly in PagedList? It's the only way to have actual copy 
> displayed without to reload this page.
>
> Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each 
> time the PageData change. When I didn´t have your improved class 
> PagedList, it works fine, since the fetch was doing many times for 
> each action and the data update in the DataTable. For that I was 
> thinking in some way put another condition on your filter for the 
> fetch where after I called the add/delete/edit method put that 
> variable in true and enter to the if to do the fetch, because I see 
> that when I click in the page number (a fetch is doing) the data 
> update in the DataTable. I hope your solution works for me It looks 
> pretty nice.
>
> On 7/5/07, *Vladimir Isakovich* <ivlad10@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Paul,
>     many thanks for your answers.
>      
>     1. Interestigly enough, after the warning the border is  still
>     applied. If I try to do the same with style=..., there is no effect.
>     this has nothing to do with the data fetching.
>     2. I have a guess about two calls to fetchPage() in the DataModel.
>     May be it's because we have 2 UIComponents called DataScroller
>     (one with buttons and another with the message). Shuld it be
>     posted as a bug on dataScroller? I've seen the defects page on
>     myFaces, but not familiar with the procedure of addin to that list.
>     3. I've got it why you have your pageSize being analized and used
>     in getDataModel(), your page explains it. I'll try to implement
>     the same with an additional inputText.
>     4. I also noticed on your page - the dataScroller has just 2
>     buttons plus numbers in between. This way your strategy of
>     fetching data chunks should work. I am using the "standard"
>     scroller which has in addition fast forward/backward and
>     first/last buttons, and in this case I think I'm better of calling
>     DB every time (I've no way of predicting what page will be
>     requested next).
>     5. Probably next thing I'll try to implement: edit/delete/add, and
>     after that I'm planning to implement Ajax datascroller. It's not a
>     good user experiense, when the whole page gets re-rendered on
>     every action.
>     6. Although I've experience with javaScript, at least when I
>     compare myself with the java developers I've worked with, but I've
>     never tried using XmlHttpRequest. I have this book: 'Pro JSF and
>     Ajax', but it was a diappointment after loading and gettin running
>     their example to find out that it's based on some proprietary
>     jars. Since you're using this ajax dataScroller, could you please
>     enlight me on any existing standard for ajax (are there some
>     'standard' jars I can use as a base of my app)?
>      
>     thanks, vlad
>
>      
>     On 7/5/07, *Paul Iov* <paul@voller-ernst.de
>     <ma...@voller-ernst.de>> wrote:
>
>         Well... just a bit refining
>         Vladimir Isakovich schrieb:
>>
>>         Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule
>>         warnAttr
>>         WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85
>>         border="1" Property 'border' is not on type:
>>         org.apache.myfaces.component.html.ext .*HtmlGraphicImage*
>>
>>         2. I also can see a warning...
>>
>         It's correct. The old good border="0" for image is deprecated
>         with HTML4. We should use CSS instead.
>          
>
>
>


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi Paul, I put your code in my backing_bean and call the method
dropScroller(String dataTableId) after the delete method was called, I send
to this method the id of the data table:

                <t:dataTable id="data" styleClass="scrollerTable" ...


But the dataTable doesn´t update, in my console I recived the message:
"dropScroller
called" but nothing happen. What else do I should do, or what I'm doing bad.

Also:
I guess Daniel, you are using event listener in your backing bean to edit
data directly in PagedList? It's the only way to have actual copy displayed
without to reload this page.

Yes, Paul in fact I´m doing that, and, as Vladimir, I call the DB each time
the PageData change. When I didn´t have your improved class PagedList, it
works fine, since the fetch was doing many times for each action and the
data update in the DataTable. For that I was thinking in some way put
another condition on your filter for the fetch where after I called the
add/delete/edit method put that variable in true and enter to the if to do
the fetch, because I see that when I click in the page number (a fetch is
doing) the data update in the DataTable. I hope your solution works for me
It looks pretty nice.

On 7/5/07, Vladimir Isakovich <iv...@gmail.com> wrote:
>
> Paul,
> many thanks for your answers.
>
> 1. Interestigly enough, after the warning the border is  still applied. If
> I try to do the same with style=..., there is no effect.
> this has nothing to do with the data fetching.
> 2. I have a guess about two calls to fetchPage() in the DataModel. May be
> it's because we have 2 UIComponents called DataScroller (one with buttons
> and another with the message). Shuld it be posted as a bug on dataScroller?
> I've seen the defects page on myFaces, but not familiar with the procedure
> of addin to that list.
> 3. I've got it why you have your pageSize being analized and used in
> getDataModel(), your page explains it. I'll try to implement the same with
> an additional inputText.
> 4. I also noticed on your page - the dataScroller has just 2 buttons plus
> numbers in between. This way your strategy of fetching data chunks should
> work. I am using the "standard" scroller which has in addition fast
> forward/backward and first/last buttons, and in this case I think I'm better
> of calling DB every time (I've no way of predicting what page will be
> requested next).
> 5. Probably next thing I'll try to implement: edit/delete/add, and after
> that I'm planning to implement Ajax datascroller. It's not a good user
> experiense, when the whole page gets re-rendered on every action.
> 6. Although I've experience with javaScript, at least when I compare
> myself with the java developers I've worked with, but I've never tried using
> XmlHttpRequest. I have this book: 'Pro JSF and Ajax', but it was a
> diappointment after loading and gettin running their example to find out
> that it's based on some proprietary jars. Since you're using this ajax
> dataScroller, could you please enlight me on any existing standard for ajax
> (are there some 'standard' jars I can use as a base of my app)?
>
> thanks, vlad
>
>
> On 7/5/07, Paul Iov <pa...@voller-ernst.de> wrote:
> >
> > Well... just a bit refining
> > Vladimir Isakovich schrieb:
> >
> >  Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
> > WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85 border="1"
> > Property 'border' is not on type: org.apache.myfaces.component.html.ext.
> > *HtmlGraphicImage*
> >
> > 2. I also can see a warning...
> >
> > It's correct. The old good border="0" for image is deprecated with
> > HTML4. We should use CSS instead.
> >
> >
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Paul,
many thanks for your answers.

1. Interestigly enough, after the warning the border is  still applied. If I
try to do the same with style=..., there is no effect.
this has nothing to do with the data fetching.
2. I have a guess about two calls to fetchPage() in the DataModel. May be
it's because we have 2 UIComponents called DataScroller (one with buttons
and another with the message). Shuld it be posted as a bug on dataScroller?
I've seen the defects page on myFaces, but not familiar with the procedure
of addin to that list.
3. I've got it why you have your pageSize being analized and used in
getDataModel(), your page explains it. I'll try to implement the same with
an additional inputText.
4. I also noticed on your page - the dataScroller has just 2 buttons plus
numbers in between. This way your strategy of fetching data chunks should
work. I am using the "standard" scroller which has in addition fast
forward/backward and first/last buttons, and in this case I think I'm better
of calling DB every time (I've no way of predicting what page will be
requested next).
5. Probably next thing I'll try to implement: edit/delete/add, and after
that I'm planning to implement Ajax datascroller. It's not a good user
experiense, when the whole page gets re-rendered on every action.
6. Although I've experience with javaScript, at least when I compare myself
with the java developers I've worked with, but I've never tried using
XmlHttpRequest. I have this book: 'Pro JSF and Ajax', but it was a
diappointment after loading and gettin running their example to find out
that it's based on some proprietary jars. Since you're using this ajax
dataScroller, could you please enlight me on any existing standard for ajax
(are there some 'standard' jars I can use as a base of my app)?

thanks, vlad


On 7/5/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Well... just a bit refining
> Vladimir Isakovich schrieb:
>
>  Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
> WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85 border="1"
> Property 'border' is not on type: org.apache.myfaces.component.html.ext.*
> HtmlGraphicImage*
>
> 2. I also can see a warning...
>
> It's correct. The old good border="0" for image is deprecated with HTML4.
> We should use CSS instead.
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Vladimir Isakovich <iv...@gmail.com>.
Hi, Paul, Daniel and all list.
I'm really glad finding this discussion, I guess in all serious projects
there is a need for reading large tables. I was reading the Wiki page, and
had a trouble of implementing it, though after reading this thread I've got
it working, at least to some extent.
I'm using Facelets 1.1.11 with MyFaces 1.1.3 -snapshot and tomahawk 1.1.3 (I
was trying later versions, but facelets complained on server start, althoug
I did not see real issues). The DB is MySql 5 and Hibernate is DB wrapper..

I do have some questions (3 total):
1. I've added your method in my bean:

        public DataPage<Customer> fetchPage(int startRow, int pageSize) {
            log.debug("=== LocalDataModel.fetchPage startRow: "+ startRow+"
pageSize: "+pageSize);
            return *doFetchPage(*startRow, pageSize);
        }
Still, I can see two DB roundtrips when doing 'next page'
this is what I see in the log:

OPENING PAGE First Time - no problem

Jul 5, 2007 1:12:09 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
WARNING: /web/sec/examples/largeTableScroller.xhtml @104,85 border="1"
Property 'border' is not on type:
org.apache.myfaces.component.html.ext.HtmlGraphicImage
DEBUG === LocalDataModel.fetchPage startRow: 0 pageSize: 5
DEBUG **Fetch: required -> fetching...
DEBUG === Gettin new page. startRow = 0 size: 5
DEBUG attempting to initialize the SessionFactory
INFO  Hibernate 3.2.4.sp1
..... multiple infos from Hibernate about session initialization.........
Hibernate: select this_.Cust_ID as Cust1_0_0_, this_.Name as Name0_0_,
this_.Phone_Number as Phone3_0_0_, this_.Street_A
ddress as Street4_0_0_, this_.City as City0_0_, this_.State as State0_0_
from customers this_ limit ?
DEBUG === LocalDataModel.fetchPage startRow: 0 pageSize: 5
DEBUG ***Fetch: not required (already fetched)!
INFO  entering RESTORE_VIEW(1) in org.apache.myfaces.lifecycle.LifecycleImpl
INFO  entering RESTORE_VIEW(1) in org.apache.myfaces.lifecycle.LifecycleImpl

SCROLLING TO THE NEXT PAGE - unwanted read

INFO  entering RESTORE_VIEW(1) in org.apache.myfaces.lifecycle.LifecycleImpl
INFO  entering APPLY_REQUEST_VALUES(2) in
org.apache.myfaces.lifecycle.LifecycleImpl
*DEBUG === LocalDataModel.fetchPage startRow: 0 pageSize: 5    ???????
*DEBUG **Fetch: required -> fetching...
DEBUG === Gettin new page. startRow = 0 size: 5
Hibernate: select this_.Cust_ID as Cust1_0_0_, this_.Name as Name0_0_,
this_.Phone_Number as Phone3_0_0_, this_.Street_A
ddress as Street4_0_0_, this_.City as City0_0_, this_.State as State0_0_
from customers this_ limit ?
DEBUG Page Size: 5
DEBUG === LocalDataModel.fetchPage startRow: 0 pageSize: 5
DEBUG ***Fetch: not required (already fetched)!
*DEBUG === LocalDataModel.fetchPage startRow: 5 pageSize: 5    - this is
what was expected
*DEBUG **Fetch: required -> fetching...
DEBUG === Gettin new page. startRow = 5 size: 5
Hibernate: select this_.Cust_ID as Cust1_0_0_, this_.Name as Name0_0_,
this_.Phone_Number as Phone3_0_0_, this_.Street_A
ddress as Street4_0_0_, this_.City as City0_0_, this_.State as State0_0_
from customers this_ limit ?, ?
DEBUG Page Size: 5
INFO  entering RESTORE_VIEW(1) in org.apache.myfaces.lifecycle.LifecycleImpl
INFO  entering RESTORE_VIEW(1) in org.apache.myfaces.lifecycle.LifecycleImpl

Well, apparently the framework (can I say it better?) is calling fetchPage()
twice. First - with the old startRow value and second -with the new startRow
value.

2. I also can see a warning:WARNING:
/web/sec/examples/largeTableScroller.xhtml @104,85 border="1" Property
'border' is not on type:
org.apache.myfaces.component.html.ext.HtmlGraphicImage
but it seems that the property gets applied. (I can see the differense in
apearance, when the border=1 is removed).

3. I also have a question about dataSize in your DataPage. Does it mean that
the for a first time I have to run something like "select count(*)..." and
then store this value to the session, so it may be retrieved for all
consecutive reads? Do you have a better solution?


On 7/5/07, Paul Iov <pa...@voller-ernst.de> wrote:
>
> Hi Daniel,
>
> unfortunately I have neither some simple project nor article explaining
> this. I have implemented it in my own meta framework which is part of a
> big commercial application. (It consists currently of 6 or 7 different
> Eclipse projects, so it would be really difficult to extract 'clearly'
> the code, you are asking for.) I'm attaching just three classes from my
> early 'playground' code. Sorry, it's the best I can offer right now :(
> You will not be able to compile this (because the rest of my stuff have
> nothing to do with fetching itself and would be more complicated as
> helpful) but you can track the approach. There are three methods, which
> shows how it works and how to get ride of duplicated (exactly: multiple)
> fetching of the same data: getPage() and doFetchPage() in
> DataPagedListDataModel<T> and getDataModel() in PagedListFoto (which
> extends the DataPagedListDataModel indirectly)
>
> The solution is to separate the fetching call into own method in base
> abstract class. (Why it should be abstract is explained in Wiki.)
>
>    private int _lastStartRow = -1;
>    private int _lastPageSize = -1;
>    private DataPage<T> _lastPage = null;
>
>    private DataPage<T> doFetchPage(int startRow, int pageSize){
>        if ((_lastPage == null) || (_lastStartRow != startRow) ||
> (_lastPageSize != pageSize)){
>            _log.debug("**Fetch: required -> fetching...");
>            _lastPage = fetchPage(startRow, pageSize);
>            //store values to chech next time
>            _lastStartRow = startRow;
>            _lastPageSize = pageSize;
>        }else{
>            _log.debug("***Fetch: not required (already fetched)!");
>        }
>        return _lastPage;
>    }
>
> I store then the startRow and pageSize values and check it every time
> the new fetch is 'requested'. Just take a look at my debug statements
> entire the code, they should be self explained. The fetching take place
> exactly one time for particularly page of data.
>
> One more thing to be clearly explained here: the getDataModel() of
> 'enclosing' nested class (PagedListFoto in my case)  MUST BE CALLED
> TWICE, since you have two components in your JSP -> the DataTable and
> the Scroller and both are accessing this property. So you have to handle
> this situation yourself, i.e. directly in getter:
>
> public DataModel getDataModel() {
>      _log.debug("-------------- getDataModel() called -------");
>        if (dataModel == null) {
>            dataModel = new LocalDataModel(rowsPerPage);
>        }
>        return dataModel;
> }
>
> I hope it helps.
>
> Regards,
> paul
>
> P.S. As mentioned, I'm not using t:dataScroller since it's buggy in
> combination with AJAX (at least: it WAS buggu in 1.1.4 and 1.1.5), but I
> think, it makes no difference regarding fetching approach itself. I've
> send my code with few minor improvements to Adrian Mitev (author of
> original component, which was published at
>
> https://ajax4jsf.dev.java.net/servlets/ProjectDocumentList?folderID=6510&expandFolder=6510&folderID=5320
> ).
> If you are interested in this component, just ask him about it.
>
> daniel ccss schrieb:
> >
> > Thanks!!!
> >
> > Paul do you have a simple project where I can see how all working
> > together, I'm really tire of search and search for solutions and
> > nothing , I´m new in this and really need help, thanks!!
> >
> >
> > P.D: have you publish some article explaining how all this works (your
> > DataScroller using AjaxDataScroller and the approach of the wiki)?...
> > you should i know that many people will appreciate it!
> >
>
>
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Thanks!!! I'm going to study your code, thanks, Paul I noticed something
very very strange!!!! Well the method getDataModel and then the method
fetchPage are called several times, but they are even called when I click in
a link or a button to go to another JSF page, why this happen? The way to
asign the data to the dataTable int the JSP is this?:

                <t:dataTable id="data" ...
                             value="#{PacienteBean.dataModel}"


Paul i see that the rar doesn´t have the backing bean and the JSP, can you
also send me that? To see if I'm missing something on my JSP and see if my
invocations on the backingbean are ok.

Paul, really thanks for all your help!!!!!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi Daniel,

unfortunately I have neither some simple project nor article explaining 
this. I have implemented it in my own meta framework which is part of a 
big commercial application. (It consists currently of 6 or 7 different 
Eclipse projects, so it would be really difficult to extract 'clearly' 
the code, you are asking for.) I'm attaching just three classes from my 
early 'playground' code. Sorry, it's the best I can offer right now :( 
You will not be able to compile this (because the rest of my stuff have 
nothing to do with fetching itself and would be more complicated as 
helpful) but you can track the approach. There are three methods, which 
shows how it works and how to get ride of duplicated (exactly: multiple) 
fetching of the same data: getPage() and doFetchPage() in 
DataPagedListDataModel<T> and getDataModel() in PagedListFoto (which 
extends the DataPagedListDataModel indirectly)

The solution is to separate the fetching call into own method in base 
abstract class. (Why it should be abstract is explained in Wiki.)

    private int _lastStartRow = -1;
    private int _lastPageSize = -1;
    private DataPage<T> _lastPage = null;
   
    private DataPage<T> doFetchPage(int startRow, int pageSize){
        if ((_lastPage == null) || (_lastStartRow != startRow) || 
(_lastPageSize != pageSize)){
            _log.debug("**Fetch: required -> fetching...");
            _lastPage = fetchPage(startRow, pageSize);
            //store values to chech next time
            _lastStartRow = startRow;
            _lastPageSize = pageSize;
        }else{
            _log.debug("***Fetch: not required (already fetched)!");
        }
        return _lastPage;
    }

I store then the startRow and pageSize values and check it every time 
the new fetch is 'requested'. Just take a look at my debug statements 
entire the code, they should be self explained. The fetching take place 
exactly one time for particularly page of data.

One more thing to be clearly explained here: the getDataModel() of 
'enclosing' nested class (PagedListFoto in my case)  MUST BE CALLED 
TWICE, since you have two components in your JSP -> the DataTable and 
the Scroller and both are accessing this property. So you have to handle 
this situation yourself, i.e. directly in getter:

public DataModel getDataModel() {
      _log.debug("-------------- getDataModel() called -------");
        if (dataModel == null) {
            dataModel = new LocalDataModel(rowsPerPage);
        }
        return dataModel;
}

I hope it helps.

Regards,
paul

P.S. As mentioned, I'm not using t:dataScroller since it's buggy in 
combination with AJAX (at least: it WAS buggu in 1.1.4 and 1.1.5), but I 
think, it makes no difference regarding fetching approach itself. I've 
send my code with few minor improvements to Adrian Mitev (author of 
original component, which was published at 
https://ajax4jsf.dev.java.net/servlets/ProjectDocumentList?folderID=6510&expandFolder=6510&folderID=5320). 
If you are interested in this component, just ask him about it.

daniel ccss schrieb:
>
> Thanks!!!
>
> Paul do you have a simple project where I can see how all working 
> together, I'm really tire of search and search for solutions and 
> nothing , I´m new in this and really need help, thanks!!
>
>
> P.D: have you publish some article explaining how all this works (your 
> DataScroller using AjaxDataScroller and the approach of the wiki)?... 
> you should i know that many people will appreciate it!
>


Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Thanks!!!

Paul do you have a simple project where I can see how all working together,
I'm really tire of search and search for solutions and nothing , I´m new in
this and really need help, thanks!!


P.D: have you publish some article explaining how all this works (your
DataScroller using AjaxDataScroller and the approach of the wiki)?... you
should i know that many people will appreciate it!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi Daniel,

I think, your Problem lies in PagedListDataModel<T>.getRowData() from wiki.
I've implemented this approach, however with my own DataScroller, based 
on AjaxDataScroller by Adrian Mitev, and everything works fine.
Take a look at conditions for (re)fetching of single DataPage (I've 
extended the original comments with my own).

// Check if rowIndex is equal to startRow,
// useful for dynamic sorting on pages
//
//comment: why should it be usefull???
//this duplicates fetch calls, if the page was
//already fetched in getPage().
//The same in if (rowIndex >= endRow)
//with condition 'or equal'!
if (rowIndex == page.getStartRow()){
    _log.debug("Fetch: in getRowData(), reason: rowIndex == 
page.getStartRow()");
    page = doFetchPage(rowIndex, pageSize);
}

regards,
paul

daniel ccss schrieb:
> I really need help with this, nobody has implemented succesfuly the 
> datascroller +  WorkingWithLargeTables article? How do you people 
> implement the pagination with a Tomahawk dataScroller, without bring 
> all the records? For me all works fine my problem is that the method 
> that brings the data is call several times for each DataPage.
>
> ...



Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
I really need help with this, nobody has implemented succesfuly the
datascroller +  WorkingWithLargeTables article? How do you people implement
the pagination with a Tomahawk dataScroller, without bring all the records?
For me all works fine my problem is that the method that brings the data is
call several times for each DataPage.**

On 7/3/07, daniel ccss <da...@gmail.com> wrote:
>
> Ok let's see, the backing bean is in request:
>
> <managed-bean>
>  <description>Pacientes
>  </description>
>  <managed-bean-name>PacienteBean</managed-bean-name>
>  <managed-bean-class>controller.pacientes.PacienteBean
> </managed-bean-class>
>  <managed-bean-scope>request</managed-bean-scope>
>  </managed-bean>
>
> How can I use the cache for a Backing Bean? Some Guru that can help me? I
> can give you all my Jdeveloper project and you can test it?
>
> Any other idea, thanks!!
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Ok let's see, the backing bean is in request:

<managed-bean>
 <description>Pacientes
 </description>
 <managed-bean-name>PacienteBean</managed-bean-name>
 <managed-bean-class>controller.pacientes.PacienteBean</managed-bean-class>
 <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>

How can I use the cache for a Backing Bean? Some Guru that can help me? I
can give you all my Jdeveloper project and you can test it?

Any other idea, thanks!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Mikael Andersson <ma...@gmail.com>.
Haven't read the wiki page, so I don't know how that works.

Perhaps you can have the backing bean in request scope (maybe it already is
and this advice is not useful) and use a cache, then the data would be
reloaded for each request but the multiple gets occuring within that request
would be cached..

Best bet is to wait for one of the gurus to provide some insightful tips ;)

Cheers

On 03/07/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi Mike, thank you for your answer, you are the fist that suggest
> something, I read the info of the getter called few times, but I have the
> same problem that the person that asked, because I can´t use the lazy list,
> I need to go to the database to bring each page of the dataScroller, I don´t
> want to bring all the list beacuse is too large. I erase the second data
> scroller as you say but I get the same results. These are my outputs of
> going for this pages: 1,2,3,4,3,2,1 (paging 4 in 4).
>
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 0 AND 4
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 9 AND 13
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 12 AND 16
> LINENUM BETWEEN 12 AND 16
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 8 AND 12
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 4 AND 8
> LINENUM BETWEEN 0 AND 4
>
> Any Help? Tell me if you need more info, thanks!!
>

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by daniel ccss <da...@gmail.com>.
Hi Mike, thank you for your answer, you are the fist that suggest something,
I read the info of the getter called few times, but I have the same problem
that the person that asked, because I can´t use the lazy list, I need to go
to the database to bring each page of the dataScroller, I don´t want to
bring all the list beacuse is too large. I erase the second data scroller as
you say but I get the same results. These are my outputs of going for this
pages: 1,2,3,4,3,2,1 (paging 4 in 4).

LINENUM BETWEEN 0 AND 4
LINENUM BETWEEN 0 AND 4
LINENUM BETWEEN 0 AND 4
LINENUM BETWEEN 0 AND 4
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 9 AND 13
LINENUM BETWEEN 8 AND 12
LINENUM BETWEEN 8 AND 12
LINENUM BETWEEN 12 AND 16
LINENUM BETWEEN 12 AND 16
LINENUM BETWEEN 8 AND 12
LINENUM BETWEEN 8 AND 12
LINENUM BETWEEN 8 AND 12
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 4 AND 8
LINENUM BETWEEN 0 AND 4

Any Help? Tell me if you need more info, thanks!!

Re: Tomahawk+DataScroller+WorkingWithLargeTables

Posted by Mikael Andersson <ma...@gmail.com>.
Hi,
the getter methods typically get called several times, so caching of the
data is usually desired (if you are interested you could have a look at seam
and @Factory which addresses this).
Don't know how the dataScroller works, but I would guess that it is
responsible for at least one call to the EL in the value attribute of the
data table (and since you have two scrollers in there, that would be two
calls).

Found this with some info:
http://www.nabble.com/getter-called-few-times-tf1716500.html

Not a lot of explenation, but you should be able to find more somewhere in
this forum.

Cheers,
 Mike

On 03/07/07, daniel ccss <da...@gmail.com> wrote:
>
> Hi all, I'm new in this mailing list, and I new using My Faces, hope you
> can help me.
>
> Things to know: i'm using JDeveloper 10.1.3.1, last My Faces, last
> Tomahawk implementation version
>
> I made the following things:
> 1-The datascroller example (http://www.irian.at/myfaces/ dataScroller.jsf)
> and all works fine.
> 2- Then I read and implemented the article in the wiki call: WorkingWithLargeTables
> ( http://wiki.apache.org/myfaces/WorkingWithLargeTables ) and all works
> fine, the number of links, the method who brings each DataPage, the data
> that is displaying in each page, all fine.
>
> But I noticed that when I put a System.out.println in the method that
> brings the DataPage, the method that bring the DataPage from the database is
> invoked several times, for example the System.outs that appear in my
> console when I: load the page, click in page2 link, and click in page3 are:
>
> ... LINENUM BETWEEN 0 AND 2
> ... LINENUM BETWEEN 0 AND 2
> ... LINENUM BETWEEN 0 AND 2
> ... LINENUM BETWEEN 0 AND 2
> ... LINENUM BETWEEN 2 AND 4
> ... LINENUM BETWEEN 2 AND 4
> ... LINENUM BETWEEN 2 AND 4
> ... LINENUM BETWEEN 5 AND 7
>
> Why this happen? I put a breakpoint in the fetchPage(int startRow, int
> pageSize) method, and in fact it is call several times for each DataPage
> that is show.
>
> The DataPage<T> class and the PagedListDataModel<T> class are the same
> that appears in the WorkingWithLargeTables article from wiki.
>
> This is the code of my bean class:
>
> public class PacienteBean {
>
>     DataModel dataModel = null;
>     private DataPage<Paciente> getDataPage(int inicio, int regPorPagina) {
>         PacienteEJB paciente = null;
>         try {
>             final Context context = new InitialContext();
>             paciente = (PacienteEJB)context.lookup("PacienteEJB");
>         } catch (NamingException e) {
>             System.out.println(e.getMessage());
>         }
>         return paciente.obtenerPacientes (inicio, regPorPagina);
>     }
>
>     public DataModel getDataModel() {
>         if (dataModel == null) {
>             dataModel = new LocalDataModel(2);
>         }
>         return dataModel;
>     }
>
>     private class LocalDataModel extends PagedListDataModel {
>         public LocalDataModel(int pageSize) {
>             super(pageSize);
>         }
>
>         public DataPage<Paciente> fetchPage(int startRow, int pageSize) {
>             return getDataPage(startRow, pageSize);
>         }
>     }
>     public String mostrarPacientes() {
>         return "success";
>     }
> }
>
> The only clue that I have is that something is happening in the jsp,
> beacause the wiki article don´t explains how the jsp have to be, in fact I
> leave it the same as the datascroller example jsp, only changing the value
> of the DataTable value="#{PacienteBean.dataModel}" and putting the
> preserveDataModel="false" because I want that for each page the DataPage
> be loaded from the DataBase. This is my jsp:
>
> <%@ page contentType="text/html;charset=windows-1252"%>
> <%@ taglib uri=" http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri=" http://myfaces.apache.org/tomahawk " prefix="t"%>
> <f:view>
>     <html>
>         <head>
>             <meta http-equiv="Content-Type"
>                   content="text/html; charset=windows-1252"/>
>             <title>listaPacientes</title>
>         </head>
>         <body><h:form>
>                 <h:panelGroup id="body">
>                     <t:dataTable id="data" styleClass="scrollerTable"
>                                  headerClass="standardTable_Header"
>                                  footerClass="standardTable_Header"
>
> rowClasses="standardTable_Row1,standardTable_Row2"
>
> columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
>                                  var="tablaPacientes"
>                                  value="#{ PacienteBean.dataModel}"
>                                  preserveDataModel="false" rows="2">
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText value="#{tablaPacientes.numIdent
> }"/>
>                         </h:column>
>                         <h:column>
>                             <f:facet name="header"></f:facet>
>                             <h:outputText value="#{tablaPacientes.nombre
> }"/>
>                         </h:column>
>                     </t:dataTable>
>                     <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;"
>                                         immediate="true">
>                             <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"
>                                         immediate="true"
>                                         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>
>                 </h:panelGroup>
>                 <t:commandLink value="test" immediate="true"/>
>             </h:form></body>
>     </html>
> </f:view>
> Please help me with this, we are actually deciding which implementation of
> myfaces to use, and I really trust in apache work, I don´t want that other
> implementation be choose for our applications, thanks!!!