First, Prev, Next, Last Display

In NetDyanmics I was able to show or not show the First, Previous,

Next and Last buttons depending on the state of the repeated. For

instance, if the repeated was display the first rows of data and

there were no previous rows, I would not display the First and

Previous buttons. Likewise if the repeated was displaying the last

set of data and there were no additional rows to display, I would not

show the Next and Last buttons.

This was accomplished by using getCurrFirstRow and

lastRecordIsDisplayed methods of the CSpCommonRepeated.

Is there any way in JATO to duplicate this functionality? I have

attempted to figure out how many total rows the Model had and which

rows are currently being displayed but it appears that the Model only

contains the needed rows for display.

Any help is appreciated.

Jason Smith

<a href="/group/SunONE-JATO/post?protectID=045059014009175125015133055026062254132 210057046167121181">jsmith@E...</a>

[1087 byte] By [Guest] at [2007-11-25 9:33:09]
# 1

Hi Jason--

The following method will allow you to determine the current position within

the result set:

ResultSetModelBase.getLocationOffset()

If this value is 0 or less, you're at the beginning of the result set.

Otherwise, you're somewhere else in the result set.

Determining if you're at the end of the result set is more difficult. One

technique would be to check whether the number of rows in the model were

less than the max displayable number in the tiled view, and base your

decision on this. This wouldn't work if the total number of rows were a

multiple of the max dispaly size, but might be adequate for most situations.

Detecting if you're at the end the result set because of a last() operation

is even more difficult, because then an equal number of rows will be

available as the max displayable rows because the fetch starts from the end

of the result set. In this case, though, you could just set a flag in your

Last button request event handler to hide the button on the redisplay.

Sorry I don't have a cleaner technique for you at the moment. I'll look

into making this easier in the future.

Todd

Guest at 2007-7-1 18:26:51 > top of Java-index,Development Tools,Java Tools...