Java Code Examples for gwt.material.design.client.ui.MaterialToast

The following examples show how to use gwt.material.design.client.ui.MaterialToast. 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: StandardDataTableView.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("updateFirstRow")
void onUpdateFirstRow(ClickEvent e) {
    String firstName = "John";
    String lastName = "Doe";
    String email = "[email protected]";

    if (people.get(0) != null) {
        Person firstPerson = people.get(0);
        firstPerson.setFirstName(firstName);
        firstPerson.setLastName(lastName);
        firstPerson.setEmail(email);
        table.updateRow(firstPerson);

        MaterialToast.fireToast("Updated first row : " + firstName + " " + lastName);
    } else {
        MaterialToast.fireToast("Can not find the first person.");
    }
}
 
Example 2
Source Project: gwt-material-demo   Source File: AsyncView.java    License: Apache License 2.0 6 votes vote down vote up
protected void addClickHandler(AbstractAsyncButton... buttons) {
    for (AbstractAsyncButton button : buttons) {
        button.addLoadingHandler(event -> {
            MaterialToast.fireToast("Loading Event Fired");
        });

        button.addSuccessHandler(event -> {
            MaterialToast.fireToast("Success Event Fired");
        });

        button.addErrorHandler(event -> {
            MaterialToast.fireToast("Errored Event Fired");
        });
        button.addClickHandler(event -> {
            button.loading("Loading your data...");
            Scheduler.get().scheduleFixedDelay(() -> {
                if (errorSuccess.getValue()) {
                    button.success("Successfully Loaded");
                } else {
                    button.error("Failed to load");
                }
                return false;
            }, 3000);
        });
    }
}
 
Example 3
Source Project: gwt-material-demo   Source File: ImageCropperView.java    License: Apache License 2.0 6 votes vote down vote up
void applyDimension() {

        if (comboViewPortWidth.getSingleValue() > comboBoundaryWidth.getSingleValue()) {
            MaterialToast.fireToast("Boundary width must be greater than the Viewport width");
            return;
        }

        if (comboViewPortHeight.getSingleValue() > comboBoundaryHeight.getSingleValue()) {
            MaterialToast.fireToast("Boundary height must be greater than the Viewport height");
            return;
        }

        JsCropperDimension viewPort = new JsCropperDimension();
        viewPort.width = comboViewPortWidth.getSingleValue();
        viewPort.height = comboViewPortHeight.getSingleValue();

        JsCropperDimension boundary = new JsCropperDimension();
        boundary.width = comboBoundaryWidth.getSingleValue();
        boundary.height = comboBoundaryHeight.getSingleValue();

        cropper.setViewport(viewPort);
        cropper.setBoundary(boundary);
        cropper.reload();
    }
 
Example 4
Source Project: gwt-material-demo   Source File: CircularProgressView.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
CircularProgressView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    buildCircularDynamic(circLabel);
    buildCircularDynamic(circLabel2);
    buildCircularDynamic(circLabel3);
    buildCircularDynamic(circResponsive);

    circStartAngle.setStartAngle(Math.PI / 2);
    circStartAngle2.setStartAngle(Math.PI / 2);

    circEvents.addStartHandler(event -> MaterialToast.fireToast("Started"));
    circEvents.addCompleteHandler(event -> MaterialToast.fireToast("Completed"));
    buildCircularDynamic(circEvents);


    buildCircularContinuos();
}
 
Example 5
Source Project: gwt-material-demo   Source File: NotificationView.java    License: Apache License 2.0 6 votes vote down vote up
@UiHandler("notify")
void notify(ClickEvent e) {
    if (isSupported()) {
        if (Notification.getPermission().equals("granted")) {
            NotificationOptions options = new NotificationOptions();
            options.body = "I love GMD";
            options.icon = "https://user.oc-static.com/upload/2017/05/03/14938342186053_01-duration-and-easing.png";
            // Will show the Notification provided by NotificationOptions
            Notification notification = new Notification("GMD Says", options);
            // Listen to any Notification events
            notification.setOnclick(param1 -> MaterialToast.fireToast("Clicked"));
            notification.setOnclose(param1 -> MaterialToast.fireToast("Closed"));
            notification.setOnerror(param1 -> MaterialToast.fireToast("Error"));
            notification.setOnshow(param1 -> MaterialToast.fireToast("Shown"));
        } else {
            MaterialToast.fireToast("Permission Denied. Update it thru the browser setting");
        }
    }
}
 
Example 6
Source Project: gwt-material-demo   Source File: ListBoxView.java    License: Apache License 2.0 6 votes vote down vote up
@Inject
ListBoxView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    generateAllowBlankItems(lstAllowBlank);

    buildListHeroes(lstValueBox);
    buildListHeroes(lstEmptyPlacehoder);

    lstFocusAndBlur.addFocusHandler(focusEvent -> MaterialToast.fireToast("Focus Event Fired"));
    lstFocusAndBlur.addBlurHandler(blurEvent -> MaterialToast.fireToast("Blur Event Fired"));
    buildListHeroes(lstFocusAndBlur);

    lstOptions.addFocusHandler(focusEvent -> {
        MaterialToast.fireToast("FOCUSED");
    });

    lstOptions.addBlurHandler(blurEvent -> {
        MaterialToast.fireToast("BLURRED");
    });

    lstOptions.addValueChangeHandler(valueChangeEvent -> {
        MaterialToast.fireToast(valueChangeEvent.getValue());
    });
}
 
Example 7
Source Project: gwt-boot-samples   Source File: HelloWorldView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("showButton")
void handleShowButtonClick(ClickEvent e) {
	foodDropDown.getItems().forEach(item -> {
		MaterialToast.fireToast(item.toString());
		logger.info(item.toString());
	});
}
 
Example 8
Source Project: gwt-material-demo   Source File: AlertView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("showAlertError")
void showAlertError(ClickEvent e) {
    alertError.setType(comboType.getSingleValue());
    if (withCallback.getValue()) {
        alertError.open(() -> MaterialToast.fireToast("Callback Fired"));
        return;
    }
    alertError.open();
}
 
Example 9
Source Project: gwt-material-demo   Source File: AddressLookupView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
AddressLookupView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    // Loading API
    ApiRegistry.register(new AddressLookupApi("AIzaSyCcFsjlqr-DR6acrZ8xZKhXNGxeS3nDmIE"), new Callback<Void, Exception>() {
        @Override
        public void onFailure(Exception exception) {
            MaterialToast.fireToast(exception.getMessage());
        }

        @Override
        public void onSuccess(Void aVoid) {
            addressLookup.load();

        }
    });



    // Lookup Demo
    AddressLookupOptions option = AddressLookupOptions.create();
    option.setTypes(AddressType.ADDRESS);

    addressLookup.setOptions(option);
    addressLookup.addPlaceChangedHandler(event -> {
        MaterialToast.fireToast("Place Changed event fired");
        setComponent(streetAddress, addressLookup.getAddressComponent(AddressComponentType.STREET_ADDRESS));
        setComponent(city, addressLookup.getAddressComponent(AddressComponentType.LOCALITY));
        setComponent(state, addressLookup.getAddressComponent(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_1));
        setComponent(country, addressLookup.getAddressComponent(AddressComponentType.COUNTRY));
        setComponent(zipCode, addressLookup.getAddressComponent(AddressComponentType.POSTAL_CODE));
    });
}
 
Example 10
Source Project: gwt-material-demo   Source File: TreeView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnDeselectItem")
void onDeselectItem(ClickEvent e) {
    if (docTree.getSelectedItem() == null) {
        MaterialToast.fireToast("You must select an item first.");
    } else {
        MaterialToast.fireToast("Item " + docTree.getSelectedItem().getText() + " was deselected.");
        docTree.deselectSelectedItem();
    }
}
 
Example 11
Source Project: gwt-material-demo   Source File: ThemeManager.java    License: Apache License 2.0 5 votes vote down vote up
public static void loadTheme(ThemeLoader.ThemeBundle themeBundle) {
    ThemeLoader.loadAsync(themeBundle, new ThemeLoader.ThemeAsyncCallback() {
        @Override
        public void onSuccess(int resourceCount) {
            if (themeBundle == ThemeAmber.INSTANCE) {
                setColor(Color.AMBER, Color.AMBER_DARKEN_3, Color.AMBER_LIGHTEN_2);
            } else if (themeBundle == ThemeBlue.INSTANCE) {
                setColor(Color.BLUE, Color.BLUE_DARKEN_3, Color.BLUE_LIGHTEN_2);
            } else if (themeBundle == ThemeBrown.INSTANCE) {
                setColor(Color.BROWN, Color.BROWN_DARKEN_3, Color.BROWN_LIGHTEN_2);
            } else if (themeBundle == ThemeGreen.INSTANCE) {
                setColor(Color.GREEN, Color.GREEN_DARKEN_3, Color.GREEN_LIGHTEN_2);
            } else if (themeBundle == ThemeGrey.INSTANCE) {
                setColor(Color.GREY, Color.GREY_DARKEN_3, Color.GREY_LIGHTEN_2);
            } else if (themeBundle == ThemeOrange.INSTANCE) {
                setColor(Color.ORANGE, Color.ORANGE_DARKEN_3, Color.ORANGE_LIGHTEN_2);
            } else if (themeBundle == ThemePink.INSTANCE) {
                setColor(Color.PINK, Color.PINK_DARKEN_3, Color.PINK_LIGHTEN_2);
            } else if (themeBundle == ThemePurple.INSTANCE) {
                setColor(Color.PURPLE, Color.PURPLE_DARKEN_3, Color.PURPLE_LIGHTEN_2);
            } else if (themeBundle == ThemeRed.INSTANCE) {
                setColor(Color.RED, Color.RED_DARKEN_3, Color.RED_LIGHTEN_2);
            } else if (themeBundle == ThemeYellow.INSTANCE) {
                setColor(Color.YELLOW, Color.YELLOW_DARKEN_3, Color.YELLOW_LIGHTEN_2);
            }
        }

        @Override
        public void onFailure(Throwable reason) {
            MaterialToast.fireToast(reason.getMessage());
        }
    });
}
 
Example 12
Source Project: gwt-material-demo   Source File: RichEditorView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("getValue")
void onGetValue(ClickEvent e) {
    String value = clearRichEditor.getValue();
    if (value.isEmpty()) {
        value = "Empty";
    }
    MaterialToast.fireToast(value);
}
 
Example 13
Source Project: gwt-material-demo   Source File: CircularProgressView.java    License: Apache License 2.0 5 votes vote down vote up
protected void buildCircularContinuos() {
    Timer timer = new Timer() {
        @Override
        public void run() {
            double total = (i * 100) / 5;
            circContinuos.setValue(total / 100, true);
            if (i >= 5) {
                MaterialToast.fireToast("Finished");
                cancel();
            }
            i++;
        }
    };
    timer.scheduleRepeating(1000);
}
 
Example 14
Source Project: gwt-material-demo   Source File: DialogsView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("btnToastAction")
void onToastAction(ClickEvent e) {
    MaterialLink link = new MaterialLink("UNDO");
    link.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            MaterialToast.fireToast("UNDO DONE");
        }
    });
    new MaterialToast(link).toast("Item Deleted");
}
 
Example 15
Source Project: gwt-material-demo   Source File: ScrollFireView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
ScrollFireView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    MaterialScrollfire.apply(panel.getElement(), () -> {
        MaterialToast.fireToast("Toasted");
    });
    MaterialScrollfire.apply(listContainer.getElement(), () -> new MaterialAnimation().transition(Transition.SHOW_STAGGERED_LIST).animate(listContainer));
    MaterialScrollfire.apply(image.getElement(), () -> new MaterialAnimation().transition(Transition.FADE_IN_IMAGE).animate(image));

}
 
Example 16
Source Project: gwt-material-demo   Source File: MenuBarView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("dpMode")
void onSelectionMode(SelectionEvent<Widget> selection) {
    for(Widget w : dpMode.getItems()){
        if(w instanceof MaterialCheckBox){
            ((MaterialCheckBox) w).setValue(false);
        }
    }
    if(selection.getSelectedItem() instanceof MaterialCheckBox){
        ((MaterialCheckBox) selection.getSelectedItem()).setValue(true);
        MaterialToast.fireToast("Checked : " + ((MaterialCheckBox) selection.getSelectedItem()).getText());
    }
}
 
Example 17
Source Project: gwt-material-demo   Source File: CutOutsView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
CutOutsView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));
    ThemeManager.register(cutout);
    cutout.addCloseHandler(closeEvent -> {
        MaterialToast.fireToast("Close Event Fired");
    });

    cutout.addOpenHandler(openEvent -> {
        MaterialToast.fireToast("Open Event Fired");
    });
    cutout.setTarget(btnCutOut);
}
 
Example 18
/**
 * The full text of the address component
 */
@JsOverlay
public final String getLongName() {
    if (long_name == null) {
        MaterialToast.fireToast("PUTA");
    }
    return long_name;
}
 
Example 19
Source Project: gwt-material-demo   Source File: AutoCompleteView.java    License: Apache License 2.0 5 votes vote down vote up
@UiHandler("getTextValue")
void getTextValue(ClickEvent e) {
    if (acListType.getItemBox().getText().isEmpty()) {
        MaterialToast.fireToast("Value is empty");
    } else {
        MaterialToast.fireToast(acListType.getItemBox().getText() + "");
    }
}
 
Example 20
Source Project: gwt-material-demo   Source File: NotificationView.java    License: Apache License 2.0 5 votes vote down vote up
protected boolean isSupported() {
    boolean supported = PwaManager.isPwaSupported();
    if (!supported) {
        MaterialToast.fireToast("Push Notification is not supported");
    }
    return supported;
}
 
Example 21
Source Project: gwt-material-demo   Source File: PickersView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
PickersView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));

    dpLimit.setDateMin(new Date(117, 0, 1));
    dpLimit.setDateMax(new Date(117, 0, 15));
    // Events on date picker
    dpEvents.addOpenHandler(event -> {
        if(event.getTarget().getValue() != null){
            MaterialToast.fireToast("Opened Date Picker " + event.getTarget().getValue());
        }else{
            MaterialToast.fireToast("Opened Date Picker" );
        }
    });
    dpEvents.addCloseHandler(event -> MaterialToast.fireToast("Closed Date Picker with value " + event.getTarget().getValue()));
    dpEvents.addValueChangeHandler(event -> MaterialToast.fireToast("Date Selected " + event.getValue()));

    dpOpenClose.addOpenHandler(event -> {
        if(event.getTarget().getValue() != null){
            MaterialToast.fireToast("Opened Date Picker " + event.getTarget().getValue());
        } else {
            MaterialToast.fireToast("Opened Date Picker" );
        }
    });
    dpOpenClose.addCloseHandler(event -> MaterialToast.fireToast("Closed Date Picker with value " + event.getTarget().getValue()));
    dpOpenClose.addValueChangeHandler(event -> {
        MaterialToast.fireToast("Date Selected " + event.getValue());
        dpOpenClose.close();
    });

    dpAutoClose.addValueChangeHandler(event -> {
        MaterialToast.fireToast("Date Selected " + event.getValue());
    });

    dpBirthdate.setDate(new Date(50, 1, 1));

    initLanguage();
}
 
Example 22
Source Project: gwt-material-demo   Source File: NavBarView.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
NavBarView(Binder uiBinder) {
    initWidget(uiBinder.createAndBindUi(this));
    navSection.addSelectionHandler(selectionEvent -> MaterialToast.fireToast(selectionEvent.getSelectedItem() + " Selected Index"));

    typePanel.add(new DemoImagePanel(new DemoImageDTO("Default NavBar", "Provides a non-fixed navbar. Good for blogs.",
            "http://i.imgur.com/rGx7XRW.gif",
            generateDemoLink("default"),
            generateSource("navbardefault/DefaultNavBarView.ui.xml"))));

    typePanel.add(new DemoImagePanel(new DemoImageDTO("Fixed NavBar", "By setting layoutPosition='FIXED', your navbar will be fixed on top when scrolling through the content.",
            "http://i.imgur.com/muYAAjl.gif",
            generateDemoLink("fixed"),
            generateSource("navbarfixed/FixedNavBarView.ui.xml"))));

    typePanel.add(new DemoImagePanel(new DemoImageDTO("Tall NavBar", "You can easily adjust the navbar's height to make it tall by height='200px',",
            "http://i.imgur.com/dtUsHRd.gif",
            generateDemoLink("tall"),
            generateSource("navbartall/TallNavBarView.ui.xml"))));

    typePanel.add(new DemoImagePanel(new DemoImageDTO("Extended NavBar", "Using MaterialNavContent - you can easily attached any component for the extension of your MaterialNavBar",
            "http://i.imgur.com/bUYC6qs.png",
            generateDemoLink("extend"),
            generateSource("navbarextend/ExtendNavBarView.ui.xml"))));


    typePanel.add(new DemoImagePanel(new DemoImageDTO("Tabs in NavBar", "You can easily add tabs for secondary navigation on MaterialNavBar by attaching it on MaterialNavContent",
            "http://i.imgur.com/7c3AGBs.png",
            generateDemoLink("tab"),
            generateSource("navbartab/TabNavBarView.ui.xml"))));

    typePanel.add(new DemoImagePanel(new DemoImageDTO("Shrinkable NavBar", "Provides a delightful scrolling effect when expanding or shrinking the navbar.",
            "http://i.imgur.com/tHUDgqB.gif",
            generateDemoLink("shrink"),
            generateSource("navbarshrink/ShrinkNavBarView.ui.xml"))));
}
 
Example 23
Source Project: gwt-boot-samples   Source File: HelloWorldView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("foodDropDown")
void handleDropdown(SelectionEvent<Widget> callback) {
	MaterialToast.fireToast(
			"Selected : " + ((MaterialLink) callback.getSelectedItem())
					.getText());
}
 
Example 24
Source Project: gwt-material   Source File: DefaultDisplayLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void failure(String error) {
    MaterialToast.fireToast(error);
}
 
Example 25
Source Project: gwt-material-demo   Source File: StandardDataTableView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("getFirstRow")
void onGetFirstRow(ClickEvent e) {
    MaterialToast.fireToast("FIRST ROW: " + table.getRow(0).getData().getFirstName());
}
 
Example 26
Source Project: gwt-material-demo   Source File: FrozenDataTableView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("getFirstRow")
void onGetFirstRow(ClickEvent e) {
    MaterialToast.fireToast("FIRST ROW: " + table.getRow(0).getData().getFirstName());
}
 
Example 27
Source Project: gwt-material-demo   Source File: ButtonsView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnHover")
void onHover(MouseOverEvent e) {
    MaterialToast.fireToast("Hover Triggered");
    btnHover.setText("Hovered");
}
 
Example 28
Source Project: gwt-material-demo   Source File: DialogsView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("btnToast")
void onToast(ClickEvent e) {
    MaterialToast.fireToast("I Love Material Design");
}
 
Example 29
Source Project: gwt-material-demo   Source File: ToggleView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("groupToggle")
void selection(SelectionEvent<Integer> e) {
    MaterialToast.fireToast("Selected Index : " + e.getSelectedItem());
}
 
Example 30
Source Project: gwt-material-demo   Source File: ToggleView.java    License: Apache License 2.0 4 votes vote down vote up
@UiHandler("getIndex")
void getIndex(ClickEvent e) {
    MaterialToast.fireToast("Selected Index : " + groupToggle.getValue().get(0));
}