Source Code Cross Referenced for NotePanel.java in  » Project-Management » airTODO » org » airtodo » gui » panel_open » 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 » Project Management » airTODO » org.airtodo.gui.panel_open 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.airtodo.gui.panel_open;
002:
003:        import static org.air.framework.gui.box.Gap.small;
004:
005:        import java.awt.Component;
006:        import java.awt.Dialog;
007:        import java.awt.event.ActionEvent;
008:        import java.sql.Timestamp;
009:        import java.util.HashMap;
010:        import java.util.Map;
011:
012:        import javax.swing.Box;
013:        import javax.swing.SwingUtilities;
014:
015:        import org.air.framework.core.Registry;
016:        import org.air.framework.core.Utils;
017:        import org.air.framework.date.MyDate;
018:        import org.air.framework.date.PeriodFormatterUtils;
019:        import org.air.framework.db.MapCleaner;
020:        import org.air.framework.gui.dialogs.grid.AbstractGridDialog;
021:        import org.air.framework.gui.dialogs.input.AbstractOpenTabbedPanel;
022:        import org.air.framework.gui.lookup.WidgetComboLookup;
023:        import org.air.framework.gui.widgets.Button;
024:        import org.air.framework.gui.widgets.WidgetChoose;
025:        import org.air.framework.gui.widgets.WidgetTextArea;
026:        import org.air.framework.gui.widgets.WidgetTextField;
027:        import org.air.framework.i18n.NlsColumns;
028:        import org.air.framework.records.Common;
029:        import org.airtodo.db.DbUtils;
030:        import org.airtodo.gui.dialog_table.AttachmentGridNonSelectableDialog;
031:        import org.airtodo.gui.dialog_table.EmployeeGridSelectableDialog;
032:        import org.airtodo.gui.dialog_table.NoteGridNonSelectableDialog;
033:        import org.airtodo.gui_common.actions.other.ActionAttachments;
034:        import org.airtodo.gui_common.actions.other.ActionNotes;
035:        import org.airtodo.gui_common.components.lookup_data.LookupDataPriorityNote;
036:        import org.airtodo.records.Employees;
037:        import org.airtodo.records.Initiators;
038:        import org.airtodo.records.Notes;
039:
040:        public class NotePanel extends AbstractOpenTabbedPanel {
041:            private long masterId;
042:
043:            private long noteId;
044:
045:            public NotePanel() {
046:                getTabGeneral().add(getChooseInitiator());
047:                getTabGeneral().add(getWidgetPriorityCombo());
048:                getTabGeneral().add(getWidgetTextFieldName());
049:                getTabGeneral().add(getWidgetTextAreaComment());
050:                //
051:                getButtonPanel().addAll(getButtonNotes(), small(),
052:                        getButtonAttachments(), Box.createHorizontalGlue());
053:            }
054:
055:            //
056:            //	getButtonNotes
057:            //
058:            private Button buttonNotes;
059:
060:            private Component getButtonNotes() {
061:                if (buttonNotes == null) {
062:                    buttonNotes = new Button(new ActionNotes() {
063:                        public void actionPerformed(ActionEvent e) {
064:                            Dialog owner = (Dialog) SwingUtilities
065:                                    .windowForComponent(getOwner());
066:                            NoteGridNonSelectableDialog dialog = new NoteGridNonSelectableDialog(
067:                                    owner, getWidgetTextFieldName().getText());
068:                            dialog.setMasterId(noteId);
069:                            dialog.loadAndSelect();
070:                            dialog.setVisible(true);
071:                        }
072:                    });
073:                }
074:                return buttonNotes;
075:            }
076:
077:            //
078:            //	getWidgetPriorityCombo
079:            //
080:            private WidgetComboLookup widgetPriorityCombo;
081:
082:            private WidgetComboLookup getWidgetPriorityCombo() {
083:                if (widgetPriorityCombo == null)
084:                    widgetPriorityCombo = new WidgetComboLookup(
085:                            new LookupDataPriorityNote());
086:                return widgetPriorityCombo;
087:            }
088:
089:            //
090:            //	getChooseInitiator
091:            //
092:            private Long initiatorId;
093:
094:            private WidgetChoose chooseInitiator;
095:
096:            private Map initiatorMap = new HashMap();
097:
098:            private WidgetChoose getChooseInitiator() {
099:                if (chooseInitiator == null) {
100:                    chooseInitiator = new WidgetChoose(NlsColumns
101:                            .getText(Initiators.NAME)) {
102:                        @Override
103:                        protected void action() {
104:                            Dialog owner = getOwner();
105:                            AbstractGridDialog dialog;
106:                            if (initiatorId == null)
107:                                dialog = new EmployeeGridSelectableDialog(owner);
108:                            else
109:                                dialog = new EmployeeGridSelectableDialog(
110:                                        owner, initiatorId);
111:                            dialog.setVisible(true);
112:                            if (!dialog.isFinish())
113:                                return;
114:                            Map selectedMap = dialog.getSelectedMap();
115:                            Object employeeId = selectedMap.get(Utils
116:                                    .getColumnIdentifier(Common.ID));
117:                            Map employeeMap = MapCleaner.buildNativeMap(
118:                                    selectedMap, Employees.class);
119:                            initiatorMap.put(Utils
120:                                    .getColumnIdentifier(Notes.INITIATOR_ID),
121:                                    employeeId);
122:                            initiatorId = (Long) initiatorMap.get(Utils
123:                                    .getColumnIdentifier(Notes.INITIATOR_ID));
124:                            Map m = DbUtils
125:                                    .convertEmployeesMapToInitiatorsMap(employeeMap);
126:                            initiatorMap.putAll(m);
127:                            String name = (String) initiatorMap.get(Utils
128:                                    .getColumnIdentifier(Initiators.NAME));
129:                            chooseInitiator.setText(name);
130:                        }
131:                    };
132:                    chooseInitiator.setEnabled(!Registry.getFilterId()
133:                            .containsKey(Initiators.class));
134:                    chooseInitiator.setVisible(NlsColumns
135:                            .getText(Initiators.NAME) != null);
136:                }
137:                return chooseInitiator;
138:            }
139:
140:            //
141:            //	getButtonAttachments
142:            //
143:            private Button buttonAttachments;
144:
145:            private Component getButtonAttachments() {
146:                if (buttonAttachments == null) {
147:                    buttonAttachments = new Button(new ActionAttachments() {
148:                        public void actionPerformed(ActionEvent e) {
149:                            Dialog owner = (Dialog) SwingUtilities
150:                                    .windowForComponent(NotePanel.this );
151:                            AttachmentGridNonSelectableDialog dialog = new AttachmentGridNonSelectableDialog(
152:                                    owner, getWidgetTextFieldName().getText());
153:                            dialog.setMasterId(noteId);
154:                            dialog.loadAndSelect();
155:                            dialog.setVisible(true);
156:                        }
157:                    });
158:                }
159:                return buttonAttachments;
160:            }
161:
162:            //
163:            //	getWidgetTextFieldName
164:            //
165:            private WidgetTextField widgetTextFieldName;
166:
167:            private WidgetTextField getWidgetTextFieldName() {
168:                if (widgetTextFieldName == null)
169:                    widgetTextFieldName = new WidgetTextField(Notes.SUBJECT,
170:                            true);
171:                return widgetTextFieldName;
172:            }
173:
174:            //
175:            //	getWidgetTextAreaComment
176:            //
177:            private WidgetTextArea widgetTextAreaComment;
178:
179:            private WidgetTextArea getWidgetTextAreaComment() {
180:                if (widgetTextAreaComment == null)
181:                    widgetTextAreaComment = new WidgetTextArea(Notes.NOTE);
182:                return widgetTextAreaComment;
183:            }
184:
185:            //
186:            //	isFormValid
187:            //
188:            @Override
189:            public boolean isFormValid() {
190:                return getWidgetTextFieldName().isTextValid() && //;
191:                        getChooseInitiator().isTextValid();
192:            }
193:
194:            @Override
195:            public void fromGui(Map map) {
196:                Timestamp timestamp = (Timestamp) map.get(Utils
197:                        .getColumnIdentifier(Common.TIMESTAMP));
198:                map.put(Utils.getColumnIdentifier(Notes.TIMESTAMP), new MyDate(
199:                        timestamp, PeriodFormatterUtils.FIELD.MINUTE));
200:                getWidgetPriorityCombo().fromGui(map);
201:                map.put(Utils.getColumnIdentifier(Notes.MASTER_ID), masterId);
202:                getWidgetTextFieldName().fromGui(map);
203:                getWidgetTextAreaComment().fromGui(map);
204:                map.putAll(initiatorMap);
205:            }
206:
207:            @Override
208:            public void toGui(Map map) {
209:                Timestamp timestamp = (Timestamp) map.get(Utils
210:                        .getColumnIdentifier(Common.TIMESTAMP));
211:                getTabbedPane()
212:                        .setTitleAt(
213:                                0,
214:                                new MyDate(timestamp,
215:                                        PeriodFormatterUtils.FIELD.MINUTE)
216:                                        .toString());
217:
218:                //
219:                String name = (String) map.get(Utils
220:                        .getColumnIdentifier(Initiators.NAME));
221:                if (name != null)
222:                    getChooseInitiator().setText(name);
223:                initiatorId = (Long) map.get(Utils
224:                        .getColumnIdentifier(Notes.INITIATOR_ID));
225:                //		
226:                getWidgetPriorityCombo().toGui(map);
227:                masterId = (Long) map.get(Utils
228:                        .getColumnIdentifier(Notes.MASTER_ID));
229:                getWidgetTextFieldName().toGui(map);
230:                getWidgetTextAreaComment().toGui(map);
231:                //
232:                noteId = (Long) map.get(Utils.getColumnIdentifier(Common.ID));
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.