use of com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel 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.SearchSpecialItemPanel in project midpoint by Evolveum.
the class IndirectSearchItem method createSpecialSearchPanel.
@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
SearchSpecialItemPanel panel = new SearchSpecialItemPanel(id, new PropertyModel(searchBoxConfiguration, SearchBoxConfigurationHelper.F_INDIRECT_ITEM + "." + IndirectSearchItemConfigurationType.F_INDIRECT.getLocalPart())) {
@Override
protected WebMarkupContainer initSearchItemField(String id) {
List<Boolean> choices = new ArrayList<>();
choices.add(Boolean.TRUE);
choices.add(Boolean.FALSE);
DropDownChoicePanel inputPanel = new DropDownChoicePanel(id, getModelValue(), Model.ofList(choices), new ChoiceRenderer<Boolean>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(Boolean val) {
if (val) {
return getPageBase().createStringResource("Boolean.TRUE").getString();
}
return getPageBase().createStringResource("Boolean.FALSE").getString();
}
}, false);
inputPanel.getBaseFormComponent().add(WebComponentUtil.getSubmitOnEnterKeyDownBehavior("searchSimple"));
inputPanel.getBaseFormComponent().add(AttributeAppender.append("style", "width: 68" + "px; max-width: 400px !important;"));
inputPanel.getBaseFormComponent().add(new EnableBehaviour(() -> searchBoxConfiguration != null && !searchBoxConfiguration.isSearchScope(SearchBoxScopeType.SUBTREE)));
inputPanel.setOutputMarkupId(true);
return inputPanel;
}
@Override
protected IModel<String> createLabelModel() {
return Model.of(WebComponentUtil.getTranslatedPolyString(getIndirectConfig().getDisplay().getLabel()));
}
@Override
protected IModel<String> createHelpModel() {
return Model.of(WebComponentUtil.getTranslatedPolyString(getIndirectConfig().getDisplay().getHelp()));
}
};
panel.add(new VisibleBehaviour(this::isPanelVisible));
return panel;
}
use of com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel 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;
}
use of com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel in project midpoint by Evolveum.
the class ScopeSearchItem method createSpecialSearchPanel.
@Override
public SearchSpecialItemPanel createSpecialSearchPanel(String id) {
return new SearchSpecialItemPanel(id, new PropertyModel(scopeConfigModel, ScopeSearchItemConfigurationType.F_DEFAULT_VALUE.getLocalPart())) {
@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 Model.of(WebComponentUtil.getTranslatedPolyString(getScopeConfig().getDisplay().getLabel()));
}
@Override
protected IModel<String> createHelpModel() {
return Model.of(WebComponentUtil.getTranslatedPolyString(getScopeConfig().getDisplay().getHelp()));
}
};
}
use of com.evolveum.midpoint.web.component.search.SearchSpecialItemPanel 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");
}
};
}
};
}
Aggregations