Example usage for com.google.gwt.query.client Function Function

List of usage examples for com.google.gwt.query.client Function Function

Introduction

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

Prototype

Function

Source Link

Usage

From source file:be.dramaix.ai.slidingpuzzle.client.ConfigPanel.java

License:Apache License

private void bind() {
    // heuristic choice
    SELECTOR.getHeuristicSelectElement().change(new Function() {
        public void f(Element e) {
            String value = $(e).val();
            onHeuristicChange(value);/*from w  w  w .j  a va2  s. c o m*/
        }
    });

    // algorithm choice
    SELECTOR.getAlgorithmSelectElement().change(new Function() {
        public void f(Element e) {
            String value = $(e).val();
            onAlgorithmChange(value);
        }
    });

    SELECTOR.getPuzzleTypeRadios().click(new Function() {
        public void f(Element e) {
            int newDimension = Integer.parseInt($(e).val());
            onDimensionChange(newDimension);
        }
    });

}

From source file:be.dramaix.ai.slidingpuzzle.client.Puzzle.java

License:Apache License

private void bind() {
    // randomize the puzzle
    SELECTOR.getRandomButton().click(new Function() {
        public void f() {
            SELECTOR.getInformationMessages().hide();

            startState = State.createRandom(dimension);
            loadState(startState);/*from   w  w w.j  a  v a  2s  .c om*/

            SELECTOR.getPlayButton().hide();
            SELECTOR.getSolveButton().show();
        }
    });

    // play the result
    SELECTOR.getPlayButton().click(new Function() {
        public void f() {
            loadState(startState);
            play();
        }
    });

    //dimension of the puzzle change ?
    SELECTOR.getPuzzleTypeRadios().click(new Function() {
        public void f(Element e) {
            int newDimension = Integer.parseInt($(e).val());
            onDimensionChange(newDimension);
        }
    });
}

From source file:be.dramaix.ai.slidingpuzzle.client.Puzzle.java

License:Apache License

private void slide(final int currentIndex, final int time) {

    if (currentIndex == result.length() - 1) {
        return;/*from www.ja v a  2 s .  c  o m*/
    }

    State start = result.getNodes()[currentIndex].getState();
    final State end = result.getNodes()[currentIndex + 1].getState();
    Action a = result.getNodes()[currentIndex + 1].getAction();

    int xSlide = TILE_DIMENSION * a.getMove().getHorizontalMove();
    int ySlide = TILE_DIMENSION * a.getMove().getVerticalMove();

    int topInitial = TILE_DIMENSION * a.getCellLocation().getRowIndex();
    int leftInitial = TILE_DIMENSION * a.getCellLocation().getColumnIndex();

    int topFinal = topInitial + ySlide;
    int leftFinal = leftInitial + xSlide;

    int value = start.getCellValue(a.getCellLocation());

    GQuery cell = $(SLIDE_HELPER_HTML).css("top", "" + topInitial + "px").css("left", "" + leftInitial + "px");

    SELECTOR.getPuzzleBoard().append(cell);

    String animation = "left: '" + leftFinal + "px'; top: '" + topFinal + "px';";

    $("#slideHelper").text("" + value).animate(animation, time).delay(50, new Function() {
        @Override
        public void f() {
            loadState(end);
            slide(currentIndex + 1, time);
        }
    });

}

From source file:be.dramaix.ai.slidingpuzzle.client.SlidingPuzzleApp.java

License:Apache License

/**
 * Bind a click handler on the solve button.
 *//*from   w w  w.j a  v a  2s  .  c  o  m*/
private void bind() {

    $("#solve").click(new Function() {
        public void f() {
            SELECTOR.getInformationMessages().hide();
            loading.show();
            result.reset();
            solve();
        }
    });

}

From source file:cc.kune.common.client.msgs.UserMessageWidget.java

License:GNU Affero Public License

@Override
public void close() {
    $(this).as(Effects).fadeOut(300, new Function() {
        @Override//from   w ww  . j a va2 s  . c om
        public void f() {
            removeFromParent();
            setVisible(false);
            closeCallback.onClose();
        }
    });

}

From source file:cimav.client.view.nomina.HorasExtrasUI.java

public HorasExtrasUI() {

    this.buildGrid(); // antes del initWidget

    initWidget(uiBinder.createAndBindUi(this));

    anchorPlus.addClickHandler(new HorasExtrasUI.ClickPlus());

    Properties wnd = window.cast();
    wnd.setFunction("removeHoraExtra", new Function() {
        // relacionado con NomIconInputCell
        public void f() {
            JsArrayMixed args = arguments(0);
            String idHoraExtra = args.getString(0);
            getHorasExtrasREST().remove(idHoraExtra);
        }/*from  ww  w .j  av a2s.  com*/
    });

}

From source file:cimav.client.view.nomina.NominaFaltasUI.java

public NominaFaltasUI() {

    this.buildGrid(); // antes del initWidget

    initWidget(uiBinder.createAndBindUi(this));

    faltaChosen = new org.gwtbootstrap3.client.ui.ValueListBox<>(new Renderer<ETipoIncidencia>() {
        @Override//ww w.j a  v a2s  . co  m
        public String render(ETipoIncidencia object) {
            if (object == null) {
                return "None";
            }
            return object.getDescripcion();
        }

        @Override
        public void render(ETipoIncidencia object, Appendable appendable) throws IOException {
            String s = render(object);
            appendable.append(s);
        }
    });
    List<ETipoIncidencia> tipos = Arrays.asList(ETipoIncidencia.values());
    faltaChosen.setValue(ETipoIncidencia.AI); //default
    faltaChosen.setAcceptableValues(tipos);
    faltaChosen.addStyleName("movimientos-chosen");

    htmlPanel.add(faltaChosen);

    anchorPlus.addClickHandler(new ClickPlus());

    Properties wnd = window.cast();
    wnd.setFunction("removeFalta", new Function() {
        public void f() {
            JsArrayMixed args = arguments(0);
            String idFalta = args.getString(0);
            getIncidenciasREST().remove(idFalta);
        }
    });

}

From source file:cimav.client.view.nomina.NominaSaldoUI.java

@UiConstructor
public NominaSaldoUI(String idTipoConcepto) {

    this.tipoConcepto = ETipoConcepto.get(idTipoConcepto);

    this.buildGrid(); // antes del initWidget

    initWidget(uiBinder.createAndBindUi(this));

    conceptosChosen = new ConceptosChosen(this.tipoConcepto, ETipoMovimiento.PAGO);
    conceptosChosen.addStyleName("movimientos-chosen");
    htmlPanel.add(conceptosChosen);//w  w  w .j a  va  2 s. c  o m

    anchorPlus.addClickHandler(new ClickPlus());

    Properties wnd = window.cast();
    wnd.setFunction("removeSaldo", new Function() {
        public void f() {
            JsArrayMixed args = arguments(0);
            String idSaldo = args.getString(0);
            getNominaQuincenalsREST().remove(idSaldo);
        }
    });

}

From source file:com.arcbees.beestore.client.application.ApplicationView.java

License:Apache License

private void bind() {
    shoppingCartOpen = false;/*from  w w  w . j  a v  a 2s . c om*/
    $(numberOfItemsTooltip).hide();

    $(backTop).click(new Function() {
        @Override
        public void f() {
            $("html, body").each(new Function() {
                @Override
                public void f(Element element) {
                    new ScrollTopAnimation(element).run(ANIMATION_DURATION);
                }
            });
        }
    });

    $(cartButton).click(new Function() {
        @Override
        public void f() {
            toggleCartVisibility();
        }
    });

    $(closeMessage).click(new Function() {
        @Override
        public void f() {
            closeTopBar();
        }
    });

    setI18nAnchors();
}

From source file:com.arcbees.beestore.client.application.product.ProductView.java

License:Apache License

private void bind() {
    $(shareButton).click(new Function() {
        @Override/*from w  w w  .ja  v a 2  s  .co m*/
        public void f() {
            getUiHandlers().onShareButtonClicked();
        }
    });

    $(addToCart).click(new Function() {
        @Override
        public void f() {
            int quantity = getQuantity();
            if (quantity > 0) {
                getUiHandlers().onAddToCartButtonClicked(quantity);
            }
        }
    });
}