Search in sources :

Example 26 with User

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

the class ChangeUserAccessResponse method fromJson.

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

Example 27 with User

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

the class ChangeUserDetailsRequest method fromJson.

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

Example 28 with User

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

the class GetUsersRequest method fromJson.

@Override
public void fromJson(JsonObject jsonObject) {
    super.fromJson(jsonObject);
    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();
        }
    }
    if (jsonObject.has("user")) {
        JsonElement jsonUser = jsonObject.get("user");
        if (jsonUser != null) {
            user = new User();
            user.fromJson(jsonUser.getAsJsonObject());
        }
    }
    if (jsonObject.has("relationshipType")) {
        JsonElement jsonRelationshipType = jsonObject.get("relationshipType");
        if (jsonRelationshipType != null) {
            relationshipType = RelationshipTypeType.fromString(jsonRelationshipType.getAsString());
        }
    }
    if (jsonObject.has("userIsOther")) {
        JsonElement jsonUserIsOther = jsonObject.get("userIsOther");
        if (jsonUserIsOther != null) {
            userIsOther = Boolean.valueOf(jsonUserIsOther.getAsBoolean());
        }
    }
}
Also used : User(com.willshex.blogwt.shared.api.datatype.User) JsonElement(com.google.gson.JsonElement) Pager(com.willshex.blogwt.shared.api.Pager)

Example 29 with User

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

the class RegisterUserResponse method fromJson.

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

Example 30 with User

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

the class ChangeDetailsPage method onAttach.

/* (non-Javadoc)
	 * 
	 * @see com.google.gwt.user.client.ui.Composite#onAttach() */
@Override
protected void onAttach() {
    super.onAttach();
    AccountTabsPart.get().removeFromParent();
    register(DefaultEventBus.get().addHandlerToSource(NavigationChangedEventHandler.TYPE, NavigationController.get(), (p, c) -> {
        reset();
        boolean addTabs = true;
        if (PageType.ChangeDetailsPageType.equals(c.getPage())) {
            if (c.getAction() == null) {
                show(user = SessionController.get().user());
                lnkChangePassword.setTargetHistoryToken(PageType.ChangePasswordPageType.asTargetHistoryToken());
                AccountTabsPart.get().setUser(null);
                lnkChangePassword.setVisible(true);
                pnlPassword.setVisible(false);
            } else if ("id".equals(c.getAction()) && c.getParameterCount() > 0) {
                Long id = Long.valueOf(c.getParameter(0));
                User user = new User();
                user.id(id);
                AccountTabsPart.get().setUser(user);
                UserController.get().getUser(user);
                lnkChangePassword.setVisible(false);
                pnlPassword.setVisible(false);
            } else if ("new".equals(c.getAction())) {
                elDates.setInnerText("Enter user details");
                lnkChangePassword.setVisible(false);
                pnlPassword.setVisible(true);
                if (SessionController.get().isAdmin()) {
                    actionText = CREATE_ACTION_TEXT;
                }
                addTabs = false;
            }
        } else if (PageType.RegisterPageType.equals(c.getPage())) {
            elDates.setInnerText("Enter user details");
            lnkChangePassword.setVisible(false);
            pnlPassword.setVisible(true);
            actionText = REGISTER_ACTION_TEXT;
            addTabs = false;
        }
        elHeading.setInnerText(getHeadingText());
        elGravatar.setInnerSafeHtml(getGravatarSafeHtml());
        if (addTabs) {
            pnlTabs.add(AccountTabsPart.get());
            AccountTabsPart.get().navigationChanged(p, c);
        } else {
            AccountTabsPart.get().removeFromParent();
        }
        ready();
        refreshTitle();
    }));
    register(DefaultEventBus.get().addHandlerToSource(GetUserDetailsEventHandler.TYPE, UserController.get(), this));
    register(DefaultEventBus.get().addHandlerToSource(ChangeUserDetailsEventHandler.TYPE, UserController.get(), this));
    register(DefaultEventBus.get().addHandlerToSource(GetEmailAvatarEventHandler.TYPE, UserController.get(), this));
    register(DefaultEventBus.get().addHandlerToSource(RegisterUserEventHandler.TYPE, UserController.get(), this));
}
Also used : ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) GetEmailAvatarEventHandler(com.willshex.blogwt.client.api.user.event.GetEmailAvatarEventHandler) DateTimeHelper(com.willshex.blogwt.shared.helper.DateTimeHelper) User(com.willshex.blogwt.shared.api.datatype.User) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Image(com.google.gwt.user.client.ui.Image) AccountTabsPart(com.willshex.blogwt.client.part.accounttabs.AccountTabsPart) UiHandler(com.google.gwt.uibinder.client.UiHandler) TextBox(com.google.gwt.user.client.ui.TextBox) NavigationChangedEventHandler(com.willshex.blogwt.client.event.NavigationChangedEventHandler) Resources(com.willshex.blogwt.client.Resources) GetUserDetailsRequest(com.willshex.blogwt.shared.api.user.call.GetUserDetailsRequest) GWT(com.google.gwt.core.client.GWT) GetEmailAvatarRequest(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarRequest) PageType(com.willshex.blogwt.shared.page.PageType) UiBinder(com.google.gwt.uibinder.client.UiBinder) SessionController(com.willshex.blogwt.client.controller.SessionController) SafeHtmlTemplates(com.google.gwt.safehtml.client.SafeHtmlTemplates) StatusType(com.willshex.gson.web.service.shared.StatusType) GetUserDetailsResponse(com.willshex.blogwt.shared.api.user.call.GetUserDetailsResponse) RegisterUserResponse(com.willshex.blogwt.shared.api.user.call.RegisterUserResponse) HeadingElement(com.google.gwt.dom.client.HeadingElement) UserController(com.willshex.blogwt.client.controller.UserController) GetEmailAvatarResponse(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarResponse) PasswordTextBox(com.google.gwt.user.client.ui.PasswordTextBox) RegisterUserRequest(com.willshex.blogwt.shared.api.user.call.RegisterUserRequest) TextArea(com.google.gwt.user.client.ui.TextArea) Page(com.willshex.blogwt.client.page.Page) ChangeUserDetailsRequest(com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsRequest) Button(com.google.gwt.user.client.ui.Button) UiHelper(com.willshex.blogwt.client.helper.UiHelper) HTMLPanel(com.google.gwt.user.client.ui.HTMLPanel) WizardDialog(com.willshex.blogwt.client.wizard.WizardDialog) ChangeUserDetailsResponse(com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsResponse) UserHelper(com.willshex.blogwt.shared.helper.UserHelper) GetUserDetailsEventHandler(com.willshex.blogwt.client.api.user.event.GetUserDetailsEventHandler) Widget(com.google.gwt.user.client.ui.Widget) ChangeUserDetailsEventHandler(com.willshex.blogwt.client.api.user.event.ChangeUserDetailsEventHandler) RegisterUserEventHandler(com.willshex.blogwt.client.api.user.event.RegisterUserEventHandler) Hyperlink(com.google.gwt.user.client.ui.Hyperlink) UiField(com.google.gwt.uibinder.client.UiField) NavigationController(com.willshex.blogwt.client.controller.NavigationController) Element(com.google.gwt.dom.client.Element) DefaultEventBus(com.willshex.blogwt.client.DefaultEventBus) FormPanel(com.google.gwt.user.client.ui.FormPanel) PageTypeHelper(com.willshex.blogwt.client.helper.PageTypeHelper) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) User(com.willshex.blogwt.shared.api.datatype.User)

Aggregations

User (com.willshex.blogwt.shared.api.datatype.User)46 JsonElement (com.google.gson.JsonElement)19 InputValidationException (com.willshex.gson.web.service.server.InputValidationException)10 Pager (com.willshex.blogwt.shared.api.Pager)6 Permission (com.willshex.blogwt.shared.api.datatype.Permission)5 Page (com.willshex.blogwt.shared.api.datatype.Page)4 Post (com.willshex.blogwt.shared.api.datatype.Post)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Key (com.googlecode.objectify.Key)3 Role (com.willshex.blogwt.shared.api.datatype.Role)3 Date (java.util.Date)3 HeadingElement (com.google.gwt.dom.client.HeadingElement)2 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)2 MetaNotification (com.willshex.blogwt.shared.api.datatype.MetaNotification)2 Relationship (com.willshex.blogwt.shared.api.datatype.Relationship)2 BlobKey (com.google.appengine.api.blobstore.BlobKey)1 ScoredDocument (com.google.appengine.api.search.ScoredDocument)1 JsonObject (com.google.gson.JsonObject)1