Coverage Report - org.kuali.rice.kns.uif.container.View
 
Classes in this File Line Coverage Branch Coverage Complexity
View
0%
0/162
0%
0/30
1.2
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation Licensed under the Educational Community
 3  
  * License, Version 1.0 (the "License"); you may not use this file except in
 4  
  * compliance with the License. You may obtain a copy of the License at
 5  
  * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law
 6  
  * or agreed to in writing, software distributed under the License is
 7  
  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 8  
  * KIND, either express or implied. See the License for the specific language
 9  
  * governing permissions and limitations under the License.
 10  
  */
 11  
 package org.kuali.rice.kns.uif.container;
 12  
 
 13  
 import java.util.ArrayList;
 14  
 import java.util.HashMap;
 15  
 import java.util.HashSet;
 16  
 import java.util.Iterator;
 17  
 import java.util.List;
 18  
 import java.util.Map;
 19  
 import java.util.Set;
 20  
 
 21  
 import org.apache.commons.lang.StringUtils;
 22  
 import org.kuali.rice.kns.service.DataObjectMetaDataService;
 23  
 import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
 24  
 import org.kuali.rice.kns.uif.UifConstants;
 25  
 import org.kuali.rice.kns.uif.UifConstants.ViewStatus;
 26  
 import org.kuali.rice.kns.uif.UifConstants.ViewType;
 27  
 import org.kuali.rice.kns.uif.authorization.Authorizer;
 28  
 import org.kuali.rice.kns.uif.authorization.PresentationController;
 29  
 import org.kuali.rice.kns.uif.core.BindingInfo;
 30  
 import org.kuali.rice.kns.uif.core.Component;
 31  
 import org.kuali.rice.kns.uif.core.ReferenceCopy;
 32  
 import org.kuali.rice.kns.uif.core.RequestParameter;
 33  
 import org.kuali.rice.kns.uif.field.LinkField;
 34  
 import org.kuali.rice.kns.uif.service.ViewHelperService;
 35  
 import org.kuali.rice.kns.uif.util.BooleanMap;
 36  
 import org.kuali.rice.kns.uif.util.ClientValidationUtils;
 37  
 import org.kuali.rice.kns.uif.util.ViewModelUtils;
 38  
 import org.kuali.rice.kns.uif.widget.BreadCrumbs;
 39  
 import org.kuali.rice.kns.uif.widget.GrowlsWidget;
 40  
 import org.kuali.rice.kns.util.ObjectUtils;
 41  
 import org.kuali.rice.kns.web.spring.UifControllerHandlerInterceptor;
 42  
 
 43  
 /**
 44  
  * Root of the component tree which encompasses a set of related
 45  
  * <code>GroupContainer</code> instances tied together with a common page layout
 46  
  * and navigation.
 47  
  * <p>
 48  
  * The <code>View</code> component ties together all the components and
 49  
  * configuration of the User Interface for a piece of functionality. In Rice
 50  
  * applications the view is typically associated with a <code>Document</code>
 51  
  * instance.
 52  
  * </p>
 53  
  * <p>
 54  
  * The view template lays out the common header, footer, and navigation for the
 55  
  * related pages. In addition the view renders the HTML head element bringing in
 56  
  * common script files and style sheets, along with optionally rendering a form
 57  
  * element for pages that need to post data back to the server.
 58  
  * </p>
 59  
  * <p>
 60  
  * Configuration of UIF features such as model validation is also done through
 61  
  * the <code>View</code>
 62  
  * </p>
 63  
  * 
 64  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 65  
  */
 66  
 public class View extends ContainerBase {
 67  
     private static final long serialVersionUID = -1220009725554576953L;
 68  
 
 69  
     private String viewName;
 70  
 
 71  
     // Breadcrumbs
 72  
     private BreadCrumbs breadcrumbs;
 73  
     private String viewLabelFieldPropertyName;
 74  
     private BindingInfo viewLabelFieldBindingInfo;
 75  
     private String appendOption;
 76  
 
 77  
     // Growls support
 78  
     private GrowlsWidget growlsWidget;
 79  
     private boolean growlMessagingEnabled;
 80  
 
 81  
     private String entryPageId;
 82  
 
 83  
     @RequestParameter
 84  
     private String currentPageId;
 85  
 
 86  
     private NavigationGroup navigation;
 87  
 
 88  
     private Class<?> formClass;
 89  
     private String defaultBindingObjectPath;
 90  
     private Map<String, Class<?>> abstractTypeClasses;
 91  
 
 92  
     private List<String> additionalScriptFiles;
 93  
     private List<String> additionalCssFiles;
 94  
 
 95  
     private String viewTypeName;
 96  
     private Class<? extends ViewHelperService> viewHelperServiceClassName;
 97  
 
 98  
     private String viewStatus;
 99  
     private ViewIndex viewIndex;
 100  
     private Map<String, String> viewRequestParameters;
 101  
 
 102  
     private Class<? extends PresentationController> presentationControllerClass;
 103  
     private Class<? extends Authorizer> authorizerClass;
 104  
 
 105  
     private BooleanMap actionFlags;
 106  
     private BooleanMap editModes;
 107  
 
 108  
     private Map<String, String> expressionVariables;
 109  
 
 110  
     private boolean singlePageView;
 111  
     private PageGroup page;
 112  
 
 113  
     private List<? extends Group> items;
 114  
 
 115  
     private LinkField viewMenuLink;
 116  
     private String viewMenuGrouping;
 117  
 
 118  
     private boolean validateDirty;
 119  
 
 120  
     @RequestParameter
 121  
     private boolean dialogMode;
 122  
 
 123  
     @RequestParameter
 124  
     private String returnTarget;
 125  
 
 126  
     @ReferenceCopy
 127  
     private ViewHelperService viewHelperService;
 128  
 
 129  0
     public View() {
 130  0
         dialogMode = false;
 131  0
         singlePageView = false;
 132  0
         viewTypeName = ViewType.DEFAULT;
 133  0
         viewStatus = UifConstants.ViewStatus.CREATED;
 134  
 
 135  0
         additionalScriptFiles = new ArrayList<String>();
 136  0
         additionalCssFiles = new ArrayList<String>();
 137  0
         items = new ArrayList<Group>();
 138  0
         abstractTypeClasses = new HashMap<String, Class<?>>();
 139  0
         viewRequestParameters = new HashMap<String, String>();
 140  0
         expressionVariables = new HashMap<String, String>();
 141  0
     }
 142  
 
 143  
     /**
 144  
      * The following initialization is performed:
 145  
      * <ul>
 146  
      * <li>If a single paged view, set items in page group and put the page in
 147  
      * the items list</li>
 148  
      * <li>If current page id is not set, it is set to the configured entry page
 149  
      * or first item in list id</li>
 150  
      * </ul>
 151  
      * 
 152  
      * @see org.kuali.rice.kns.uif.container.ContainerBase#performInitialization(org.kuali.rice.kns.uif.container.View)
 153  
      */
 154  
     @SuppressWarnings("unchecked")
 155  
     @Override
 156  
     public void performInitialization(View view) {
 157  0
         super.performInitialization(view);
 158  
 
 159  
         // populate items on page for single paged view
 160  0
         if (singlePageView) {
 161  0
             if (page != null) {
 162  0
                 page.setItems(new ArrayList<Group>(items));
 163  
 
 164  
                 // reset the items list to include the one page
 165  0
                 items = new ArrayList<Group>();
 166  0
                 ((List<Group>) items).add(page);
 167  
             } else {
 168  0
                 throw new RuntimeException("For single paged views the page Group must be set.");
 169  
             }
 170  
         }
 171  
 
 172  
         // set the entry page
 173  0
         if (StringUtils.isNotBlank(entryPageId)) {
 174  0
             currentPageId = entryPageId;
 175  
         } else {
 176  0
             Group firstPageGroup = getItems().get(0);
 177  0
             currentPageId = firstPageGroup.getId();
 178  
         }
 179  
 
 180  0
     }
 181  
 
 182  
     /**
 183  
      * This method is used to determine what property name is to be used for
 184  
      * view label appendage, called before the generation of
 185  
      * history/breadcrumb/title, but cannot be called from performInitialize
 186  
      * because the abstractTypeClasses map may not be populated before
 187  
      * super.performInitialize is called from a view child class (required for
 188  
      * ViewModelUtils#getPropertyType determination used in this method)
 189  
      * Currently called from UifControllerHandlerInterceptor...
 190  
      * 
 191  
      * @see View#setViewLabelFieldPropertyName(String)
 192  
      * @see View#setViewLabelFieldBindingInfo(BindingInfo)
 193  
      * @see ViewModelUtils#getPropertyType
 194  
      * @see UifControllerHandlerInterceptor#postHandle
 195  
      */
 196  
     public void determineViewLabelPropertyName() {
 197  
         // We have binding info but a custom viewLabelFieldPropertyName is set
 198  0
         if (viewLabelFieldBindingInfo != null && StringUtils.isNotBlank(viewLabelFieldPropertyName)) {
 199  0
             viewLabelFieldBindingInfo.setDefaults(this, viewLabelFieldPropertyName);
 200  
         }
 201  
         // Nothing is preset, auto determine title
 202  0
         else if (viewLabelFieldBindingInfo == null && StringUtils.isBlank(viewLabelFieldPropertyName)) {
 203  
             Class<?> doClass;
 204  0
             if (StringUtils.isNotBlank(this.getDefaultBindingObjectPath())) {
 205  0
                 doClass = ViewModelUtils.getPropertyType(this, this.getDefaultBindingObjectPath());
 206  
             } else {
 207  0
                 doClass = this.getFormClass();
 208  
             }
 209  0
             DataObjectMetaDataService mds = KNSServiceLocatorWeb.getDataObjectMetaDataService();
 210  0
             if (doClass != null) {
 211  0
                 String title = mds.getTitleAttribute(doClass);
 212  0
                 viewLabelFieldPropertyName = title;
 213  
             }
 214  
         }
 215  
         // else assumption is to use whatever is in viewLabelFieldBindingInfo or
 216  
         // viewLabelFieldPropertyName
 217  0
     }
 218  
 
 219  
     /**
 220  
      * Perform finalize here adds to its document ready script the
 221  
      * setupValidator js function for setting up the validator for this view.
 222  
      * 
 223  
      * @see org.kuali.rice.kns.uif.container.ContainerBase#performFinalize(org.kuali.rice.kns.uif.container.View,
 224  
      *      java.lang.Object, org.kuali.rice.kns.uif.core.Component)
 225  
      */
 226  
     @Override
 227  
     public void performFinalize(View view, Object model, Component parent) {
 228  0
         super.performFinalize(view, model, parent);
 229  
 
 230  0
         String prefixScript = "";
 231  0
         if (this.getOnDocumentReadyScript() != null) {
 232  0
             prefixScript = this.getOnDocumentReadyScript();
 233  
         }
 234  0
         this.setOnDocumentReadyScript(prefixScript + "jQuery.extend(jQuery.validator.messages, "
 235  
                 + ClientValidationUtils.generateValidatorMessagesOption() + ");");
 236  0
     }
 237  
 
 238  
     /**
 239  
      * @see org.kuali.rice.kns.uif.core.ComponentBase#getNestedComponents()
 240  
      */
 241  
     @Override
 242  
     public List<Component> getNestedComponents() {
 243  0
         List<Component> components = super.getNestedComponents();
 244  
 
 245  0
         components.add(navigation);
 246  
 
 247  0
         return components;
 248  
     }
 249  
 
 250  
     /**
 251  
      * @see org.kuali.rice.krad.web.view.container.ContainerBase#getSupportedComponents()
 252  
      */
 253  
     @Override
 254  
     public Set<Class<? extends Component>> getSupportedComponents() {
 255  0
         Set<Class<? extends Component>> supportedComponents = new HashSet<Class<? extends Component>>();
 256  0
         supportedComponents.add(Group.class);
 257  
 
 258  0
         return supportedComponents;
 259  
     }
 260  
 
 261  
     /**
 262  
      * @see org.kuali.rice.kns.uif.core.Component#getComponentTypeName()
 263  
      */
 264  
     @Override
 265  
     public String getComponentTypeName() {
 266  0
         return "view";
 267  
     }
 268  
 
 269  
     /**
 270  
      * Iterates through the contained page items and returns the Page that
 271  
      * matches the set current page id
 272  
      * 
 273  
      * @return Page instance
 274  
      */
 275  
     public PageGroup getCurrentPage() {
 276  0
         for (Iterator<? extends Group> iterator = this.getItems().iterator(); iterator.hasNext();) {
 277  0
             Group pageGroup = iterator.next();
 278  0
             if (pageGroup.getId().equals(getCurrentPageId())) {
 279  0
                 return (PageGroup) pageGroup;
 280  
             }
 281  0
         }
 282  
 
 283  0
         return null;
 284  
     }
 285  
 
 286  
     /**
 287  
      * View name provides an identifier for a view within a type. That is if a
 288  
      * set of <code>View</code> instances have the same values for the
 289  
      * properties that are used to retrieve them by their type, the name can be
 290  
      * given to further qualify the view that should be retrieved.
 291  
      * <p>
 292  
      * A view type like the <code>LookupView</code> might have several views for
 293  
      * the same object class, but one that is the 'default' lookup and another
 294  
      * that is the 'advanced' lookup. Therefore the name on the first could be
 295  
      * set to 'default', and likewise the name for the second 'advanced'.
 296  
      * </p>
 297  
      * 
 298  
      * @return String name of view
 299  
      */
 300  
     public String getViewName() {
 301  0
         return this.viewName;
 302  
     }
 303  
 
 304  
     /**
 305  
      * Setter for the view's name
 306  
      * 
 307  
      * @param viewName
 308  
      */
 309  
     public void setViewName(String viewName) {
 310  0
         this.viewName = viewName;
 311  0
     }
 312  
 
 313  
     /**
 314  
      * Specifies what page should be rendered by default. This is the page that
 315  
      * will be rendered when the <code>View</code> is first rendered or when the
 316  
      * current page is not set
 317  
      * 
 318  
      * @return String id of the page to render by default
 319  
      */
 320  
     public String getEntryPageId() {
 321  0
         return this.entryPageId;
 322  
     }
 323  
 
 324  
     /**
 325  
      * Setter for default Page id
 326  
      * 
 327  
      * @param entryPageId
 328  
      */
 329  
     public void setEntryPageId(String entryPageId) {
 330  0
         this.entryPageId = entryPageId;
 331  0
     }
 332  
 
 333  
     /**
 334  
      * The id for the page within the view that should be displayed in the UI.
 335  
      * Other pages of the view will not be rendered
 336  
      * 
 337  
      * @return String id of the page that should be displayed
 338  
      */
 339  
     public String getCurrentPageId() {
 340  0
         return this.currentPageId;
 341  
     }
 342  
 
 343  
     /**
 344  
      * Setter for the page id to display
 345  
      * 
 346  
      * @param currentPageId
 347  
      */
 348  
     public void setCurrentPageId(String currentPageId) {
 349  0
         this.currentPageId = currentPageId;
 350  0
     }
 351  
 
 352  
     /**
 353  
      * <code>NavigationGroup</code> instance for the <code>View</code>
 354  
      * <p>
 355  
      * Provides configuration necessary to render the navigation. This includes
 356  
      * navigation items in addition to configuration for the navigation
 357  
      * renderer.
 358  
      * </p>
 359  
      * 
 360  
      * @return NavigationGroup
 361  
      */
 362  
     public NavigationGroup getNavigation() {
 363  0
         return this.navigation;
 364  
     }
 365  
 
 366  
     /**
 367  
      * Setter for the View's <code>NavigationGroup</code>
 368  
      * 
 369  
      * @param navigation
 370  
      */
 371  
     public void setNavigation(NavigationGroup navigation) {
 372  0
         this.navigation = navigation;
 373  0
     }
 374  
 
 375  
     /**
 376  
      * Class of the Form that should be used with the <code>View</code>
 377  
      * instance. The form is the top level object for all the view's data and is
 378  
      * used to present and accept data in the user interface. All form classes
 379  
      * should extend UifFormBase
 380  
      * 
 381  
      * @return Class<?> class for the view's form
 382  
      * @see org.kuali.rice.kns.web.spring.form.UifFormBase
 383  
      */
 384  
     public Class<?> getFormClass() {
 385  0
         return this.formClass;
 386  
     }
 387  
 
 388  
     /**
 389  
      * Setter for the form class
 390  
      * 
 391  
      * @param formClass
 392  
      */
 393  
     public void setFormClass(Class<?> formClass) {
 394  0
         this.formClass = formClass;
 395  0
     }
 396  
 
 397  
     /**
 398  
      * For <code>View</code> types that work primarily with one nested object of
 399  
      * the form (for instance document, or bo) the default binding object path
 400  
      * can be set for each of the views <code>DataBinding</code> components. If
 401  
      * the component does not set its own binding object path it will inherit
 402  
      * the default
 403  
      * 
 404  
      * @return String binding path to the object from the form
 405  
      * @see org.kuali.rice.kns.uif.BindingInfo.getBindingObjectPath()
 406  
      */
 407  
     public String getDefaultBindingObjectPath() {
 408  0
         return this.defaultBindingObjectPath;
 409  
     }
 410  
 
 411  
     /**
 412  
      * Setter for the default binding object path to use for the view
 413  
      * 
 414  
      * @param defaultBindingObjectPath
 415  
      */
 416  
     public void setDefaultBindingObjectPath(String defaultBindingObjectPath) {
 417  0
         this.defaultBindingObjectPath = defaultBindingObjectPath;
 418  0
     }
 419  
 
 420  
     /**
 421  
      * Configures the concrete classes that will be used for properties in the
 422  
      * form object graph that have an abstract or interface type
 423  
      * <p>
 424  
      * For properties that have an abstract or interface type, it is not
 425  
      * possible to perform operations like getting/settings property values and
 426  
      * getting information from the dictionary. When these properties are
 427  
      * encountered in the object graph, this <code>Map</code> will be consulted
 428  
      * to determine the concrete type to use.
 429  
      * </p>
 430  
      * <p>
 431  
      * e.g. Suppose we have a property document.accountingLine.accountNumber and
 432  
      * the accountingLine property on the document instance has an interface
 433  
      * type 'AccountingLine'. We can then put an entry into this map with key
 434  
      * 'document.accountingLine', and value
 435  
      * 'org.kuali.rice.sampleapp.TravelAccountingLine'. When getting the
 436  
      * property type or an entry from the dictionary for accountNumber, the
 437  
      * TravelAccountingLine class will be used.
 438  
      * </p>
 439  
      * 
 440  
      * @return Map<String, Class> of class implementations keyed by path
 441  
      */
 442  
     public Map<String, Class<?>> getAbstractTypeClasses() {
 443  0
         return this.abstractTypeClasses;
 444  
     }
 445  
 
 446  
     /**
 447  
      * Setter for the Map of class implementations keyed by path
 448  
      * 
 449  
      * @param abstractTypeClasses
 450  
      */
 451  
     public void setAbstractTypeClasses(Map<String, Class<?>> abstractTypeClasses) {
 452  0
         this.abstractTypeClasses = abstractTypeClasses;
 453  0
     }
 454  
 
 455  
     /**
 456  
      * Declares additional script files that should be included with the
 457  
      * <code>View</code>. These files are brought into the HTML page along with
 458  
      * common script files configured for the Rice application. Each entry
 459  
      * contain the path to the CSS file, either a relative path, path from web
 460  
      * root, or full URI
 461  
      * <p>
 462  
      * e.g. '/krad/scripts/myScript.js', '../scripts/myScript.js',
 463  
      * 'http://my.edu/web/myScript.js'
 464  
      * </p>
 465  
      * 
 466  
      * @return List<String> script file locations
 467  
      */
 468  
     public List<String> getAdditionalScriptFiles() {
 469  0
         return this.additionalScriptFiles;
 470  
     }
 471  
 
 472  
     /**
 473  
      * Setter for the List of additional script files to included with the
 474  
      * <code>View</code>
 475  
      * 
 476  
      * @param additionalScriptFiles
 477  
      */
 478  
     public void setAdditionalScriptFiles(List<String> additionalScriptFiles) {
 479  0
         this.additionalScriptFiles = additionalScriptFiles;
 480  0
     }
 481  
 
 482  
     /**
 483  
      * Declares additional CSS files that should be included with the
 484  
      * <code>View</code>. These files are brought into the HTML page along with
 485  
      * common CSS files configured for the Rice application. Each entry should
 486  
      * contain the path to the CSS file, either a relative path, path from web
 487  
      * root, or full URI
 488  
      * <p>
 489  
      * e.g. '/krad/css/stacked-view.css', '../css/stacked-view.css',
 490  
      * 'http://my.edu/web/stacked-view.css'
 491  
      * </p>
 492  
      * 
 493  
      * @return List<String> CSS file locations
 494  
      */
 495  
     public List<String> getAdditionalCssFiles() {
 496  0
         return this.additionalCssFiles;
 497  
     }
 498  
 
 499  
     /**
 500  
      * Setter for the List of additional CSS files to included with the
 501  
      * <code>View</code>
 502  
      * 
 503  
      * @param additionalCssFiles
 504  
      */
 505  
     public void setAdditionalCssFiles(List<String> additionalCssFiles) {
 506  0
         this.additionalCssFiles = additionalCssFiles;
 507  0
     }
 508  
 
 509  
     public boolean isDialogMode() {
 510  0
         return this.dialogMode;
 511  
     }
 512  
 
 513  
     public void setDialogMode(boolean dialogMode) {
 514  0
         this.dialogMode = dialogMode;
 515  0
     }
 516  
 
 517  
     /**
 518  
      * @param returnTarget
 519  
      *            the returnTarget to set
 520  
      */
 521  
     public void setReturnTarget(String returnTarget) {
 522  0
         this.returnTarget = returnTarget;
 523  0
     }
 524  
 
 525  
     /**
 526  
      * @return the returnTarget
 527  
      */
 528  
     public String getReturnTarget() {
 529  0
         return returnTarget;
 530  
     }
 531  
 
 532  
     /**
 533  
      * View type name the view is associated with
 534  
      * <p>
 535  
      * Views that share common features and functionality can be grouped by the
 536  
      * view type. Usually view types extend the <code>View</code> class to
 537  
      * provide additional configuration and to set defaults. View types can also
 538  
      * implement the <code>ViewTypeService</code> to add special indexing and
 539  
      * retrieval of views.
 540  
      * </p>
 541  
      * 
 542  
      * @return String view type name for the view
 543  
      */
 544  
     public String getViewTypeName() {
 545  0
         return this.viewTypeName;
 546  
     }
 547  
 
 548  
     /**
 549  
      * Setter for the view's type name
 550  
      * 
 551  
      * @param viewTypeName
 552  
      */
 553  
     public void setViewTypeName(String viewTypeName) {
 554  0
         this.viewTypeName = viewTypeName;
 555  0
     }
 556  
 
 557  
     /**
 558  
      * Class name of the <code>ViewHelperService</code> that handles the various
 559  
      * phases of the Views lifecycle
 560  
      * 
 561  
      * @return Class for the spring bean
 562  
      * @see org.kuali.rice.kns.uif.service.ViewHelperService
 563  
      */
 564  
     public Class<? extends ViewHelperService> getViewHelperServiceClassName() {
 565  0
         return this.viewHelperServiceClassName;
 566  
     }
 567  
 
 568  
     /**
 569  
      * Setter for the <code>ViewHelperService</code> class name
 570  
      * 
 571  
      * @param viewLifecycleService
 572  
      */
 573  
     public void setViewHelperServiceClassName(Class<? extends ViewHelperService> viewHelperServiceClassName) {
 574  0
         this.viewHelperServiceClassName = viewHelperServiceClassName;
 575  0
     }
 576  
 
 577  
     /**
 578  
      * Creates the <code>ViewHelperService</code> associated with the View
 579  
      * 
 580  
      * @return ViewHelperService instance
 581  
      */
 582  
     public ViewHelperService getViewHelperService() {
 583  0
         if (this.viewHelperService == null) {
 584  0
             viewHelperService = ObjectUtils.newInstance(viewHelperServiceClassName);
 585  
         }
 586  
 
 587  0
         return viewHelperService;
 588  
     }
 589  
 
 590  
     /**
 591  
      * Invoked to produce a ViewIndex of the current view's components
 592  
      */
 593  
     public void index() {
 594  0
         ViewIndex viewIndex = new ViewIndex(this);
 595  0
         this.viewIndex = viewIndex;
 596  0
     }
 597  
 
 598  
     /**
 599  
      * Holds field indexes of the <code>View</code> instance for retrieval
 600  
      *
 601  
      * @return ViewIndex instance
 602  
      */
 603  
     public ViewIndex getViewIndex() {
 604  0
         return this.viewIndex;
 605  
     }
 606  
 
 607  
     /**
 608  
      * Map of parameters from the request that set view options, used to rebuild
 609  
      * the view on each post
 610  
      * <p>
 611  
      * Views can be configured by parameters. These might impact which parts of
 612  
      * the view are rendered or how the view behaves. Generally these would get
 613  
      * passed in when a new view is requested (by request parameters). These
 614  
      * will be used to initially populate the view properties. In addition, on a
 615  
      * post the view will be rebuilt and properties reset again by the allow
 616  
      * request parameters.
 617  
      * </p>
 618  
      * <p>
 619  
      * Example parameter would be for MaintenaceView whether a New, Edit, or
 620  
      * Copy was requested (maintenance mode)
 621  
      * </p>
 622  
      * 
 623  
      * @return
 624  
      */
 625  
     public Map<String, String> getViewRequestParameters() {
 626  0
         return this.viewRequestParameters;
 627  
     }
 628  
 
 629  
     /**
 630  
      * Setter for the view's request parameters map
 631  
      * 
 632  
      * @param viewRequestParameters
 633  
      */
 634  
     public void setViewRequestParameters(Map<String, String> viewRequestParameters) {
 635  0
         this.viewRequestParameters = viewRequestParameters;
 636  0
     }
 637  
 
 638  
     /**
 639  
      * PresentationController class that should be used for the
 640  
      * <code>View</code> instance
 641  
      * <p>
 642  
      * The presentation controller is consulted to determine component (group,
 643  
      * field) state such as required, read-only, and hidden. The presentation
 644  
      * controller does not take into account user permissions. The presentation
 645  
      * controller can also output action flags and edit modes that will be set
 646  
      * onto the view instance and can be referred to by conditional expressions
 647  
      * </p>
 648  
      * 
 649  
      * @return Class<? extends PresentationController>
 650  
      * @see org.kuali.rice.kns.uif.container.View.getActionFlags()
 651  
      * @see org.kuali.rice.kns.uif.container.View.getEditModes()
 652  
      */
 653  
     public Class<? extends PresentationController> getPresentationControllerClass() {
 654  0
         return this.presentationControllerClass;
 655  
     }
 656  
 
 657  
     /**
 658  
      * Setter for the view's presentation controller
 659  
      * 
 660  
      * @param presentationControllerClass
 661  
      */
 662  
     public void setPresentationControllerClass(Class<? extends PresentationController> presentationControllerClass) {
 663  0
         this.presentationControllerClass = presentationControllerClass;
 664  0
     }
 665  
 
 666  
     /**
 667  
      * Authorizer class that should be used for the <code>View</code> instance
 668  
      * <p>
 669  
      * The authorizer class is consulted to determine component (group, field)
 670  
      * state such as required, read-only, and hidden based on the users
 671  
      * permissions. It typically communicates with the Kuali Identity Management
 672  
      * system to determine roles and permissions. It is used with the
 673  
      * presentation controller and dictionary conditional logic to determine the
 674  
      * final component state. The authorizer can also output action flags and
 675  
      * edit modes that will be set onto the view instance and can be referred to
 676  
      * by conditional expressions
 677  
      * </p>
 678  
      * 
 679  
      * @return Class<? extends Authorizer>
 680  
      * @see org.kuali.rice.kns.uif.container.View.getActionFlags()
 681  
      * @see org.kuali.rice.kns.uif.container.View.getEditModes()
 682  
      */
 683  
     public Class<? extends Authorizer> getAuthorizerClass() {
 684  0
         return this.authorizerClass;
 685  
     }
 686  
 
 687  
     /**
 688  
      * Setter for the view's authorizer
 689  
      * 
 690  
      * @param authorizerClass
 691  
      */
 692  
     public void setAuthorizerClass(Class<? extends Authorizer> authorizerClass) {
 693  0
         this.authorizerClass = authorizerClass;
 694  0
     }
 695  
 
 696  
     /**
 697  
      * Map of strings that flag what actions can be taken in the UI
 698  
      * <p>
 699  
      * These can be used in conditional expressions in the dictionary or by
 700  
      * other UI logic
 701  
      * </p>
 702  
      * 
 703  
      * @return BooleanMap action flags
 704  
      */
 705  
     public BooleanMap getActionFlags() {
 706  0
         return this.actionFlags;
 707  
     }
 708  
 
 709  
     /**
 710  
      * Setter for the action flags Map
 711  
      * 
 712  
      * @param actionFlags
 713  
      */
 714  
     public void setActionFlags(BooleanMap actionFlags) {
 715  0
         this.actionFlags = actionFlags;
 716  0
     }
 717  
 
 718  
     /**
 719  
      * Map of edit modes that enabled for the view
 720  
      * <p>
 721  
      * These can be used in conditional expressions in the dictionary or by
 722  
      * other UI logic
 723  
      * </p>
 724  
      * 
 725  
      * @return BooleanMap edit modes
 726  
      */
 727  
     public BooleanMap getEditModes() {
 728  0
         return this.editModes;
 729  
     }
 730  
 
 731  
     /**
 732  
      * Setter for the edit modes Map
 733  
      * 
 734  
      * @param editModes
 735  
      */
 736  
     public void setEditModes(BooleanMap editModes) {
 737  0
         this.editModes = editModes;
 738  0
     }
 739  
 
 740  
     /**
 741  
      * Map that contains expressions to evaluate and make available as variables
 742  
      * for conditional expressions within the view
 743  
      * <p>
 744  
      * Each Map entry contains one expression variables, where the map key gives
 745  
      * the name for the variable, and the map value gives the variable
 746  
      * expression. The variables expressions will be evaluated before
 747  
      * conditional logic is run and made available as variables for other
 748  
      * conditional expressions. Variable expressions can be based on the model
 749  
      * and any object contained in the view's context
 750  
      * </p>
 751  
      * 
 752  
      * @return Map<String, String> variable expressions
 753  
      */
 754  
     public Map<String, String> getExpressionVariables() {
 755  0
         return this.expressionVariables;
 756  
     }
 757  
 
 758  
     /**
 759  
      * Setter for the view's map of variable expressions
 760  
      * 
 761  
      * @param expressionVariables
 762  
      */
 763  
     public void setExpressionVariables(Map<String, String> expressionVariables) {
 764  0
         this.expressionVariables = expressionVariables;
 765  0
     }
 766  
 
 767  
     /**
 768  
      * Indicates whether the <code>View</code> only has a single page
 769  
      * <code>Group</code> or contains multiple page <code>Group</code>
 770  
      * instances. In the case of a single page it is assumed the group's items
 771  
      * list contains the section groups for the page, and the page itself is
 772  
      * given by the page property ({@link #getPage()}. This is for convenience
 773  
      * of configuration and also can drive other configuration like styling.
 774  
      * 
 775  
      * @return boolean true if the view only contains one page group, false if
 776  
      *         it contains multple pages
 777  
      */
 778  
     public boolean isSinglePageView() {
 779  0
         return this.singlePageView;
 780  
     }
 781  
 
 782  
     /**
 783  
      * Setter for the single page indicator
 784  
      * 
 785  
      * @param singlePageView
 786  
      */
 787  
     public void setSinglePageView(boolean singlePageView) {
 788  0
         this.singlePageView = singlePageView;
 789  0
     }
 790  
 
 791  
     /**
 792  
      * For single paged views ({@link #isSinglePageView()}, gives the page
 793  
      * <code>Group</code> the view should render. The actual items for the page
 794  
      * is taken from the group's items list ({@link #getItems()}, and set onto
 795  
      * the give page group. This is for convenience of configuration.
 796  
      * 
 797  
      * @return Group page group for single page views
 798  
      */
 799  
     public PageGroup getPage() {
 800  0
         return this.page;
 801  
     }
 802  
 
 803  
     /**
 804  
      * Setter for the page group for single page views
 805  
      * 
 806  
      * @param page
 807  
      */
 808  
     public void setPage(PageGroup page) {
 809  0
         this.page = page;
 810  0
     }
 811  
 
 812  
     /**
 813  
      * @see org.kuali.rice.kns.uif.container.ContainerBase#getItems()
 814  
      */
 815  
     @Override
 816  
     public List<? extends Group> getItems() {
 817  0
         return this.items;
 818  
     }
 819  
 
 820  
     /**
 821  
      * Setter for the view's <code>Group</code> instances
 822  
      * 
 823  
      * @param items
 824  
      */
 825  
     @Override
 826  
     public void setItems(List<? extends Component> items) {
 827  
         // TODO: fix this generic issue
 828  0
         this.items = (List<? extends Group>) items;
 829  0
     }
 830  
 
 831  
     /**
 832  
      * Provides configuration for displaying a link to the view from an
 833  
      * application menu
 834  
      * 
 835  
      * @return LinkField view link field
 836  
      */
 837  
     public LinkField getViewMenuLink() {
 838  0
         return this.viewMenuLink;
 839  
     }
 840  
 
 841  
     /**
 842  
      * Setter for the views link field
 843  
      * 
 844  
      * @param viewMenuLink
 845  
      */
 846  
     public void setViewMenuLink(LinkField viewMenuLink) {
 847  0
         this.viewMenuLink = viewMenuLink;
 848  0
     }
 849  
 
 850  
     /**
 851  
      * Provides a grouping string for the view to group its menu link (within a
 852  
      * portal for instance)
 853  
      * 
 854  
      * @return String menu grouping
 855  
      */
 856  
     public String getViewMenuGrouping() {
 857  0
         return this.viewMenuGrouping;
 858  
     }
 859  
 
 860  
     /**
 861  
      * Setter for the views menu grouping
 862  
      * 
 863  
      * @param viewMenuGrouping
 864  
      */
 865  
     public void setViewMenuGrouping(String viewMenuGrouping) {
 866  0
         this.viewMenuGrouping = viewMenuGrouping;
 867  0
     }
 868  
 
 869  
     /**
 870  
      * Indicates what lifecycle phase the View instance is in
 871  
      * <p>
 872  
      * The view lifecycle begins with the CREATED status. In this status a new
 873  
      * instance of the view has been retrieved from the dictionary, but no
 874  
      * further processing has been done. After the initialize phase has been run
 875  
      * the status changes to INITIALIZED. After the model has been applied and
 876  
      * the view is ready for render the status changes to FINAL
 877  
      * </p>
 878  
      * 
 879  
      * @return String view status
 880  
      * @see org.kuali.rice.kns.uif.UifConstants.ViewStatus
 881  
      */
 882  
     public String getViewStatus() {
 883  0
         return this.viewStatus;
 884  
     }
 885  
 
 886  
     /**
 887  
      * Setter for the view status
 888  
      * 
 889  
      * @param viewStatus
 890  
      */
 891  
     public void setViewStatus(String viewStatus) {
 892  0
         this.viewStatus = viewStatus;
 893  0
     }
 894  
 
 895  
     /**
 896  
      * Indicates whether the view has been initialized
 897  
      * 
 898  
      * @return boolean true if the view has been initialized, false if not
 899  
      */
 900  
     public boolean isInitialized() {
 901  0
         return StringUtils.equals(viewStatus, ViewStatus.INITIALIZED)
 902  
                 || StringUtils.equals(viewStatus, ViewStatus.FINAL);
 903  
     }
 904  
 
 905  
     /**
 906  
      * Indicates whether the view has been updated from the model and final
 907  
      * updates made
 908  
      * 
 909  
      * @return boolean true if the view has been updated, false if not
 910  
      */
 911  
     public boolean isFinal() {
 912  0
         return StringUtils.equals(viewStatus, ViewStatus.FINAL);
 913  
     }
 914  
 
 915  
     /**
 916  
      * onSubmit script configured on the <code>View</code> gets placed on the
 917  
      * form element
 918  
      * 
 919  
      * @see org.kuali.rice.kns.uif.core.ComponentBase#getSupportsOnSubmit()
 920  
      */
 921  
     @Override
 922  
     public boolean getSupportsOnSubmit() {
 923  0
         return true;
 924  
     }
 925  
 
 926  
     /**
 927  
      * onLoad script configured on the <code>View</code> gets placed in a load
 928  
      * call
 929  
      * 
 930  
      * @see org.kuali.rice.kns.uif.core.ComponentBase#getSupportsOnLoad()
 931  
      */
 932  
     @Override
 933  
     public boolean getSupportsOnLoad() {
 934  0
         return true;
 935  
     }
 936  
 
 937  
     /**
 938  
      * onDocumentReady script configured on the <code>View</code> gets placed in
 939  
      * a document ready jQuery block
 940  
      * 
 941  
      * @see org.kuali.rice.kns.uif.core.ComponentBase#getSupportsOnLoad()
 942  
      */
 943  
     @Override
 944  
     public boolean getSupportsOnDocumentReady() {
 945  0
         return true;
 946  
     }
 947  
 
 948  
     /**
 949  
      * Breadcrumb widget used for displaying homeward path and history
 950  
      * 
 951  
      * @return the breadcrumbs
 952  
      */
 953  
     public BreadCrumbs getBreadcrumbs() {
 954  0
         return this.breadcrumbs;
 955  
     }
 956  
 
 957  
     /**
 958  
      * @param breadcrumbs
 959  
      *            the breadcrumbs to set
 960  
      */
 961  
     public void setBreadcrumbs(BreadCrumbs breadcrumbs) {
 962  0
         this.breadcrumbs = breadcrumbs;
 963  0
     }
 964  
 
 965  
     /**
 966  
      * Growls widget which sets up global settings for the growls used in this
 967  
      * view and its pages
 968  
      * 
 969  
      * @return the growlsWidget
 970  
      */
 971  
     public GrowlsWidget getGrowlsWidget() {
 972  0
         return this.growlsWidget;
 973  
     }
 974  
 
 975  
     /**
 976  
      * @param growlsWidget
 977  
      *            the growlsWidget to set
 978  
      */
 979  
     public void setGrowlsWidget(GrowlsWidget growlsWidget) {
 980  0
         this.growlsWidget = growlsWidget;
 981  0
     }
 982  
 
 983  
     /**
 984  
      * Growls use the messages contained in the message map. If enabled, info
 985  
      * messages in their entirety will be displayed in growls, for warning and
 986  
      * error messages a growl message will notify the user that these messages
 987  
      * exist on the page. If this setting is disabled, it is recommended that
 988  
      * infoMessage display be enabled for the page ErrorsField bean in order to
 989  
      * display relevant information to the user. Note: the growl scripts are
 990  
      * built out in the PageGroup class.
 991  
      * 
 992  
      * @return the growlMessagingEnabled
 993  
      */
 994  
     public boolean isGrowlMessagingEnabled() {
 995  0
         return this.growlMessagingEnabled;
 996  
     }
 997  
 
 998  
     /**
 999  
      * @param growlMessagingEnabled
 1000  
      *            the growlMessagingEnabled to set
 1001  
      */
 1002  
     public void setGrowlMessagingEnabled(boolean growlMessagingEnabled) {
 1003  0
         this.growlMessagingEnabled = growlMessagingEnabled;
 1004  0
     }
 1005  
 
 1006  
     /**
 1007  
      * 
 1008  
      * Indicates whether the form should be validated for dirtyness. For FormView, it's necessary to 
 1009  
      * validate when the user tries to navigate out of the form. If set, all the AttributeFields
 1010  
      * will be validated on refresh, navigate, cancel or close Action or on form unload and if dirty, displays a message and user
 1011  
      * can decide whether to continue with the action or stay on the form. For lookup and inquiry, it's not needed to validate.
 1012  
      * 
 1013  
      * @return validateDirty 
 1014  
      */
 1015  
     public boolean isValidateDirty() {
 1016  0
         return this.validateDirty;
 1017  
     }
 1018  
 
 1019  
     /**
 1020  
      * Setter for dirty validation.
 1021  
      */
 1022  
     public void setValidateDirty(boolean validateDirty) {
 1023  0
         this.validateDirty = validateDirty;
 1024  0
     }
 1025  
 
 1026  
     /**
 1027  
      * @return the viewLabelFieldPropertyName
 1028  
      */
 1029  
     public String getViewLabelFieldPropertyName() {
 1030  0
         return this.viewLabelFieldPropertyName;
 1031  
     }
 1032  
 
 1033  
     /**
 1034  
      * Sets the property name to be used to determine what will be used in the
 1035  
      * breadcrumb title of this view
 1036  
      * The title can be determined from a
 1037  
      * combination of this and viewLabelFieldbindingInfo: If only
 1038  
      * viewLabelFieldPropertyName is set, the title we be determined against the
 1039  
      * defaultBindingObjectPath. If only viewLabelFieldbindingInfo is set it
 1040  
      * must provide information about what object(bindToForm or explicit) and
 1041  
      * path to use. If both viewLabelFieldbindingInfo and
 1042  
      * viewLabelFieldPropertyName are set, the bindingInfo will be used with a
 1043  
      * the viewLabelFieldPropertyName as its bindingPath. If neither are set,
 1044  
      * the default title attribute from the dataObject's metadata (determined by the
 1045  
      * defaultBindingObjectPath's object) will be used.
 1046  
      * @param viewLabelFieldPropertyName
 1047  
      *            the viewLabelFieldPropertyName to set
 1048  
      */
 1049  
     public void setViewLabelFieldPropertyName(String viewLabelFieldPropertyName) {
 1050  0
         this.viewLabelFieldPropertyName = viewLabelFieldPropertyName;
 1051  0
     }
 1052  
 
 1053  
     /**
 1054  
      * @return the viewLabelFieldBindingInfo
 1055  
      */
 1056  
     public BindingInfo getViewLabelFieldBindingInfo() {
 1057  0
         return this.viewLabelFieldBindingInfo;
 1058  
     }
 1059  
 
 1060  
     /**
 1061  
      * The binding info settings to use when selecting a field to use in the
 1062  
      * breadcrumb title for this view. 
 1063  
      * The title can be determined from a
 1064  
      * combination of this and viewLabelFieldPropertyName: If only
 1065  
      * viewLabelFieldPropertyName is set, the title we be determined against the
 1066  
      * defaultBindingObjectPath. If only viewLabelFieldbindingInfo is set it
 1067  
      * must provide information about what object(bindToForm or explicit) and
 1068  
      * path to use. If both viewLabelFieldbindingInfo and
 1069  
      * viewLabelFieldPropertyName are set, the bindingInfo will be used with a
 1070  
      * the viewLabelFieldPropertyName as its bindingPath. If neither are set,
 1071  
      * the default title attribute from the dataObject's metadata (determined by the
 1072  
      * defaultBindingObjectPath's object) will be used.
 1073  
      * 
 1074  
      * @param viewLabelFieldBindingInfo
 1075  
      *            the viewLabelFieldBindingInfo to set
 1076  
      */
 1077  
     public void setViewLabelFieldBindingInfo(BindingInfo viewLabelFieldBindingInfo) {
 1078  0
         this.viewLabelFieldBindingInfo = viewLabelFieldBindingInfo;
 1079  0
     }
 1080  
 
 1081  
     /**
 1082  
      * @return the appendOption
 1083  
      */
 1084  
     public String getAppendOption() {
 1085  0
         return this.appendOption;
 1086  
     }
 1087  
 
 1088  
     /**
 1089  
      * The option to use when appending the view label on the breadcrumb title.
 1090  
      * Available options: 'dash', 'parenthesis', and 'replace'(don't append -
 1091  
      * simply replace the title). MUST be set for the viewLabelField to be used
 1092  
      * in the breadcrumb, if not set no appendage will be added.
 1093  
      * 
 1094  
      * @see View#setViewLabelFieldPropertyName(String)
 1095  
      * @see View#setViewLabelFieldBindingInfo(BindingInfo)
 1096  
      * 
 1097  
      * @param appendOption
 1098  
      *            the appendOption to set
 1099  
      */
 1100  
     public void setAppendOption(String appendOption) {
 1101  0
         this.appendOption = appendOption;
 1102  0
     }
 1103  
 
 1104  
 }