Example usage for com.google.gwt.query.client GQuery removeData

List of usage examples for com.google.gwt.query.client GQuery removeData

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery removeData.

Prototype

public GQuery removeData(String name) 

Source Link

Document

Removes named data store from an element.

Usage

From source file:gwtquery.plugins.draggable.client.plugins.OpacityPlugin.java

License:Apache License

public void onStop(DraggableHandler handler, DragContext ctx, GqEvent e) {
    GQuery $element = (handler.getOptions().getHelperType() == HelperType.ORIGINAL) ? handler.getHelper()
            : $(ctx.getDraggable());/*from w  w  w  .  ja  v a 2s . c o m*/
    if ($element == null || $element.length() == 0) {
        return;
    }

    if ($element.data(OLD_OPACITY_KEY) == null) {
        return;
    }
    Double oldOpacity = $element.data(OLD_OPACITY_KEY, Double.class);
    $element.css(OPACITY_CSS_KEY, oldOpacity != null ? String.valueOf(oldOpacity) : "");
    $element.removeData(OLD_OPACITY_KEY);

}

From source file:gwtquery.plugins.droppable.client.gwt.DragAndDropCellWidgetUtils.java

License:Apache License

void cleanCell(Element cell) {

    if (cell == null) {
        return;/*from  w  w w.ja  v  a2 s.c  o m*/
    }

    GQuery $cell = $(cell);

    if (DraggableHandler.getInstance(cell) != null) {
        $cell.as(Draggable).destroy();
    }

    if (DroppableHandler.getInstance(cell) != null) {
        $cell.as(Droppable).destroy();
    }

    $cell.removeData(VALUE_KEY);
}

From source file:gwtquery.plugins.selectable.client.Selectable.java

License:Apache License

/**
 * Remove "selectable" feature of elements
 * /*w ww . j a v a  2 s  .c  om*/
 * @return
 */
public Selectable unSelectable() {
    for (Element e : elements()) {
        GQuery $e = $(e);
        GQuery selectees = $e.data(SELECTEES_KEY, GQuery.class);
        if (selectees != null) {
            selectees.removeClass(CssClassNames.UI_UNSELECTEE).removeData(SELECTABLE_ITEM_KEY);
        }
        $e.removeClass(CssClassNames.UI_SELECTABLE, "ui-selectable-disabled");
        $e.removeData(SELECTEES_KEY).removeData(SELECTABLE_KEY);

    }
    destroyMouseHandler();
    return this;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.AutoCompleteTextInput.java

License:Open Source License

private void setEvents() {

    final GQuery input = $(inputElement);

    // ON TEXT CHANGE
    input.keypress(new Function() {

        @Override/*from   w  w  w. jav a2  s .co m*/
        public boolean f(final Event e) {

            // Window.alert(e.getKeyCode() + " - " + e.getCharCode());

            switch (e.getKeyCode()) {
            case KeyCodes.KEY_ENTER:
                e.stopPropagation();
                return false;
            case KeyCodes.KEY_ESCAPE:
                AutoCompleteTextInput.this.reset();
                break;
            case KeyCodes.KEY_DELETE:
            case KeyCodes.KEY_BACKSPACE:
            case 0: // Character
            default:

                AutoCompleteTextInput.this.resetValue();

                // ClearTimeout if another key is pressed before the end of previous timeout
                if (input.data(AUTOCOMPLETE_ONCHANGE_TIMER) != null) {
                    final Timer t = (Timer) input.data(AUTOCOMPLETE_ONCHANGE_TIMER);
                    t.cancel();
                    input.removeData(AUTOCOMPLETE_ONCHANGE_TIMER);
                }

                final Timer t = new Timer() {

                    @Override
                    public void run() {
                        input.removeData(AUTOCOMPLETE_ONCHANGE_TIMER);
                        AutoCompleteTextInput.this.refresh();
                    }
                };
                input.data("AUTOCOMPLETE_ONCHANGE_TIMER", t);
                t.schedule(500);
                break;
            }

            return true;
        }
    });

    // ON TEXT BLUR
    input.blur(new Function() {

        @Override
        public void f() {
            if (input.data(AUTOCOMPLETE_ONCHANGE_TIMER) != null) {
                final Timer t = (Timer) input.data(AUTOCOMPLETE_ONCHANGE_TIMER);
                t.cancel();
                input.removeData(AUTOCOMPLETE_ONCHANGE_TIMER);
            }
            boolean isFocused = childrenFocused(dropdown.getElement());
            // && $(AutoCompleteTextInput.this.dropdown.getElement()).find(":focus").size() == 0) {
            if (!$(inputElement).is(".completed") && !isFocused) {

                AutoCompleteTextInput.this.reset();
                dropdown.close();
            }
        }

    });
}