01: // @@
02: // @@
03: /*
04: * Wi.Ser Framework
05: *
06: * Version: 1.8.1, 20-September-2007
07: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library located in LGPL.txt in the
21: * license directory; if not, write to the
22: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23: * Boston, MA 02111-1307, USA.
24: *
25: * If this agreement does not cover your requirements, please contact us
26: * via email to get detailed information about the commercial license
27: * or our service offerings!
28: *
29: */
30: // @@
31: package de.ug2t.unifiedGui.wizard.validation;
32:
33: import java.util.*;
34:
35: import de.ug2t.kernel.*;
36: import de.ug2t.unifiedGui.*;
37: import de.ug2t.unifiedGui.wizard.*;
38:
39: public class MandatoryCheck implements IWizardPrePostAction {
40:
41: public boolean pcmf_doPrePost(WizardPlugin xPl, int xPrePost,
42: int xDirection) {
43: if (xPrePost == IWizardPrePostAction.CSC_WIZ_POSTACTION
44: && xDirection != IWizardPrePostAction.CSC_WIZ_PREV) {
45: boolean error = false;
46: ArrayList l_list = xPl.pcmf_getAllMandatorys();
47: if (l_list == null)
48: return (true);
49:
50: Iterator l_it = l_list.iterator();
51: while (l_it.hasNext()) {
52: UnComponent l_comp = (UnComponent) l_it.next();
53: if (l_comp.pcmf_isHidden() == false
54: && l_comp.pcmf_isDisabled() == false
55: && l_comp.pcmf_isParentHidden() == false
56: && l_comp.pcmf_isParentDisabled() == false
57: && (l_comp.pcmf_getValue() == null || l_comp
58: .pcmf_getValue().toString().trim()
59: .equals(""))) {
60: l_comp.pcmf_setBorder(UnComponent.LINE_BORDER,
61: "red", 1);
62: error = true;
63: } else
64: l_comp.pcmf_setBorder(UnComponent.LINE_BORDER,
65: "black", 1);
66: }
67: if (error == true) {
68: xPl.pcmf_addMessage(KeTools
69: .pcmf_deRef("%#MY_LANGUAGE:wizard:errmsg"));
70: return (false);
71: }
72: return (true);
73: }
74: return (true);
75: }
76: }
|