use of com.evolveum.midpoint.web.component.input.SearchFilterPanel in project midpoint by Evolveum.
the class ResourceProtectedEditor method initLayout.
protected void initLayout(final PageResourceWizard parentPage) {
WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
container.setOutputMarkupId(true);
add(container);
ListView repeater = new ListView<ResourceObjectPatternType>(ID_REPEATER, getModel()) {
@Override
protected void populateItem(final ListItem<ResourceObjectPatternType> item) {
WebMarkupContainer linkCont = new WebMarkupContainer(ID_ACCOUNT_LINK);
linkCont.setOutputMarkupId(true);
linkCont.add(new AttributeModifier("href", createCollapseItemId(item, true)));
item.add(linkCont);
Label accountLabel = new Label(ID_ACCOUNT_NAME, new IModel<String>() {
@Override
public String getObject() {
StringBuilder sb = new StringBuilder();
ResourceObjectPatternType account = item.getModelObject();
sb.append("#").append(item.getIndex() + 1).append(" - ");
return sb.toString();
}
});
linkCont.add(accountLabel);
AjaxLink<Void> delete = new AjaxLink<Void>(ID_BUTTON_DELETE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteProtectedAccountPerformed(target, item);
}
};
parentPage.addEditingVisibleBehavior(delete);
linkCont.add(delete);
WebMarkupContainer accountBody = new WebMarkupContainer(ID_ACCOUNT_BODY);
accountBody.setOutputMarkupId(true);
accountBody.setMarkupId(createCollapseItemId(item, false).getObject());
if (changeState != ChangeState.SKIP) {
accountBody.add(new AttributeModifier("class", new IModel<String>() {
@Override
public String getObject() {
if (changeState == ChangeState.FIRST && item.getIndex() == 0) {
return "panel-collapse collapse in";
} else if (changeState == ChangeState.LAST && item.getIndex() == (getModelObject().size() - 1)) {
return "panel-collapse collapse in";
} else {
return "panel-collapse collapse";
}
}
}));
}
item.add(accountBody);
// TODO - maybe add some validator and auto-complete functionality?
TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(item.getModel(), "name"));
name.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
parentPage.addEditingEnabledBehavior(name);
accountBody.add(name);
// TODO - maybe add some validator and auto-complete functionality?
TextField uid = new TextField<>(ID_UID, new PropertyModel<String>(item.getModel(), "uid"));
uid.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
parentPage.addEditingEnabledBehavior(uid);
accountBody.add(uid);
SearchFilterPanel searchFilterPanel = new SearchFilterPanel<>(ID_FILTER_EDITOR, new NonEmptyPropertyModel<>(item.getModel(), "filter"), parentPage.getReadOnlyModel());
accountBody.add(searchFilterPanel);
Label nameTooltip = new Label(ID_T_NAME);
nameTooltip.add(new InfoTooltipBehavior());
accountBody.add(nameTooltip);
Label uidTooltip = new Label(ID_T_UID);
uidTooltip.add(new InfoTooltipBehavior());
accountBody.add(uidTooltip);
Label filterTooltip = new Label(ID_T_FILTER);
filterTooltip.add(new InfoTooltipBehavior());
accountBody.add(filterTooltip);
}
};
repeater.setOutputMarkupId(true);
container.add(repeater);
AjaxLink<Void> add = new AjaxLink<Void>(ID_BUTTON_ADD) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
addProtectedAccountPerformed(target);
}
};
parentPage.addEditingVisibleBehavior(add);
add(add);
}
use of com.evolveum.midpoint.web.component.input.SearchFilterPanel in project midpoint by Evolveum.
the class ConditionalSearchFilterEditor method initLayout.
protected void initLayout(PageResourceWizard parentPage) {
ExpressionEditorPanel expressionEditor = new ExpressionEditorPanel(ID_EXPRESSION_PANEL, new PropertyModel<>(getModel(), ConditionalSearchFilterType.F_CONDITION.getLocalPart()), parentPage) {
@Override
public void performExpressionHook(AjaxRequestTarget target) {
if (getExpressionDtoModel().getObject() != null) {
ExpressionType expression = getExpressionDtoModel().getObject().getExpressionObject();
ConditionalSearchFilterEditor.this.getModel().getObject().setCondition(expression);
}
}
@Override
public String getTypeLabelKey() {
return "ConditionalSearchFilterEditor.condition.type.label";
}
@Override
public String getDescriptionLabelKey() {
return "ConditionalSearchFilterEditor.condition.description.label";
}
@Override
public String getUpdateLabelKey() {
return "ConditionalSearchFilterEditor.condition.update.label";
}
@Override
public String getExpressionLabelKey() {
return "ConditionalSearchFilterEditor.condition.label";
}
};
add(expressionEditor);
SearchFilterPanel filterClauseEditor = new SearchFilterPanel<>(ID_FILTER_CLAUSE_PANEL, (NonEmptyModel<ConditionalSearchFilterType>) getModel(), parentPage.getReadOnlyModel());
add(filterClauseEditor);
}
Aggregations