Package org.gwtoolbox.sample.widget.client.misc

Source Code of org.gwtoolbox.sample.widget.client.misc.GGrowlSamplePane

package org.gwtoolbox.sample.widget.client.misc;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import org.gwtoolbox.commons.ui.client.ggrowl.GGrowl;
import org.gwtoolbox.ioc.core.client.annotation.Component;
import org.gwtoolbox.sample.widget.client.SamplePanel;
import org.gwtoolbox.widget.client.WidgetImages;
import org.gwtoolbox.widget.client.button.SimpleButton;

/**
* @author Uri Boness
*/
@Component
@MiscSample
public class GGrowlSamplePane extends Composite implements SamplePanel {

    public GGrowlSamplePane() {
        HorizontalPanel buttons = new HorizontalPanel();
        buttons.setSpacing(4);

        SimpleButton button = new SimpleButton("Show Message", WidgetImages.Instance.get().notification_Message().createImage());
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                GGrowl.showMessage("Short Message", "This is the content of the message", 3500);
            }
        });
        buttons.add(button);

        button = new SimpleButton("Show Long Message", WidgetImages.Instance.get().notification_Message().createImage());
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                GGrowl.showMessage("Long Message", "This is the content of a very very very very very long message, so " + "long it seems it has no end, but it does... it's coming soon... very soon... wait... wait... " + "here it comes... no.. just kiding it's not coming... yes it is... now!", 8000);
            }
        });
        buttons.add(button);

        button = new SimpleButton("Show Sticky Message", WidgetImages.Instance.get().notification_Message().createImage());
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                GGrowl.showMessage("Short Message", "This is the content of the message, it's not a long as the logest " +
                        "message, but still it has its length", -1);
            }
        });
        buttons.add(button);
       
        SimplePanel main = new SimplePanel();
        main.setWidget(buttons);

        initWidget(main);
    }

    public String getName() {
        return "GGrowl";
    }

    public Widget getContentWidget() {
        return this;
    }

    public void reset() {
    }
}
TOP

Related Classes of org.gwtoolbox.sample.widget.client.misc.GGrowlSamplePane

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.