Skip to content
Snippets Groups Projects
Commit 26a569aa authored by srosse's avatar srosse
Browse files

no-jira: auto completer form item need to send form event too

parent 8e889446
No related branches found
No related tags found
No related merge requests found
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.core.gui.components.form.flexible.impl.elements;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
/**
*
* Initial date: 12 août 2020<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class AutoCompleteFormEvent extends FormEvent {
private static final long serialVersionUID = -2589906437153168517L;
private final String key;
public AutoCompleteFormEvent(String command, FormItem source, String key) {
super(command, source);
this.key = key;
}
public String getKey() {
return key;
}
}
...@@ -63,6 +63,7 @@ public class AutoCompleterComponent extends FormBaseComponentImpl { ...@@ -63,6 +63,7 @@ public class AutoCompleterComponent extends FormBaseComponentImpl {
autoCompleter.setKey(key); autoCompleter.setKey(key);
autoCompleter.setValue(value); autoCompleter.setValue(value);
fireEvent(ureq, new AutoCompleteEvent(AutoCompleteEvent.SELECT_EVENT, key)); fireEvent(ureq, new AutoCompleteEvent(AutoCompleteEvent.SELECT_EVENT, key));
autoCompleter.dispatchFormRequest(ureq);
} }
} }
......
...@@ -96,14 +96,27 @@ public class AutoCompleterImpl extends AbstractTextElement implements AutoComple ...@@ -96,14 +96,27 @@ public class AutoCompleterImpl extends AbstractTextElement implements AutoComple
} }
} }
@Override
public int getMinLength() { public int getMinLength() {
return minLength; return minLength;
} }
@Override
public void setMinLength(int minLength) { public void setMinLength(int minLength) {
this.minLength = minLength; this.minLength = minLength;
} }
@Override
public void dispatchFormRequest(UserRequest ureq) {
String cmd = ureq.getParameter("cid");
if("select".equals(cmd)) {
String uKey = ureq.getParameter("key");
setKey(uKey);
setValue(ureq.getParameter("value"));
getRootForm().fireFormEvent(ureq, new AutoCompleteFormEvent(AutoCompleteEvent.SELECT_EVENT, this, uKey));
}
}
@Override @Override
public void evalFormRequest(UserRequest ureq) { public void evalFormRequest(UserRequest ureq) {
String paramId = component.getFormDispatchId(); String paramId = component.getFormDispatchId();
......
...@@ -104,7 +104,6 @@ public class EditLectureBlockController extends FormBasicController { ...@@ -104,7 +104,6 @@ public class EditLectureBlockController extends FormBasicController {
private List<Identity> teachers; private List<Identity> teachers;
private List<GroupBox> groupBox; private List<GroupBox> groupBox;
private String[] teacherKeys; private String[] teacherKeys;
private String[] teacherValues;
private final boolean lectureManagementManaged; private final boolean lectureManagementManaged;
private final List<LocationHistory> locations; private final List<LocationHistory> locations;
...@@ -205,7 +204,7 @@ public class EditLectureBlockController extends FormBasicController { ...@@ -205,7 +204,7 @@ public class EditLectureBlockController extends FormBasicController {
} }
allPossibleTeachers = new ArrayList<>(new HashSet<>(allPossibleTeachers)); allPossibleTeachers = new ArrayList<>(new HashSet<>(allPossibleTeachers));
teacherKeys = new String[allPossibleTeachers.size() + 1]; teacherKeys = new String[allPossibleTeachers.size() + 1];
teacherValues = new String[allPossibleTeachers.size() + 1]; String[] teacherValues = new String[allPossibleTeachers.size() + 1];
for(int i=allPossibleTeachers.size() + 1; i-->1; ) { for(int i=allPossibleTeachers.size() + 1; i-->1; ) {
Identity coach = allPossibleTeachers.get(i - 1); Identity coach = allPossibleTeachers.get(i - 1);
teacherKeys[i] = coach.getKey().toString(); teacherKeys[i] = coach.getKey().toString();
...@@ -396,8 +395,6 @@ public class EditLectureBlockController extends FormBasicController { ...@@ -396,8 +395,6 @@ public class EditLectureBlockController extends FormBasicController {
} }
lectureBlock.setStartDate(dateEl.getDate()); lectureBlock.setStartDate(dateEl.getDate());
lectureBlock.setEndDate(dateEl.getSecondDate()); lectureBlock.setEndDate(dateEl.getSecondDate());
System.out.println(dateEl.getDate());
System.out.println(dateEl.getSecondDate());
int plannedLectures = Integer.parseInt(plannedLecturesEl.getSelectedKey()); int plannedLectures = Integer.parseInt(plannedLecturesEl.getSelectedKey());
lectureBlock.setPlannedLecturesNumber(plannedLectures); lectureBlock.setPlannedLecturesNumber(plannedLectures);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment