Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- extracting (abstract) PrismValuePanel from ItemPanel - implement PrismPropertyValuePanel, PrismReferenceValuePanel and PrismContainerValuePanel with default panels - introducing AbstractInputGuiComponentFactory - parent abstract factory for all InputPanel panels. add default behaviors, validators, etc.
- Loading branch information
Showing
63 changed files
with
1,748 additions
and
849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...n/java/com/evolveum/midpoint/gui/impl/factory/panel/AbstractInputGuiComponentFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* 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.factory.panel; | ||
|
||
import com.evolveum.midpoint.gui.api.factory.GuiComponentFactory; | ||
|
||
import com.evolveum.midpoint.gui.api.registry.GuiComponentRegistry; | ||
|
||
import com.evolveum.midpoint.gui.impl.prism.wrapper.PrismPropertyWrapper; | ||
import com.evolveum.midpoint.web.component.prism.InputPanel; | ||
|
||
import com.evolveum.midpoint.web.component.util.EnableBehaviour; | ||
|
||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
|
||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter; | ||
import org.apache.wicket.markup.html.form.FormComponent; | ||
import org.apache.wicket.markup.html.form.TextField; | ||
import org.apache.wicket.markup.html.panel.Panel; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.LambdaModel; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* abstract factory for all InputPanel panels | ||
* @param <T> | ||
*/ | ||
public abstract class AbstractInputGuiComponentFactory<T> implements GuiComponentFactory<PrismPropertyPanelContext<T>> { | ||
|
||
@Autowired private GuiComponentRegistry componentRegistry; | ||
|
||
public GuiComponentRegistry getRegistry() { | ||
return componentRegistry; | ||
} | ||
|
||
@Override | ||
public Panel createPanel(PrismPropertyPanelContext<T> panelCtx) { | ||
InputPanel panel = getPanel(panelCtx); | ||
|
||
final List<FormComponent> formComponents = panel.getFormComponents(); | ||
for (FormComponent<T> formComponent : formComponents) { | ||
PrismPropertyWrapper<T> propertyWrapper = panelCtx.unwrapWrapperModel(); | ||
IModel<String> label = LambdaModel.of(propertyWrapper::getDisplayName); | ||
formComponent.setLabel(label); | ||
formComponent.setRequired(panelCtx.isMandatory()); | ||
|
||
if (formComponent instanceof TextField) { | ||
formComponent.add(new AttributeModifier("size", "42")); | ||
} | ||
formComponent.add(panelCtx.getAjaxEventBehavior()); | ||
formComponent.add(panelCtx.getVisibleEnableBehavior()); | ||
// formComponent.add(new EnableBehaviour(() -> getEditabilityHandler() == null || | ||
// getEditabilityHandler().isEditable(getModelObject()))); | ||
} | ||
|
||
panel.getValidatableComponent().add(panelCtx.getExpressionValidator()); | ||
|
||
panelCtx.getFeedback().setFilter(new ComponentFeedbackMessageFilter(panel.getValidatableComponent())); | ||
|
||
|
||
return panel; | ||
} | ||
|
||
@Override | ||
public Integer getOrder() { | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
protected abstract InputPanel getPanel(PrismPropertyPanelContext<T> panelCtx); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.