1 /** 2 * Copyright 2005-2014 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.uif.container; 17 18 import java.util.List; 19 20 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace; 21 import org.kuali.rice.krad.uif.component.BindingInfo; 22 import org.kuali.rice.krad.uif.component.Component; 23 import org.kuali.rice.krad.uif.component.ComponentSecurity; 24 import org.kuali.rice.krad.uif.component.DataBinding; 25 import org.kuali.rice.krad.uif.element.Action; 26 import org.kuali.rice.krad.uif.element.Message; 27 import org.kuali.rice.krad.uif.view.View; 28 import org.kuali.rice.krad.uif.widget.QuickFinder; 29 30 /** 31 * Interface representing an editable collection within a view. 32 * 33 * @author Kuali Rice Team (rice.collab@kuali.org) 34 */ 35 public interface CollectionGroup extends Group, DataBinding { 36 37 /** 38 * New collection lines are handled in the framework by maintaining a map on 39 * the form. The map contains as a key the collection name, and as value an 40 * instance of the collection type. An entry is created here for the 41 * collection represented by the <code>CollectionGroup</code> if an instance 42 * is not available (clearExistingLine will force a new instance). The given 43 * model must be a subclass of <code>UifFormBase</code> in order to find the 44 * Map. 45 * 46 * @param model Model instance that contains the new collection lines Map 47 * @param clearExistingLine boolean that indicates whether the line should be set to a 48 * new instance if it already exists 49 */ 50 void initializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup, 51 boolean clearExistingLine); 52 53 /** 54 * Object class the collection maintains. Used to get dictionary information 55 * in addition to creating new instances for the collection when necessary 56 * 57 * @return collection object class 58 */ 59 Class<?> getCollectionObjectClass(); 60 61 /** 62 * Setter for the collection object class 63 * 64 * @param collectionObjectClass 65 */ 66 void setCollectionObjectClass(Class<?> collectionObjectClass); 67 68 /** 69 * Setter for the collections property name 70 * 71 * @param propertyName 72 */ 73 void setPropertyName(String propertyName); 74 75 /** 76 * Action fields that should be rendered for each collection line. Example 77 * line action is the delete action 78 * 79 * @return line action fields 80 */ 81 List<? extends Component> getLineActions(); 82 83 /** 84 * Setter for the line action fields list 85 * 86 * @param lineActions 87 */ 88 void setLineActions(List<? extends Component> lineActions); 89 90 /** 91 * Indicates whether the action column for the collection should be rendered 92 * 93 * @return true if the actions should be rendered, false if not 94 * @see #getLineActions() 95 */ 96 boolean isRenderLineActions(); 97 98 /** 99 * Setter for the render line actions indicator 100 * 101 * @param renderLineActions 102 */ 103 void setRenderLineActions(boolean renderLineActions); 104 105 /** 106 * Indicates whether an add line should be rendered for the collection 107 * 108 * @return true if add line should be rendered, false if it should 109 * not be 110 */ 111 boolean isRenderAddLine(); 112 113 /** 114 * Setter for the render add line indicator 115 * 116 * @param renderAddLine 117 */ 118 void setRenderAddLine(boolean renderAddLine); 119 120 /** 121 * Convenience getter for the add line label field text. The text is used to 122 * label the add line when rendered and its placement depends on the 123 * <code>LayoutManager</code> 124 * 125 * <p> 126 * For the <code>TableLayoutManager</code> the label appears in the sequence 127 * column to the left of the add line fields. For the 128 * <code>StackedLayoutManager</code> the label is placed into the group 129 * header for the line. 130 * </p> 131 * 132 * @return add line label 133 */ 134 String getAddLabel(); 135 136 /** 137 * Setter for the add line label text 138 * 139 * @param addLabelText 140 */ 141 void setAddLabel(String addLabelText); 142 143 /** 144 * <code>Message</code> instance for the add line label 145 * 146 * @return add line Message 147 * @see #getAddLabel 148 */ 149 Message getAddLineLabel(); 150 151 /** 152 * Setter for the <code>Message</code> instance for the add line label 153 * 154 * @param addLineLabel 155 * @see #getAddLabel 156 */ 157 void setAddLineLabel(Message addLineLabel); 158 159 /** 160 * Name of the property that contains an instance for the add line. If set 161 * this is used with the binding info to create the path to the add line. 162 * Can be left blank in which case the framework will manage the add line 163 * instance in a generic map. 164 * 165 * @return add line property name 166 */ 167 String getAddLinePropertyName(); 168 169 /** 170 * Setter for the add line property name 171 * 172 * @param addLinePropertyName 173 */ 174 void setAddLinePropertyName(String addLinePropertyName); 175 176 /** 177 * <code>BindingInfo</code> instance for the add line property used to 178 * determine the full binding path. If add line name given 179 * {@link #getAddLabel} then it is set as the binding name on the 180 * binding info. Add line label and binding info are not required, in which 181 * case the framework will manage the new add line instances through a 182 * generic map (model must extend UifFormBase) 183 * 184 * @return BindingInfo add line binding info 185 */ 186 BindingInfo getAddLineBindingInfo(); 187 188 /** 189 * Setter for the add line binding info 190 * 191 * @param addLineBindingInfo 192 */ 193 void setAddLineBindingInfo(BindingInfo addLineBindingInfo); 194 195 /** 196 * List of <code>Component</code> instances that should be rendered for the 197 * collection add line (if enabled). If not set, the default group's items 198 * list will be used 199 * 200 * @return add line field list 201 * @see CollectionGroup#performInitialization(Object) 202 */ 203 List<? extends Component> getAddLineItems(); 204 205 /** 206 * Setter for the add line field list 207 * 208 * @param addLineItems 209 */ 210 void setAddLineItems(List<? extends Component> addLineItems); 211 212 /** 213 * Component fields that should be rendered for the add line. 214 * 215 * <p>This is generally the add action (button) but can be configured to contain additional 216 * components 217 * </p> 218 * 219 * @return add line action fields 220 */ 221 List<? extends Component> getAddLineActions(); 222 223 /** 224 * Setter for the add line action components fields 225 * 226 * @param addLineActions 227 */ 228 void setAddLineActions(List<? extends Component> addLineActions); 229 230 /** 231 * Indicates whether lines of the collection group should be selected by rendering a 232 * field for each line that will allow selection 233 * 234 * <p> 235 * For example, having the select field enabled could allow selecting multiple lines from a search 236 * to return (multi-value lookup) 237 * </p> 238 * 239 * @return true if select field should be rendered, false if not 240 */ 241 boolean isIncludeLineSelectionField(); 242 243 /** 244 * Setter for the render selected field indicator 245 * 246 * @param includeLineSelectionField 247 */ 248 void setIncludeLineSelectionField(boolean includeLineSelectionField); 249 250 /** 251 * When {@link #isIncludeLineSelectionField()} is true, gives the name of the property the select field 252 * should bind to 253 * 254 * <p> 255 * Note if no prefix is given in the property name, such as 'form.', it is assumed the property is 256 * contained on the collection line. In this case the binding path to the collection line will be 257 * appended. In other cases, it is assumed the property is a list or set of String that will hold the 258 * selected identifier strings 259 * </p> 260 * 261 * <p> 262 * This property is not required. If not the set the framework will use a property contained on 263 * <code>UifFormBase</code> 264 * </p> 265 * 266 * @return property name for select field 267 */ 268 String getLineSelectPropertyName(); 269 270 /** 271 * Setter for the property name that will bind to the select field 272 * 273 * @param lineSelectPropertyName 274 */ 275 void setLineSelectPropertyName(String lineSelectPropertyName); 276 277 /** 278 * Instance of the <code>QuickFinder</code> widget that configures a multi-value lookup for the collection 279 * 280 * <p> 281 * If the collection lookup is enabled (by the render property of the quick finder), {@link 282 * #getCollectionObjectClass()} will be used as the data object class for the lookup (if not set). Field 283 * conversions need to be set as usual and will be applied for each line returned 284 * </p> 285 * 286 * @return instance configured for the collection lookup 287 */ 288 QuickFinder getCollectionLookup(); 289 290 /** 291 * Setter for the collection lookup quickfinder instance 292 * 293 * @param collectionLookup 294 */ 295 void setCollectionLookup(QuickFinder collectionLookup); 296 297 /** 298 * Indicates whether inactive collections lines should be displayed 299 * 300 * <p> 301 * Setting only applies when the collection line type implements the 302 * <code>Inactivatable</code> interface. If true and showInactive is 303 * set to false, the collection will be filtered to remove any items 304 * whose active status returns false 305 * </p> 306 * 307 * @return true to show inactive records, false to not render inactive records 308 */ 309 boolean isShowInactiveLines(); 310 311 /** 312 * Setter for the show inactive indicator 313 * 314 * @param showInactiveLines boolean show inactive 315 */ 316 void setShowInactiveLines(boolean showInactiveLines); 317 318 /** 319 * Collection filter instance for filtering the collection data when the 320 * showInactive flag is set to false 321 * 322 * @return CollectionFilter 323 */ 324 CollectionFilter getActiveCollectionFilter(); 325 326 /** 327 * Setter for the collection filter to use for filter inactive records from the 328 * collection 329 * 330 * @param activeCollectionFilter CollectionFilter instance 331 */ 332 void setActiveCollectionFilter(CollectionFilter activeCollectionFilter); 333 334 /** 335 * List of {@link CollectionFilter} instances that should be invoked to filter the collection before 336 * displaying 337 * 338 * @return List<CollectionFilter> 339 */ 340 List<CollectionFilter> getFilters(); 341 342 /** 343 * Setter for the List of collection filters for which the collection will be filtered against 344 * 345 * @param filters 346 */ 347 void setFilters(List<CollectionFilter> filters); 348 349 /** 350 * List of {@link BindingInfo} instances that represent lines not authorized to be viewed or edited by the user. 351 */ 352 List<BindingInfo> getUnauthorizedLineBindingInfos(); 353 354 /** 355 * @see CollectionGroup#getUnauthorizedLineBindingInfos() 356 */ 357 void setUnauthorizedLineBindingInfos(List<BindingInfo> unauthorizedLineBindingInfos); 358 359 /** 360 * List of <code>CollectionGroup</code> instances that are sub-collections 361 * of the collection represented by this collection group 362 * 363 * @return sub collections 364 */ 365 List<CollectionGroup> getSubCollections(); 366 367 /** 368 * Setter for the sub collection list 369 * 370 * @param subCollections 371 */ 372 void setSubCollections(List<CollectionGroup> subCollections); 373 374 /** 375 * Collection Security object that indicates what authorization (permissions) exist for the collection 376 * 377 * @return CollectionGroupSecurity instance 378 */ 379 CollectionGroupSecurity getCollectionGroupSecurity(); 380 381 /** 382 * Override to assert a {@link CollectionGroupSecurity} instance is set 383 * 384 * @param componentSecurity instance of CollectionGroupSecurity 385 */ 386 void setComponentSecurity(ComponentSecurity componentSecurity); 387 388 /** 389 * @see org.kuali.rice.krad.uif.container.CollectionGroupSecurity#isEditLineAuthz() 390 */ 391 boolean isEditLineAuthz(); 392 393 /** 394 * @see org.kuali.rice.krad.uif.container.CollectionGroupSecurity#setEditLineAuthz(boolean) 395 */ 396 void setEditLineAuthz(boolean editLineAuthz); 397 398 /** 399 * @see org.kuali.rice.krad.uif.container.CollectionGroupSecurity#isViewLineAuthz() 400 */ 401 boolean isViewLineAuthz(); 402 403 /** 404 * @see org.kuali.rice.krad.uif.container.CollectionGroupSecurity#setViewLineAuthz(boolean) 405 */ 406 void setViewLineAuthz(boolean viewLineAuthz); 407 408 /** 409 * <code>CollectionGroupBuilder</code> instance that will build the 410 * components dynamically for the collection instance 411 * 412 * @return CollectionGroupBuilder instance 413 */ 414 CollectionGroupBuilder getCollectionGroupBuilder(); 415 416 /** 417 * Setter for the collection group building instance 418 * 419 * @param collectionGroupBuilder 420 */ 421 void setCollectionGroupBuilder(CollectionGroupBuilder collectionGroupBuilder); 422 423 /** 424 * @param renderInactiveToggleButton the showHideInactiveButton to set 425 */ 426 void setRenderInactiveToggleButton(boolean renderInactiveToggleButton); 427 428 /** 429 * @return the showHideInactiveButton 430 */ 431 boolean isRenderInactiveToggleButton(); 432 433 /** 434 * The number of records to display for a collection 435 * 436 * @return int 437 */ 438 int getDisplayCollectionSize(); 439 440 /** 441 * Setter for the display collection size 442 * 443 * @param displayCollectionSize 444 */ 445 void setDisplayCollectionSize(int displayCollectionSize); 446 447 /** 448 * Indicates whether new items should be styled with the #newItemsCssClass 449 * 450 * @return true if new items must be highlighted 451 */ 452 boolean isHighlightNewItems(); 453 454 /** 455 * Setter for the flag that allows for different styling of new items 456 * 457 * @param highlightNewItems 458 */ 459 void setHighlightNewItems(boolean highlightNewItems); 460 461 /** 462 * The css style class that will be added on new items 463 * 464 * @return the new items css style class 465 */ 466 String getNewItemsCssClass(); 467 468 /** 469 * Setter for the new items css style class 470 * 471 * @param newItemsCssClass 472 */ 473 void setNewItemsCssClass(String newItemsCssClass); 474 475 /** 476 * The css style class that will be added on the add item group or row 477 * 478 * @return the add item group or row css style class 479 */ 480 String getAddItemCssClass(); 481 482 /** 483 * Setter for the add item css style class 484 * 485 * @param addItemCssClass 486 */ 487 void setAddItemCssClass(String addItemCssClass); 488 489 /** 490 * Indicates whether the add item group or row should be styled with the #addItemCssClass 491 * 492 * @return true if add item group or row must be highlighted 493 */ 494 boolean isHighlightAddItem(); 495 496 /** 497 * Setter for the flag that allows for different styling of the add item group or row 498 * 499 * @param highlightAddItem 500 */ 501 void setHighlightAddItem(boolean highlightAddItem); 502 503 /** 504 * Indicates that a button will be rendered that allows the user to add blank lines to the collection 505 * 506 * <p> 507 * The button will be added separately from the collection items. The default add line wil not be rendered. The 508 * action of the button will call the controller, add the blank line to the collection and do a component refresh. 509 * </p> 510 * 511 * @return boolean 512 */ 513 boolean isRenderAddBlankLineButton(); 514 515 /** 516 * Setter for the flag indicating that the add blank line button must be rendered 517 * 518 * @param renderAddBlankLineButton 519 */ 520 void setRenderAddBlankLineButton(boolean renderAddBlankLineButton); 521 522 /** 523 * The add blank line {@link Action} field rendered when renderAddBlankLineButton is true 524 * 525 * @return boolean 526 */ 527 Action getAddBlankLineAction(); 528 529 /** 530 * Setter for the add blank line {@link Action} field 531 * 532 * @param addBlankLineAction 533 */ 534 void setAddBlankLineAction(Action addBlankLineAction); 535 536 /** 537 * Indicates the add line placement 538 * 539 * <p> 540 * Valid values are 'TOP' or 'BOTTOM'. The default is 'TOP'. When the value is 'BOTTOM' the blank line will be 541 * added 542 * to the end of the collection. 543 * </p> 544 * 545 * @return the add blank line action placement 546 */ 547 String getAddLinePlacement(); 548 549 /** 550 * Setter for the add line placement 551 * 552 * @param addLinePlacement add line placement string 553 */ 554 void setAddLinePlacement(String addLinePlacement); 555 556 /** 557 * Indicates whether the save line actions should be rendered 558 * 559 * @return boolean 560 */ 561 boolean isRenderSaveLineActions(); 562 563 /** 564 * Setter for the flag indicating whether the save actions should be rendered 565 * 566 * @param renderSaveLineActions 567 */ 568 void setRenderSaveLineActions(boolean renderSaveLineActions); 569 570 /** 571 * Indicates that a add action should be rendered and that the add group be displayed in a lightbox 572 * 573 * @return boolean 574 */ 575 boolean isAddViaLightBox(); 576 577 /** 578 * Setter for the flag to indicate that add groups should be displayed in a light box 579 * 580 * @param addViaLightBox 581 */ 582 void setAddViaLightBox(boolean addViaLightBox); 583 584 /** 585 * The {@link Action} that will be displayed that will open the add line group in a lightbox 586 * 587 * @return Action 588 */ 589 Action getAddViaLightBoxAction(); 590 591 /** 592 * Setter for the add line via lightbox {@link Action} 593 * 594 * @param addViaLightBoxAction 595 */ 596 void setAddViaLightBoxAction(Action addViaLightBoxAction); 597 598 /** 599 * Gets useServerPaging, the flag that indicates whether server side paging is enabled. Defaults to false. 600 * 601 * @return true if server side paging is enabled. 602 */ 603 boolean isUseServerPaging(); 604 605 /** 606 * Sets useServerPaging, the flag indicating whether server side paging is enabled. 607 * 608 * @param useServerPaging the useServerPaging value to set 609 */ 610 void setUseServerPaging(boolean useServerPaging); 611 612 int getPageSize(); 613 614 void setPageSize(int pageSize); 615 616 /** 617 * Gets the displayStart, the index of the first item to display on the page (assuming useServerPaging is enabled). 618 * 619 * <p>if this field has not been set, the returned value will be -1</p> 620 * 621 * @return the index of the first item to display, or -1 if unset 622 */ 623 int getDisplayStart(); 624 625 /** 626 * Sets the displayStart, the index of the first item to display on the page (assuming useServerPaging is enabled). 627 * 628 * @param displayStart the displayStart to set 629 */ 630 void setDisplayStart(int displayStart); 631 632 /** 633 * Gets the displayLength, the number of items to display on the page (assuming useServerPaging is enabled). 634 * 635 * <p>if this field has not been set, the returned value will be -1</p> 636 * 637 * @return the number of items to display on the page, or -1 if unset 638 */ 639 int getDisplayLength(); 640 641 /** 642 * Sets the displayLength, the number of items to display on the page (assuming useServerPaging is enabled). 643 * 644 * @param displayLength the displayLength to set 645 */ 646 void setDisplayLength(int displayLength); 647 648 /** 649 * Gets the number of un-filtered elements from the model collection. 650 * 651 * <p>if this field has not been set, the returned value will be -1</p> 652 * 653 * @return the filtered collection size, or -1 if unset 654 */ 655 int getFilteredCollectionSize(); 656 657 /** 658 * Sets the number of un-filtered elements from the model collection. 659 * 660 * <p>This value is used for display and rendering purposes, it has no effect on the model collection</p> 661 * 662 * @param filteredCollectionSize the filtered collection size 663 */ 664 void setFilteredCollectionSize(int filteredCollectionSize); 665 666 /** 667 * @see org.kuali.rice.krad.uif.component.Component#completeValidation 668 */ 669 void completeValidation(ValidationTrace tracer); 670 671 /** 672 * This method ... 673 * 674 */ 675 void pushCollectionGroupToReference(); 676 677 /** 678 * This method ... 679 * 680 * @return 681 */ 682 List<String> getDuplicateLinePropertyNames(); 683 684 }