Example usage for com.google.gwt.ajaxloader.client AjaxLoader init

List of usage examples for com.google.gwt.ajaxloader.client AjaxLoader init

Introduction

In this page you can find the example usage for com.google.gwt.ajaxloader.client AjaxLoader init.

Prototype

public static void init() 

Source Link

Document

Initialize the API without specifying a key.

Usage

From source file:com.google.livingstories.client.contentmanager.ContentManager.java

License:Apache License

public void onModuleLoad() {
    // Inject the contents of the living story page CSS file
    Resources.INSTANCE.css().ensureInjected();

    AjaxLoader.init();

    tabs = new TabPanel();
    tabs.setWidth("100%");

    tabs.add(contentItemManager, "Manage Content");
    tabs.add(livingStoryManager, "Manage Living Stories");
    tabs.add(themeManager, "Manage Themes");
    tabs.add(importManager, "Import/Export Data");

    tabs.selectTab(0);/*w ww. jav  a2 s .  c om*/
    selectedIndex = 0;

    tabs.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            // TODO: this work is extra if the user didn't actually change
            // anything on the source tab.
            ManagerPane previousTab = (ManagerPane) tabs.getWidget(selectedIndex);
            boolean livingStoriesEdited = (previousTab == livingStoryManager);
            boolean contentItemsEdited = (previousTab == contentItemManager);
            for (int i = 0; i < tabs.getWidgetCount(); i++) {
                ManagerPane pane = (ManagerPane) tabs.getWidget(i);
                if (pane != previousTab) {
                    if (livingStoriesEdited) {
                        pane.onLivingStoriesChanged();
                    }
                    if (contentItemsEdited) {
                        pane.onContentItemsChanged();
                    }

                    pane.onShow();
                }
            }
            selectedIndex = event.getItem();
        }
    });

    RootPanel.get().add(tabs);
}

From source file:com.google.livingstories.client.lsp.LivingStory.java

License:Apache License

@Override
public void onModuleLoad() {
    // Inject the contents of the CSS file
    Resources.INSTANCE.css().ensureInjected();

    AjaxLoader.init();

    String cookieName = Constants.getCookieName(LivingStoryData.getLivingStoryUrl());
    String cookieValue = Cookies.getCookie(cookieName);

    if (cookieValue != null) {
        try {/*  w  w  w  .  ja va 2  s. c o m*/
            LivingStoryData.setCookieBasedLastVisitDate(new Date(Long.valueOf(cookieValue)));
        } catch (NumberFormatException e) {
        }
    }

    // note the visit.
    Date now = new Date();
    Date cookieExpiry = new Date(now.getTime() + SIXTY_DAYS_IN_MILLISECONDS);
    Cookies.setCookie(cookieName, String.valueOf(now.getTime()), cookieExpiry);

    RootPanel.get("storyBody").add(new LivingStoryPage());

    HistoryManager.initialize();

    // Also set appropriate i18n text for a couple of constants:
    Document doc = Document.get();
    doc.getElementById("rssLink").setAttribute("title",
            LspMessageHolder.msgs.rssFeedTitle(LivingStoryData.getLivingStoryTitle()));
    doc.getElementById("readOtherStories").setInnerText(LspMessageHolder.consts.otherStories());
}

From source file:com.google.livingstories.plugins.wordpress.livingstorypropertymanager.client.Plugin.java

License:Apache License

public void onModuleLoad() {
    Resources.INSTANCE.css().ensureInjected();
    AjaxLoader.init();

    RootPanel.get("contentManagerBox").add(new LivingStoryPropertyManager());
}