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