use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class ConfigurationStep method initLayout.
private void initLayout() {
com.evolveum.midpoint.web.component.form.Form form = new com.evolveum.midpoint.web.component.form.Form<>(ID_MAIN, true);
form.setOutputMarkupId(true);
add(form);
form.add(WebComponentUtil.createTabPanel(ID_CONFIGURATION, parentPage, new ArrayList<ITab>(), null));
AjaxSubmitButton testConnection = new AjaxSubmitButton(ID_TEST_CONNECTION, createStringResource("ConfigurationStep.button.testConnection")) {
@Override
protected void onError(final AjaxRequestTarget target, Form<?> form) {
WebComponentUtil.refreshFeedbacks(form, target);
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
testConnectionPerformed(target);
}
};
testConnection.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !parentPage.isReadOnly();
}
});
add(testConnection);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class SchemaHandlingStep method initLayout.
private void initLayout() {
final ListDataProvider<ResourceObjectTypeDefinitionTypeDto> objectTypeProvider = new ListDataProvider<>(this, new PropertyModel<List<ResourceObjectTypeDefinitionTypeDto>>(schemaHandlingDtoModel, SchemaHandlingDto.F_OBJECT_TYPE_DTO_LIST));
// first row - object types table
WebMarkupContainer objectTypesTable = new WebMarkupContainer(ID_ROWS);
objectTypesTable.setOutputMarkupId(true);
add(objectTypesTable);
// second row - object type editor
WebMarkupContainer objectTypeEditor = new WebMarkupContainer(ID_OBJECT_TYPE_EDITOR);
objectTypeEditor.setOutputMarkupId(true);
objectTypeEditor.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return isAnySelected();
}
});
add(objectTypeEditor);
// third row container
WebMarkupContainer thirdRowContainer = new WebMarkupContainer(ID_THIRD_ROW_CONTAINER);
thirdRowContainer.setOutputMarkupId(true);
add(thirdRowContainer);
// ---------------------- details -----------------------
// Object type table (list)
DataView<ResourceObjectTypeDefinitionTypeDto> objectTypeDataView = new DataView<ResourceObjectTypeDefinitionTypeDto>(ID_ROW_OBJECT_TYPE, objectTypeProvider, UserProfileStorage.DEFAULT_PAGING_SIZE) {
@Override
protected void populateItem(final Item<ResourceObjectTypeDefinitionTypeDto> item) {
final ResourceObjectTypeDefinitionTypeDto objectType = item.getModelObject();
AjaxSubmitLink link = new AjaxSubmitLink(ID_LINK_OBJECT_TYPE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
editObjectTypePerformed(target, objectType);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(parentPage.getFeedbackPanel());
}
};
item.add(link);
Label label = new Label(ID_NAME_OBJECT_TYPE, createObjectTypeDisplayModel(objectType));
label.setOutputMarkupId(true);
link.add(label);
AjaxLink delete = new AjaxLink(ID_BUTTON_DELETE_OBJECT_TYPE) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteObjectTypePerformed(target, objectType);
}
};
parentPage.addEditingVisibleBehavior(delete);
link.add(delete);
item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isSelected(item.getModelObject()) ? "success" : null;
}
}));
}
};
objectTypesTable.add(objectTypeDataView);
NavigatorPanel navigator = new NavigatorPanel(ID_PAGING_OBJECT_TYPE, objectTypeDataView, true);
navigator.setOutputMarkupPlaceholderTag(true);
navigator.setOutputMarkupId(true);
add(navigator);
AjaxSubmitLink add = new AjaxSubmitLink(ID_BUTTON_ADD_OBJECT_TYPE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
addObjectTypePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(parentPage.getFeedbackPanel());
}
};
parentPage.addEditingVisibleBehavior(add);
add(add);
initObjectTypeEditor(objectTypeEditor);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class TaskMainPanel method initTabPanel.
protected void initTabPanel(Form mainForm) {
List<ITab> tabs = createTabs();
TabbedPanel<ITab> tabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, parentPage, tabs, new TabbedPanel.RightSideItemProvider() {
@Override
public Component createRightSideItem(String id) {
VisibleEnableBehaviour boxEnabled = new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return !parentPage.isEdit();
}
};
TaskShowAdvancedFeaturesPanel advancedFeaturesPanel = new TaskShowAdvancedFeaturesPanel(id, showAdvancedFeaturesModel, boxEnabled) {
@Override
protected void onAdvancedFeaturesUpdate(AjaxRequestTarget target) {
target.add(getTabPanel());
target.add(getButtonPanel());
// we DO NOT call parentPage.refresh here because in edit mode this would erase any model changes
// (well, because - for some strange reasons - even this code erases name and description input fields
// occassionally, we hide 'advanced features' checkbox in editing mode)
}
};
advancedFeaturesPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
// we don't distinguish between basic/advanced features for other task types yet
return parentPage.getTaskDto().isWorkflow();
}
});
return advancedFeaturesPanel;
}
});
mainForm.add(tabPanel);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class TaskOperationTabPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel, PageBase pageBase) {
final PropertyModel<ModelOperationStatusDto> operationStatusModel = new PropertyModel<>(taskDtoModel, TaskDto.F_MODEL_OPERATION_STATUS);
VisibleEnableBehaviour modelOpBehaviour = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return operationStatusModel.getObject() != null;
}
};
ModelOperationStatusPanel panel = new ModelOperationStatusPanel(ID_MODEL_OPERATION_STATUS_PANEL, operationStatusModel);
panel.add(modelOpBehaviour);
add(panel);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class TaskProgressTabPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel, PageBase pageBase) {
final TaskCurrentStateDtoModel model = new TaskCurrentStateDtoModel(taskDtoModel);
iterativeInformationPanel = new IterativeInformationPanel(ID_ITERATIVE_INFORMATION_PANEL, model, pageBase);
iterativeInformationPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getIterativeTaskInformationType() != null;
}
});
iterativeInformationPanel.setOutputMarkupId(true);
add(iterativeInformationPanel);
synchronizationInformationPanelBefore = new SynchronizationInformationPanel(ID_SYNCHRONIZATION_INFORMATION_PANEL_BEFORE, new PropertyModel<SynchronizationInformationDto>(model, TaskCurrentStateDto.F_SYNCHRONIZATION_INFORMATION_DTO), false);
synchronizationInformationPanelBefore.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getSynchronizationInformationType() != null;
}
});
synchronizationInformationPanelBefore.setOutputMarkupId(true);
add(synchronizationInformationPanelBefore);
synchronizationInformationPanelAfter = new SynchronizationInformationPanel(ID_SYNCHRONIZATION_INFORMATION_PANEL_AFTER, new PropertyModel<SynchronizationInformationDto>(model, TaskCurrentStateDto.F_SYNCHRONIZATION_INFORMATION_AFTER_DTO), true);
synchronizationInformationPanelAfter.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getSynchronizationInformationType() != null && !taskDtoModel.getObject().isDryRun();
}
});
synchronizationInformationPanelAfter.setOutputMarkupId(true);
add(synchronizationInformationPanelAfter);
actionsExecutedInformationPanel = new ActionsExecutedInformationPanel(ID_ACTIONS_EXECUTED_INFORMATION_PANEL, new PropertyModel<ActionsExecutedInformationDto>(model, TaskCurrentStateDto.F_ACTIONS_EXECUTED_INFORMATION_DTO));
actionsExecutedInformationPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getActionsExecutedInformationType() != null;
}
});
actionsExecutedInformationPanel.setOutputMarkupId(true);
add(actionsExecutedInformationPanel);
}
Aggregations