1 | |
package org.kuali.student.lum.program.client.major.edit; |
2 | |
|
3 | |
import com.google.gwt.user.client.ui.Widget; |
4 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
5 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
6 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection; |
7 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
8 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
9 | |
import org.kuali.student.core.assembly.data.Metadata; |
10 | |
import org.kuali.student.core.assembly.data.QueryPath; |
11 | |
import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration; |
12 | |
import org.kuali.student.lum.common.client.lo.LOBuilder; |
13 | |
import org.kuali.student.lum.common.client.lo.LOBuilderBinding; |
14 | |
import org.kuali.student.lum.program.client.ProgramConstants; |
15 | |
import org.kuali.student.lum.program.client.ProgramSections; |
16 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
public class LearningObjectivesEditConfiguration extends AbstractSectionConfiguration { |
22 | |
|
23 | 0 | public LearningObjectivesEditConfiguration() { |
24 | 0 | rootSection = new VerticalSectionView(ProgramSections.LEARNING_OBJECTIVES_EDIT, ProgramProperties.get().program_menu_sections_learningObjectives(), ProgramConstants.PROGRAM_MODEL_ID); |
25 | 0 | } |
26 | |
|
27 | |
protected void buildLayout() { |
28 | 0 | VerticalSection section = new VerticalSection(); |
29 | 0 | QueryPath path = QueryPath.concat("", ProgramConstants.LEARNING_OBJECTIVES, "*", "loInfo", "desc"); |
30 | 0 | Metadata meta = configurer.getModelDefinition().getMetadata(path); |
31 | 0 | FieldDescriptor fd = addField(section, ProgramConstants.LEARNING_OBJECTIVES, |
32 | |
null, |
33 | |
new LOBuilder("type", "state", "course", "kuali.loRepository.key.singleUse", meta), |
34 | |
""); |
35 | 0 | fd.setWidgetBinding(LOBuilderBinding.INSTANCE); |
36 | 0 | section.addStyleName("KS-LUM-Section-Divider"); |
37 | 0 | rootSection.addSection(section); |
38 | 0 | } |
39 | |
|
40 | |
public FieldDescriptor addField(Section section, String fieldKey, MessageKeyInfo messageKey, Widget widget, String parentPath) { |
41 | 0 | QueryPath path = QueryPath.concat(parentPath, fieldKey); |
42 | 0 | Metadata meta = configurer.getModelDefinition().getMetadata(path); |
43 | |
|
44 | 0 | FieldDescriptor fd = new FieldDescriptor(path.toString(), messageKey, meta); |
45 | 0 | if (widget != null) { |
46 | 0 | fd.setFieldWidget(widget); |
47 | |
} |
48 | 0 | section.addField(fd); |
49 | 0 | return fd; |
50 | |
} |
51 | |
|
52 | |
} |