-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d45ab6d
commit dffb5db
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/search/TypeSearchPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2021 Evolveum | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:extend> | ||
<wicket:fragment wicket:id="typeSearchFragment"> | ||
<div wicket:id="typePanel" class="form-group" style="padding-right: 5px; margin-bottom: 5px; text-align-last: left;"/> | ||
</wicket:fragment> | ||
<wicket:child/> | ||
</wicket:extend> | ||
</body> | ||
</html> |
70 changes: 70 additions & 0 deletions
70
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/search/TypeSearchPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (C) 2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.web.component.search; | ||
|
||
import com.evolveum.midpoint.prism.Containerable; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchBoxModeType; | ||
|
||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.panel.Fragment; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.PropertyModel; | ||
|
||
/** | ||
* @author honchar | ||
*/ | ||
public class TypeSearchPanel<C extends Containerable> extends AbstractSearchPanel<C>{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
private static final String ID_TYPE_PANEL = "typePanel"; | ||
private static final String ID_TYPE_SEARCH_FRAGMENT = "typeSearchFragment"; | ||
|
||
public TypeSearchPanel(String id, IModel<Search<C>> model) { | ||
super(id, model); | ||
} | ||
|
||
protected void initSearchItemsPanel(RepeatingView searchItemsRepeatingView) { | ||
TypeSearchFragment typeSearchFragment = new TypeSearchFragment(searchItemsRepeatingView.newChildId(), | ||
ID_TYPE_SEARCH_FRAGMENT, TypeSearchPanel.this); | ||
typeSearchFragment.setOutputMarkupId(true); | ||
searchItemsRepeatingView.add(typeSearchFragment); | ||
|
||
super.initSearchItemsPanel(searchItemsRepeatingView); | ||
} | ||
|
||
protected void searchPerformed(AjaxRequestTarget target) { | ||
|
||
} | ||
|
||
class TypeSearchFragment extends Fragment { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public TypeSearchFragment(String id, String markupId, AbstractSearchPanel markupProvider) { | ||
super(id, markupId, markupProvider); | ||
initTypeLayout(); | ||
} | ||
|
||
private void initTypeLayout() { | ||
PropertyModel<ContainerTypeSearchItem> typeModel = new PropertyModel<>(getModel(), Search.F_TYPE); | ||
SearchTypePanel typePanel = new SearchTypePanel(ID_TYPE_PANEL, typeModel){ | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
protected void searchPerformed(AjaxRequestTarget target) { | ||
resetMoreDialogModel(); | ||
TypeSearchPanel.this.searchPerformed(target); | ||
} | ||
}; | ||
add(typePanel); | ||
typePanel.add(new VisibleBehaviour(() -> typeModel != null && typeModel.getObject() != null && typeModel.getObject().isVisible() | ||
&& !SearchBoxModeType.OID.equals(getModelObject().getSearchType()))); | ||
} | ||
} | ||
} |