Source Code Cross Referenced for PIMBrowserExample.java in  » IDE-Netbeans » mobility » pimbrowserexample » 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 » IDE Netbeans » mobility » pimbrowserexample 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2007, Sun Microsystems, Inc.
003:         * 
004:         * All rights reserved.
005:         * 
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         * 
010:         *     * Redistributions of source code must retain the above copyright
011:         *       notice, this list of conditions and the following disclaimer.
012:         *     * Redistributions in binary form must reproduce the above copyright
013:         *       notice, this list of conditions and the following disclaimer in
014:         *       the documentation and/or other materials provided with the
015:         *       distribution.
016:         *     * Neither the name of Sun Microsystems, Inc. nor the names of its
017:         *       contributors may be used to endorse or promote products derived
018:         *       from this software without specific prior written permission.
019:         * 
020:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
023:         * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
024:         * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027:         * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:         */
032:
033:        package pimbrowserexample;
034:
035:        import javax.microedition.midlet.*;
036:        import javax.microedition.lcdui.*;
037:        import javax.microedition.pim.PIM;
038:        import org.netbeans.microedition.lcdui.SplashScreen;
039:        import org.netbeans.microedition.lcdui.pda.PIMBrowser;
040:
041:        /**
042:         * @author devil
043:         * http://www.netbeans.org/kb/60/mobility/pimbrowser.html
044:         */
045:        public class PIMBrowserExample extends MIDlet implements 
046:                CommandListener {
047:
048:            private boolean midletPaused = false;
049:
050:            //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
051:            private Command exitCommand;
052:            private Alert alert;
053:            private PIMBrowser pimBrowser;
054:            private SplashScreen splashScreen;
055:
056:            //</editor-fold>//GEN-END:|fields|0|
057:
058:            /**
059:             * The PIMBrowserExample constructor.
060:             */
061:            public PIMBrowserExample() {
062:            }
063:
064:            //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
065:            //</editor-fold>//GEN-END:|methods|0|
066:
067:            //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
068:            /**
069:             * Initilizes the application.
070:             * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
071:             */
072:            private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
073:                // write pre-initialize user code here
074:                //GEN-LINE:|0-initialize|1|0-postInitialize
075:                // write post-initialize user code here
076:            }//GEN-BEGIN:|0-initialize|2|
077:
078:            //</editor-fold>//GEN-END:|0-initialize|2|
079:
080:            //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
081:            /**
082:             * Performs an action assigned to the Mobile Device - MIDlet Started point.
083:             */
084:            public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
085:                // write pre-action user code here
086:                switchDisplayable(null, getSplashScreen());//GEN-LINE:|3-startMIDlet|1|3-postAction
087:                // write post-action user code here
088:            }//GEN-BEGIN:|3-startMIDlet|2|
089:
090:            //</editor-fold>//GEN-END:|3-startMIDlet|2|
091:
092:            //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
093:            /**
094:             * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
095:             */
096:            public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
097:                // write pre-action user code here
098:                //GEN-LINE:|4-resumeMIDlet|1|4-postAction
099:                // write post-action user code here
100:            }//GEN-BEGIN:|4-resumeMIDlet|2|
101:
102:            //</editor-fold>//GEN-END:|4-resumeMIDlet|2|
103:
104:            //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
105:            /**
106:             * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
107:             * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
108:             * @param nextDisplayable the Displayable to be set
109:             */
110:            public void switchDisplayable(Alert alert,
111:                    Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
112:                // write pre-switch user code here
113:                Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
114:                if (alert == null) {
115:                    display.setCurrent(nextDisplayable);
116:                } else {
117:                    display.setCurrent(alert, nextDisplayable);
118:                }//GEN-END:|5-switchDisplayable|1|5-postSwitch
119:                // write post-switch user code here
120:            }//GEN-BEGIN:|5-switchDisplayable|2|
121:
122:            //</editor-fold>//GEN-END:|5-switchDisplayable|2|
123:
124:            //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
125:            /**
126:             * Called by a system to indicated that a command has been invoked on a particular displayable.
127:             * @param command the Command that was invoked
128:             * @param displayable the Displayable where the command was invoked
129:             */
130:            public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
131:                // write pre-action user code here
132:                if (displayable == pimBrowser) {//GEN-BEGIN:|7-commandAction|1|19-preAction
133:                    if (command == PIMBrowser.SELECT_PIM_ITEM) {//GEN-END:|7-commandAction|1|19-preAction
134:                        // write pre-action user code here
135:                        switchDisplayable(getAlert(), getPimBrowser());//GEN-LINE:|7-commandAction|2|19-postAction
136:                        // write post-action user code here
137:                    } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|3|27-preAction
138:                        // write pre-action user code here
139:                        exitMIDlet();//GEN-LINE:|7-commandAction|4|27-postAction
140:                        // write post-action user code here
141:                    }//GEN-BEGIN:|7-commandAction|5|15-preAction
142:                } else if (displayable == splashScreen) {
143:                    if (command == SplashScreen.DISMISS_COMMAND) {//GEN-END:|7-commandAction|5|15-preAction
144:                        // write pre-action user code here
145:                        switchDisplayable(null, getPimBrowser());//GEN-LINE:|7-commandAction|6|15-postAction
146:                        // write post-action user code here
147:                    }//GEN-BEGIN:|7-commandAction|7|7-postCommandAction
148:                }//GEN-END:|7-commandAction|7|7-postCommandAction
149:                // write post-action user code here
150:            }//GEN-BEGIN:|7-commandAction|8|
151:
152:            //</editor-fold>//GEN-END:|7-commandAction|8|
153:
154:            //<editor-fold defaultstate="collapsed" desc=" Generated Getter: splashScreen ">//GEN-BEGIN:|13-getter|0|13-preInit
155:            /**
156:             * Returns an initiliazed instance of splashScreen component.
157:             * @return the initialized component instance
158:             */
159:            public SplashScreen getSplashScreen() {
160:                if (splashScreen == null) {//GEN-END:|13-getter|0|13-preInit
161:                    // write pre-init user code here
162:                    splashScreen = new SplashScreen(getDisplay());//GEN-BEGIN:|13-getter|1|13-postInit
163:                    splashScreen.setTitle("splashScreen");
164:                    splashScreen.setCommandListener(this );
165:                    splashScreen.setText("PIM Browser Example");//GEN-END:|13-getter|1|13-postInit
166:                    // write post-init user code here
167:                }//GEN-BEGIN:|13-getter|2|
168:                return splashScreen;
169:            }
170:
171:            //</editor-fold>//GEN-END:|13-getter|2|
172:
173:            //<editor-fold defaultstate="collapsed" desc=" Generated Getter: pimBrowser ">//GEN-BEGIN:|17-getter|0|17-preInit
174:            /**
175:             * Returns an initiliazed instance of pimBrowser component.
176:             * @return the initialized component instance
177:             */
178:            public PIMBrowser getPimBrowser() {
179:                if (pimBrowser == null) {//GEN-END:|17-getter|0|17-preInit
180:                    // write pre-init user code here
181:                    pimBrowser = new PIMBrowser(getDisplay(), PIM.CONTACT_LIST);//GEN-BEGIN:|17-getter|1|17-postInit
182:                    pimBrowser.setTitle("pimBrowser");
183:                    pimBrowser.addCommand(PIMBrowser.SELECT_PIM_ITEM);
184:                    pimBrowser.addCommand(getExitCommand());
185:                    pimBrowser.setCommandListener(this );//GEN-END:|17-getter|1|17-postInit
186:                    // write post-init user code here
187:                }//GEN-BEGIN:|17-getter|2|
188:                return pimBrowser;
189:            }
190:
191:            //</editor-fold>//GEN-END:|17-getter|2|
192:
193:            //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|26-getter|0|26-preInit
194:            /**
195:             * Returns an initiliazed instance of exitCommand component.
196:             * @return the initialized component instance
197:             */
198:            public Command getExitCommand() {
199:                if (exitCommand == null) {//GEN-END:|26-getter|0|26-preInit
200:                    // write pre-init user code here
201:                    exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|26-getter|1|26-postInit
202:                    // write post-init user code here
203:                }//GEN-BEGIN:|26-getter|2|
204:                return exitCommand;
205:            }
206:
207:            //</editor-fold>//GEN-END:|26-getter|2|
208:
209:            //<editor-fold defaultstate="collapsed" desc=" Generated Getter: alert ">//GEN-BEGIN:|32-getter|0|32-preInit
210:            /**
211:             * Returns an initiliazed instance of alert component.
212:             * @return the initialized component instance
213:             */
214:            public Alert getAlert() {
215:                if (alert == null) {//GEN-END:|32-getter|0|32-preInit
216:                    // write pre-init user code here
217:                    alert = new Alert("alert", "Contact Selected", null, null);//GEN-BEGIN:|32-getter|1|32-postInit
218:                    alert.setTimeout(Alert.FOREVER);//GEN-END:|32-getter|1|32-postInit
219:                    // write post-init user code here
220:                }//GEN-BEGIN:|32-getter|2|
221:                return alert;
222:            }
223:
224:            //</editor-fold>//GEN-END:|32-getter|2|
225:
226:            /**
227:             * Returns a display instance.
228:             * @return the display instance.
229:             */
230:            public Display getDisplay() {
231:                return Display.getDisplay(this );
232:            }
233:
234:            /**
235:             * Exits MIDlet.
236:             */
237:            public void exitMIDlet() {
238:                switchDisplayable(null, null);
239:                destroyApp(true);
240:                notifyDestroyed();
241:            }
242:
243:            /**
244:             * Called when MIDlet is started.
245:             * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
246:             */
247:            public void startApp() {
248:                if (midletPaused) {
249:                    resumeMIDlet();
250:                } else {
251:                    initialize();
252:                    startMIDlet();
253:                }
254:                midletPaused = false;
255:            }
256:
257:            /**
258:             * Called when MIDlet is paused.
259:             */
260:            public void pauseApp() {
261:                midletPaused = true;
262:            }
263:
264:            /**
265:             * Called to signal the MIDlet to terminate.
266:             * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
267:             */
268:            public void destroyApp(boolean unconditional) {
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.