Source Code Cross Referenced for XListModelAdapter.java in  » XML-UI » XUI » net » xoetrope » xui » data » 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 » XML UI » XUI » net.xoetrope.xui.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.xui.data;
002:
003:        /**
004:         * <p>Adapts an XModel to provide access to child nodes as a list in a way that
005:         * is more convenient for use with UI components and so that some state
006:         * information can be maintained.</p>
007:         * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003<br>
008:         * License:      see license.txt
009:         * @version $Revision: 1.19 $
010:         */
011:        public class XListModelAdapter implements  XModelAdapter {
012:            protected XModel model;
013:            protected int columnIdx = -1;
014:
015:            /**
016:             * Constructs a new adapter for the specified model node.
017:             * @param the model node to adapt
018:             */
019:            public XListModelAdapter(XModel src) {
020:                model = src;
021:            }
022:
023:            /**
024:             * Constructs a new adapter.
025:             */
026:            public XListModelAdapter() {
027:            }
028:
029:            /**
030:             * Set the index of the column to use when getting values from this adapter
031:             * @param colIdx the (sero based) column index.
032:             */
033:            public void setKeyColumn(int colIdx) {
034:                columnIdx = colIdx;
035:            }
036:
037:            /**
038:             * Get the number of children belong to the model node that this object adapts
039:             * @return the number of children
040:             */
041:            public int getNumChildren() {
042:                return model.getNumChildren();
043:            }
044:
045:            /**
046:             * Gets the individual list item value
047:             * @param i The index of the listitem
048:             * @return The value of the listitem
049:             */
050:            public Object get(int i) {
051:                if (columnIdx >= 0)
052:                    return model.get(i).get(columnIdx);
053:                else
054:                    return model.get(i).get();
055:            }
056:
057:            /**
058:             * Set the value of the listitem
059:             * @param o The new value
060:             */
061:            public void set(Object o) {
062:                model.set(o);
063:            }
064:
065:            /**
066:             * Gets the value of the selected item from the list.
067:             * @return the selected list item/node
068:             */
069:            public Object getSelected() {
070:                return model.get();
071:            }
072:
073:            /**
074:             * Set the adapter source
075:             * @param src the model
076:             */
077:            public void setModel(XModel src) {
078:                model = src;
079:            }
080:
081:            /**
082:             * Get the model being used by this adapter
083:             * @return
084:             */
085:            public XModel getModel() {
086:                return model;
087:            }
088:
089:            /**
090:             * Gets the name of the model node
091:             * @return the name
092:             */
093:            public String getTagName() {
094:                return model.getAttribValueAsString(XBaseModel.ID_ATTRIBUTE);
095:            }
096:
097:            /**
098:             * Locate a key value in the underlying data source
099:             * @param key the key to locate
100:             * @param columnIdx the index of the key column
101:             * @return the row/record index taht contains the first instance of the key,
102:             * or -1 if the key is not found
103:             */
104:            public int find(String key, int columnIdx) {
105:                int numChildren = model.getNumChildren();
106:                for (int i = 0; i < numChildren; i++) {
107:                    String s = model.get(i).get(columnIdx).toString();
108:                    if (s.equals(key))
109:                        return i;
110:                }
111:                return -1;
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.