| 1 | |
package org.kuali.student.lum.program.client.core.edit; |
| 2 | |
|
| 3 | |
import com.google.gwt.user.client.ui.VerticalPanel; |
| 4 | |
|
| 5 | |
import org.kuali.student.common.ui.client.configurable.mvc.Configurer; |
| 6 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
| 7 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
| 8 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.BaseSection; |
| 9 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.HorizontalSection; |
| 10 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.VerticalSection; |
| 11 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView; |
| 12 | |
import org.kuali.student.lum.common.client.configuration.AbstractSectionConfiguration; |
| 13 | |
import org.kuali.student.lum.program.client.ProgramConstants; |
| 14 | |
import org.kuali.student.lum.program.client.ProgramMsgConstants; |
| 15 | |
import org.kuali.student.lum.program.client.ProgramSections; |
| 16 | |
import org.kuali.student.lum.program.client.core.CredentialProgramsBinding; |
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
public class CoreInformationEditConfiguration extends AbstractSectionConfiguration { |
| 22 | |
|
| 23 | 0 | public CoreInformationEditConfiguration(Configurer configurer) { |
| 24 | 0 | this.setConfigurer(configurer); |
| 25 | 0 | rootSection = new VerticalSectionView(ProgramSections.PROGRAM_DETAILS_EDIT, getLabel(ProgramMsgConstants.PROGRAM_MENU_SECTIONS_PROGRAMINFORMATION), |
| 26 | |
ProgramConstants.PROGRAM_MODEL_ID); |
| 27 | 0 | } |
| 28 | |
|
| 29 | |
@Override |
| 30 | |
protected void buildLayout() { |
| 31 | 0 | HorizontalSection horizontalSection = new HorizontalSection(); |
| 32 | 0 | horizontalSection.addSection(createLeftSection()); |
| 33 | 0 | horizontalSection.addSection(createRightSection()); |
| 34 | 0 | rootSection.addSection(horizontalSection); |
| 35 | 0 | } |
| 36 | |
|
| 37 | |
private VerticalSection createLeftSection() { |
| 38 | 0 | VerticalSection section = new VerticalSection(); |
| 39 | 0 | section.addSection(createKeyProgramInformationSection()); |
| 40 | 0 | section.addSection(createProgramTitleSection()); |
| 41 | 0 | section.addSection(createDatesSection()); |
| 42 | 0 | return section; |
| 43 | |
} |
| 44 | |
|
| 45 | |
private VerticalSection createRightSection() { |
| 46 | 0 | VerticalSection section = new VerticalSection(); |
| 47 | 0 | section.addStyleName("readOnlySection"); |
| 48 | 0 | section.addSection(createReadOnlySection()); |
| 49 | 0 | return section; |
| 50 | |
} |
| 51 | |
|
| 52 | |
private VerticalSection createKeyProgramInformationSection() { |
| 53 | 0 | VerticalSection section = new VerticalSection(); |
| 54 | 0 | configurer.addField(section, ProgramConstants.CODE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_CODE)); |
| 55 | 0 | return section; |
| 56 | |
} |
| 57 | |
|
| 58 | |
private VerticalSection createProgramTitleSection() { |
| 59 | 0 | VerticalSection section = new VerticalSection(); |
| 60 | 0 | configurer.addField(section, ProgramConstants.LONG_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLEFULL)); |
| 61 | 0 | configurer.addField(section, ProgramConstants.SHORT_TITLE, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLESHORT)); |
| 62 | 0 | configurer.addField(section, ProgramConstants.TRANSCRIPT, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_TITLETRANSCRIPT)); |
| 63 | 0 | return section; |
| 64 | |
} |
| 65 | |
|
| 66 | |
private VerticalSection createDatesSection() { |
| 67 | 0 | VerticalSection section = new VerticalSection(SectionTitle.generateH3Title(getLabel(ProgramMsgConstants.PROGRAMINFORMATION_DATES))); |
| 68 | |
|
| 69 | 0 | FieldDescriptor fd = configurer.addField(section,ProgramConstants.PROPOSAL_PREV_START_TERM_PATH, generateMessageInfo(ProgramMsgConstants.MAJORDISCIPLINE_PREVSTARTTERM)); |
| 70 | 0 | fd.getFieldWidget().setVisible(false); |
| 71 | 0 | fd.hideLabel(); |
| 72 | 0 | configurer.addField(section, ProgramConstants.START_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_STARTTERM)); |
| 73 | 0 | configurer.addField(section, ProgramConstants.END_PROGRAM_ENTRY_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENTRYTERM)); |
| 74 | 0 | configurer.addField(section, ProgramConstants.END_PROGRAM_ENROLL_TERM, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_ENROLLTERM)); |
| 75 | 0 | return section; |
| 76 | |
} |
| 77 | |
|
| 78 | |
private VerticalSection createReadOnlySection() { |
| 79 | 0 | VerticalSection section = new VerticalSection(); |
| 80 | 0 | addCredentialPrograms(section); |
| 81 | 0 | return section; |
| 82 | |
} |
| 83 | |
|
| 84 | |
private void addCredentialPrograms(BaseSection section) { |
| 85 | 0 | FieldDescriptor fieldDescriptor = configurer.addReadOnlyField(section, ProgramConstants.CREDENTIAL_PROGRAMS, generateMessageInfo(ProgramMsgConstants.PROGRAMINFORMATION_CREDENTIALPROGRAM), new VerticalPanel()); |
| 86 | 0 | fieldDescriptor.setWidgetBinding(new CredentialProgramsBinding()); |
| 87 | 0 | } |
| 88 | |
} |