-
Notifications
You must be signed in to change notification settings - Fork 188
/
PrismPropertyValuePanel.java
57 lines (46 loc) · 2.24 KB
/
PrismPropertyValuePanel.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
/*
* Copyright (c) 2020 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.gui.impl.prism.panel;
import com.evolveum.midpoint.gui.impl.error.ErrorPanel;
import com.evolveum.midpoint.gui.impl.factory.panel.ItemPanelContext;
import com.evolveum.midpoint.gui.impl.factory.panel.PrismPropertyPanelContext;
import com.evolveum.midpoint.gui.impl.prism.wrapper.PrismPropertyValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismPropertyWrapper;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.util.exception.SchemaException;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
public class PrismPropertyValuePanel<T> extends PrismValuePanel<T, PrismPropertyWrapper<T>, PrismPropertyValueWrapper<T>> {
public PrismPropertyValuePanel(String id, IModel<PrismPropertyValueWrapper<T>> model, ItemPanelSettings settings) {
super(id, model, settings);
}
@Override
protected <PC extends ItemPanelContext> PC createPanelCtx(IModel<PrismPropertyWrapper<T>> wrapper) {
PrismPropertyPanelContext<T> panelCtx = new PrismPropertyPanelContext<>(wrapper);
return (PC) panelCtx;
}
@Override
protected Component createDefaultPanel(String id) {
if (getPageBase().getApplication().usesDevelopmentConfig()) {
return new ErrorPanel(id, createStringResource("Cannot create component for: " + getModelObject().getParent().getItem()));
} else {
Label noComponent = new Label(id);
noComponent.setVisible(false);
return noComponent;
}
}
@Override
protected <PV extends PrismValue> PV createNewValue(PrismPropertyWrapper<T> itemWrapper) {
return (PV) getPrismContext().itemFactory().createPropertyValue();
}
@Override
protected void remove(PrismPropertyValueWrapper<T> valueToRemove, AjaxRequestTarget target) throws SchemaException {
throw new UnsupportedOperationException("Must be implemented in calling panel");
}
}