Package org.appfuse.client.widget

Examples of org.appfuse.client.widget.BulletList


     * style="display: none;"/>
     */
    final Label grow = new Label();
    panel.add(grow);
    grow.addStyleName("grow");
    final BulletList list = new BulletList();
    list.setStyleName("token-input-list-facebook");
    final ListItem item = new ListItem();
    item.setStyleName("token-input-input-token-facebook");
    itemBox
        .getElement()
        .setAttribute(
            "style",
            "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium;");
    box.getElement().setId("suggestion_box");
    item.add(box);
    list.add(item);

    // this needs to be on the itemBox rather than box, or backspace will
    // get executed twice
    itemBox.addKeyDownHandler(new KeyDownHandler() {
      public void onKeyDown(KeyDownEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          // only allow manual entries with @ signs (assumed email
          // addresses)
          if (itemBox.getValue().contains("@"))
            deselectItem(itemBox, list);
        }
        // handle backspace
        if (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE) {
          if ("".equals(itemBox.getValue().trim())) {
            ListItem li = (ListItem) list.getWidget(list
                .getWidgetCount() - 2);
            Paragraph p = (Paragraph) li.getWidget(0);
            if (itemsSelected.contains(p.getText())) {
              itemsSelected.remove(p.getText());
              GWT.log("Removing selected item '" + p.getText()
                  + "'", null);
              GWT.log("Remaining: " + itemsSelected, null);
            }
            list.remove(li);
            itemBox.setFocus(true);
            fireComponentResized();
          }
        }

View Full Code Here

TOP

Related Classes of org.appfuse.client.widget.BulletList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.