Skip to content

Commit

Permalink
execute options for details panel (MID-7257)
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Sep 29, 2021
1 parent 71a14c9 commit b9c26f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.util.Collection;
import java.util.List;

import com.evolveum.midpoint.web.page.admin.users.component.ExecuteChangeOptionsDto;

import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory;
Expand Down Expand Up @@ -45,6 +47,7 @@ public class FocusDetailsModels<F extends FocusType> extends AssignmentHolderDet
private static final String OPERATION_LOAD_SHADOW = DOT_CLASS + "loadShadow";

private LoadableModel<List<ShadowWrapper>> projectionModel;
private final LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel;

public FocusDetailsModels(LoadableModel<PrismObject<F>> prismObjectModel, PageBase serviceLocator) {
super(prismObjectModel, serviceLocator);
Expand All @@ -57,6 +60,15 @@ protected List<ShadowWrapper> load() {
return loadShadowWrappers();
}
};

executeOptionsModel = new LoadableModel<>(false) {
private static final long serialVersionUID = 1L;

@Override
protected ExecuteChangeOptionsDto load() {
return ExecuteChangeOptionsDto.createFromSystemConfiguration();
}
};
}

private PageBase getPageBase() {
Expand Down Expand Up @@ -384,4 +396,8 @@ protected List<ObjectDelta<? extends ObjectType>> getAdditionalModifyDeltas(Oper

return deltas;
}

public LoadableModel<ExecuteChangeOptionsDto> getExecuteOptionsModel() {
return executeOptionsModel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,8 @@ public class ExecuteChangeOptionsPanel extends BasePanel<ExecuteChangeOptionsDto
private static final String ID_OPTIONS = "options";
private static final String ID_RESET_CHOICES = "resetChoices";

private final LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel;

public ExecuteChangeOptionsPanel(String id) {
super(id);

executeOptionsModel = new LoadableModel<>(false) {
private static final long serialVersionUID = 1L;

@Override
protected ExecuteChangeOptionsDto load() {
return ExecuteChangeOptionsDto.createFromSystemConfiguration();
}
};
public ExecuteChangeOptionsPanel(String id, LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel) {
super(id, executeOptionsModel);
}

@Override
Expand All @@ -79,16 +68,6 @@ protected void onInitialize(){
initLayout();
}

@Override
public IModel<ExecuteChangeOptionsDto> getModel() {
return executeOptionsModel;
}

@Override
public ExecuteChangeOptionsDto getModelObject() {
return executeOptionsModel.getObject();
}

private CheckboxMenuItem createCheckboxMenuItem(String label, String propertyExpression) {
return new CheckboxMenuItem(createStringResource(label), new PropertyModel<>(getModel(), propertyExpression));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ public class FocusOperationalButtonsPanel<F extends FocusType> extends Assignmen

private static final String ID_EXECUTE_OPTIONS = "executeOptions";

public FocusOperationalButtonsPanel(String id, LoadableModel<PrismObjectWrapper<F>> model) {
private final LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel;

public FocusOperationalButtonsPanel(String id, LoadableModel<PrismObjectWrapper<F>> model, LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel) {
super(id, model);
this.executeOptionsModel = executeOptionsModel;
}

@Override
Expand All @@ -43,7 +46,7 @@ protected void onInitialize() {
}

private void initLayout() {
ExecuteChangeOptionsPanel optionsPanel = new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS) {
ExecuteChangeOptionsPanel optionsPanel = new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel) {

@Override
protected void reloadPanelOnOptionsUpdate(AjaxRequestTarget target) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void setSaveOnConfigure(boolean saveOnConfigure) {

@Override
protected FocusOperationalButtonsPanel<F> createButtonsPanel(String id, LoadableModel<PrismObjectWrapper<F>> wrapperModel) {
return new FocusOperationalButtonsPanel<>(id, wrapperModel) {
return new FocusOperationalButtonsPanel<>(id, wrapperModel, getObjectDetailsModels().getExecuteOptionsModel()) {

@Override
protected void savePerformed(AjaxRequestTarget target) {
Expand Down

0 comments on commit b9c26f3

Please sign in to comment.