Example usage for com.google.gwt.gen2.complexpanel.client FastTree injectDefaultCss

List of usage examples for com.google.gwt.gen2.complexpanel.client FastTree injectDefaultCss

Introduction

In this page you can find the example usage for com.google.gwt.gen2.complexpanel.client FastTree injectDefaultCss.

Prototype

public static void injectDefaultCss() 

Source Link

Document

Injects the default styles as a css resource.

Usage

From source file:com.google.gwt.gen2.demo.collapsiblepanel.client.CollapsiblePanelDemo.java

License:Apache License

/**
 * This is the entry point method.//w  w  w.j ava  2 s.c  o m
 */
public void onModuleLoad() {
    try {

        // Some random contents to make the tree interesting.
        Panel contents = createSchoolNavBar();
        FastTree.injectDefaultCss();
        CollapsiblePanel.injectDefaultCss();

        // The panel.
        final CollapsiblePanel panel = new CollapsiblePanel();
        panel.addCollapsedStateHandler(new CollapsedStateHandler() {
            public void onCollapsedState(CollapsedStateEvent e) {
                Window.alert("panel collapsed");
            }
        });

        panel.addExpandedStateHandler(new ExpandedStateHandler() {
            public void onExpandedState(ExpandedStateEvent e) {
                Window.alert("panel expanded");
            }
        });

        String value = Location.getParameter("collapsed");
        if (value != null) {
            value = value.trim();
            if (value.equals("true")) {
                panel.setCollapsedState(true);
            } else if (value.equals("false")) {
                // do nothing, default.
            } else {
                Window.alert("collapsed should not be given " + value + " use true or false instead");
            }
        }
        RootPanel.get("collapsible-panel").add(panel);
        panel.add(contents);
        panel.setHeight(Window.getClientHeight() - 1 + "px");
        panel.hookupControlToggle(controlButton);
    } catch (RuntimeException e) {
        if (GWT.isScript()) {
            Log.severe(e.getMessage());
        }
        throw e;
    }
}

From source file:com.google.gwt.gen2.demo.fasttree.client.FastTreeDemo.java

License:Apache License

public StackPanel createDemo() {

    // inject default styles
    FastTree.injectDefaultCss();

    StackPanel p = new StackPanel();

    if (LocaleInfo.getCurrentLocale().isRTL()) {
        p.add(hebrewTree(), " ");
    }/*w ww.j av  a  2 s .  c om*/
    p.add(basicTree(), "Basic tree");
    p.add(lazyTree(), "Lazy tree");
    p.add(verboseTree(), "Verbose tree");
    p.add(crazyTree(), "Crazy tree");
    p.add(dynamicTree(), "Dynamic tree");
    p.add(cancelEventTree(), "Cancel event tree");

    return p;
}