Source Code Cross Referenced for ListItem.java in  » Portal » Open-Portal » ob » listbox » 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 » Portal » Open Portal » ob.listbox 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Stingray Software Objective Blend
003:         * Copyright (C) 1997 Stingray Software, Inc.
004:         * All Rights Reserved
005:         *
006:         * This source code is only intended as a supplement to
007:         * the Stingray Objective Blend product.  See the Objective
008:         * Blend html help documentation for detailed information regarding
009:         * using OB classes.
010:         *
011:         * Author : Kerry Smith
012:         * Description : ListItem.java - list box
013:         *
014:         * CHANGELOG:
015:         * 7/09/96 	LFW	Created
016:         * 3/12/97  JDK1.1
017:         *
018:         */
019:
020:        /**
021:         ListItem
022:
023:         This class is used exclusively with the ListBox (and its subclasses)
024:         to describe data associated with a row of data in the ListBox.  The
025:         ListItem class itself contains additional property information and
026:         describes the content of a single column of the row (typically the leftmost column,
027:         or column 0).  The ListItem contains a Vectored list of "subitems" which
028:         contain information about the multiple columns of data in the ListItem row.
029:
030:         @author Copyright (c) 1997 Stingray Software, Inc., All Rights Reserved
031:         @see ob.listbox.ListBox
032:         @see ob.listbox.ListSubItem
033:         */package ob.listbox;
034:
035:        import java.awt.*;
036:        import com.sun.portal.log.common.PortalLogger;
037:        import java.awt.event.*;
038:        import java.io.Serializable;
039:        import java.util.*;
040:        import ob.obbase.*;
041:        import ob.text.*;
042:
043:        // Class used for listbox items
044:        public class ListItem implements  Serializable {
045:            protected Vector m_arrSubItems = new Vector();// item's subitems
046:            protected String m_pszText = ""; // item text
047:            protected int m_nImage = -1; // image index
048:            protected int m_nCY = ListBox.LVXC_UNINITIALIZED; // height uninitialized
049:            // int m_nFmt = ListBox.FMT_LEFT;
050:            protected Rectangle m_rcText = new Rectangle();
051:            protected Rectangle m_rcIcon = new Rectangle();
052:            protected Font m_fonFont = null;
053:            protected Object m_objData;
054:
055:            // state and stateEx info
056:            protected boolean m_bIsSelected = false;
057:            protected boolean m_bIsDropHiLited = false;
058:            protected boolean m_bIsFocused = false;
059:            protected boolean m_bIsMarked = false;
060:            protected boolean m_bIsDisabled = false;
061:
062:            /**
063:             * retrieves the text of the ListItem
064:             * @return text as type String
065:             */
066:            public String getText() {
067:                return m_pszText;
068:            }
069:
070:            /**
071:             * set text bounds of the ListItem
072:             * @param x x coordinate
073:             * @param y y coordinate
074:             * @param width width
075:             * @param height height
076:             */
077:            public void setTextBounds(int x, int y, int width, int height) {
078:                m_rcText.setBounds(x, y, width, height);
079:            }
080:
081:            /**
082:             * sets the space for the text height
083:             * @param h height as type int
084:             */
085:            public void setTextHeight(int h) {
086:                m_rcText.height = h;
087:            }
088:
089:            /**
090:             * sets the boundaries of the text region
091:             * @param r rectangle boundary
092:             */
093:            public void setTextBounds(Rectangle r) {
094:                m_rcText = r;
095:            }
096:
097:            /**
098:             * sets up a vector of subitems for the ListItem
099:             * @param subItems stored in a Vector
100:             */
101:            public void setSubItems(Vector subItems) {
102:                m_arrSubItems = subItems;
103:            }
104:
105:            /**
106:             * sets the y coordinate of the image
107:             * @param newY the new y coordinate offset in pixels
108:             */
109:            public void setImageYPos(int newY) {
110:                m_rcIcon.y = newY;
111:            }
112:
113:            /**
114:             * sets the height of the ListItem
115:             * @param nNewHeight height in pixels
116:             */
117:            public void setHeight(int nNewHeight) {
118:                m_nCY = nNewHeight;
119:            }
120:
121:            /**
122:             * sets a reference image for the item
123:             * @param id reference to image list as type int
124:             */
125:            public void setImage(int id) {
126:                m_nImage = id;
127:            }
128:
129:            /**
130:             * retrieves the image reference for this ListItem
131:             * @return image reference as type int
132:             */
133:            public int getImage() {
134:                return m_nImage;
135:            }
136:
137:            /**
138:             * retrieves the boundary of the text area for the ListItem
139:             * @return text area as type Rectangle
140:             */
141:            public Rectangle getTextBounds() {
142:                return m_rcText;
143:            }
144:
145:            /**
146:             * retrieves the boundary for the image area for the ListItem
147:             * @return image area as type Rectangle
148:             */
149:            public Rectangle getImageBounds() {
150:                return m_rcIcon;
151:            }
152:
153:            /**
154:             * retrieves the pixel height of the ListItem
155:             * @return height as type int
156:             */
157:            public int getHeight() {
158:                return m_nCY;
159:            }
160:
161:            /**
162:             * sets the boundaries of the image part of the ListItem.
163:             * @param img the boundary as type Rectangle
164:             */
165:            public void setImageBounds(Rectangle img) {
166:                m_rcIcon = img;
167:            }
168:
169:            /**
170:             * retrieves the font of the ListItem
171:             * @return font as type Font
172:             */
173:            public Font getFont() {
174:                return m_fonFont;
175:            }
176:
177:            /**
178:             * sets the font of the ListItem
179:             * @param f Font type
180:             */
181:            public void setFont(Font f) {
182:                m_fonFont = f;
183:            }
184:
185:            /**
186:             * copies the data of another ListItem
187:             * @param item ListItem to copy from
188:             */
189:            public void copy(ListItem item) {
190:                m_arrSubItems = (Vector) ((item.m_arrSubItems).clone());
191:                m_pszText = new String(item.m_pszText);
192:                m_nImage = item.m_nImage;
193:                m_nCY = item.m_nCY;
194:                m_rcText = item.m_rcText;
195:                m_rcIcon = item.m_rcIcon;
196:                m_fonFont = item.m_fonFont;
197:                m_bIsSelected = item.m_bIsSelected;
198:                m_bIsDropHiLited = item.m_bIsDropHiLited;
199:                m_bIsFocused = item.m_bIsFocused;
200:                m_bIsMarked = item.m_bIsMarked;
201:                m_bIsDisabled = item.m_bIsDisabled;
202:
203:            }
204:
205:            /**
206:             * set text for the ListItem's main column (usually column 0)
207:             * @param s text as type String
208:             */
209:            public void setText(String s) {
210:                m_pszText = s;
211:            }
212:
213:            /**
214:             * An individual item can store an additional data member with it
215:             * which is independent to what is displayed.  This method will
216:             * retrieve that data as type Object.
217:             * @return data as type Object
218:             */
219:            public Object getItemData() {
220:                return m_objData;
221:            }
222:
223:            /**
224:             * A ListItem can store an additional piece of data (derived from Object)
225:             * which is independent of the display.
226:             * @param obj data piece as type Object
227:             */
228:            public void setItemData(Object obj) {
229:                m_objData = obj;
230:            }
231:
232:            /**
233:             * A ListItem is a container of several other ListSubItem
234:             * instances (which correspond to the individual columns of the row
235:             * described by the ListItem).  This method will retrieve those
236:             * elements of the ListSubItems.
237:             * @param iSubItem which column you wish to retrieve the ListSubItem for
238:             * @return the ListSubItem retrieved
239:             */
240:            public ListSubItem getSubItem(int iSubItem) {
241:
242:                if ((iSubItem - 1) < m_arrSubItems.size())
243:                    return (ListSubItem) m_arrSubItems.elementAt(iSubItem - 1);
244:                else
245:                    return null;
246:            }
247:
248:            /**
249:             * deletes a subitem from the ListItem.
250:             * @param iSubItem which subitem to delete
251:             * @return whether item was successfully deleted or not
252:             */
253:            public boolean deleteSubItem(int iSubItem) {
254:                if ((iSubItem - 1) < m_arrSubItems.size()) {
255:                    m_arrSubItems.removeElementAt(iSubItem - 1);
256:                    return true;
257:                } else
258:                    return false;
259:            }
260:
261:            /**
262:             * appends a ListSubItem onto the ListItem.
263:             * @param subItem which ListSubItem to add on
264:             */
265:            public void addSubItem(ListSubItem subItem) {
266:                // ignored some callback stuff here
267:                m_arrSubItems.addElement(subItem);
268:            }
269:
270:            /**
271:             * creates a new subitem based on the String value passed in,
272:             * and appends it to the current ListItem.
273:             * @param subitem the text for the new subitem as type String
274:             */
275:            public void addSubItem(String subitem) {
276:                ListSubItem sub = new ListSubItem(subitem);
277:                addSubItem(sub);
278:            }
279:
280:            /**
281:             * appends a blank sub item to the end of the ListItem.
282:             */
283:            public void addSubItem() {
284:                ListSubItem sub = new ListSubItem();
285:                addSubItem(sub);
286:            }
287:
288:            /**
289:             * retrieves the number of subitems in this ListItem.
290:             * @return number of subitems as type int.
291:             */
292:            public int getSubItemCount() {
293:                return m_arrSubItems.size();
294:            }
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.