Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>public class SelectionComboBox extends HorizontalPanel implements ClickHandler { private class ListItem extends Label implements ClickHandler { String text; public ListItem(String text) { this.text = text; this.setText(text); this.addClickHandler(this); } @Override public void onClick(ClickEvent event) { selectedValue = text; popup.hide(); } } CheckBox combo; FlowPanel list; PopupPanel popup; String selectedValue; Label triangle; public SelectionComboBox() { list = new FlowPanel(); popup = new PopupPanel(); combo = new CheckBox(); triangle = new Label(); list.add(new ListItem("All")); list.add(new ListItem("None")); list.add(new ListItem("Read")); list.add(new ListItem("Unread")); list.add(new ListItem("Starred")); list.add(new ListItem("Unstarred")); popup.setWidget(list); popup.setPopupPosition(this.getAbsoluteLeft(), this.getAbsoluteTop() + this.getOffsetHeight()); this.addDomHandler(this, ClickEvent.getType()); triangle.addClickHandler(this); this.add(combobox); this.add(triangle); } public void addValueChangeHandler(ValueChangeHandler&lt;Boolean&gt; handler) { combo.addValueChangeHandler(handler); } public String getSelection() { return selectedValue; } @Override public void onClick(ClickEvent event) { popup.show(); } } </code></pre> <p>Style for the triangle:</p> <pre><code>height:0; width:0; border-left:20px solid transparent; border-right:20px solid transparent; border-top:20px solid black; </code></pre> <p>The above styles will give you a triangle just using Css.</p> <p>You might have to add a feature that will not select the Checkbox if the list hasn't elements that apply to the selection.</p> <p>(Note: Code is untested, but should help you get started)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload