Source Code Cross Referenced for Item.java in  » J2EE » wicket » wicket » extensions » markup » html » repeater » refreshing » 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 » J2EE » wicket » wicket.extensions.markup.html.repeater.refreshing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Item.java 458267 2005-12-09 07:31:35Z ivaynberg $
003:         * $Revision: 458267 $
004:         * $Date: 2005-12-09 08:31:35 +0100 (Fri, 09 Dec 2005) $
005:         *
006:         * ====================================================================
007:         * Licensed under the Apache License, Version 2.0 (the "License");
008:         * you may not use this file except in compliance with the License.
009:         * You may obtain a copy of the License at
010:         *
011:         *  http://www.apache.org/licenses/LICENSE-2.0
012:         *
013:         * Unless required by applicable law or agreed to in writing, software
014:         * distributed under the License is distributed on an "AS IS" BASIS,
015:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016:         * See the License for the specific language governing permissions and
017:         * limitations under the License.
018:         */
019:        package wicket.extensions.markup.html.repeater.refreshing;
020:
021:        import java.util.Comparator;
022:
023:        import wicket.markup.html.WebMarkupContainer;
024:        import wicket.model.IModel;
025:        import wicket.version.undo.Change;
026:
027:        /**
028:         * Container that holds components in a RefreshingView. One Item represents one
029:         * entire row of the view. Users should add all containing components to the
030:         * Item instead of the view, this is accomplished by implementing
031:         * refreshingView.populateItem(Item item).
032:         * 
033:         * @see RefreshingView
034:         * 
035:         * @author Igor Vaynberg (ivaynberg)
036:         */
037:        public class Item extends WebMarkupContainer {
038:            private static final long serialVersionUID = 1L;
039:
040:            /** relative index of this item */
041:            private int index;
042:
043:            /**
044:             * @param id
045:             *            component id
046:             * @param index
047:             *            relative index of this item in the pageable view
048:             * @param model
049:             *            model for this item
050:             */
051:            public Item(final String id, int index, final IModel model) {
052:                super (id, model);
053:                this .index = index;
054:            }
055:
056:            /**
057:             * Sets the index of this item
058:             * 
059:             * @param index
060:             *            new index
061:             */
062:            public void setIndex(int index) {
063:                if (this .index != index) {
064:                    if (isVersioned()) {
065:                        addStateChange(new Change() {
066:                            final int oldIndex = Item.this .index;
067:                            private static final long serialVersionUID = 1L;
068:
069:                            public void undo() {
070:                                Item.this .index = oldIndex;
071:                            }
072:
073:                            public String toString() {
074:                                return "IndexChange[component: " + getPath()
075:                                        + ", index: " + oldIndex + "]";
076:                            }
077:                        });
078:                    }
079:                    this .index = index;
080:                }
081:            }
082:
083:            /**
084:             * @return the index assigned to this item
085:             */
086:            public int getIndex() {
087:                return index;
088:            }
089:
090:            /**
091:             * @return the primary key assigned to this item
092:             */
093:            public String getPrimaryKey() {
094:                return getId();
095:            }
096:
097:            /**
098:             * Comparator that compares Items by their index property
099:             * 
100:             * @author Igor Vaynberg (ivaynberg)
101:             * 
102:             */
103:            public static class IndexComparator implements  Comparator {
104:                private static final Comparator instance = new IndexComparator();
105:
106:                /**
107:                 * @return static instance of the comparator
108:                 */
109:                public static final Comparator getInstance() {
110:                    return instance;
111:                }
112:
113:                /**
114:                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
115:                 */
116:                public int compare(Object o1, Object o2) {
117:                    Item lhs = (Item) o1;
118:                    Item rhs = (Item) o2;
119:                    return lhs.getIndex() - rhs.getIndex();
120:                }
121:
122:            };
123:
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.