Source Code Cross Referenced for ApplicationView.java in  » IDE-Netbeans » uml » org » netbeans » modules » uml » ui » products » ad » application » 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 » uml » org.netbeans.modules.uml.ui.products.ad.application 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.uml.ui.products.ad.application;
043:
044:        import java.awt.BorderLayout;
045:        import java.awt.event.MouseAdapter;
046:        import java.awt.event.MouseEvent;
047:        import java.awt.event.MouseListener;
048:        import java.awt.Component;
049:        import javax.swing.BoxLayout;
050:
051:        import javax.swing.JToolBar;
052:        import javax.swing.Icon;
053:        import javax.swing.JMenu;
054:        import javax.swing.JPanel;
055:        import javax.swing.JPopupMenu;
056:
057:        import org.netbeans.modules.uml.ui.swing.plaf.basic.BasicPullDownButtonBorder;
058:        import org.netbeans.modules.uml.ui.swing.pulldownbutton.JPullDownButton;
059:        import org.netbeans.modules.uml.ui.swing.pulldownbutton.PopupMenuInvoker;
060:        import org.netbeans.modules.uml.ui.swing.testbed.addin.menu.TestBedMenuManager;
061:
062:        /**
063:         * 
064:         * @author Trey Spiva
065:         */
066:        public abstract class ApplicationView extends JPanel {
067:            private String m_Title = "";
068:            private Icon m_Icon = null;
069:            private String m_ToolTip = null;
070:            private String m_Id = "";
071:            private JToolBar m_ToolBarManager = null;
072:
073:            // IZ# 78924 - conover: needed to be a panel to left align the toolbar
074:            //                      wasn't working as a Box for some reason
075:            // private Box m_ToolComponent = Box.createHorizontalBox();
076:            private JPanel m_ToolComponent;
077:
078:            public ApplicationView(String id) {
079:                setId(id);
080:            }
081:
082:            public JPanel getView() {
083:                setLayout(new BorderLayout());
084:
085:                JPanel viewSite = new JPanel();
086:                createViewControl(viewSite);
087:                add(viewSite, BorderLayout.CENTER);
088:                setPopupMenuListener(new PopupMenuManager(viewSite));
089:                initializeUIBars(this );
090:
091:                return this ;
092:            }
093:
094:            public PopupMenuManager getPopupMenuManager(JPanel panel) {
095:                return new PopupMenuManager(panel);
096:            }
097:
098:            protected void initializeUIBars(JPanel view) {
099:                // IZ# 78924 - conover: layout the toolbar panel to left align the icons
100:
101:                m_ToolComponent = new JPanel();
102:                BoxLayout boxlayout = new BoxLayout(m_ToolComponent,
103:                        BoxLayout.X_AXIS);
104:                m_ToolComponent.setLayout(boxlayout);
105:
106:                JToolBar bar = new JToolBar();
107:                bar.setFloatable(false);
108:                m_ToolBarManager = bar;
109:
110:                TestBedMenuManager menuManager = new TestBedMenuManager();
111:                JMenu menu = new JMenu();
112:                menuManager.setMenuItem(menu);
113:
114:                contributeActionBars(m_ToolBarManager);
115:
116:                m_ToolComponent.add(m_ToolBarManager);
117:                menuManager.createMenuBar();
118:
119:                if (menu.getItemCount() > 0) {
120:                    JPullDownButton btn = new JPullDownButton();
121:                    btn.setBorder(new BasicPullDownButtonBorder(false));
122:                    btn.setPulldownInvoker(new PopupMenuInvoker(menu
123:                            .getPopupMenu()));
124:                    m_ToolComponent.add(btn);
125:                }
126:
127:                view.add(m_ToolComponent, BorderLayout.NORTH);
128:            }
129:
130:            public abstract void createViewControl(JPanel parent);
131:
132:            protected void contributeActionBars(JToolBar bars) {
133:            }
134:
135:            public void setPopupMenuListener(MouseListener listener) {
136:            }
137:
138:            //**************************************************
139:            // Context Menu Methods
140:            //**************************************************
141:            //   private PopupMenuExtender  m_ContextMenu        = null;
142:            private TestBedMenuManager m_ContextMenuManager = null;
143:            private JMenu m_ContextPopup = new JMenu();
144:
145:            public void registerContextMenu(boolean clearBeforeShow) {
146:                //      registerContextMenu(getId(), clearBeforeShow, prov);
147:                registerContextMenu(getId(), clearBeforeShow);
148:            }
149:
150:            public void registerContextMenu(String id, boolean clearBeforeShow) {
151:                m_ContextMenuManager = new TestBedMenuManager();
152:                m_ContextMenuManager.setRemoveAllWhenShown(clearBeforeShow);
153:
154:                m_ContextMenuManager.setMenuItem(m_ContextPopup);
155:                //      m_ContextMenu = new PopupMenuExtender(id, m_ContextMenuManager, prov, this);      
156:            }
157:
158:            /**
159:             * This method should be over ridden by any subclass which wants to contribute items to the menu
160:             * 
161:             */
162:            public void menuAboutToShow(IMenuManager manager) {
163:            }
164:
165:            /**
166:             * This method should be overridden by any subclass that wants to remove any items from the context menu.
167:             * @param manager
168:             */
169:            public void processRemovesIfAny(IMenuManager manager) {
170:            }
171:
172:            //**************************************************
173:            // Data Access Methods
174:            //**************************************************
175:
176:            /**
177:             * @return
178:             */
179:            public String getTitle() {
180:                return m_Title;
181:            }
182:
183:            /**
184:             * @param string
185:             */
186:            public void setTitle(String string) {
187:                m_Title = string;
188:            }
189:
190:            /**
191:             * @return
192:             */
193:            public Icon getIcon() {
194:                return m_Icon;
195:            }
196:
197:            /**
198:             * @param icon
199:             */
200:            public void setIcon(Icon icon) {
201:                m_Icon = icon;
202:            }
203:
204:            /**
205:             * @return
206:             */
207:            public String getToolTip() {
208:                return m_ToolTip;
209:            }
210:
211:            /**
212:             * @param string
213:             */
214:            public void setToolTip(String string) {
215:                m_ToolTip = string;
216:            }
217:
218:            /**
219:             * @return
220:             */
221:            public String getId() {
222:                return m_Id;
223:            }
224:
225:            /**
226:             * @param string
227:             */
228:            public void setId(String string) {
229:                m_Id = string;
230:            }
231:
232:            public class PopupMenuManager extends MouseAdapter {
233:                JPanel m_View = null;
234:
235:                public PopupMenuManager(JPanel view) {
236:                    m_View = view;
237:                }
238:
239:                /* (non-Javadoc)
240:                 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
241:                 */
242:                public void mouseReleased(MouseEvent e) {
243:                    // Some Operating Systems will show the popupmenu on the mouse
244:                    // down and some will show it on the mouse up.
245:                    showPopupMenu(e);
246:                }
247:
248:                public void showPopupMenu(Component c) {
249:
250:                    if (m_ContextMenuManager.getRemoveAllWhenShown() == true) {
251:                        m_ContextMenuManager.removeAll();
252:                        m_ContextPopup.removeAll();
253:                    }
254:
255:                    menuAboutToShow(m_ContextMenuManager);
256:                    processRemovesIfAny(m_ContextMenuManager);
257:
258:                    //            m_ContextMenu.menuAboutToShow(m_ContextMenuManager);
259:                    m_ContextMenuManager.createMenuBar();
260:                    JPopupMenu menu = m_ContextPopup.getPopupMenu();
261:                    menu.show(c, c.getLocation().x, c.getLocation().y);
262:                }
263:
264:                private boolean showPopupMenu(MouseEvent e) {
265:                    boolean retVal = e.isPopupTrigger();
266:
267:                    if (retVal == true) {
268:                        if (m_ContextMenuManager.getRemoveAllWhenShown() == true) {
269:                            m_ContextMenuManager.removeAll();
270:                            m_ContextPopup.removeAll();
271:                        }
272:
273:                        menuAboutToShow(m_ContextMenuManager);
274:                        processRemovesIfAny(m_ContextMenuManager);
275:
276:                        //            m_ContextMenu.menuAboutToShow(m_ContextMenuManager);
277:                        m_ContextMenuManager.createMenuBar();
278:                        JPopupMenu menu = m_ContextPopup.getPopupMenu();
279:                        Component source = e.getComponent();
280:                        menu.show(source, e.getX(), e.getY());
281:                    } else {
282:                        super .mousePressed(e);
283:                    }
284:
285:                    return retVal;
286:                }
287:
288:                /* (non-Javadoc)
289:                 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
290:                 */
291:                public void mousePressed(MouseEvent e) {
292:                    // Some Operating Systems will show the popupmenu on the mouse
293:                    // down and some will show it on the mouse up.
294:                    showPopupMenu(e);
295:                }
296:
297:            }
298:
299:        }
w__w_w_.___j___a_va__2___s___.c__om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.