01: /* PageSizeEvent.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Sat Jun 30 21:02:06 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zul.event;
20:
21: import org.zkoss.zk.ui.Component;
22: import org.zkoss.zk.ui.event.Event;
23:
24: import org.zkoss.zul.ext.Pageable;
25: import org.zkoss.zul.ext.Paginal;
26:
27: /**
28: * Used to notify that the page size is changed (by the user), or by
29: * {@link Paginal} (such as {@link org.zkoss.zul.Paging}).
30: *
31: * @author tomyeh
32: * @since 2.4.1
33: */
34: public class PageSizeEvent extends Event {
35: private final Pageable _pgi;
36: private final int _pgsz;
37:
38: /** Construct a page size event.
39: *
40: * @param target the target must be a paginal component, i.e.,
41: * implements {@link Pageable}.
42: * @param pgsz the new page size
43: */
44: public PageSizeEvent(String name, Component target, int pgsz) {
45: super (name, target);
46: _pgi = (Pageable) target;
47: _pgsz = pgsz;
48: }
49:
50: /** Construct a page size event that the target is different
51: * from the page controller.
52: *
53: * @param target the event target
54: * @param pageable the paging controller. In other words,
55: * it is usually {@link Paginal}.
56: */
57: public PageSizeEvent(String name, Component target,
58: Pageable pageable, int pgsz) {
59: super (name, target);
60: _pgi = pageable;
61: _pgsz = pgsz;
62: }
63:
64: /** Returns the pageable controller.
65: */
66: public Pageable getPageable() {
67: return _pgi;
68: }
69:
70: /** Returns the page size.
71: * <p>It is the same as {@link #getPageable}'s {@link Pageable#getPageSize}.
72: */
73: public int getPageSize() {
74: return _pgsz;
75: }
76: }
|