Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.DefaultWidgetFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultWidgetFactory
0%
0/3
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.common.ui.client.configurable.mvc;
 17  
 
 18  
 import org.kuali.student.common.ui.client.configurable.mvc.impl.DefaultWidgetFactoryImpl;
 19  
 import org.kuali.student.core.assembly.data.LookupParamMetadata;
 20  
 import org.kuali.student.core.assembly.data.Metadata;
 21  
 import org.kuali.student.core.assembly.data.MetadataInterrogator;
 22  
 import org.kuali.student.core.assembly.data.MetadataInterrogator.ConstraintIds;
 23  
 
 24  
 import com.google.gwt.core.client.GWT;
 25  
 import com.google.gwt.user.client.ui.Widget;
 26  
 
 27  
 /**
 28  
  * Returns a corresponding auto generated widget based on metadata.  Not all fields can have their
 29  
  * widgets reliably generated (or it may be better to not use the default), in these cases pass the
 30  
  * custom widget into FieldDescriptor directly.
 31  
  * <br>
 32  
  * Things within the metadata taken into account:
 33  
  * access = meta.getWriteAccess(); <br>
 34  
  * isMultiLine - uses text area for multiline<br>
 35  
  * isRepeating - if this is true and the metadata has lookupdata generates a picker that can be used to produce a list<br>
 36  
  * isRichText = MetadataInterrogator.hasConstraint(meta, ConstraintIds.RICH_TEXT); <br>
 37  
  * maxLength - affects how long a text field will be<br>
 38  
  * type - affects why kind of widget is generated<br>
 39  
  * lookupMeta - generates a widget that is backed by a search and based on attributes in its lookupMeta<br>
 40  
  * additionalLookups - additional lookups for the generated widget<br>
 41  
  * canEdit <br>
 42  
  * canUnmask <br>
 43  
  * canView <br>
 44  
  * 
 45  
  * Note that this class can use gwt deferred binding to have its DefaultWidgetFactory implementation
 46  
  * overridden with a custom one, though the result is high impact for as most fields rely on this class.
 47  
  * 
 48  
  * Default widget abstract class - see DefaultWidgetFactoryImpl for implementation.
 49  
  * 
 50  
  * @author Kuali Student Team
 51  
  *
 52  
  */
 53  0
 public abstract class DefaultWidgetFactory {
 54  0
         private static final DefaultWidgetFactory instance = GWT.create(DefaultWidgetFactoryImpl.class);
 55  
         public static DefaultWidgetFactory getInstance() {
 56  0
                 return instance;
 57  
         }
 58  
         
 59  
         /**
 60  
          * Gets the input widget by auto generating based on the metadata within the FieldDescriptor passed in
 61  
          * @param meta
 62  
          * @return
 63  
          */
 64  
         public abstract Widget getWidget(FieldDescriptor field);
 65  
         
 66  
         /**
 67  
          * Gets the input widget by auto generating based on the metadata passed in
 68  
          * @param meta
 69  
          * @return
 70  
          */
 71  
         public abstract Widget getWidget(Metadata meta);
 72  
         
 73  
         /**
 74  
          * Gets the read only widget by auto generating based on the metadata passed in
 75  
          * @param meta
 76  
          * @return
 77  
          */
 78  
         public abstract Widget getReadOnlyWidget(Metadata meta);
 79  
         
 80  
         
 81  
         /**
 82  
          * Generates a widget based on the LookupParamMetadata passed in
 83  
          * @param meta
 84  
          * @return
 85  
          */
 86  
         public abstract Widget getWidget(LookupParamMetadata meta);
 87  
         
 88  
 }
 89