-
Notifications
You must be signed in to change notification settings - Fork 188
/
InternalsDebugUtilPanel.java
79 lines (63 loc) · 3.02 KB
/
InternalsDebugUtilPanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.web.page.admin.configuration;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.util.DebugUtil;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.AjaxSubmitButton;
import com.evolveum.midpoint.web.component.form.CheckFormGroup;
import com.evolveum.midpoint.web.page.admin.configuration.dto.InternalsConfigDto;
public class InternalsDebugUtilPanel extends BasePanel<InternalsConfigDto>{
private static final long serialVersionUID = 1L;
private static final Trace LOGGER = TraceManager.getTrace(InternalsDebugUtilPanel.class);
private static final String ID_FORM = "form";
private static final String ID_DETAILED_DEBUG_DUMP = "detailedDebugDump";
private static final String ID_SAVE_DEBUG_UTIL = "saveDebugUtil";
private static final String LABEL_SIZE = "col-md-4";
private static final String INPUT_SIZE = "col-md-8";
public InternalsDebugUtilPanel(String id, IModel<InternalsConfigDto> model) {
super(id, model);
}
protected void onInitialize() {
super.onInitialize();
setOutputMarkupId(true);
Form form = new com.evolveum.midpoint.web.component.form.Form(ID_FORM);
form.setOutputMarkupId(true);
add(form);
CheckFormGroup detailed = new CheckFormGroup(ID_DETAILED_DEBUG_DUMP,
new PropertyModel<>(getModel(), InternalsConfigDto.F_DETAILED_DEBUG_DUMP),
createStringResource("PageInternals.detailedDebugDump"), LABEL_SIZE, INPUT_SIZE);
form.add(detailed);
AjaxSubmitButton update = new AjaxSubmitButton(ID_SAVE_DEBUG_UTIL,
createStringResource("PageBase.button.update")) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
updateDebugPerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
target.add(getPageBase().getFeedbackPanel());
}
};
form.add(update);
}
private void updateDebugPerformed(AjaxRequestTarget target){
getModelObject().saveDebugUtil();
LOGGER.trace("Updated debug util, detailedDebugDump={}", DebugUtil.isDetailedDebugDump());
success(getString("PageInternals.message.debugUpdatePerformed", DebugUtil.isDetailedDebugDump()));
target.add(getPageBase().getFeedbackPanel(), getDebugUtilForm());
}
private Form getDebugUtilForm(){
return (Form) get(ID_FORM);
}
}