Source Code Cross Referenced for Rows.java in  » Ajax » zk » org » zkoss » zul » 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 » Ajax » zk » org.zkoss.zul 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Rows.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Tue Oct 25 16:02:39     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2005 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.zul;
020:
021:        import java.util.Set;
022:        import java.util.HashSet;
023:        import java.util.Iterator;
024:
025:        import org.zkoss.zk.ui.Component;
026:        import org.zkoss.zk.ui.UiException;
027:        import org.zkoss.zk.ui.ext.render.Cropper;
028:
029:        import org.zkoss.zul.impl.XulElement;
030:        import org.zkoss.zul.ext.Paginal;
031:
032:        /**
033:         * Defines the rows of a grid.
034:         * Each child of a rows element should be a {@link Row} element.
035:         *
036:         * @author tomyeh
037:         */
038:        public class Rows extends XulElement {
039:            /** Returns the grid that contains this rows.
040:             * <p>It is the same as {@link #getParent}.
041:             */
042:            public Grid getGrid() {
043:                return (Grid) getParent();
044:            }
045:
046:            //Paging//
047:            /** Returns the index of the first visible child.
048:             * <p>Used only for component development, not for application developers.
049:             */
050:            public int getVisibleBegin() {
051:                final Grid grid = getGrid();
052:                if (grid == null || !grid.inPagingMold())
053:                    return 0;
054:                final Paginal pgi = grid.getPaginal();
055:                return pgi.getActivePage() * pgi.getPageSize();
056:            }
057:
058:            /** Returns the index of the last visible child.
059:             * <p>Used only for component development, not for application developers.
060:             */
061:            public int getVisibleEnd() {
062:                final Grid grid = getGrid();
063:                if (grid == null || !grid.inPagingMold())
064:                    return Integer.MAX_VALUE;
065:                final Paginal pgi = grid.getPaginal();
066:                return (pgi.getActivePage() + 1) * pgi.getPageSize() - 1; //inclusive
067:            }
068:
069:            //-- Component --//
070:            public void setParent(Component parent) {
071:                if (parent != null && !(parent instanceof  Grid))
072:                    throw new UiException("Unsupported parent for rows: "
073:                            + parent);
074:                super .setParent(parent);
075:            }
076:
077:            public boolean insertBefore(Component child, Component insertBefore) {
078:                if (!(child instanceof  Row))
079:                    throw new UiException("Unsupported child for rows: "
080:                            + child);
081:                return super .insertBefore(child, insertBefore);
082:            }
083:
084:            public void onChildAdded(Component child) {
085:                super .onChildAdded(child);
086:
087:                final Grid grid = getGrid();
088:                if (grid != null && grid.inPagingMold())
089:                    grid.getPaginal().setTotalSize(getChildren().size());
090:            }
091:
092:            public void onChildRemoved(Component child) {
093:                super .onChildRemoved(child);
094:
095:                final Grid grid = getGrid();
096:                if (grid != null && grid.inPagingMold())
097:                    grid.getPaginal().setTotalSize(getChildren().size());
098:            }
099:
100:            //-- ComponentCtrl --//
101:            protected Object newExtraCtrl() {
102:                return new ExtraCtrl();
103:            }
104:
105:            /** A utility class to implement {@link #getExtraCtrl}.
106:             * It is used only by component developers.
107:             */
108:            protected class ExtraCtrl extends XulElement.ExtraCtrl implements 
109:                    Cropper {
110:                //--Cropper--//
111:                public boolean isCropper() {
112:                    final Grid grid = getGrid();
113:                    return grid != null && grid.inPagingMold();
114:                }
115:
116:                public Set getAvailableAtClient() {
117:                    final Grid grid = getGrid();
118:                    if (grid == null || !grid.inPagingMold())
119:                        return null;
120:
121:                    final Set avail = new HashSet(37);
122:                    final Paginal pgi = grid.getPaginal();
123:                    int pgsz = pgi.getPageSize();
124:                    final int ofs = pgi.getActivePage() * pgsz;
125:                    for (final Iterator it = getChildren().listIterator(ofs); --pgsz >= 0
126:                            && it.hasNext();)
127:                        avail.add(it.next());
128:                    return avail;
129:                }
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.