diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java index cc90e47e8782e1e2bf02e3b2d85e187998376cb0..c5ce1e1e8fddb12566b6cf4de654f92677eb9b9e 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java @@ -679,7 +679,7 @@ public class Form extends LogDelegator { } - private class FormDependencyRulesInitComponentVisitor implements FormComponentVisitor { + private static class FormDependencyRulesInitComponentVisitor implements FormComponentVisitor { public boolean visit(FormItem comp, UserRequest ureq) { if (comp instanceof FormItemContainer) { @@ -698,18 +698,8 @@ public class Form extends LogDelegator { } - - /** - * Description:<br> - * TODO: patrickb Class Description for ValidatingFormComponentVisitor - * <P> - * Initial Date: 07.12.2006 <br> - * - * @author patrickb - */ - private class ValidatingFormComponentVisitor implements FormComponentVisitor { - - List tmp = new ArrayList(); + private static class ValidatingFormComponentVisitor implements FormComponentVisitor { + final List<ValidationStatus> tmp = new ArrayList<ValidationStatus>(); public ValidationStatus[] getStatus() { return ValidationStatusHelper.sort(tmp); @@ -723,15 +713,8 @@ public class Form extends LogDelegator { return true; } } - /** - * Description:<br> - * TODO: patrickb Class Description for ValidatingFormComponentVisitor - * <P> - * Initial Date: 07.12.2006 <br> - * - * @author patrickb - */ - private class ResettingFormComponentVisitor implements FormComponentVisitor { + + private static class ResettingFormComponentVisitor implements FormComponentVisitor { public boolean visit(FormItem comp, UserRequest ureq) { //reset all fields including also non visible and disabled form items! diff --git a/src/main/java/org/olat/portfolio/ui/structel/EPShareListController.java b/src/main/java/org/olat/portfolio/ui/structel/EPShareListController.java index b616b7c7907bce4f2bc16bfbb7dd229488bf6f0a..fdcfd69107c0011a8efc33f123711b78869906f0 100644 --- a/src/main/java/org/olat/portfolio/ui/structel/EPShareListController.java +++ b/src/main/java/org/olat/portfolio/ui/structel/EPShareListController.java @@ -153,6 +153,10 @@ public class EPShareListController extends FormBasicController { for (PolicyWrapper policyWrapper : policyWrappers) { Type type = policyWrapper.getType(); + if(type == null) { + continue;//tutor implicit rule + } + TextElement mailEl = policyWrapper.getMailEl(); if (mailEl != null) { String mail = mailEl.getValue(); @@ -185,7 +189,8 @@ public class EPShareListController extends FormBasicController { allOk &= false; } } - if (policyWrapper.getFromChooser().hasError() || policyWrapper.getToChooser().hasError()){ + if ((policyWrapper.getFromChooser() != null && policyWrapper.getFromChooser().hasError()) + || (policyWrapper.getToChooser() != null && policyWrapper.getToChooser().hasError())){ genericError = translate("map.share.date.invalid"); allOk &= false; } @@ -200,7 +205,9 @@ public class EPShareListController extends FormBasicController { FormLayoutContainer cmp = (FormLayoutContainer) flc.getFormComponent(policyWrapper.getComponentName()); String errorCompName = policyWrapper.calc("errorpanel"); StaticTextElement errTextEl = (StaticTextElement) cmp.getFormComponent(errorCompName); - if (genericError != null) errTextEl.setValue(genericError); + if (genericError != null && errTextEl != null) { + errTextEl.setValue(genericError); + } } return allOk && super.validateFormLogic(ureq); @@ -213,6 +220,8 @@ public class EPShareListController extends FormBasicController { List<EPMapPolicy> mapPolicies = new ArrayList<EPMapPolicy>(); for(PolicyWrapper wrapper:policyWrappers) { + if(wrapper.getType() == null) continue; + mapPolicies.add(wrapper.getMapPolicy()); if (wrapper.getType().equals(EPMapPolicy.Type.invitation)){ // always send an invitation mail for invited-non-olat users @@ -387,8 +396,12 @@ public class EPShareListController extends FormBasicController { if(mailEl != null) { policyWrapper.getInvitation().setMail(mailEl.getValue()); } - policyWrapper.setFrom(policyWrapper.getFromChooser().getDate()); - policyWrapper.setTo(policyWrapper.getToChooser().getDate()); + if(policyWrapper.getFromChooser() != null) { + policyWrapper.setFrom(policyWrapper.getFromChooser().getDate()); + } + if(policyWrapper.getToChooser() != null) { + policyWrapper.setTo(policyWrapper.getToChooser().getDate()); + } } } @@ -413,10 +426,10 @@ public class EPShareListController extends FormBasicController { container.contextPut("wrapper", policyWrapper); container.setRootForm(mainForm); - SingleSelection type = uifactory.addDropdownSingleselect("map.share.target." + cmpName, "map.share.target", container, targetKeys, targetValues, null); - type.addActionListener(this, FormEvent.ONCHANGE); - type.setUserObject(policyWrapper); if(policyWrapper.getType() != null) { + SingleSelection type = uifactory.addDropdownSingleselect("map.share.target." + cmpName, "map.share.target", container, targetKeys, targetValues, null); + type.addActionListener(this, FormEvent.ONCHANGE); + type.setUserObject(policyWrapper); type.select(policyWrapper.getType().name(), true); switch(policyWrapper.getType()) { case user: @@ -628,7 +641,7 @@ public class EPShareListController extends FormBasicController { if (StringHelper.containsNonWhitespace(searchValue)) { String searchValueLower = searchValue.toLowerCase(); for(BusinessGroup group:groupList) { - if(group.getName().toLowerCase().indexOf(searchValueLower) >= 0) { + if(group.getName() != null && group.getName().toLowerCase().indexOf(searchValueLower) >= 0) { resMap.put(group.getName(), group.getKey().toString()); } } @@ -638,6 +651,11 @@ public class EPShareListController extends FormBasicController { public class TutorPolicyWrapper extends PolicyWrapper { + @Override + public Type getType() { + return null; + } + @Override public Date getTo() { return null;