| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.student.common.ui.client.configurable.mvc; |
| 17 |
|
|
| 18 |
|
import java.util.HashMap; |
| 19 |
|
import java.util.LinkedHashMap; |
| 20 |
|
import java.util.List; |
| 21 |
|
import java.util.Map; |
| 22 |
|
import java.util.Map.Entry; |
| 23 |
|
|
| 24 |
|
import org.kuali.student.common.assembly.data.QueryPath; |
| 25 |
|
import org.kuali.student.common.ui.client.application.Application; |
| 26 |
|
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController; |
| 27 |
|
import org.kuali.student.common.ui.client.configurable.mvc.layouts.TabMenuController; |
| 28 |
|
import org.kuali.student.common.ui.client.configurable.mvc.layouts.ViewLayoutController; |
| 29 |
|
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
| 30 |
|
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
| 31 |
|
import org.kuali.student.common.ui.client.event.ActionEvent; |
| 32 |
|
import org.kuali.student.common.ui.client.event.SaveActionEvent; |
| 33 |
|
import org.kuali.student.common.ui.client.event.SectionUpdateEvent; |
| 34 |
|
import org.kuali.student.common.ui.client.event.SectionUpdateHandler; |
| 35 |
|
import org.kuali.student.common.ui.client.event.ValidateRequestEvent; |
| 36 |
|
import org.kuali.student.common.ui.client.event.ValidateRequestHandler; |
| 37 |
|
import org.kuali.student.common.ui.client.mvc.ActionCompleteCallback; |
| 38 |
|
import org.kuali.student.common.ui.client.mvc.Callback; |
| 39 |
|
import org.kuali.student.common.ui.client.mvc.Controller; |
| 40 |
|
import org.kuali.student.common.ui.client.mvc.DataModel; |
| 41 |
|
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
| 42 |
|
import org.kuali.student.common.ui.client.mvc.View; |
| 43 |
|
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
| 44 |
|
import org.kuali.student.common.ui.client.widgets.KSButton; |
| 45 |
|
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
| 46 |
|
import org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement; |
| 47 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
| 48 |
|
import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel; |
| 49 |
|
|
| 50 |
|
import com.google.gwt.core.client.GWT; |
| 51 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
| 52 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
| 53 |
|
import com.google.gwt.user.client.ui.FlowPanel; |
| 54 |
|
import com.google.gwt.user.client.ui.Widget; |
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@see |
| 61 |
|
@author |
| 62 |
|
|
| 63 |
|
|
|
|
|
| 0% |
Uncovered Elements: 295 (295) |
Complexity: 95 |
Complexity Density: 0.59 |
|
| 64 |
|
public abstract class LayoutController extends Controller implements ViewLayoutController, View { |
| 65 |
|
|
| 66 |
|
protected Map<Enum<?>, View> viewMap = new LinkedHashMap<Enum<?>, View>(); |
| 67 |
|
protected Map<String, Enum<?>> viewEnumMap = new HashMap<String, Enum<?>>(); |
| 68 |
|
protected Enum<?> defaultView; |
| 69 |
|
|
| 70 |
|
protected String name; |
| 71 |
|
protected Enum<?> viewType; |
| 72 |
|
|
| 73 |
|
protected View startPopupView; |
| 74 |
|
protected KSLightBox startViewWindow; |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 80 |
0
|
public LayoutController(){... |
| 81 |
0
|
super(); |
| 82 |
|
|
| 83 |
0
|
addApplicationEventHandler(SectionUpdateEvent.TYPE, new SectionUpdateHandler(){ |
| 84 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 85 |
0
|
@Override... |
| 86 |
|
public void onSectionUpdate(final SectionUpdateEvent event) { |
| 87 |
0
|
LayoutController.this.requestModel(new ModelRequestCallback<DataModel>(){ |
| 88 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 89 |
0
|
@Override... |
| 90 |
|
public void onRequestFail(Throwable cause) { |
| 91 |
0
|
GWT.log("Unable to retrieve model for section update", cause); |
| 92 |
|
} |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 94 |
0
|
@Override... |
| 95 |
|
public void onModelReady(DataModel model) { |
| 96 |
0
|
event.getSection().updateModel(model); |
| 97 |
0
|
event.getSection().updateWidgetData(model); |
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
}); |
| 101 |
|
|
| 102 |
|
} |
| 103 |
|
}); |
| 104 |
|
|
| 105 |
0
|
addApplicationEventHandler(ValidateRequestEvent.TYPE, new ValidateRequestHandler() { |
| 106 |
|
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 107 |
0
|
@Override... |
| 108 |
|
public void onValidateRequest(final ValidateRequestEvent event) { |
| 109 |
0
|
FieldDescriptor originatingField = event.getFieldDescriptor(); |
| 110 |
0
|
String modelId = null; |
| 111 |
0
|
if (originatingField != null) { |
| 112 |
0
|
modelId = originatingField.getModelId(); |
| 113 |
|
} |
| 114 |
0
|
if (modelId == null) { |
| 115 |
0
|
requestModel(new ModelRequestCallback<DataModel>() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
0
|
@Override... |
| 117 |
|
public void onModelReady(DataModel model) { |
| 118 |
0
|
validate(model, event); |
| 119 |
|
} |
| 120 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 121 |
0
|
@Override... |
| 122 |
|
public void onRequestFail(Throwable cause) { |
| 123 |
0
|
GWT.log("Unable to retrieve model for validation", cause); |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
}); |
| 127 |
|
} else { |
| 128 |
0
|
requestModel(modelId, new ModelRequestCallback<DataModel>() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 129 |
0
|
@Override... |
| 130 |
|
public void onModelReady(DataModel model) { |
| 131 |
0
|
validate(model, event); |
| 132 |
|
} |
| 133 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 134 |
0
|
@Override... |
| 135 |
|
public void onRequestFail(Throwable cause) { |
| 136 |
0
|
GWT.log("Unable to retrieve model for validation", cause); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
}); |
| 140 |
|
} |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
}); |
| 144 |
|
} |
| 145 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 146 |
0
|
private void validate(DataModel model, final ValidateRequestEvent event) {... |
| 147 |
0
|
if(event.validateSingleField()){ |
| 148 |
0
|
model.validateField(event.getFieldDescriptor(), new Callback<List<ValidationResultInfo>>() { |
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 8 |
Complexity Density: 0.73 |
|
| 149 |
0
|
@Override... |
| 150 |
|
public void exec(List<ValidationResultInfo> result) { |
| 151 |
0
|
if(event.getFieldDescriptor() != null) { |
| 152 |
|
|
| 153 |
|
|
| 154 |
0
|
FieldElement element = event.getFieldDescriptor().getFieldElement(); |
| 155 |
0
|
Widget w = event.getFieldDescriptor().getFieldWidget(); |
| 156 |
0
|
if(element != null) { |
| 157 |
0
|
element.clearValidationErrors(); |
| 158 |
|
|
| 159 |
0
|
if ((w instanceof CanProcessValidationResults) && ((CanProcessValidationResults) w).doesOnTheFlyValidation()) { |
| 160 |
0
|
((CanProcessValidationResults) w).Validate(event, result); |
| 161 |
|
} else { |
| 162 |
0
|
for(int i = 0; i < result.size(); i++) { |
| 163 |
0
|
ValidationResultInfo vr = result.get(i); |
| 164 |
0
|
if (vr.getElement().equals(event.getFieldDescriptor().getFieldKey()) && event.getFieldDescriptor().hasHadFocus()) { |
| 165 |
0
|
element.processValidationResult(vr); |
| 166 |
|
} |
| 167 |
|
} |
| 168 |
|
} |
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
} |
| 173 |
|
}); |
| 174 |
|
} else { |
| 175 |
0
|
model.validate(new Callback<List<ValidationResultInfo>>() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 176 |
0
|
@Override... |
| 177 |
|
public void exec(List<ValidationResultInfo> result) { |
| 178 |
0
|
isValid(result, false, true); |
| 179 |
|
} |
| 180 |
|
}); |
| 181 |
|
} |
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
|
| 185 |
|
|
| 186 |
|
@param |
| 187 |
|
@return |
| 188 |
|
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 189 |
0
|
public ErrorLevel checkForErrors(List<ValidationResultInfo> list){... |
| 190 |
0
|
ErrorLevel errorLevel = ErrorLevel.OK; |
| 191 |
|
|
| 192 |
0
|
for(ValidationResultInfo vr: list){ |
| 193 |
0
|
if(vr.getErrorLevel().getLevel() > errorLevel.getLevel()){ |
| 194 |
0
|
errorLevel = vr.getErrorLevel(); |
| 195 |
|
} |
| 196 |
0
|
if(errorLevel.equals(ErrorLevel.ERROR)){ |
| 197 |
0
|
break; |
| 198 |
|
} |
| 199 |
|
} |
| 200 |
|
|
| 201 |
0
|
return errorLevel; |
| 202 |
|
|
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
@param |
| 209 |
|
@return |
| 210 |
|
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.38 |
|
| 211 |
0
|
public static LayoutController findParentLayout(Widget w){... |
| 212 |
0
|
LayoutController result = null; |
| 213 |
0
|
while (true) { |
| 214 |
0
|
if (w == null) { |
| 215 |
0
|
break; |
| 216 |
0
|
} else if (w instanceof HasLayoutController) { |
| 217 |
0
|
result = ((HasLayoutController)w).getLayoutController(); |
| 218 |
0
|
if (result != null) { |
| 219 |
0
|
break; |
| 220 |
|
} |
| 221 |
0
|
} else if (w instanceof LayoutController) { |
| 222 |
0
|
result = (LayoutController) w; |
| 223 |
0
|
break; |
| 224 |
|
} |
| 225 |
0
|
w = w.getParent(); |
| 226 |
|
|
| 227 |
|
} |
| 228 |
0
|
return result; |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
|
| 232 |
|
@see |
| 233 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 234 |
0
|
public void addStartViewPopup(final View view){... |
| 235 |
0
|
startPopupView = view; |
| 236 |
0
|
if(startViewWindow == null){ |
| 237 |
0
|
startViewWindow = new KSLightBox(); |
| 238 |
|
} |
| 239 |
|
|
| 240 |
0
|
FlowPanel panel = new FlowPanel(); |
| 241 |
0
|
panel.add(view.asWidget()); |
| 242 |
0
|
KSButton save = new KSButton("Save",new ClickHandler(){ |
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 243 |
0
|
public void onClick(ClickEvent event) {... |
| 244 |
0
|
view.updateModel(); |
| 245 |
0
|
SaveActionEvent saveActionEvent = new SaveActionEvent(true); |
| 246 |
|
|
| 247 |
0
|
saveActionEvent.setActionCompleteCallback(new ActionCompleteCallback(){ |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 248 |
0
|
public void onActionComplete(ActionEvent action) {... |
| 249 |
0
|
startViewWindow.hide(); |
| 250 |
|
} |
| 251 |
|
}); |
| 252 |
|
|
| 253 |
|
|
| 254 |
0
|
fireApplicationEvent(saveActionEvent); |
| 255 |
|
} |
| 256 |
|
}); |
| 257 |
0
|
startViewWindow.addButton(save); |
| 258 |
|
|
| 259 |
0
|
KSButton cancel = new KSButton("Cancel", new ClickHandler(){ |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 260 |
0
|
public void onClick(ClickEvent event) {... |
| 261 |
0
|
startViewWindow.hide(); |
| 262 |
|
} |
| 263 |
|
}); |
| 264 |
0
|
startViewWindow.addButton(cancel); |
| 265 |
|
|
| 266 |
0
|
if(view instanceof SectionView){ |
| 267 |
0
|
((SectionView) view).setController(this); |
| 268 |
|
} |
| 269 |
0
|
startViewWindow.setWidget(panel); |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
|
| 273 |
|
@return |
| 274 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 275 |
0
|
public boolean isStartViewShowing(){... |
| 276 |
0
|
if(startViewWindow == null){ |
| 277 |
0
|
return false; |
| 278 |
|
} |
| 279 |
0
|
return startViewWindow.isShowing(); |
| 280 |
|
} |
| 281 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 282 |
0
|
public View getStartPopupView(){... |
| 283 |
0
|
return startPopupView; |
| 284 |
|
} |
| 285 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 286 |
0
|
public void showStartPopup(final Callback<Boolean> onReadyCallback){... |
| 287 |
0
|
startPopupView.beforeShow(new Callback<Boolean>() { |
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 288 |
0
|
@Override... |
| 289 |
|
public void exec(Boolean result) { |
| 290 |
0
|
if (result) { |
| 291 |
0
|
startViewWindow.show(); |
| 292 |
|
} |
| 293 |
0
|
onReadyCallback.exec(result); |
| 294 |
|
} |
| 295 |
|
}); |
| 296 |
|
} |
| 297 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 298 |
0
|
public KSLightBox getStartPopup(){... |
| 299 |
0
|
return startViewWindow; |
| 300 |
|
} |
| 301 |
|
|
| 302 |
|
|
| 303 |
|
|
| 304 |
|
|
| 305 |
|
|
| 306 |
|
@see |
| 307 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 308 |
0
|
public void addView(View view){... |
| 309 |
0
|
viewMap.put(view.getViewEnum(), view); |
| 310 |
0
|
viewEnumMap.put(view.getViewEnum().toString(), view.getViewEnum()); |
| 311 |
0
|
if(view instanceof SectionView){ |
| 312 |
0
|
((SectionView) view).setController(this); |
| 313 |
|
} |
| 314 |
0
|
else if(view instanceof ToolView){ |
| 315 |
0
|
((ToolView) view).setController(this); |
| 316 |
|
} |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
|
| 320 |
|
@see |
| 321 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 322 |
0
|
public <V extends Enum<?>> void setDefaultView(V viewType){... |
| 323 |
0
|
this.defaultView = viewType; |
| 324 |
|
} |
| 325 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 326 |
0
|
public Enum<?> getDefaultView(){... |
| 327 |
0
|
return this.defaultView; |
| 328 |
|
} |
| 329 |
|
|
| 330 |
|
|
| 331 |
|
@see |
| 332 |
|
|
| 333 |
|
public abstract void updateModel(); |
| 334 |
|
|
| 335 |
|
|
| 336 |
|
|
| 337 |
|
@param |
| 338 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 339 |
0
|
public void updateModelFromView(Enum<?> viewType){... |
| 340 |
0
|
View v = viewMap.get(viewType); |
| 341 |
0
|
if(v != null){ |
| 342 |
0
|
v.updateModel(); |
| 343 |
|
} |
| 344 |
|
} |
| 345 |
|
|
| 346 |
|
|
| 347 |
|
|
| 348 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 349 |
0
|
public void updateModelFromCurrentView(){... |
| 350 |
0
|
if(this.getCurrentView() != null){ |
| 351 |
0
|
this.getCurrentView().updateModel(); |
| 352 |
|
} |
| 353 |
|
} |
| 354 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 355 |
0
|
@Override... |
| 356 |
|
public <V extends Enum<?>> void getView(V viewType, Callback<View> callback) { |
| 357 |
0
|
callback.exec(viewMap.get(viewType)); |
| 358 |
|
} |
| 359 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 360 |
0
|
@Override... |
| 361 |
|
public Enum<?> getViewEnumValue(String enumValue) { |
| 362 |
0
|
return viewEnumMap.get(enumValue); |
| 363 |
|
} |
| 364 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 365 |
0
|
@Override... |
| 366 |
|
public void showDefaultView(final Callback<Boolean> onReadyCallback) { |
| 367 |
0
|
HistoryManager.setLogNavigationHistory(false); |
| 368 |
|
|
| 369 |
0
|
if(defaultView != null){ |
| 370 |
0
|
showView(defaultView, onReadyCallback); |
| 371 |
|
} |
| 372 |
0
|
else if(!viewMap.isEmpty()){ |
| 373 |
0
|
if(defaultView == null){ |
| 374 |
0
|
showView(viewMap.entrySet().iterator().next().getKey(), onReadyCallback); |
| 375 |
|
} |
| 376 |
|
} |
| 377 |
|
|
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
|
| 381 |
|
|
| 382 |
|
|
| 383 |
|
|
| 384 |
|
@param |
| 385 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 386 |
0
|
public void showFirstView(Callback<Boolean> onReadyCallback){... |
| 387 |
0
|
HistoryManager.setLogNavigationHistory(false); |
| 388 |
0
|
if(!viewMap.isEmpty()){ |
| 389 |
0
|
showView(viewMap.entrySet().iterator().next().getKey(), onReadyCallback); |
| 390 |
|
} |
| 391 |
|
else{ |
| 392 |
0
|
showDefaultView(onReadyCallback); |
| 393 |
|
} |
| 394 |
|
} |
| 395 |
|
|
| 396 |
|
|
| 397 |
|
|
| 398 |
|
|
| 399 |
|
|
| 400 |
|
@param |
| 401 |
|
@param |
| 402 |
|
@return |
| 403 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 404 |
0
|
public boolean isValid(List<ValidationResultInfo> validationResults, boolean checkCurrentSectionOnly){... |
| 405 |
0
|
return isValid(validationResults, checkCurrentSectionOnly, true); |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
|
| 409 |
|
@see |
| 410 |
|
@param |
| 411 |
|
@param |
| 412 |
|
@param |
| 413 |
|
@return |
| 414 |
|
|
|
|
|
| 0% |
Uncovered Elements: 43 (43) |
Complexity: 10 |
Complexity Density: 0.4 |
|
| 415 |
0
|
public boolean isValid(List<ValidationResultInfo> validationResults, boolean checkCurrentSectionOnly, boolean allFields){... |
| 416 |
|
|
| 417 |
0
|
boolean isValid = true; |
| 418 |
|
|
| 419 |
0
|
clearAllWarnings(); |
| 420 |
|
|
| 421 |
0
|
if (checkCurrentSectionOnly){ |
| 422 |
|
|
| 423 |
0
|
View v = getCurrentView(); |
| 424 |
0
|
if(v instanceof Section){ |
| 425 |
0
|
isValid = isValid(validationResults, (Section)v, allFields); |
| 426 |
|
} |
| 427 |
0
|
if(this.isStartViewShowing()){ |
| 428 |
0
|
if(startPopupView instanceof Section){ |
| 429 |
0
|
isValid = isValid(validationResults, ((Section) startPopupView), allFields) && isValid; |
| 430 |
|
} |
| 431 |
|
} |
| 432 |
|
} else { |
| 433 |
|
|
| 434 |
0
|
String errorSections = ""; |
| 435 |
0
|
StringBuilder errorSectionsbuffer = new StringBuilder(); |
| 436 |
0
|
errorSectionsbuffer.append(errorSections); |
| 437 |
0
|
for (Entry<Enum<?>, View> entry:viewMap.entrySet()) { |
| 438 |
0
|
View v = entry.getValue(); |
| 439 |
0
|
if (v instanceof Section){ |
| 440 |
0
|
if (!isValid(validationResults, (Section)v, allFields)){ |
| 441 |
0
|
isValid = false; |
| 442 |
0
|
errorSectionsbuffer.append(((SectionView)v).getName() + ", "); |
| 443 |
|
} |
| 444 |
|
} |
| 445 |
|
} |
| 446 |
0
|
if(this.isStartViewShowing()){ |
| 447 |
0
|
if(startPopupView instanceof Section){ |
| 448 |
0
|
isValid = isValid(validationResults, ((Section) startPopupView), allFields) && isValid; |
| 449 |
|
} |
| 450 |
|
} |
| 451 |
0
|
errorSections = errorSectionsbuffer.toString(); |
| 452 |
0
|
if (!errorSections.isEmpty()){ |
| 453 |
0
|
errorSections = errorSections.substring(0, errorSections.length()-2); |
| 454 |
|
|
| 455 |
|
} |
| 456 |
|
} |
| 457 |
|
|
| 458 |
0
|
return isValid; |
| 459 |
|
} |
| 460 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 461 |
0
|
private boolean isValid(List<ValidationResultInfo> validationResults, Section section, boolean allFields){ ... |
| 462 |
0
|
ErrorLevel status; |
| 463 |
0
|
if(allFields){ |
| 464 |
0
|
section.setFieldHasHadFocusFlags(true); |
| 465 |
0
|
status = section.processValidationResults(validationResults); |
| 466 |
|
} |
| 467 |
|
else{ |
| 468 |
0
|
status = section.processValidationResults(validationResults, false); |
| 469 |
|
} |
| 470 |
|
|
| 471 |
0
|
return (status != ErrorLevel.ERROR); |
| 472 |
|
} |
| 473 |
|
|
| 474 |
|
|
| 475 |
|
|
| 476 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 477 |
0
|
protected void clearAllWarnings(){... |
| 478 |
0
|
for (Entry<Enum<?>, View> entry:viewMap.entrySet()) { |
| 479 |
0
|
View v = entry.getValue(); |
| 480 |
0
|
if (v instanceof Section){ |
| 481 |
0
|
((Section)v).clearValidationWarnings(); |
| 482 |
|
} |
| 483 |
|
} |
| 484 |
|
} |
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 492 |
|
|
| 493 |
|
@see |
| 494 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 495 |
0
|
@Override... |
| 496 |
|
public void beforeViewChange(Enum<?> viewChangingTo, Callback<Boolean> okToChange) { |
| 497 |
|
|
| 498 |
0
|
if(this.getCurrentView() instanceof Controller){ |
| 499 |
0
|
((Controller)this.getCurrentView()).beforeViewChange(viewChangingTo, okToChange); |
| 500 |
|
} |
| 501 |
|
else{ |
| 502 |
0
|
okToChange.exec(true); |
| 503 |
|
} |
| 504 |
|
|
| 505 |
0
|
this.showExport(isExportButtonActive()); |
| 506 |
|
} |
| 507 |
|
|
| 508 |
|
|
| 509 |
|
|
| 510 |
|
|
| 511 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 512 |
0
|
protected void showWarnings(){ ... |
| 513 |
0
|
if (!Application.getApplicationContext().getValidationWarnings().isEmpty()){ |
| 514 |
0
|
isValid(Application.getApplicationContext().getValidationWarnings(), true); |
| 515 |
|
} |
| 516 |
|
} |
| 517 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 518 |
0
|
@Override... |
| 519 |
|
public Widget asWidget() { |
| 520 |
0
|
return this; |
| 521 |
|
} |
| 522 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 523 |
0
|
@Override... |
| 524 |
|
public boolean beforeHide() { |
| 525 |
0
|
return true; |
| 526 |
|
} |
| 527 |
|
|
| 528 |
|
|
| 529 |
|
|
| 530 |
|
|
| 531 |
|
@see |
| 532 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 533 |
0
|
@Override... |
| 534 |
|
public void beforeShow(Callback<Boolean> onReadyCallback) { |
| 535 |
0
|
onReadyCallback.exec(true); |
| 536 |
|
} |
| 537 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 538 |
0
|
@Override... |
| 539 |
|
public Controller getController() { |
| 540 |
0
|
return parentController; |
| 541 |
|
} |
| 542 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 543 |
0
|
@Override... |
| 544 |
|
public String getName() { |
| 545 |
0
|
if(name == null && viewType != null){ |
| 546 |
0
|
return viewType.toString(); |
| 547 |
|
} |
| 548 |
|
else{ |
| 549 |
0
|
return name; |
| 550 |
|
} |
| 551 |
|
} |
| 552 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 553 |
0
|
@Override... |
| 554 |
|
public Enum<?> getViewEnum() { |
| 555 |
0
|
return viewType; |
| 556 |
|
} |
| 557 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 558 |
0
|
public void setViewEnum(Enum<?> viewType){... |
| 559 |
0
|
this.viewType= viewType; |
| 560 |
|
} |
| 561 |
|
|
| 562 |
|
|
| 563 |
|
|
| 564 |
|
|
| 565 |
|
@param |
| 566 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 567 |
0
|
public void setName(String name){... |
| 568 |
0
|
this.name = name; |
| 569 |
|
} |
| 570 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 571 |
0
|
public void setController(Controller controller){... |
| 572 |
0
|
parentController = controller; |
| 573 |
|
} |
| 574 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 575 |
0
|
@Override... |
| 576 |
|
public void collectBreadcrumbNames(List<String> names) { |
| 577 |
0
|
names.add(this.getName()); |
| 578 |
0
|
if(this.getCurrentView() != null){ |
| 579 |
0
|
this.getCurrentView().collectBreadcrumbNames(names); |
| 580 |
|
} |
| 581 |
|
} |
| 582 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 583 |
0
|
@Override... |
| 584 |
|
public void clear() { |
| 585 |
|
|
| 586 |
|
} |
| 587 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 588 |
0
|
public boolean isExportButtonActive() {... |
| 589 |
0
|
return false; |
| 590 |
|
} |
| 591 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 592 |
0
|
@Override... |
| 593 |
|
public void showExport(boolean show) { |
| 594 |
|
|
| 595 |
|
|
| 596 |
|
} |
| 597 |
|
} |