├── .gitignore
├── README.md
├── backlog.txt
├── deploy-standalone-demo
├── oegyscroll-demo
├── pom.xml
├── run
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── laughingpanda
│ │ └── oegyscrolldemo
│ │ ├── OegyScrollDemoApplication.java
│ │ ├── OegyScrollDemoPage.html
│ │ └── OegyScrollDemoPage.java
│ └── webapp
│ ├── WEB-INF
│ └── web.xml
│ └── images
│ ├── loading-row.gif
│ └── table-rows-striped.gif
├── oegyscroll
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── laughingpanda
│ │ └── wicket
│ │ ├── Block.java
│ │ ├── LazyLoadScrollableList.java
│ │ ├── PlaceHolder.java
│ │ ├── ProxyDataProvider.java
│ │ ├── RemainderBlock.java
│ │ ├── RowDataView.java
│ │ ├── ScrolledContentView.java
│ │ ├── SublistDataProvider.java
│ │ ├── oegyscroll-updater.js
│ │ └── oegyscroll.js
│ └── test
│ ├── java
│ └── org
│ │ └── laughingpanda
│ │ └── wicket
│ │ ├── LazyLoadScrollableListSpec.java
│ │ ├── LazyLoadScrollableListTestPage.html
│ │ └── LazyLoadScrollableListTestPage.java
│ └── js
│ ├── jquery-1.3.2.js
│ ├── qunit.css
│ ├── qunit.js
│ └── scrollertest.html
├── pom.xml
└── standalone-demo
├── images
├── loading-row.gif
└── table-rows-striped.gif
└── index.html
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | .settings/
3 | .classpath
4 | .project
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OegyScroll
2 | ==========
3 |
4 | From LaughingPanda
5 | ------------------
6 |
7 | OegyScroll (or org.laughingpanda.LazyLoadScrollableList) is a Wicket
8 | component for displaying long lists of data in a scrollable view. The
9 | idea is that at first only the first 100 rows are loaded to the browser
10 | and more rows are loaded while you scroll. This way a list of 20000
11 | items can easily be shown in a browser, because the initial markup of
12 | the page contains only some hundreds of elements. Still, the page
13 | behaves as if all the data was loaded immediately. The user can freely
14 | scroll through the data and will only experience a short delay before
15 | the actual data appears.
16 |
17 | New: JQuery client-side library
18 | -------------------------------
19 |
20 | Using the client-side library, you can enjoy OegyScrolling without
21 | Wicket, too. Have a look at [this humble demo page][demo] to get the
22 | idea!
23 |
24 | [demo]: http://juhajasatu.com/oegydemo/
25 |
26 | How To Install It?
27 | ------------------
28 |
29 | If you're using Maven 2, just add the following dependency block into your POM file:
30 |
31 |
32 |
33 | org.laughingpanda.oegyscroll
34 | oegyscroll
35 | 1.0-SNAPSHOT
36 |
37 |
38 |
39 | ..or you can just clone the source and build it yourself.
40 |
41 | Dependencies
42 | ------------
43 |
44 | * Wicket 1.4 (can easily be backported to 1.3.x)
45 | * Tested on Firefox 3.0, IE 6.0, IE 7.0
46 |
47 | How To Use It?
48 | --------------
49 |
50 | It's designed to be an easy replacement for [DataView][]. You supply
51 | your data using an implementation of [data provider][IDataProvider] such
52 | as [ListDataProvider][].
53 |
54 | Like with DataView, you have to override the populateRow method where
55 | you add the components for each actual data row.
56 |
57 | You need some custom HTML in your markup too, where you specify the
58 | markup for the placeholders and the data rows. You should use CSS styles
59 | to ensure that the height of the placeholder equals row height times
60 | block size.
61 |
62 | Please have a look at the [OegyScroll demo][] and I'm sure you'll get
63 | the idea. If you do a full checkout of OegyScroll, you'll also get the
64 | runnable demo, which has a "run" script for running it in Jetty.
65 |
66 | [DataView]: http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/repeater/data/DataView.html
67 | [IDataProvider]: http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/repeater/data/IDataProvider.html
68 | [ListDataProvider]: http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/repeater/data/ListDataProvider.html
69 | [OegyScroll demo]: https://github.com/reaktor/oegyscroll/tree/master/oegyscroll-demo
70 |
71 | How Does It Work?
72 | -----------------
73 |
74 | It splits your data into blocks of 100 items (yes, you can specify block
75 | size too) and at first, only shows a bunch of rows (actually the
76 | remainder of rowcount divided by block size). For the rest of the rows,
77 | it puts placeholder components in the markup and replaces them with
78 | actual rows when the placeholder gets visible in the browser. The
79 | visibility check is done using a piece of javascript that is run once a
80 | second and checks if there are placeholders that should be replaced with
81 | data rows. The javascript invokes the onclick behaviour attached to the
82 | placeholder, and the behavior replaces the placeholder with row data
83 | using Ajax.
84 |
85 | Developers
86 | ----------
87 |
88 | * Juha Paananen
89 | * Antti Viljakainen
90 |
91 | Version Control
92 | ---------------
93 |
94 | * Github: [https://github.com/reaktor/oegyscroll](https://github.com/reaktor/oegyscroll)
95 | * git: `git://github.com/reaktor/oegyscroll.git`
96 |
97 |
98 | License
99 | -------
100 |
101 | Copyright © 2009 original author or authors
102 |
103 | OegyScroll is Licensed under the
104 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
105 |
--------------------------------------------------------------------------------
/backlog.txt:
--------------------------------------------------------------------------------
1 | - IE testing for the new javascript implementation
2 | - Where to deploy the javascripts?
3 | - Make Wicket code append all the required attributes
4 | - Use "onscroll" event or equivalent where applicable
5 |
--------------------------------------------------------------------------------
/deploy-standalone-demo:
--------------------------------------------------------------------------------
1 | DEST=valtone.com:juhajasatu.com/html
2 | JS_SOURCE=oegyscroll/src/main/java/org/laughingpanda/wicket
3 | scp -r standalone-demo/* $DEST/oegydemo
4 | scp $JS_SOURCE/oegyscroll.js $DEST/oegyscroll
5 | scp $JS_SOURCE/oegyscroll-updater.js $DEST/oegyscroll
6 |
--------------------------------------------------------------------------------
/oegyscroll-demo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | org.laughingpanda.oegyscroll
4 | oegyscroll-demo
5 | war
6 | 1.15-SNAPSHOT
7 | oegyscroll-demo
8 | https://github.com/reaktor/oegyscroll
9 |
10 |
11 | org.laughingpanda.oegyscroll
12 | oegyscroll
13 | 1.15-SNAPSHOT
14 |
15 |
16 |
17 | oegyscroll-demo
18 |
19 |
20 | org.apache.maven.plugins
21 | maven-compiler-plugin
22 |
23 | 1.5
24 | 1.5
25 |
26 |
27 |
28 |
29 |
30 | src/main/java
31 |
32 | **/*.java
33 |
34 |
35 |
36 |
37 |
38 |
39 | Laughing Panda SCP
40 | Laughing Panda
41 | scpexe://maven.laughingpanda.org:/var/www/maven.laughingpanda.org/maven2
42 |
43 |
44 | Laughing Panda SCP
45 | Laughing Panda
46 | scpexe://maven.laughingpanda.org:/var/www/maven.laughingpanda.org/maven2/snapshots
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/oegyscroll-demo/run:
--------------------------------------------------------------------------------
1 | mvn org.mortbay.jetty:maven-jetty-plugin:6.1.14:run
2 |
--------------------------------------------------------------------------------
/oegyscroll-demo/src/main/java/org/laughingpanda/oegyscrolldemo/OegyScrollDemoApplication.java:
--------------------------------------------------------------------------------
1 | package org.laughingpanda.oegyscrolldemo;
2 |
3 | import org.apache.wicket.Page;
4 | import org.apache.wicket.protocol.http.WebApplication;
5 |
6 | public class OegyScrollDemoApplication extends WebApplication {
7 | @Override
8 | public Class extends Page> getHomePage() {
9 | return OegyScrollDemoPage.class;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/oegyscroll-demo/src/main/java/org/laughingpanda/oegyscrolldemo/OegyScrollDemoPage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
14 |
15 |
38 | Refresh
39 |
40 |
--------------------------------------------------------------------------------
/oegyscroll-demo/src/main/java/org/laughingpanda/oegyscrolldemo/OegyScrollDemoPage.java:
--------------------------------------------------------------------------------
1 | package org.laughingpanda.oegyscrolldemo;
2 |
3 | import java.util.Iterator;
4 |
5 | import org.apache.wicket.ajax.AjaxRequestTarget;
6 | import org.apache.wicket.ajax.markup.html.AjaxLink;
7 | import org.apache.wicket.markup.html.WebMarkupContainer;
8 | import org.apache.wicket.markup.html.WebPage;
9 | import org.apache.wicket.markup.html.basic.Label;
10 | import org.apache.wicket.markup.repeater.data.IDataProvider;
11 | import org.apache.wicket.model.IModel;
12 | import org.apache.wicket.model.Model;
13 | import org.laughingpanda.wicket.LazyLoadScrollableList;
14 |
15 | public class OegyScrollDemoPage extends WebPage {
16 | private final class SampleDataProvider implements
17 | IDataProvider {
18 | private final int size;
19 |
20 | private SampleDataProvider(int size) {
21 | this.size = size;
22 | }
23 |
24 | public Iterator extends String> iterator(final int first, final int count) {
25 | return new Iterator() {
26 | int index = first;
27 |
28 | public boolean hasNext() {
29 | return index < first + count;
30 | }
31 |
32 | public String next() {
33 | try {
34 | return "Row " + index + " of sample data set";
35 | } finally {
36 | index++;
37 | }
38 | }
39 |
40 | public void remove() {
41 | throw new UnsupportedOperationException();
42 | }};
43 | }
44 |
45 | public IModel model(String object) {
46 | return new Model(object);
47 | }
48 |
49 | public int size() {
50 | return size;
51 | }
52 |
53 | public void detach() {
54 | }
55 | }
56 |
57 | static int counter = 0;
58 |
59 |
60 | public OegyScrollDemoPage() {
61 | this(100000, 100);
62 | }
63 |
64 | public OegyScrollDemoPage(final int size, final int blockSize) {
65 | final LazyLoadScrollableList scroller = new LazyLoadScrollableList("djuizyScroller", new SampleDataProvider(size), blockSize) {
66 | @Override
67 | protected void populateRow(final WebMarkupContainer rowContainer, final int index, final String modelObject) {
68 | rowContainer.add(new Label("rowLabel", new Model(modelObject)));
69 | }
70 | };
71 | add(scroller);
72 |
73 | add(new AjaxLink