001 package org.kuali.student.lum.common.client.configuration;
002
003 import org.kuali.student.common.ui.client.configurable.mvc.Configurer;
004 import org.kuali.student.common.ui.client.mvc.DataModel;
005 import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo;
006
007 /**
008 * Skeletal implementation of {@link Configuration}.
009 *
010 * @author Igor
011 */
012 public abstract class AbstractConfiguration implements Configuration {
013
014 protected Configurer configurer;
015
016 public void setConfigurer(Configurer configurer) {
017 this.configurer = configurer;
018 }
019
020 @Override
021 public void applyRestrictions() {
022 }
023
024 @Override
025 public boolean checkPermission(DataModel model) {
026 return false;
027 }
028
029 @Override
030 public void removeRestrictions() {
031
032 }
033
034 /**
035 * Generates a message info to be used in your field descriptor to get the label for the field.
036 * Used by the field descriptor with the application context to determine the label to show based on
037 * the labelKey
038 * @param labelKey key of the message - must match a message in your messages (stored in the db)
039 * @return
040 */
041 public MessageKeyInfo generateMessageInfo(String labelKey) {
042 return this.configurer.generateMessageInfo(labelKey);
043 }
044
045 /**
046 * Gets the string corresponding to the label key passed in from the application messages
047 * @param labelKey
048 * @return
049 */
050 public String getLabel(String labelKey) {
051 return this.configurer.getLabel(labelKey);
052 }
053 }