use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class PagePreviewChanges method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm("mainForm");
mainForm.setMultiPart(true);
add(mainForm);
List<ITab> tabs = createTabs();
TabbedPanel<ITab> previewChangesTabbedPanel = WebComponentUtil.createTabPanel(ID_TABBED_PANEL, this, tabs, null);
previewChangesTabbedPanel.setOutputMarkupId(true);
mainForm.add(previewChangesTabbedPanel);
initButtons(mainForm);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class ProgressPanel method initLayout.
private void initLayout() {
MidpointForm progressForm = new MidpointForm<>(ID_PROGRESS_FORM, true);
add(progressForm);
contentsPanel = new WebMarkupContainer(ID_CONTENTS_PANEL);
contentsPanel.setOutputMarkupId(true);
progressForm.add(contentsPanel);
ListView statusItemsListView = new ListView<ProgressReportActivityDto>(ID_ACTIVITIES, new IModel<List<ProgressReportActivityDto>>() {
@Override
public List<ProgressReportActivityDto> getObject() {
ProgressReporter reporter = reporterModel.getProcessData();
ProgressDto progressDto = reporter.getProgress();
return progressDto.getProgressReportActivities();
}
}) {
@Override
protected void populateItem(ListItem<ProgressReportActivityDto> item) {
populateStatusItem(item);
}
};
contentsPanel.add(statusItemsListView);
statisticsPanel = new StatisticsPanel(ID_STATISTICS, new StatisticsDtoModel());
contentsPanel.add(statisticsPanel);
ListView logItemsListView = new ListView(ID_LOG_ITEMS, new IModel<List>() {
@Override
public List getObject() {
ProgressReporter reporter = reporterModel.getProcessData();
ProgressDto progressDto = reporter.getProgress();
return progressDto.getLogItems();
}
}) {
@Override
protected void populateItem(ListItem item) {
item.add(new Label(ID_LOG_ITEM, item.getModel()));
}
};
contentsPanel.add(logItemsListView);
Label executionTime = new Label(ID_EXECUTION_TIME, new IModel<String>() {
@Override
public String getObject() {
ProgressReporter reporter = reporterModel.getProcessData();
if (reporter.getOperationDurationTime() > 0) {
return getString("ProgressPanel.ExecutionTimeWhenFinished", reporter.getOperationDurationTime());
} else if (reporter.getOperationStartTime() > 0) {
return getString("ProgressPanel.ExecutionTimeWhenRunning", (System.currentTimeMillis() - reporter.getOperationStartTime()) / 1000);
} else {
return null;
}
}
});
contentsPanel.add(executionTime);
initButtons(progressForm);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class ResourceContentTabPanel method initLayout.
private void initLayout() {
setOutputMarkupId(true);
final Form mainForm = new MidpointForm(ID_MAIN_FORM);
mainForm.setOutputMarkupId(true);
mainForm.addOrReplace(initTable(getModel()));
add(mainForm);
AutoCompleteTextPanel<String> intent = new AutoCompleteTextPanel<String>(ID_INTENT, new PropertyModel<>(resourceContentSearch, "intent"), String.class, false, null) {
private static final long serialVersionUID = 1L;
@Override
public Iterator<String> getIterator(String input) {
ResourceSchema refinedSchema;
try {
refinedSchema = ResourceSchemaFactory.getCompleteSchema(getModelObject());
if (refinedSchema != null) {
return refinedSchema.getIntentsForKind(getKind()).iterator();
} else {
return Collections.emptyIterator();
}
} catch (SchemaException e) {
return Collections.emptyIterator();
}
}
};
intent.getBaseFormComponent().add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(get(ID_REAL_OBJECT_CLASS));
updateResourceContentSearch();
mainForm.addOrReplace(initTable(getModel()));
target.add(mainForm);
}
});
intent.setOutputMarkupId(true);
intent.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isUseObjectClass();
}
});
add(intent);
Label realObjectClassLabel = new Label(ID_REAL_OBJECT_CLASS, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
ResourceObjectDefinition ocDef;
try {
ResourceSchema refinedSchema = ResourceSchemaFactory.getCompleteSchema(getModelObject());
if (refinedSchema == null) {
return "NO SCHEMA DEFINED";
}
ocDef = refinedSchema.findObjectDefinition(getKind(), getIntent());
if (ocDef != null) {
return ocDef.getObjectClassDefinition().getTypeName().getLocalPart();
}
} catch (SchemaException e) {
}
return "NOT FOUND";
}
});
realObjectClassLabel.setOutputMarkupId(true);
add(realObjectClassLabel);
AutoCompleteQNamePanel objectClassPanel = new AutoCompleteQNamePanel(ID_OBJECT_CLASS, new PropertyModel<>(resourceContentSearch, "objectClass")) {
private static final long serialVersionUID = 1L;
@Override
public Collection<QName> loadChoices() {
return createObjectClassChoices(getModel());
}
@Override
protected void onChange(AjaxRequestTarget target) {
LOGGER.trace("Object class panel update: {}", isUseObjectClass());
updateResourceContentSearch();
mainForm.addOrReplace(initTable(getModel()));
target.add(mainForm);
}
};
objectClassPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isUseObjectClass();
}
});
add(objectClassPanel);
AjaxLink<Boolean> repoSearch = new AjaxLink<Boolean>(ID_REPO_SEARCH, new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
isRepoSearch = true;
getContentStorage(kind, SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT).setResourceSearch(Boolean.FALSE);
getContentStorage(kind, SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT).setResourceSearch(Boolean.FALSE);
resourceContentSearch.getObject().setResourceSearch(Boolean.FALSE);
updateResourceContentSearch();
mainForm.addOrReplace(initRepoContent(ResourceContentTabPanel.this.getModel()));
target.add(getParent().addOrReplace(mainForm));
target.add(this);
target.add(getParent().get(ID_RESOURCE_SEARCH).add(AttributeModifier.replace("class", "btn btn-sm btn-default")));
}
@Override
protected void onBeforeRender() {
super.onBeforeRender();
if (!getModelObject().booleanValue())
add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));
}
};
add(repoSearch);
AjaxLink<Boolean> resourceSearch = new AjaxLink<Boolean>(ID_RESOURCE_SEARCH, new PropertyModel<>(resourceContentSearch, "resourceSearch")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
isRepoSearch = false;
getContentStorage(kind, SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT).setResourceSearch(Boolean.TRUE);
getContentStorage(kind, SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT).setResourceSearch(Boolean.TRUE);
updateResourceContentSearch();
resourceContentSearch.getObject().setResourceSearch(Boolean.TRUE);
mainForm.addOrReplace(initResourceContent(ResourceContentTabPanel.this.getModel()));
target.add(getParent().addOrReplace(mainForm));
target.add(this.add(AttributeModifier.append("class", " active")));
target.add(getParent().get(ID_REPO_SEARCH).add(AttributeModifier.replace("class", "btn btn-sm btn-default")));
}
@Override
protected void onBeforeRender() {
super.onBeforeRender();
getModelObject().booleanValue();
if (getModelObject().booleanValue())
add(AttributeModifier.replace("class", "btn btn-sm btn-default active"));
}
};
add(resourceSearch);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class ResourceSchemaHandlingTabPanel method initLayout.
private void initLayout() {
MidpointForm<?> form = new MidpointForm<>(ID_FORM);
add(form);
MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> objectTypesPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_TABLE, ResourceObjectTypeDefinitionType.class) {
@Override
protected MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> item) {
return createMultivalueContainerDetailsPanel(ID_ITEM_DETAILS, item.getModel());
}
@Override
protected boolean isCreateNewObjectVisible() {
return false;
}
@Override
protected IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> getContainerModel() {
return PrismContainerWrapperModel.fromContainerWrapper(ResourceSchemaHandlingTabPanel.this.getModel(), SchemaHandlingType.F_OBJECT_TYPE);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
public String getCssClass() {
return " col-md-1 ";
}
});
return columns;
}
};
form.add(objectTypesPanel);
}
use of com.evolveum.midpoint.web.component.form.MidpointForm in project midpoint by Evolveum.
the class PageRoles method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<RoleType> table = new MainObjectListPanel<RoleType>(ID_TABLE, RoleType.class) {
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_ROLES;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
FocusListInlineMenuHelper<RoleType> listInlineMenuHelper = new FocusListInlineMenuHelper<RoleType>(RoleType.class, PageRoles.this, this) {
private static final long serialVersionUID = 1L;
protected boolean isShowConfirmationDialog(ColumnMenuAction action) {
return PageRoles.this.isShowConfirmationDialog(action);
}
protected IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName) {
return PageRoles.this.getConfirmationMessageModel(action, actionName);
}
};
return listInlineMenuHelper.createRowActions(getType());
}
// @Override
// protected List<IColumn<SelectableBean<RoleType>, String>> createDefaultColumns() {
// return ColumnUtils.getDefaultRoleColumns();
// }
@Override
protected List<ItemPath> getFixedSearchItems() {
List<ItemPath> fixedSearchItems = new ArrayList<>();
fixedSearchItems.add(ObjectType.F_NAME);
fixedSearchItems.add(AbstractRoleType.F_DISPLAY_NAME);
fixedSearchItems.add(AbstractRoleType.F_IDENTIFIER);
return fixedSearchItems;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
Aggregations