Source Code Cross Referenced for PopupItem.java in  » UML » jrefactory » org » acm » seguin » completer » popup » 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 » UML » jrefactory » org.acm.seguin.completer.popup 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.acm.seguin.completer.popup;
002:
003:        import org.acm.seguin.completer.Config;
004:        import org.acm.seguin.ide.jedit.Navigator.NavigatorLogger;
005:        import org.acm.seguin.completer.Completer;
006:        import org.acm.seguin.completer.info.*;
007:        import javax.swing.ImageIcon;
008:        import java.lang.reflect.*;
009:
010:        //import anthelper.utils.ReflectUtils;
011:
012:        /**
013:         * Description of the Class
014:         *
015:         * @author    btateyama@yahoo.com
016:         * @created   December 11, 2002
017:         */
018:        public abstract class PopupItem implements  Comparable {
019:            static final NavigatorLogger logger = Completer
020:                    .getLogger(PopupItem.class);
021:            // text to view in popup
022:            String _strData = null;
023:            String _strLeftText = "void";
024:            String _strFormattedString = null;
025:
026:            // text to insert
027:            String _strBeforeCaret = null;
028:            String _strAfterCaret = null;
029:            // underlying data source
030:            Object _objDataSource = null;
031:            // formatting info
032:            boolean _bUnderline = false;
033:            boolean _bBold = false;
034:            boolean _bLeftHighLight = true;
035:            ImageIcon _icon = null;
036:            int _iIconWidth = 0;
037:
038:            protected PopupItem() {
039:            }
040:
041:            void initFormatForMods(int argMods) {
042:                // perhaps add more here for bg color, etc.
043:                _bUnderline = Modifier.isStatic(argMods);
044:            }
045:
046:            /**
047:             * Gets the beforeCaretString attribute of the PopupItem object
048:             *
049:             * @return   The beforeCaretString value
050:             */
051:            public String getBeforeCaretString() {
052:                return _strBeforeCaret;
053:            }
054:
055:            /**
056:             * Gets the afterCaretString attribute of the PopupItem object
057:             *
058:             * @return   The afterCaretString value
059:             */
060:            public String getAfterCaretString() {
061:                return _strAfterCaret == null ? "" : _strAfterCaret;
062:            }
063:
064:            /**
065:             * Gets the icon attribute of the PopupItem object
066:             *
067:             * @return   The icon value
068:             */
069:            public ImageIcon getIcon() {
070:                return _icon;
071:            }
072:
073:            /**
074:             * Gets the returnType attribute of the PopupItem object
075:             *
076:             * @return   The returnType value
077:             */
078:            public String getLeftText() {
079:                return _strLeftText;
080:            }
081:
082:            /**
083:             * Gets the dataSource attribute of the PopupItem object
084:             *
085:             * @return   The dataSource value
086:             */
087:            public Object getDataSource() {
088:                return _objDataSource;
089:            }
090:
091:            /**
092:             * Description of the Method
093:             *
094:             * @return   Description of the Return Value1
095:             */
096:            public String toString() {
097:                return _strData;
098:            }
099:
100:            /**
101:             * Description of the Method
102:             *
103:             * @param argPadLen  Description of the Parameter
104:             * @return           Description of the Return Value
105:             */
106:            public String toString(int argPadLen) {
107:
108:                synchronized (this ) {
109:
110:                    if (_strFormattedString == null) {
111:                        StringBuffer sb = new StringBuffer();
112:                        if (getLeftText().length() != 0) {
113:                            // 1st pad to len
114:                            String strLeft = getLeftText();
115:                            for (int i = 0, l = argPadLen - strLeft.length(); i < l; i++) {
116:                                sb.append(" ");
117:                            }
118:                            sb.append(strLeft);
119:                        }
120:                        sb.append(_strData);
121:                        _strFormattedString = sb.toString();
122:                    }
123:                }
124:                return _strFormattedString;
125:            }
126:
127:            /**
128:             * Description of the Method
129:             *
130:             * @return   Description of the Return Value
131:             */
132:            public boolean underLine() {
133:                return _bUnderline;
134:            }
135:
136:            public boolean leftHighlight() {
137:                return _bLeftHighLight;
138:            }
139:
140:            /**
141:             * Gets the iconWidth attribute of the PopupItem object
142:             *
143:             * @return   The iconWidth value
144:             */
145:            public int getIconWidth() {
146:                return _iIconWidth;
147:            }
148:
149:            /**
150:             * Description of the Method
151:             *
152:             * @param obj  Description of the Parameter
153:             * @return     Description of the Return Value
154:             */
155:            public int compareTo(Object obj) {
156:                return (obj instanceof  PopupItem ? toString().compareTo(
157:                        obj.toString()) : -1);
158:            }
159:
160:            /**
161:             * Description of the Method
162:             *
163:             * @param obj  Description of the Parameter
164:             * @return     Description of the Return Value
165:             */
166:            public boolean equals(Object obj) {
167:                boolean bEq = obj == this ;
168:                if (!bEq && obj != null) {
169:                    PopupItem pi = (PopupItem) obj;
170:                    bEq = (pi.toString().equals(toString())
171:                            && pi.getBeforeCaretString().equals(
172:                                    getBeforeCaretString())
173:                            && pi.getAfterCaretString().equals(
174:                                    getAfterCaretString()) && pi
175:                            .getDataSource().equals(getDataSource()));
176:                }
177:                return bEq;
178:            }
179:
180:            static String getParamsDesc(String[] argParamTypes) {
181:                StringBuffer sb = new StringBuffer("(");
182:                for (int i = 0, l = argParamTypes.length; i < l; i++) {
183:                    sb.append(getPlainName(argParamTypes[i]));
184:                    if (i + 1 < l)
185:                        sb.append(",");
186:                }
187:                sb.append(")");
188:                return sb.toString();
189:            }
190:
191:            static String decodeTypeArray(char argChar) {
192:                String str = null;
193:                switch (argChar) {
194:                case 'B':
195:                    str = "byte";
196:                    break;
197:                case 'C':
198:                    str = "char";
199:                    break;
200:                case 'D':
201:                    str = "double";
202:                    break;
203:                case 'F':
204:                    str = "float";
205:                    break;
206:                case 'I':
207:                    str = "int";
208:                    break;
209:                case 'J':
210:                    str = "long";
211:                    break;
212:                case 'S':
213:                    str = "short";
214:                    break;
215:                case 'Z':
216:                    str = "boolean";
217:                    break;
218:                // ?? V void
219:                }
220:                return str;
221:            }
222:
223:            static String getPlainName(String argType) {
224:                StringBuffer sb = new StringBuffer();
225:                //logger.msg("type", argType);
226:                if (argType.startsWith("[")) {
227:                    //logger.msg("in stuff");
228:                    // it's an array of some kind and some dimension
229:                    StringBuffer sbDim = new StringBuffer();
230:                    for (int i = 0, l = argType.length(); i < l
231:                            && argType.charAt(i) == '['; i++) {
232:                        sbDim.append("[]");
233:                    }
234:
235:                    // we have accounted for dimension, now decode type
236:                    int iL = argType.indexOf("[L");
237:                    if (iL != -1) {
238:                        // we have a class of somekind
239:                        String strFullName = argType.substring(iL + 2, argType
240:                                .indexOf(";"));
241:                        sb.append(getPlainName(strFullName));
242:                    } else {
243:                        // we have a native type array (see Class.getName())
244:                        String strNativeType = decodeTypeArray(argType
245:                                .charAt(sbDim.length() / 2));
246:                        if (strNativeType != null) {
247:                            sb.append(strNativeType);
248:                        }
249:                    }
250:                    sb.append(sbDim.toString());
251:                } else {
252:                    sb.append(getPlainName(argType));
253:                }
254:                return sb.toString();
255:            }
256:
257:            public static String getPlainName2(String argName) {
258:                String strPlainName = argName.substring(argName
259:                        .lastIndexOf(".") + 1);
260:                //@REVIEW
261:                // We make a special case for the static field class.
262:                // It appears as class$<className with $ instead of .>
263:                // Ex: class$anthelper$ui$ConfigDialog
264:                if (strPlainName.startsWith("class$")) {
265:                    strPlainName = "class";
266:                }
267:                strPlainName = strPlainName.replace('$', '.');
268:                return strPlainName;
269:            }
270:
271:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.