use of com.evolveum.midpoint.web.component.search.ReferenceValueSearchPanel in project midpoint by Evolveum.
the class TenantSearchItem method createSpecialSearchPanel.
@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
IModel tenantModel = new PropertyModel(searchBoxConfiguration, SearchBoxConfigurationHelper.F_TENANT) {
@Override
public void setObject(Object object) {
if (object == null) {
searchBoxConfiguration.resetTenantRef();
} else {
super.setObject(object);
}
}
};
PrismReferenceDefinition tenantRefDef = getTenantDefinition();
SearchSpecialItemPanel panel = new SearchSpecialItemPanel(id, tenantModel) {
@Override
protected WebMarkupContainer initSearchItemField(String id) {
return new ReferenceValueSearchPanel(id, getModelValue(), tenantRefDef) {
@Override
public Boolean isItemPanelEnabled() {
return !searchBoxConfiguration.isIndirect();
}
@Override
protected List<QName> getAllowedRelations() {
return Collections.singletonList(RelationTypes.MEMBER.getRelation());
}
};
}
@Override
protected IModel<String> createLabelModel() {
return Model.of(WebComponentUtil.getTranslatedPolyString(getTenantConfig().getDisplay().getLabel()));
}
@Override
protected IModel<String> createHelpModel() {
if (getTenantConfig().getDisplay().getHelp() != null) {
return Model.of(WebComponentUtil.getTranslatedPolyString(getTenantConfig().getDisplay().getHelp()));
}
String help = tenantRefDef.getHelp();
if (StringUtils.isNotEmpty(help)) {
return getPageBase().createStringResource(help);
}
return Model.of(tenantRefDef.getDocumentation());
}
};
panel.add(new VisibleBehaviour(() -> searchBoxConfiguration == null || !searchBoxConfiguration.isIndirect()));
return panel;
}
use of com.evolveum.midpoint.web.component.search.ReferenceValueSearchPanel in project midpoint by Evolveum.
the class ProjectSearchItem method createSpecialSearchPanel.
@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
IModel projectModel = new PropertyModel(getMemberPanelStorage(), SearchBoxConfigurationHelper.F_PROJECT) {
@Override
public void setObject(Object object) {
if (object == null) {
getMemberPanelStorage().resetProjectRef();
} else {
super.setObject(object);
}
}
};
PrismReferenceDefinition projectRefDef = getProjectRefDef();
SearchSpecialItemPanel panel = new SearchSpecialItemPanel(id, projectModel) {
@Override
protected WebMarkupContainer initSearchItemField(String id) {
return new ReferenceValueSearchPanel(id, getModelValue(), projectRefDef) {
@Override
public Boolean isItemPanelEnabled() {
return !(getMemberPanelStorage().isIndirect());
}
@Override
protected List<QName> getAllowedRelations() {
return Collections.singletonList(RelationTypes.MEMBER.getRelation());
}
};
}
@Override
protected IModel<String> createLabelModel() {
return Model.of(WebComponentUtil.getTranslatedPolyString(getProjectSearchConfig().getDisplay().getLabel()));
}
@Override
protected IModel<String> createHelpModel() {
if (getProjectSearchConfig().getDisplay().getHelp() != null) {
return Model.of(WebComponentUtil.getTranslatedPolyString(getProjectSearchConfig().getDisplay().getHelp()));
}
String help = projectRefDef.getHelp();
if (StringUtils.isNotEmpty(help)) {
return getPageBase().createStringResource(help);
}
return Model.of(projectRefDef.getDocumentation());
}
};
panel.add(new VisibleBehaviour(() -> getMemberPanelStorage() == null || !getMemberPanelStorage().isIndirect()));
return panel;
}
Aggregations