Clover Coverage Report - KS LUM 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 06:51:40 EDT
../../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
33   117   10   3.67
2   88   0.3   9
9     1.11  
1    
 
  VariationController       Line # 30 33 0% 10 44 0% 0.0
 
No Tests
 
1    package org.kuali.student.lum.program.client.variation;
2   
3    import com.google.gwt.event.dom.client.ClickEvent;
4    import com.google.gwt.event.dom.client.ClickHandler;
5    import com.google.gwt.event.shared.HandlerManager;
6    import com.google.gwt.user.client.ui.Anchor;
7    import com.google.gwt.user.client.ui.HorizontalPanel;
8    import com.google.gwt.user.client.ui.Label;
9    import com.google.gwt.user.client.ui.Widget;
10   
11    import org.kuali.student.common.assembly.data.Data;
12    import org.kuali.student.common.ui.client.application.ViewContext;
13    import org.kuali.student.common.ui.client.mvc.DataModel;
14    import org.kuali.student.common.ui.client.mvc.ModelRequestCallback;
15    import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
16    import org.kuali.student.lum.common.client.widgets.AppLocations;
17    import org.kuali.student.lum.program.client.ProgramConstants;
18    import org.kuali.student.lum.program.client.ProgramController;
19    import org.kuali.student.lum.program.client.events.ModelLoadedEvent;
20    import org.kuali.student.lum.program.client.major.MajorController;
21    import org.kuali.student.lum.program.client.properties.ProgramProperties;
22    import org.kuali.student.lum.program.client.rpc.AbstractCallback;
23    import org.kuali.student.lum.program.client.widgets.ProgramSideBar;
24   
25    import java.util.List;
26   
27    /**
28    * @author Igor
29    */
 
30    public abstract class VariationController extends ProgramController {
31   
32    private String parentName;
33   
34    protected MajorController majorController;
35   
36    /**
37    * Constructor.
38    *
39    * @param programModel
40    * @param eventBus
41    */
 
42  0 toggle public VariationController(DataModel programModel, ViewContext viewContext, HandlerManager eventBus, MajorController majorController) {
43  0 super("", programModel, viewContext, eventBus);
44  0 this.parentName = majorController.getName();
45  0 this.majorController = majorController;
46  0 setName(getProgramName());
47  0 sideBar = new ProgramSideBar(eventBus, ProgramSideBar.Type.MAJOR);
48  0 sideBar.initialize(majorController);
49    }
50   
 
51  0 toggle @Override
52    protected void configureView() {
53  0 setStatus();
54  0 super.configureView();
55  0 setContentTitle(getProgramName());
56  0 addContentWidget(createParentAnchor());
57  0 addContentWidget(createCommentPanel());
58    }
59   
 
60  0 toggle private Widget createParentAnchor() {
61  0 HorizontalPanel anchorPanel = new HorizontalPanel();
62  0 Anchor anchor = new Anchor(parentName);
63  0 anchor.addClickHandler(new ClickHandler() {
 
64  0 toggle @Override
65    public void onClick(ClickEvent event) {
66  0 navigateToParent();
67    }
68    });
69  0 Label parentProgram = new Label(ProgramProperties.get().variation_parentProgram());
70  0 parentProgram.addStyleName("parentProgram");
71  0 anchorPanel.add(parentProgram);
72  0 anchorPanel.add(anchor);
73  0 return anchorPanel;
74    }
75   
76    protected abstract void navigateToParent();
77   
 
78  0 toggle @Override
79    public String getProgramName() {
80  0 String name = getStringProperty(ProgramConstants.LONG_TITLE);
81  0 if (name == null) {
82  0 return ProgramProperties.get().variation_new();
83    }
84  0 return ProgramProperties.get().variation_title(name);
85    }
86   
 
87  0 toggle @Override
88    public void collectBreadcrumbNames(List<String> names) {
89  0 names.add(parentName + "@" + HistoryManager.appendContext(AppLocations.Locations.VIEW_PROGRAM.getLocation(), getViewContext()));
90  0 super.collectBreadcrumbNames(names);
91    }
92   
93    /**
94    * Loads data model from the server.
95    *
96    * @param callback we have to invoke this callback when model is loaded or failed.
97    */
 
98  0 toggle @Override
99    protected void loadModel(final ModelRequestCallback<DataModel> callback) {
100  0 programRemoteService.getData(getViewContext().getId(), new AbstractCallback<Data>(ProgramProperties.get().common_retrievingData()) {
101   
 
102  0 toggle @Override
103    public void onFailure(Throwable caught) {
104  0 super.onFailure(caught);
105  0 callback.onRequestFail(caught);
106    }
107   
 
108  0 toggle @Override
109    public void onSuccess(Data result) {
110  0 super.onSuccess(result);
111  0 programModel.setRoot(result);
112  0 callback.onModelReady(programModel);
113  0 eventBus.fireEvent(new ModelLoadedEvent(programModel));
114    }
115    });
116    }
117    }