View Javadoc
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 edu.sampleu.demo.layout;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import org.kuali.rice.krad.uif.component.Component;
22  import org.kuali.rice.krad.uif.container.PageGroup;
23  import org.kuali.rice.krad.uif.control.Control;
24  import org.kuali.rice.krad.uif.field.InputField;
25  import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl;
26  import org.kuali.rice.krad.uif.util.ComponentFactory;
27  import org.kuali.rice.krad.uif.util.LifecycleElement;
28  
29  /**
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class UifGeneratedTestViewHelperServiceImpl extends ViewHelperServiceImpl {
33  
34      private static final long serialVersionUID = 1594814355163875742L;
35  
36      @Override
37      public void performCustomInitialization(LifecycleElement component) {
38          super.performCustomInitialization(component);
39          List<Component> fields = new ArrayList<Component>();
40          if(component instanceof PageGroup && component.getId().equals("UifGeneratedFields-Page1")){
41              for(int i=0; i < 400; i++){
42                  InputField field = ComponentFactory.getInputField();
43                  Control control = ComponentFactory.getTextControl();
44                  field.setControl(control);
45                  field.setPropertyName("field1");
46                  field.setLabel("Field");
47                  field.setRequired(true);
48                  fields.add(field);
49              }
50              ((PageGroup) component).setItems(fields);
51          }
52  
53      }
54  }