use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageArchetype method createMainPanel.
@Override
protected AbstractObjectMainPanel<ArchetypeType> createMainPanel(String id) {
return new AbstractRoleMainPanel<>(id, getObjectModel(), getProjectionModel(), this) {
private static final long serialVersionUID = 1L;
@Override
public AbstractRoleMemberPanel<ArchetypeType> createMemberPanel(String panelId, PageBase pageBase) {
return new ArchetypeMembersPanel(panelId, new Model<>(getObject().asObjectable()), pageBase);
}
@Override
protected List<ITab> createTabs(PageAdminObjectDetails<ArchetypeType> parentPage) {
List<ITab> tabs = super.createTabs(parentPage);
tabs.add(new PanelTab(parentPage.createStringResource("PageArchetype.archetypePolicy"), getTabVisibility(ComponentConstants.UI_ARCHTYPE_TAB_ARCHETYPE_POLICY_URL, false, parentPage)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ContainerOfSystemConfigurationPanel<ArchetypePolicyType>(panelId, PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ArchetypeType.F_ARCHETYPE_POLICY), ArchetypePolicyType.COMPLEX_TYPE);
}
});
return tabs;
}
};
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class SwitchablePropertyValuePanel method getValueField.
private <T> Component getValueField(String id) {
Component searchItemField = null;
ItemDefinition propertyDef = getPropertyItemDefinition();
if (propertyDef != null) {
PrismObject<LookupTableType> lookupTable = WebComponentUtil.findLookupTable(propertyDef, getPageBase());
if (propertyDef instanceof PrismReferenceDefinition) {
searchItemField = new ReferenceValueSearchPanel(id, new PropertyModel<>(getModel(), "value.value"), (PrismReferenceDefinition) propertyDef) {
private static final long serialVersionUID = 1L;
@Override
protected void referenceValueUpdated(ObjectReferenceType ort, AjaxRequestTarget target) {
SwitchablePropertyValuePanel.this.getModelObject().getValue().setValue(ort);
}
};
} else if (propertyDef instanceof PrismPropertyDefinition) {
List<DisplayableValue> allowedValues = new ArrayList<>();
if (((PrismPropertyDefinition) propertyDef).getAllowedValues() != null) {
allowedValues.addAll(((PrismPropertyDefinition) propertyDef).getAllowedValues());
} else if (propertyDef.getTypeClass().equals(boolean.class) || Boolean.class.isAssignableFrom(propertyDef.getTypeClass())) {
allowedValues.add(new SearchValue<>(Boolean.TRUE, getString("Boolean.TRUE")));
allowedValues.add(new SearchValue<>(Boolean.FALSE, getString("Boolean.FALSE")));
}
if (lookupTable != null) {
searchItemField = new AutoCompleteTextPanel<String>(id, new PropertyModel<>(getModel(), "value." + ValueSearchFilterItem.F_VALUE), String.class, true, lookupTable.asObjectable()) {
private static final long serialVersionUID = 1L;
@Override
public Iterator<String> getIterator(String input) {
return WebComponentUtil.prepareAutoCompleteList(lookupTable.asObjectable(), input, ((PageBase) getPage()).getLocalizationService()).iterator();
}
};
} else if (CollectionUtils.isNotEmpty(allowedValues)) {
List<T> allowedValuesList = new ArrayList<>();
allowedValues.forEach(val -> allowedValuesList.add((T) val.getValue()));
searchItemField = new DropDownChoicePanel<T>(id, new PropertyModel<>(getModel(), "value." + ValueSearchFilterItem.F_VALUE), Model.ofList(allowedValuesList), new IChoiceRenderer<T>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(T val) {
if (val instanceof DisplayableValue) {
return ((DisplayableValue) val).getLabel();
}
return val;
}
@Override
public String getIdValue(T val, int index) {
return Integer.toString(index);
}
@Override
public T getObject(String id, IModel<? extends List<? extends T>> choices) {
return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
}
}, true);
} else {
searchItemField = new TextPanel<String>(id, new PropertyModel<>(getModel(), "value." + ValueSearchFilterItem.F_VALUE));
}
}
}
if (searchItemField instanceof InputPanel) {
((InputPanel) searchItemField).getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
}
return searchItemField != null ? searchItemField : new WebMarkupContainer(id);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class PageSelfDashboard method initMyAccounts.
private void initMyAccounts(Session session) {
AsyncDashboardPanel<Object, List<SimpleAccountDto>> accounts = new AsyncDashboardPanel<>(ID_ACCOUNTS, createStringResource("PageDashboard.accounts"), GuiStyleConstants.CLASS_SHADOW_ICON_ACCOUNT, GuiStyleConstants.CLASS_OBJECT_SHADOW_BOX_CSS_CLASSES, true) {
private static final long serialVersionUID = 1L;
@Override
protected SecurityContextAwareCallable<CallableResult<List<SimpleAccountDto>>> createCallable(Authentication auth, IModel<Object> callableParameterModel) {
return new SecurityContextAwareCallable<>(getSecurityContextManager(), auth) {
@Override
public AccountCallableResult<List<SimpleAccountDto>> callWithContextPrepared() {
// TODO is this correct? [med]
setupContext(application, session);
return loadAccounts();
}
};
}
@Override
protected Component getMainComponent(String markupId) {
return new MyAccountsPanel(markupId, new PropertyModel<>(getModel(), CallableResult.F_VALUE));
}
@Override
protected void onPostSuccess(AjaxRequestTarget target) {
showFetchResult();
super.onPostSuccess(target);
}
@Override
protected void onUpdateError(AjaxRequestTarget target, Exception ex) {
showFetchResult();
super.onUpdateError(target, ex);
}
private void showFetchResult() {
AccountCallableResult<List<SimpleAccountDto>> result = (AccountCallableResult<List<SimpleAccountDto>>) getModel().getObject();
PageBase page = (PageBase) getPage();
for (OperationResult res : result.getFetchResults()) {
if (!WebComponentUtil.isSuccessOrHandledError(res)) {
page.showResult(res);
}
}
}
};
accounts.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_ACCOUNTS);
return WebComponentUtil.getElementVisibility(visibilityType);
}
});
add(accounts);
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class RoleCatalogTabPanel method createScopeItem.
private SearchItem createScopeItem(Search search) {
return new SpecialSearchItem(search) {
@Override
public ObjectFilter createFilter(PageBase pageBase, VariablesMap variables) {
return null;
}
@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
return new SearchSpecialItemPanel(id, new PropertyModel(getRoleCatalogStorage(), RoleCatalogStorage.F_ORG_SEARCH_SCOPE)) {
@Override
protected WebMarkupContainer initSearchItemField(String id) {
DropDownChoicePanel inputPanel = new DropDownChoicePanel(id, getModelValue(), Model.of(Arrays.asList(SearchBoxScopeType.values())), new EnumChoiceRenderer(), false);
inputPanel.getBaseFormComponent().add(WebComponentUtil.getSubmitOnEnterKeyDownBehavior("searchSimple"));
inputPanel.getBaseFormComponent().add(AttributeAppender.append("style", "width: 88px; max-width: 400px !important;"));
inputPanel.setOutputMarkupId(true);
return inputPanel;
}
@Override
protected IModel<String> createLabelModel() {
return getPageBase().createStringResource("abstractRoleMemberPanel.searchScope");
}
@Override
protected IModel<String> createHelpModel() {
return getPageBase().createStringResource("abstractRoleMemberPanel.searchScope.tooltip");
}
};
}
};
}
use of com.evolveum.midpoint.gui.api.page.PageBase in project midpoint by Evolveum.
the class ConfigurationStep method testConnectionPerformed.
// copied from PageResource, TODO deduplicate
private void testConnectionPerformed(AjaxRequestTarget target) {
parentPage.refreshIssues(null);
if (parentPage.isReadOnly() || !isComplete()) {
return;
}
saveChanges();
PageBase page = getPageBase();
TestConnectionResultPanel testConnectionPanel = new TestConnectionResultPanel(page.getMainPopupBodyId(), resourceModelNoFetch.getObject().getOid(), getPage());
testConnectionPanel.setOutputMarkupId(true);
page.showMainPopup(testConnectionPanel, target);
// page.showResult(result, "Test connection failed", false);
target.add(page.getFeedbackPanel());
target.add(getForm());
}
Aggregations