Java Code Examples for gwt.material.design.addins.client.pathanimator.MaterialPathAnimator

The following examples show how to use gwt.material.design.addins.client.pathanimator.MaterialPathAnimator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("btnFAB")
void onFAB(ClickEvent e){
    // Execute the opening callback once the fab is clicked
    MaterialPathAnimator.animate(btnFAB.getElement(), musicPanel.getElement(), () -> {
        // Hide the fab with zoom out animation
        new MaterialAnimation().transition(Transition.ZOOMOUT).animate(btnFAB);
        btnFAB.setVisibility(Style.Visibility.HIDDEN);
        btnFAB.setOpacity(0);

        // Setting the visibility of the music panel
        musicPanel.setVisibility(Style.Visibility.VISIBLE);
        musicPanel.setOpacity(1);

        // Setting the music label with Bounce up animation
        lblMusic.setText("Pharell Williams / Love Yourself to Dance");
        new MaterialAnimation().transition(Transition.BOUNCEINUP).animate(lblMusic);

        // Setting the image of the artist
        imgMusic.setUrl("http://thatgrapejuice.net/wp-content/uploads/2013/08/pharrell-williams-that-grape-juice.png");
    });
}
 
Example 2
Source Project: gwt-material-demo   Source File: PathAnimatorShowcase.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("btnPause")
void onPause(ClickEvent e){
    // Execute the close callback animation
    MaterialPathAnimator.reverseAnimate(btnFAB.getElement(), musicPanel.getElement(), () -> {
        // Setting the visibility of the FAB for reverse animation
        new MaterialAnimation().transition(Transition.ZOOMIN).animate(btnFAB);
        btnFAB.setVisibility(Style.Visibility.VISIBLE);
        btnFAB.setOpacity(1);

        // Hide the music panel once the pause button is clicked
        musicPanel.setVisibility(Style.Visibility.HIDDEN);
        musicPanel.setOpacity(0);

        // Setting the previous music label with Bounce down animation
        lblMusic.setText("Lady Gaga / Telephone");
        new MaterialAnimation().transition(Transition.BOUNCEINDOWN).animate(lblMusic);

        // Setting the image of the artist
        imgMusic.setUrl("https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRi9lfCkLutb7ugJlIjn84qWNoiICopC-Vyx7QQJRHF5E7GlqFG");
    });
}
 
Example 3
Source Project: gwt-material-addins   Source File: PathStylerMixin.java    License: Apache License 2.0 6 votes vote down vote up
public void setup(MaterialPathAnimator animator) {
    animator.setAnimateOnStartCallback(() -> {
        Scheduler.get().scheduleDeferred(() -> {
            Element bridgeElement = getBridgeElement();
            if (bridgeElement != null) {
                if (shadow != null) {
                    bridgeElement.addClassName("z-depth-" + shadow);
                }

                if (backgroundColor != null) {
                    setStyleProperty("background", ColorHelper.setupComputedBackgroundColor(backgroundColor));
                }

                if (properties != null) {
                    for (PathStyleProperty property : properties) {
                        bridgeElement.getStyle().setProperty(property.getProperty(), property.getValue());
                    }
                }
            }
        });
    });
}
 
Example 4
Source Project: gwt-material-addins   Source File: MaterialOverlayTab.java    License: Apache License 2.0 6 votes vote down vote up
public void minimize(MaterialOverlay overlay) {
    if (!maximized) {
        MaterialPathAnimator animator = new MaterialPathAnimator();
        animator.setReverseCallback(() -> {
            register(overlay);
            overlay.getElement().getStyle().setVisibility(Style.Visibility.HIDDEN);
            overlay.getElement().getStyle().setOpacity(0);
        });
        animator.setSourceElement(activator.getElement());
        animator.setTargetElement(overlay.getElement());
        animator.reverseAnimate();
        body().attr("style", "overflow: auto !important");
    } else {
        Scheduler.get().scheduleDeferred(() -> {
            overlays.stream().filter(other -> other != overlay).forEach(other -> other.removeStyleName(AddinsCssName.HIDDEN));
            overlay.removeStyleName(AddinsCssName.MAXIMIZE);
        });
    }
    maximized = false;
}
 
Example 5
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnFinish")
void onFinishDialog(ClickEvent e) {
    MaterialTreeItem item = new MaterialTreeItem();
    item.setText(txtName.getText());
    item.setIconType(IconType.FOLDER);
    item.setIconColor(Color.BLUE);
    docTree.getSelectedItem().addItem(item);
    MaterialPathAnimator.reverseAnimate(btnAdd.getElement(), addOverlay.getElement());
}
 
Example 6
public void testProperties() {
    // given
    final int DURATION = 300;
    final int TARGET_DURATION = 500;
    final int EXTRA_DURATION = 800;
    final Functions.Func animateCallback = () -> {};
    final Functions.Func reverseCallback = () -> {};
    MaterialPathAnimator animator = new MaterialPathAnimator();

    // when / then
    animator.setDuration(DURATION);
    assertEquals(DURATION, animator.getDuration());
    animator.setTargetShowDuration(TARGET_DURATION);
    assertEquals(TARGET_DURATION, animator.getTargetShowDuration());
    animator.setAnimateCallback(animateCallback);
    assertEquals(animateCallback, animator.getAnimateCallback());
    animator.setReverseCallback(reverseCallback);
    assertEquals(reverseCallback, animator.getReverseCallback());
    animator.setExtraTransitionDuration(EXTRA_DURATION);
    assertEquals(EXTRA_DURATION, animator.getExtraTransitionDuration());
    MaterialPanel source = getWidget();
    animator.setSourceElement(source.getElement());
    assertEquals(source.getElement(), animator.getSourceElement());
    assertNotNull(target);
    animator.setTargetElement(target.getElement());
    assertEquals(target.getElement(), animator.getTargetElement());
}
 
Example 7
public void testStaticInstance() {
    // given
    MaterialPanel source = new MaterialPanel();
    MaterialPanel target = new MaterialPanel();
    RootPanel.get().add(source);
    RootPanel.get().add(target);

    // when / then
    target.setVisibility(Style.Visibility.HIDDEN);
    target.setOpacity(0);
    assertEquals("hidden", target.getElement().getStyle().getVisibility());
    assertEquals("0", target.getElement().getStyle().getOpacity());
    MaterialPathAnimator.animate(source, target);
    MaterialPathAnimator.reverseAnimate(source, target);
}
 
Example 8
Source Project: gwt-material-patterns   Source File: GoogleContactsView.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Open the profile overlay to view the user details
 * @param colaps
 */
public void openProfileOverlay(CustomerCollapsible colaps) {
    profileOverlay.setCustomerCollapsible(colaps);
    MaterialPathAnimator.animate(colaps.getColapsItem().getElement(), profileOverlay.getOverlay().getElement());
}
 
Example 9
Source Project: gwt-material-patterns   Source File: ProfileOverlay.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnCloseProfile")
void onCloseProfiled(ClickEvent e){
    MaterialPathAnimator.reverseAnimate(getCustomerCollapsible().getColapsItem().getElement(), overlay.getElement());
}
 
Example 10
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnAdd")
void onAddDialog(ClickEvent e) {
    MaterialPathAnimator.animate(btnAdd.getElement(), addOverlay.getElement());
}
 
Example 11
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnDelete")
void onDeleteDialog(ClickEvent e) {
    docTree.getSelectedItem().removeFromTree();
    MaterialPathAnimator.reverseAnimate(btnAdd.getElement(), addOverlay.getElement());
}
 
Example 12
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnCancel")
void onCancelDialog(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(btnAdd.getElement(), addOverlay.getElement());
}
 
Example 13
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnSource1")
void onSource(ClickEvent e) {
    MaterialPathAnimator.animate(btnSource1.getElement(), panelTarget1.getElement());
}
 
Example 14
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnSource2")
void onClickCard(ClickEvent e) {
    MaterialPathAnimator.animate(card.getElement(), panelTarget2.getElement());
}
 
Example 15
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnSource3")
void onClickCard3(ClickEvent e) {
    MaterialPathAnimator.animate(btnSource3.getElement(), panelTarget3.getElement());
}
 
Example 16
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnSource4")
void onClickIconDelete(ClickEvent e) {
    MaterialPathAnimator.animate(btnSource4.getElement(), panelTarget4.getElement());
}
 
Example 17
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col1")
void onCol1(ClickEvent e) {
    MaterialPathAnimator.animate(col1.getElement(), panelTargetCol1.getElement());
}
 
Example 18
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col2")
void onCol2(ClickEvent e) {
    MaterialPathAnimator.animate(col2.getElement(), panelTargetCol2.getElement());
}
 
Example 19
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col3")
void onCol3(ClickEvent e) {
    MaterialPathAnimator.animate(col3.getElement(), panelTargetCol3.getElement());
}
 
Example 20
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col4")
void onCol4(ClickEvent e) {
    MaterialPathAnimator.animate(col4.getElement(), panelTargetCol4.getElement());
}
 
Example 21
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col5")
void onCol5(ClickEvent e) {
    MaterialPathAnimator.animate(col5.getElement(), panelTargetCol5.getElement());
}
 
Example 22
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col6")
void onCol6(ClickEvent e) {
    MaterialPathAnimator.animate(col6.getElement(), panelTargetCol6.getElement());
}
 
Example 23
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("col7")
void onCol7(ClickEvent e) {
    MaterialPathAnimator.animate(col7.getElement(), panelTargetCol7.getElement());
}
 
Example 24
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnClose1")
void onClose(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(btnSource1.getElement(), panelTarget1.getElement());
}
 
Example 25
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnClose2")
void onCardClose(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(btnSource2.getElement(), panelTarget2.getElement());
}
 
Example 26
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnClose3")
void onCardClose3(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(btnSource3.getElement(), panelTarget3.getElement());
}
 
Example 27
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnClose4")
void onClose4(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(btnSource4.getElement(), panelTarget4.getElement());
}
 
Example 28
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnCloseCol1")
void onCloseCol1(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(col1.getElement(), panelTargetCol1.getElement());
}
 
Example 29
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnCloseCol2")
void onCloseCol2(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(col2.getElement(), panelTargetCol2.getElement());
}
 
Example 30
Source Project: gwt-material-demo   Source File: PathAnimatorView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnCloseCol3")
void onCloseCol3(ClickEvent e) {
    MaterialPathAnimator.reverseAnimate(col3.getElement(), panelTargetCol3.getElement());
}