Search in sources :

Example 11 with Page

use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.

the class GetPageResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("page")) {
        JsonElement jsonPage = jsonObject.get("page");
        if (jsonPage != null) {
            page = new Page();
            page.fromJson(jsonPage.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Page(com.willshex.blogwt.shared.api.datatype.Page)

Example 12 with Page

use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.

the class GetPagesRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("parent")) {
        JsonElement jsonParent = jsonObject.get("parent");
        if (jsonParent != null) {
            parent = new Page();
            parent.fromJson(jsonParent.getAsJsonObject());
        }
    }
    if (jsonObject.has("includePosts")) {
        JsonElement jsonIncludePosts = jsonObject.get("includePosts");
        if (jsonIncludePosts != null) {
            includePosts = Boolean.valueOf(jsonIncludePosts.getAsBoolean());
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
    if (jsonObject.has("query")) {
        JsonElement jsonQuery = jsonObject.get("query");
        if (jsonQuery != null) {
            query = jsonQuery.getAsString();
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) Page(com.willshex.blogwt.shared.api.datatype.Page)

Example 13 with Page

use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.

the class GetPagesResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("pages")) {
        JsonElement jsonPages = jsonObject.get("pages");
        if (jsonPages != null) {
            pages = new ArrayList<Page>();
            Page item = null;
            for (int i = 0; i < jsonPages.getAsJsonArray().size(); i++) {
                if (jsonPages.getAsJsonArray().get(i) != null) {
                    (item = new Page()).fromJson(jsonPages.getAsJsonArray().get(i).getAsJsonObject());
                    pages.add(item);
                }
            }
        }
    }
    if (jsonObject.has("pager")) {
        JsonElement jsonPager = jsonObject.get("pager");
        if (jsonPager != null) {
            pager = new Pager();
            pager.fromJson(jsonPager.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager) Page(com.willshex.blogwt.shared.api.datatype.Page)

Example 14 with Page

use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.

the class UpdatePageRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("page")) {
        JsonElement jsonPage = jsonObject.get("page");
        if (jsonPage != null) {
            page = new Page();
            page.fromJson(jsonPage.getAsJsonObject());
        }
    }
}
Also used : JsonElement(com.google.gson.JsonElement) Page(com.willshex.blogwt.shared.api.datatype.Page)

Example 15 with Page

use of com.willshex.blogwt.shared.api.datatype.Page in project blogwt by billy1380.

the class SearchAllResponse method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    if (jsonObject.has("posts")) {
        JsonElement jsonPosts = jsonObject.get("posts");
        if (jsonPosts != null) {
            posts = new ArrayList<Post>();
            Post item = null;
            for (int i = 0; i < jsonPosts.getAsJsonArray().size(); i++) {
                if (jsonPosts.getAsJsonArray().get(i) != null) {
                    (item = new Post()).fromJson(jsonPosts.getAsJsonArray().get(i).getAsJsonObject());
                    posts.add(item);
                }
            }
        }
    }
    if (jsonObject.has("pages")) {
        JsonElement jsonPages = jsonObject.get("pages");
        if (jsonPages != null) {
            pages = new ArrayList<Page>();
            Page item = null;
            for (int i = 0; i < jsonPages.getAsJsonArray().size(); i++) {
                if (jsonPages.getAsJsonArray().get(i) != null) {
                    (item = new Page()).fromJson(jsonPages.getAsJsonArray().get(i).getAsJsonObject());
                    pages.add(item);
                }
            }
        }
    }
    if (jsonObject.has("users")) {
        JsonElement jsonUsers = jsonObject.get("users");
        if (jsonUsers != null) {
            users = new ArrayList<User>();
            User item = null;
            for (int i = 0; i < jsonUsers.getAsJsonArray().size(); i++) {
                if (jsonUsers.getAsJsonArray().get(i) != null) {
                    (item = new User()).fromJson(jsonUsers.getAsJsonArray().get(i).getAsJsonObject());
                    users.add(item);
                }
            }
        }
    }
}
Also used : User(com.willshex.blogwt.shared.api.datatype.User) JsonElement(com.google.gson.JsonElement) Post(com.willshex.blogwt.shared.api.datatype.Post) Page(com.willshex.blogwt.shared.api.datatype.Page)

Aggregations

Page (com.willshex.blogwt.shared.api.datatype.Page)28 JsonElement (com.google.gson.JsonElement)10 Post (com.willshex.blogwt.shared.api.datatype.Post)9 ArrayList (java.util.ArrayList)6 User (com.willshex.blogwt.shared.api.datatype.User)4 HashMap (java.util.HashMap)4 Pager (com.willshex.blogwt.shared.api.Pager)3 GetPageRequest (com.willshex.blogwt.shared.api.page.call.GetPageRequest)3 GWT (com.google.gwt.core.client.GWT)2 Element (com.google.gwt.dom.client.Element)2 Key (com.googlecode.objectify.Key)2 DefaultEventBus (com.willshex.blogwt.client.DefaultEventBus)2 GetPageEventHandler (com.willshex.blogwt.client.api.page.event.GetPageEventHandler)2 NavigationController (com.willshex.blogwt.client.controller.NavigationController)2 PageController (com.willshex.blogwt.client.controller.PageController)2 NavigationChangedEventHandler (com.willshex.blogwt.client.event.NavigationChangedEventHandler)2 PageTypeHelper (com.willshex.blogwt.client.helper.PageTypeHelper)2 WizardDialogPage (com.willshex.blogwt.client.page.wizard.WizardDialogPage)2 WizardPage (com.willshex.blogwt.client.wizard.WizardPage)2 InputValidationException (com.willshex.gson.web.service.server.InputValidationException)2