final TextBox findTextBox = new TextBox();
findTextBox.addStyleName("ace_search_field");
findTextBox.getElement().setAttribute("placeholder", "Find");
setId(findTextBox, BASE_ID, "find_input");
ToolButton findButton = new ToolButton("Find", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
editor.search(findTextBox.getValue());
}
});
setId(findButton, BASE_ID, "find");
Button findPrev = new Button(SafeHtmlUtils.fromSafeConstant("<i class=\"icon-angle-left\"></i>"));
findPrev.addStyleName("toolstrip-button");
findPrev.getElement().setAttribute("action", "findPrev"); // AceEditor action wiring
setId(findPrev, BASE_ID, "prev_match");
Button findNext = new Button(SafeHtmlUtils.fromSafeConstant("<i class=\"icon-angle-right\"></i>"));
findNext.addStyleName("toolstrip-button");
findNext.getElement().setAttribute("action", "findNext"); // AceEditor action wiring
setId(findNext, BASE_ID, "next_match");
ToolStrip searchTools = new ToolStrip();
searchTools.addToolWidget(findTextBox);
searchTools.addToolButton(findButton);
searchTools.addToolWidget(findPrev);
searchTools.addToolWidget(findNext);
findTextBox.getElement().getStyle().setWidth(20, EM);
findTextBox.getElement().getStyle().setMarginBottom(0, PX);
findTextBox.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
findButton.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
findPrev.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
findNext.getElement().getParentElement().getStyle().setVerticalAlign(MIDDLE);
// next part: rebuild the original search box
FlowPanel searchForm = div("ace_search_form", false);