001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif.container;
017
018import org.apache.commons.lang.StringUtils;
019import org.kuali.rice.core.api.config.property.ConfigurationService;
020import org.kuali.rice.krad.service.KRADServiceLocator;
021import org.kuali.rice.krad.uif.component.Component;
022import org.kuali.rice.krad.uif.view.FormView;
023import org.kuali.rice.krad.uif.view.View;
024import org.kuali.rice.krad.uif.widget.Growls;
025import org.kuali.rice.krad.util.ErrorMessage;
026import org.kuali.rice.krad.util.GlobalVariables;
027import org.kuali.rice.krad.util.MessageMap;
028import org.springframework.util.AutoPopulatingList;
029
030import java.text.MessageFormat;
031import java.util.List;
032
033/**
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public class PageGroup extends Group {
037    private static final long serialVersionUID = 7571981300587270274L;
038
039    private boolean autoFocus;
040
041    /**
042     * Perform finalize here adds to its document ready script the
043     * setupValidator js function for setting up the validator for this view.
044     *
045     * @see org.kuali.rice.krad.uif.container.ContainerBase#performFinalize(org.kuali.rice.krad.uif.view.View,
046     *      java.lang.Object, org.kuali.rice.krad.uif.component.Component)
047     */
048    @Override
049    public void performFinalize(View view, Object model, Component parent) {
050        super.performFinalize(view, model, parent);
051
052        String prefixScript = "";
053        if (this.getOnDocumentReadyScript() != null) {
054            prefixScript = this.getOnDocumentReadyScript();
055        }
056
057        if (view instanceof FormView && ((FormView) view).isValidateClientSide()) {
058            this.setOnDocumentReadyScript(prefixScript + "\nsetupPage(true);");
059        }
060        else{
061            this.setOnDocumentReadyScript(prefixScript + "\nsetupPage(false);");
062        }
063    }
064
065    /**
066     * When this is true, the first field of the kualiForm will be focused by
067     * default, unless the parameter focusId is set on the form (by an
068     * actionField), then that field will be focused instead. When this setting
069     * if false, no field will be focused.
070     *
071     * @return the autoFocus
072     */
073    public boolean isAutoFocus() {
074        return this.autoFocus;
075    }
076
077    /**
078     * @param autoFocus the autoFocus to set
079     */
080    public void setAutoFocus(boolean autoFocus) {
081        this.autoFocus = autoFocus;
082    }
083
084}