From 8dd5e30c8739fb428a066f164559324ebf58ca72 Mon Sep 17 00:00:00 2001 From: jensp Date: Mon, 18 Apr 2016 16:58:02 +0000 Subject: [PATCH] CCM NG: Moved UserDetails to separate class git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4016 8810af33-2d31-482b-a856-94f89814c4df --- .../usersgroupsroles/users/UserAdmin.java | 20 +------ .../usersgroupsroles/users/UserDetails.java | 57 +++++++++++++++++++ 2 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserDetails.java diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserAdmin.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserAdmin.java index 63fcc3ddc..d14746f61 100644 --- a/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserAdmin.java +++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserAdmin.java @@ -92,13 +92,10 @@ public class UserAdmin extends BoxPanel { private final TextField usersTableFilter; private final BoxPanel usersTablePanel; private final UsersTable usersTable; - private final ActionLink backToUsersTable; - private final PropertySheet userProperties; private final Form userEditForm; private final Form passwordSetForm; private final BoxPanel actionLinks; -// private final UserDetails userDetails; - private final BoxPanel userDetails; + private final UserDetails userDetails; private final Form emailForm; private final Form editGroupMembershipsForm; private final Form editRoleMembershipsForm; @@ -148,20 +145,7 @@ public class UserAdmin extends BoxPanel { add(usersTablePanel); - userDetails = new BoxPanel(); - userDetails.setIdAttr("userDetails"); - - backToUsersTable = new ActionLink(new GlobalizedMessage( - "ui.admin.user_details.back", ADMIN_BUNDLE)); - backToUsersTable.setIdAttr("userDetailsBackLink"); - backToUsersTable.addActionListener( - e -> closeUserDetails(e.getPageState())); - userDetails.add(backToUsersTable); - - userProperties = new PropertySheet(new UserPropertySheetModelBuilder( - selectedUserId)); - userProperties.setIdAttr("userProperties"); - userDetails.add(userProperties); + userDetails = new UserDetails(this, selectedUserId); userEditForm = new Form("userEditForm"); final TextField username = new TextField("username"); diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserDetails.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserDetails.java new file mode 100644 index 000000000..a09504c35 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/usersgroupsroles/users/UserDetails.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2016 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package com.arsdigita.ui.admin.usersgroupsroles.users; + +import com.arsdigita.bebop.ActionLink; +import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.ParameterSingleSelectionModel; +import com.arsdigita.bebop.PropertySheet; +import com.arsdigita.globalization.GlobalizedMessage; + +import static com.arsdigita.ui.admin.AdminUiConstants.*; + +/** + * + * @author Jens Pelzetter + */ +public class UserDetails extends BoxPanel { + + public UserDetails( + final UserAdmin userAdmin, + final ParameterSingleSelectionModel selectedUserId) { + + super(BoxPanel.VERTICAL); + + setIdAttr("userDetails"); + + final ActionLink backToUsersTable = new ActionLink( + new GlobalizedMessage("ui.admin.user_details.back", ADMIN_BUNDLE)); + backToUsersTable.setIdAttr("userDetailsBackLink"); + backToUsersTable.addActionListener(e -> { + userAdmin.closeUserDetails(e.getPageState()); + }); + add(backToUsersTable); + + final PropertySheet userProperties = new PropertySheet( + new UserPropertySheetModelBuilder(selectedUserId)); + userProperties.setIdAttr("userProperties"); + add(userProperties); + } + +}