1 /*********************************************************************************
2 * *
3 * Raptor - Rapid prototyping of Swing GUIs based on JavaBeans like Java objects *
4 * Copyright (C) 2003 XCOM AG *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19 * *
20 *********************************************************************************/
21 package net.sf.raptor.ui.dialog;
22
23 import java.awt.Dialog;
24 import java.awt.Frame;
25
26 import net.sf.raptor.logging.Trace;
27 import net.sf.raptor.ui.components.InvalidValueException;
28 import net.sf.raptor.ui.panels.BeanEditPanel;
29
30
31 /**
32 * @author XCOM AG
33 *
34 * To change the template for this generated type comment go to
35 * Window>Preferences>Java>Code Generation>Code and Comments
36 */
37 public class BeanEditDialog extends XDialog {
38
39 private BeanEditPanel beanEditPanel;
40
41 /**
42 *
43 */
44 public BeanEditDialog() {
45 super();
46 }
47
48 /**
49 * @param owner
50 */
51 public BeanEditDialog(Frame owner) {
52 super(owner);
53 }
54
55 /**
56 * @param owner
57 * @param modal
58 */
59 public BeanEditDialog(Frame owner, boolean modal) {
60 super(owner, modal);
61 }
62
63 /**
64 * @param owner
65 * @param title
66 */
67 public BeanEditDialog(Frame owner, String title) {
68 super(owner, title);
69 }
70
71 /**
72 * @param owner
73 * @param title
74 * @param modal
75 */
76 public BeanEditDialog(Frame owner, String title, boolean modal) {
77 super(owner, title, modal);
78 }
79
80 /**
81 * @param owner
82 */
83 public BeanEditDialog(Dialog owner) {
84 super(owner);
85 }
86
87 /**
88 * @param owner
89 * @param modal
90 */
91 public BeanEditDialog(Dialog owner, boolean modal) {
92 super(owner, modal);
93 }
94
95 /**
96 * @param owner
97 * @param title
98 */
99 public BeanEditDialog(Dialog owner, String title) {
100 super(owner, title);
101 }
102
103 /**
104 * @param owner
105 * @param title
106 * @param modal
107 */
108 public BeanEditDialog(Dialog owner, String title, boolean modal) {
109 super(owner, title, modal);
110 }
111
112 /**
113 * doOkAction
114 */
115 public void doOkAction() {
116 if( beanEditPanel!=null ) {
117 try {
118 beanEditPanel.commit();
119 } catch (InvalidValueException e) {
120 // wir schliessen nicht den dialog, sondern erwarten vom
121 // benutzer die korrektur seiner fehlerhaften eingabe ...
122 return;
123 }
124 returnValue=beanEditPanel.getEditObject();
125 } else {
126 Trace.warn("and where is the beanEditPanel?");
127 }
128 setVisible(false);
129 }
130
131 /**
132 * doCancelAction
133 */
134 public void doCancelAction() {
135 returnValue=null;
136 setVisible(false);
137 }
138
139 /**
140 * @return
141 */
142 public BeanEditPanel getBeanEditPanel() {
143 return beanEditPanel;
144 }
145
146 /**
147 * @param panel
148 */
149 public void setBeanEditPanel(BeanEditPanel panel) {
150 beanEditPanel = panel;
151 }
152
153 }