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

The following examples show how to use gwt.material.design.client.ui.MaterialToast. 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 File: StandardDataTableView.java    From gwt-material-demo with 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 File: CircularProgressView.java    From gwt-material-demo with 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 #3
Source File: ListBoxView.java    From gwt-material-demo with 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 #4
Source File: NotificationView.java    From gwt-material-demo with 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 #5
Source File: ImageCropperView.java    From gwt-material-demo with 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 #6
Source File: AsyncView.java    From gwt-material-demo with 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 #7
Source File: ScrollFireView.java    From gwt-material-demo with 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 #8
Source File: AlertView.java    From gwt-material-demo with 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 File: AddressLookupView.java    From gwt-material-demo with 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 File: HelloWorldView.java    From gwt-boot-samples with 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 #11
Source File: AutoCompleteView.java    From gwt-material-demo with 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 #12
Source File: TreeView.java    From gwt-material-demo with 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 #13
Source File: ThemeManager.java    From gwt-material-demo with 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 #14
Source File: NavBarView.java    From gwt-material-demo with 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 #15
Source File: GeocoderAddressComponent.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
/**
 * The full text of the address component
 */
@JsOverlay
public final String getLongName() {
    if (long_name == null) {
        MaterialToast.fireToast("PUTA");
    }
    return long_name;
}
 
Example #16
Source File: DialogsView.java    From gwt-material-demo with 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 #17
Source File: CircularProgressView.java    From gwt-material-demo with 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 #18
Source File: NotificationView.java    From gwt-material-demo with 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 #19
Source File: MenuBarView.java    From gwt-material-demo with 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 #20
Source File: PickersView.java    From gwt-material-demo with 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 #21
Source File: CutOutsView.java    From gwt-material-demo with 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 #22
Source File: RichEditorView.java    From gwt-material-demo with 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 #23
Source File: AutoCompleteView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetAll")
void onGetAll(ClickEvent e) {
    for(User user : getSelectedUsers()){
        MaterialToast.fireToast(user.getName());
    }
}
 
Example #24
Source File: ComboBoxView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetValue")
void onGetValue(ClickEvent e) {
    MaterialToast.fireToast(comboTimeZone12.getSingleValue().getName());
}
 
Example #25
Source File: ComboBoxView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetValues")
void onGetValues(ClickEvent e) {
    for(State state : comboTimeZone12_1.getSelectedValues()) {
        MaterialToast.fireToast("Name: " + state.getName() + " Value: " + state.getValue());
    }
}
 
Example #26
Source File: ComboBoxView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetValue2")
void onGetValue2(ClickEvent e) {
    MaterialToast.fireToast(comboTimeZone13.getSingleValue().getName());
}
 
Example #27
Source File: ComboBoxView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnTagGetValue")
void onTagGetValue(ClickEvent e) {
    MaterialToast.fireToast(comboTags.getSingleValue());
}
 
Example #28
Source File: PickersView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetDate")
void onGetDate(ClickEvent e){
    MaterialToast.fireToast("" + dp.getDate());
}
 
Example #29
Source File: PwaGettingStartedView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetServiceWorker")
void getServiceWorker(ClickEvent e) {
    MaterialToast.fireToast("Script URL : " + PwaManager.getInstance().getServiceWorkerManager().getServiceWorker().scriptURL);
    MaterialToast.fireToast("State : " + PwaManager.getInstance().getServiceWorkerManager().getServiceWorker().state);
}
 
Example #30
Source File: ComboBoxView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("btnGetValues2")
void onGetValues2(ClickEvent e) {
    for(State state : comboTimeZone14.getSelectedValues()) {
        MaterialToast.fireToast("Name: " + state.getName() + " Value: " + state.getValue());
    }
}