Search
This component will add search bar in status bar.
- The required handler will be a SbSearchHandler in the related @Named bean.
- The direct children of the component are shown in the drop-down-list
- A <f:facet name="resultList"> will provide a info button and then show the facet if hovering.
The following attributes are in development:
- orientation : The component can be placed left or right in the status-bar.
- update : Will update a component on the page. In this example the "Demo" panel.
- The boolean attribute applyList (default=false) will render a carriage-return icon beside the cancel icon and can be used e.g. to apply the results in the pull-down menu to a table on the page. After clicking, the method "applySbSearch" will be triggered (and propagated to the bean) and the components in update will be updated.
Open issues:
- After clicking a search entry the update should be triggered and the pull-down should disappear.
- After clicking "somewhere else" the pull-down should disappear, but the search text should stay.
Demo
Selection |
List
No records found. |
<jp:sbSearch handler="#{sbhSearchBean.sbhSearch}" update=":selectionPanel">
<h:outputText value="#{var.firstName}"/>
<f:facet name="resultDetail">
<p:panel header="Detail user #{var.firstName}" styleClass="jeeslPanel jeesl-panel">
<j:inputGrid>
<p:outputLabel value="Password" />
<h:panelGroup class="jeesl-input-container">
<p:inputText value="blabla"/>
<p:commandButton value="Test" actionListener="#{sbhSearchBean.check()}"/>
</h:panelGroup>
</j:inputGrid>
</p:panel>
</f:facet>
</jp:sbSearch>
</ui:composition>
@Named @ViewScoped
public class SbhSearchBean extends AbstractJeeBean implements SbSearchBean
{
private static final long serialVersionUID = 1L;
final static Logger logger = LoggerFactory.getLogger(SbhSearchBean.class);
@Inject private AppAutoCompleteBean bAutoComplete;
private SbSearchHandler<JeeUser> sbhSearch; public SbSearchHandler<JeeUser> getSbhSearch() {return sbhSearch;}
private final List<JeeUser> users; public List<JeeUser> getUsers() {return users;}
private JeeUser selection; public JeeUser getSelection() {return selection;} public void setSelection(JeeUser selection) {this.selection = selection;}
public SbhSearchBean()
{
logger.info("constructed:" + SbhSearchBean.class.getSimpleName());
users = new ArrayList<>();
}
@PostConstruct
public void init()
{
super.initSecurity();
sbhSearch = SbSearchHandler.instance(JeeUser.class,this).acHandler(bAutoComplete);
logger.info(JeeLogMessage.postConstruct());
}
@Override public void selectSbSearch(JeeslHandler handler, EjbWithId item) throws JeeslLockingException, JeeslConstraintViolationException
{
logger.info("Received a selectSbSearch callback from "+handler.toString()+" with item "+item.toString());
this.selection=(JeeUser)item;
}
@Override public void applySbSearch(JeeslHandler handler)
{
users.clear();
users.addAll(sbhSearch.getList());
}
public void check()
{
logger.info("check");
}
}
Name | Required | Default | Description |
---|---|---|---|
handler | true | ||
applyList | false | ||
update | false |