1 /**
2 * Copyright 2005-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.uif.container;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.core.api.config.property.ConfigurationService;
20 import org.kuali.rice.krad.service.KRADServiceLocator;
21 import org.kuali.rice.krad.uif.component.Component;
22 import org.kuali.rice.krad.uif.view.FormView;
23 import org.kuali.rice.krad.uif.view.View;
24 import org.kuali.rice.krad.uif.widget.Growls;
25 import org.kuali.rice.krad.util.ErrorMessage;
26 import org.kuali.rice.krad.util.GlobalVariables;
27 import org.kuali.rice.krad.util.MessageMap;
28 import org.springframework.util.AutoPopulatingList;
29
30 import java.text.MessageFormat;
31 import java.util.List;
32
33 /**
34 * @author Kuali Rice Team (rice.collab@kuali.org)
35 */
36 public class PageGroup extends Group {
37 private static final long serialVersionUID = 7571981300587270274L;
38
39 private boolean autoFocus;
40
41 /**
42 * Perform finalize here adds to its document ready script the
43 * setupValidator js function for setting up the validator for this view.
44 *
45 * @see org.kuali.rice.krad.uif.container.ContainerBase#performFinalize(org.kuali.rice.krad.uif.view.View,
46 * java.lang.Object, org.kuali.rice.krad.uif.component.Component)
47 */
48 @Override
49 public void performFinalize(View view, Object model, Component parent) {
50 super.performFinalize(view, model, parent);
51
52 String prefixScript = "";
53 if (this.getOnDocumentReadyScript() != null) {
54 prefixScript = this.getOnDocumentReadyScript();
55 }
56
57 if (view instanceof FormView && ((FormView) view).isValidateClientSide()) {
58 this.setOnDocumentReadyScript(prefixScript + "\nsetupPage(true);");
59 }
60 else{
61 this.setOnDocumentReadyScript(prefixScript + "\nsetupPage(false);");
62 }
63 }
64
65 /**
66 * When this is true, the first field of the kualiForm will be focused by
67 * default, unless the parameter focusId is set on the form (by an
68 * actionField), then that field will be focused instead. When this setting
69 * if false, no field will be focused.
70 *
71 * @return the autoFocus
72 */
73 public boolean isAutoFocus() {
74 return this.autoFocus;
75 }
76
77 /**
78 * @param autoFocus the autoFocus to set
79 */
80 public void setAutoFocus(boolean autoFocus) {
81 this.autoFocus = autoFocus;
82 }
83
84 }