Java Doc for PagedNavigation.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » site » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » rife 1.6.1 » com.uwyn.rife.site 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.uwyn.rife.site.PagedNavigation

PagedNavigation
public class PagedNavigation (Code)
This class provides utility methods to generate navigation for paged lists.

The generation of the navigation depends on a collection of block and value IDs that should be defined in a template. Following is a table of all the IDs and their purpose:
ID Description
<!--B 'NAV:FIRSTRANGE'--><!--/B--> Provides the content that will be used to jump to the first range. This block has to contain an EXIT:QUERY value that will be replaced with the actual URL that will trigger the paging behaviour.
<!--B 'NAV:FIRSTRANGE:DISABLED'--><!--/B--> Provides the content that will be used when jumping to the first range is not appropriate, for instance when the first range is already the current offset.
<!--B 'NAV:PREVIOUSRANGE'--><!--/B--> Provides the content that will be used to jump to the previous range according to the current offset. This block has to contain an EXIT:QUERY value that will be replaced with the actual URL that will trigger the paging behaviour.
<!--B 'NAV:PREVIOUSRANGE:DISABLED'--><!--/B--> Provides the content that will be used when jumping to the previous range is not appropriate, for instance when the first range is the current offset.
<!--B 'NAV:ABSOLUTERANGE'--><!--/B--> Provides the content that will be used to jump directly to each individual range. This block has to contain an EXIT:QUERY value that will be replaced with the actual URL that will trigger the paging behaviour.
<!--B 'NAV:ABSOLUTERANGE:DISABLED'--><!--/B--> Provides the content that will be used when jumping directly to a specific individual range is not appropriate, for instance when that range corresponds to the current offset.
<!--B 'NAV:NEXTRANGE'--><!--/B--> Provides the content that will be used to jump to the next range according to the current offset. This block has to contain an EXIT:QUERY value that will be replaced with the actual URL that will trigger the paging behaviour.
<!--B 'NAV:NEXTRANGE:DISABLED'--><!--/B--> Provides the content that will be used when jumping to the next range is not appropriate, for instance when the last range is the current offset.
<!--B 'NAV:LASTRANGE'--><!--/B--> Provides the content that will be used to the last range. This block has to contain an EXIT:QUERY value that will be replaced with the actual URL that will trigger the paging behaviour.
<!--B 'NAV:LASTRANGE:DISABLED'--><!--/B--> Provides the content that will be used when jumping to the last range is not appropriate, for instance when the last range is already the current offset.
<!--V 'NAV:RANGECOUNT'/--> Will contain the number of ranges that are needed to display all the information that is paged. This value is optional.
<!--V 'NAV:FIRSTRANGE'/--> Will contain the content that allows to jump to the first range. This corresponds to the beginning of the paged data.
<!--V 'NAV:PREVIOUSRANGE'/--> Will contain the content that allows to jump to the previous range according to the current offset.
<!--V 'NAV:ABSOLUTERANGES'/--> Will contain the content that allows to jump directly to each individual range that is available.
<!--V 'NAV:NEXTRANGE'/--> Will contain the content that allows to jump to the next range according to the current offset.
<!--V 'NAV:LASTRANGE'/--> Will contain the content that allows to jump to the last range. This corresponds to the end of the paged data.

Besides these template conventions, you also have to provide one exit and one output that will be used to create the links that will perform the actual paging behaviour of the navigation. By default, the change_offset exit and the offset output will be used. It's up to you to create the datalink and flowlink and to correctly handle the offset value when it changes.

A very basic paged navigation could for example be defined like this:

<!--B 'NAV:FIRSTRANGE'--><a href="[!V 'EXIT:QUERY:change_offset'/]">&lt;&lt;</a><!--/B-->
 <!--B 'NAV:FIRSTRANGE:DISABLED'-->&lt;&lt;<!--/B-->
 <!--B 'NAV:PREVIOUSRANGE'--><a href="[!V 'EXIT:QUERY:change_offset'/]">&lt;</a><!--/B-->
 <!--B 'NAV:PREVIOUSRANGE:DISABLED'-->&lt;<!--/B-->
 <!--B 'NAV:ABSOLUTERANGE'-->&nbsp;<a href="[!V 'EXIT:QUERY:change_offset'/]"><!--V 'ABSOLUTERANGE_TEXT'/--></a>&nbsp;<!--/B-->
 <!--B 'NAV:ABSOLUTERANGE:DISABLED'-->&nbsp;<!--V 'ABSOLUTERANGE_TEXT'/-->&nbsp;<!--/B-->
 <!--B 'NAV:NEXTRANGE'--><a href="[!V 'EXIT:QUERY:change_offset'/]">&gt;</a><!--/B-->
 <!--B 'NAV:NEXTRANGE:DISABLED'-->&gt;<!--/B-->
 <!--B 'NAV:LASTRANGE'--><a href="[!V 'EXIT:QUERY:change_offset'/]">&gt;&gt;</a><!--/B-->
 <!--B 'NAV:LASTRANGE:DISABLED'-->&gt;&gt;<!--/B-->
 Pages: <!--V 'NAV:RANGECOUNT'/--> ( <!--V 'NAV:FIRSTRANGE'/--> <!--V 'NAV:PREVIOUSRANGE'/--> <!--V 'NAV:NEXTRANGE'/--> <!--V 'NAV:LASTRANGE'/--> | <!--V 'NAV:ABSOLUTERANGES'/--> )

Which could result in the following output where all the underlined parts are clickable and will trigger the change_offset exit and provide a new corresponding value for the offset output:

Pages: 9 ( << < > >> | 1 2 3 4 5 6 7 8 9 )

The element that displays the list and calls the navigation generation method could for example be like this:

public class List extends Element
 {
 public final static int LIMIT = 10;
 public final static int SPAN = 5;
 public void processElement()
 {
 Template t = getHtmlTemplate("article.list");
 DatabaseArticles manager = DatabaseArticlesFactory.getInstance();
 int count = manager.countArticles();
 if (0 == count) t.setBlock("content", "noarticles");
 else
 {
 int offset = getInputInt("offset", 0);
 PagedNavigation.generateNavigation(this, t, count, LIMIT, offset, SPAN);
 Collection<Article> articles = manager.listArticles(LIMIT, offset);
 for (Article article : articles)
 {
 t.setBean(article);
 t.appendBlock("articles", "article");
 }
 }
 print(t);
 }
 }


Field Summary
public static  StringDEFAULT_EXIT
    
public static  StringDEFAULT_OUTPUT
    
public static  StringID_ABSOLUTERANGE
    
public static  StringID_ABSOLUTERANGES
    
public static  StringID_ABSOLUTERANGE_DISABLED
    
public static  StringID_ABSOLUTERANGE_TEXT
    
public static  StringID_FIRSTRANGE
    
public static  StringID_FIRSTRANGE_DISABLED
    
public static  StringID_LASTRANGE
    
public static  StringID_LASTRANGE_DISABLED
    
public static  StringID_NEXTRANGE
    
public static  StringID_NEXTRANGE_DISABLED
    
public static  StringID_PREVIOUSRANGE
    
public static  StringID_PREVIOUSRANGE_DISABLED
    
public static  StringID_RANGECOUNT
    
public static  StringPREFIX_NAV
    
public static  StringSUFFIX_DISABLED
    


Method Summary
public static  voidgenerateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span)
     Generates the paged navigation for the given element, template and range configuration.
public static  voidgenerateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span, String exit, String output)
     Generates the paged navigation for the given element, template and range configuration.
public static  voidgenerateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span, String exit, String output, String pathInfo)
     Generates the paged navigation for the given element, template and range configuration.

Field Detail
DEFAULT_EXIT
public static String DEFAULT_EXIT(Code)



DEFAULT_OUTPUT
public static String DEFAULT_OUTPUT(Code)



ID_ABSOLUTERANGE
public static String ID_ABSOLUTERANGE(Code)



ID_ABSOLUTERANGES
public static String ID_ABSOLUTERANGES(Code)



ID_ABSOLUTERANGE_DISABLED
public static String ID_ABSOLUTERANGE_DISABLED(Code)



ID_ABSOLUTERANGE_TEXT
public static String ID_ABSOLUTERANGE_TEXT(Code)



ID_FIRSTRANGE
public static String ID_FIRSTRANGE(Code)



ID_FIRSTRANGE_DISABLED
public static String ID_FIRSTRANGE_DISABLED(Code)



ID_LASTRANGE
public static String ID_LASTRANGE(Code)



ID_LASTRANGE_DISABLED
public static String ID_LASTRANGE_DISABLED(Code)



ID_NEXTRANGE
public static String ID_NEXTRANGE(Code)



ID_NEXTRANGE_DISABLED
public static String ID_NEXTRANGE_DISABLED(Code)



ID_PREVIOUSRANGE
public static String ID_PREVIOUSRANGE(Code)



ID_PREVIOUSRANGE_DISABLED
public static String ID_PREVIOUSRANGE_DISABLED(Code)



ID_RANGECOUNT
public static String ID_RANGECOUNT(Code)



PREFIX_NAV
public static String PREFIX_NAV(Code)



SUFFIX_DISABLED
public static String SUFFIX_DISABLED(Code)





Method Detail
generateNavigation
public static void generateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span)(Code)
Generates the paged navigation for the given element, template and range configuration. The default exit change_offset and the default output offset will be used when generating the links.
Parameters:
  element - The element that is populating the template. Its exitwill be triggered and its output will be set.
Parameters:
  template - The template that will be used for the generation ofthe navigation.
Parameters:
  count - The total number of items that are being paged.
Parameters:
  limit - The maximum of items that will be shown in a range on apage.
Parameters:
  offset - The starting offset of the range that is currentlyvisible.
Parameters:
  span - The maximum number of ranges that will be shown asimmediately accesible absolute ranges.



generateNavigation
public static void generateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span, String exit, String output)(Code)
Generates the paged navigation for the given element, template and range configuration. This version allows you to provide your own names for the exit and the output that will be used when generating the links.
Parameters:
  element - The element that is populating the template, whose exitwill be triggered and whose output will be set.
Parameters:
  template - The template that will be used for the generation ofthe navigation.
Parameters:
  count - The total number of items that are being paged.
Parameters:
  limit - The maximum of items that will be shown in a range on apage.
Parameters:
  offset - The starting offset of the range that is currentlyvisible.
Parameters:
  span - The maximum number of ranges that will be shown asimmediately accesible absolute ranges.
Parameters:
  exit - The name of the exit that has to be used to trigger anoffset change.
Parameters:
  output - The name of the output that will contain the value of thenew range offset when the exit is triggered.



generateNavigation
public static void generateNavigation(ElementSupport element, Template template, long count, int limit, long offset, int span, String exit, String output, String pathInfo)(Code)
Generates the paged navigation for the given element, template and range configuration. This version allows you to provide your own names for the exit and the output that will be used when generating the links.
Parameters:
  element - The element that is populating the template, whose exitwill be triggered and whose output will be set.
Parameters:
  template - The template that will be used for the generation ofthe navigation.
Parameters:
  count - The total number of items that are being paged.
Parameters:
  limit - The maximum of items that will be shown in a range on apage.
Parameters:
  offset - The starting offset of the range that is currentlyvisible.
Parameters:
  span - The maximum number of ranges that will be shown asimmediately accesible absolute ranges.
Parameters:
  exit - The name of the exit that has to be used to trigger anoffset change.
Parameters:
  output - The name of the output that will contain the value of thenew range offset when the exit is triggered.
Parameters:
  pathInfo - The pathinfo to be applied to the exit used to trigger an offset change



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.