Skip to content

Commit

Permalink
changes to search panel ui
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed May 18, 2020
1 parent 9cc17a0 commit d8d4a60
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 311 deletions.
Expand Up @@ -189,7 +189,7 @@ public Search load() {
if (searchByName != null) {
for (SearchItem item : search.getItems()) {
if (ItemPath.create(ObjectType.F_NAME).equivalent(item.getPath())) {
item.setValues(Collections.singletonList(new SearchValue(searchByName)));
item.setValue(new SearchValue(searchByName));
}
}
}
Expand Down
Expand Up @@ -140,9 +140,9 @@ public SearchItem addItem(ItemDefinition def) {
ref.setRelation((QName) itemToRemove.getAllowedValues().iterator().next());
}

item.getValues().add(new SearchValue<>(ref));
item.setValue(new SearchValue<>(ref));
} else {
item.getValues().add(new SearchValue<>());
item.setValue(new SearchValue<>());
}

items.add(item);
Expand Down Expand Up @@ -200,20 +200,15 @@ public ObjectQuery createObjectQuerySimple(PrismContext ctx) {
}

private ObjectFilter createFilterForSearchItem(SearchItem item, PrismContext ctx) {
if (item.getValues().isEmpty()) {
if (item.getValue() == null || item.getValue().getValue() == null) {
return null;
}

DisplayableValue value = item.getValue();
List<ObjectFilter> conditions = new ArrayList<>();
for (DisplayableValue value : (List<DisplayableValue>) item.getValues()) {
if (value.getValue() == null) {
continue;
}

ObjectFilter filter = createFilterForSearchValue(item, value, ctx);
if (filter != null) {
conditions.add(filter);
}
ObjectFilter filter = createFilterForSearchValue(item, value, ctx);
if (filter != null) {
conditions.add(filter);
}

switch (conditions.size()) {
Expand Down
Expand Up @@ -40,7 +40,7 @@ public enum Type {

private ItemPath path;
private ItemDefinition definition;
private List<DisplayableValue<T>> values;
private DisplayableValue<T> value;

//TODO: think about dividing searchItem to searchProperty, searchReference?
private List<QName> allowedRelations;
Expand Down Expand Up @@ -110,15 +110,12 @@ public Type getType() {
return Type.TEXT;
}

public List<DisplayableValue<T>> getValues() {
if (values == null) {
values = new ArrayList<>();
}
return values;
public DisplayableValue<T> getValue() {
return value;
}

public void setValues(List<DisplayableValue<T>> values) {
this.values = values;
public void setValue(DisplayableValue<T> value) {
this.value = value;
}

public Search getSearch() {
Expand Down Expand Up @@ -163,7 +160,7 @@ public String toString() {
.append("definition", definition)
.append("search", search)
.append("path", path)
.append("values", values)
.append("value", value)
.toString();
}
}
Expand Up @@ -9,26 +9,35 @@
<head/>
<body>
<wicket:panel>
<a wicket:id="mainButton" class="btn btn-sm btn-default" about="searchItemButton">
<span wicket:id="label"/>
&nbsp;
<span class="caret"></span>
<i wicket:id="deleteButton" class="fa fa-times-circle fa-lg text-danger" style="margin-left: 10px;"/>
</a>
<!-- todo replace style attribute to css class -->
<div class="search-item" style="display: inline-block; border-color: #ddd; border-radius: 3px; background-color: #f4f4f4;
vertical-align: middle; font-size: 12px;" wicket:id="searchItemContainer">
<div class="col-sm-3" style="margin-top: 5px;" wicket:id="searchItemLabel" />
<div class="col-sm-9" wicket:id="searchItemField" />
</div>

<div wicket:id="popover" class="popover bottom">
<div class="arrow"></div>
<div class="popover-content" wicket:id="popoverBody">
<div wicket:id="values" class="input-group input-group-sm">
<div wicket:id="value"/>
</div>

<p style="margin: 0px; padding-top: 7px;">
<a data-type="update" wicket:id="update" class="btn btn-sm btn-success"/>
<a data-type="close" wicket:id="close" class="btn btn-sm btn-default"/>
</p>
</div>
</div>

<!-- <a wicket:id="mainButton" class="btn btn-sm btn-default" about="searchItemButton">-->
<!-- <span wicket:id="label"/>-->
<!-- &nbsp;-->
<!-- <span class="caret"></span>-->
<!-- <i wicket:id="deleteButton" class="fa fa-times-circle fa-lg text-danger" style="margin-left: 10px;"/>-->
<!-- </a>-->

<!-- <div wicket:id="popover" class="popover bottom">-->
<!-- <div class="arrow"></div>-->
<!-- <div class="popover-content" wicket:id="popoverBody">-->
<!-- <div wicket:id="values" class="input-group input-group-sm">-->
<!-- <div wicket:id="value"/>-->
<!-- </div>-->

<!-- <p style="margin: 0px; padding-top: 7px;">-->
<!-- <a data-type="update" wicket:id="update" class="btn btn-sm btn-success"/>-->
<!-- <a data-type="close" wicket:id="close" class="btn btn-sm btn-default"/>-->
<!-- </p>-->
<!-- </div>-->
<!-- </div>-->
</wicket:panel>
</body>
</html>

0 comments on commit d8d4a60

Please sign in to comment.