Source Code Cross Referenced for EditWinWidget.java in  » Report » datavision-1.1.0 » jimm » datavision » gui » 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 » Report » datavision 1.1.0 » jimm.datavision.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package jimm.datavision.gui;
002:
003:        import jimm.datavision.field.Field;
004:        import jimm.datavision.gui.cmd.WidgetRenameCommand;
005:        import java.awt.event.MouseEvent;
006:        import java.awt.event.ActionEvent;
007:        import javax.swing.JDialog;
008:
009:        /**
010:         *
011:         * An abstract superclass for widgets that open separate windows used to
012:         * edit the widget.
013:         *
014:         * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
015:         */
016:        public abstract class EditWinWidget extends FieldWidget {
017:
018:            protected JDialog editor;
019:
020:            /**
021:             * Constructor.
022:             *
023:             * @param sw section widget in which the field's new widget will reside
024:             * @param field a report field
025:             */
026:            EditWinWidget(SectionWidget sw, Field field) {
027:                super (sw, field);
028:            }
029:
030:            protected void addCustomPopupItems() {
031:                MenuUtils.addToMenu(this , popup, "EditWinWidget.popup_edit",
032:                        POPUP_FONT);
033:                MenuUtils.addToMenu(this , popup, "EditWinWidget.popup_rename",
034:                        POPUP_FONT);
035:                popup.addSeparator();
036:            }
037:
038:            /**
039:             * Performs some action based on the action command string (the menu
040:             * item text).
041:             */
042:            public void actionPerformed(ActionEvent e) {
043:                String command = e.getActionCommand();
044:                if (command == null)
045:                    return;
046:
047:                if ("edit".equals(command))
048:                    openEditor();
049:                else if ("rename".equals(command))
050:                    rename();
051:                else
052:                    super .actionPerformed(e);
053:            }
054:
055:            /**
056:             * if this is a double-click, start editing; else handle the mouse event
057:             * like a normal field widget.
058:             *
059:             * @param e mouse event
060:             */
061:            public void mouseClicked(MouseEvent e) {
062:                if (sectionWidget.designer.isPlacingNewTextField())
063:                    sectionWidget.createNewTextField(e);
064:                if (e.getClickCount() == 2)
065:                    openEditor();
066:                else
067:                    super .mouseClicked(e);
068:            }
069:
070:            /**
071:             * Makes our text editable and starts editing.
072:             */
073:            public void openEditor() {
074:                if (editor == null)
075:                    editor = createEditor();
076:                else
077:                    updateEditor();
078:                editor.setVisible(true);
079:                editor.toFront();
080:            }
081:
082:            /**
083:             * Creates and returns a new frame suitable for editing this widget.
084:             *
085:             * @return a frame (window or dialog) used to edit the widget
086:             */
087:            protected abstract JDialog createEditor();
088:
089:            /**
090:             * Updates the editor. This method supplies default do-nothing behavior.
091:             */
092:            protected void updateEditor() {
093:            }
094:
095:            /**
096:             * Opens a name editor.
097:             */
098:            protected void rename() {
099:                Designer designer = sectionWidget.designer;
100:                String name = new AskStringDialog(designer.getFrame(),
101:                        getEditorTitle(), getEditorLabel(), getWidgetName())
102:                        .getString();
103:                if (name != null)
104:                    designer.performCommand(new WidgetRenameCommand(this ,
105:                            getWidgetName(), name));
106:            }
107:
108:            /**
109:             * Returns the name string.
110:             *
111:             * @return the name to be edited
112:             */
113:            protected abstract String getWidgetName();
114:
115:            /**
116:             * Returns the name edit window's title.
117:             */
118:            protected abstract String getEditorTitle();
119:
120:            /**
121:             * Returns the name edit window's label (the prompt that goes before the
122:             * text edit field).
123:             */
124:            protected abstract String getEditorLabel();
125:
126:            /**
127:             * Set editable object's name. The new name is guaranteed not to be
128:             * <code>null</code>.
129:             *
130:             * @param newName the new name string
131:             */
132:            public abstract void setWidgetName(String newName);
133:
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.