diff --git a/ccm-bookmarks/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager b/ccm-bookmarks/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager new file mode 100644 index 000000000..bcf160496 --- /dev/null +++ b/ccm-bookmarks/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager @@ -0,0 +1 @@ +com.arsdigita.bookmarks.BookmarksAppManager \ No newline at end of file diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksAppManager.java b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksAppManager.java new file mode 100644 index 000000000..0a317c17b --- /dev/null +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksAppManager.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2013 Jens Pelzetter + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.bookmarks; + +import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bookmarks.util.GlobalizationUtil; +import com.arsdigita.ui.admin.applications.AbstractApplicationManager; +import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class BookmarksAppManager extends AbstractApplicationManager { + + public Class getApplication() { + return Bookmarks.class; + } + + public ApplicationInstanceAwareContainer getApplicationAdminForm() { + return new ApplicationAdminForm(); + } + + private class ApplicationAdminForm extends ApplicationInstanceAwareContainer { + + public ApplicationAdminForm() { + super(); + + final BoxPanel panel = new BoxPanel(); + panel.add(new Label(GlobalizationUtil.globalize("bookmarks.ui.not_yet_included_into_app_tab"))); + final Link link = new Link(new PrintListener() { + public void prepare(final PrintEvent event) { + final Link link = (Link) event.getTarget(); + + final String path = String.format("%s/admin", getAppInstance().getPath()); + final String label = String.format("/ccm%s", path); + + link.setTarget(path); + link.setChild(new Label(label)); + } + + }); + panel.add(link); + + add(panel); + } + + } +} diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources.properties b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources.properties index e6de89d64..aa1cbb19c 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources.properties +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources.properties @@ -15,3 +15,4 @@ bookmarks.ui.modification_date=Modification Date bookmarks.ui.creator=Creator bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark? bookmarks.ui.bookmark_in_new_window=Open in a new window +bookmarks.ui.not_yet_included_into_app_tab=The bookmarks application is not included yet into the applications tab. Use the link below diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_de.properties b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_de.properties index 76b3dc0c6..5af932a87 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_de.properties +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_de.properties @@ -15,3 +15,4 @@ bookmarks.ui.modification_date=\u00c4nderungsdatum bookmarks.ui.creator=Ersteller bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Soll dieses Lesezeichen tats\u00e4chlich gel\u00f6scht werden? bookmarks.ui.bookmark_in_new_window=In einen neuen Fenster \u00f6ffnen +bookmarks.ui.not_yet_included_into_app_tab=Die Bookmarks-Anwendung ist noch nicht in den Applications-Tab integriert. Nutzen Sie statt dessen den folgenden Link: diff --git a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_en.properties b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_en.properties index e6de89d64..39308dee5 100755 --- a/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_en.properties +++ b/ccm-bookmarks/src/com/arsdigita/bookmarks/BookmarksResources_en.properties @@ -15,3 +15,4 @@ bookmarks.ui.modification_date=Modification Date bookmarks.ui.creator=Creator bookmarks.ui.are_you_sure_you_want_to_delete_this_bookmark=Are you sure you want to delete this Bookmark? bookmarks.ui.bookmark_in_new_window=Open in a new window +bookmarks.ui.not_yet_included_into_app_tab= diff --git a/ccm-core/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager b/ccm-core/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager index 89a8dc2e7..0b4bfa3f1 100644 --- a/ccm-core/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager +++ b/ccm-core/src/META-INF/services/com.arsdigita.ui.admin.applications.ApplicationManager @@ -1,2 +1,3 @@ com.arsdigita.ui.admin.AdminAppManager -com.arsdigita.ui.login.LoginAppManager \ No newline at end of file +com.arsdigita.ui.login.LoginAppManager +com.arsdigita.ui.permissions.PermissionsAppManager \ No newline at end of file diff --git a/ccm-core/src/com/arsdigita/ui/admin/AdminConstants.java b/ccm-core/src/com/arsdigita/ui/admin/AdminConstants.java index 39b4edf5d..b45f653ee 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/AdminConstants.java +++ b/ccm-core/src/com/arsdigita/ui/admin/AdminConstants.java @@ -74,8 +74,8 @@ interface AdminConstants { BUNDLE_NAME); /** Tabbed pane indices */ - int USER_TAB_INDEX = 0; - int GROUP_TAB_INDEX = 1; + int USER_TAB_INDEX = 2; + int GROUP_TAB_INDEX = 3; /** * User tab name diff --git a/ccm-core/src/com/arsdigita/ui/admin/AdminServlet.java b/ccm-core/src/com/arsdigita/ui/admin/AdminServlet.java index 1539fe71c..abeacdfcd 100644 --- a/ccm-core/src/com/arsdigita/ui/admin/AdminServlet.java +++ b/ccm-core/src/com/arsdigita/ui/admin/AdminServlet.java @@ -157,15 +157,15 @@ public class AdminServlet extends BaseApplicationServlet implements AdminConstan * Create User split panel. * Note: Will change soon. */ - final AdminSplitPanel userSplitPanel = new AdminSplitPanel(USER_NAVBAR_TITLE); + //final AdminSplitPanel userSplitPanel = new AdminSplitPanel(USER_NAVBAR_TITLE); - final UserBrowsePane browsePane = new UserBrowsePane(); - userSplitPanel.addTab(USER_TAB_SUMMARY, new UserSummaryPane(userSplitPanel, browsePane)); - userSplitPanel.addTab(USER_TAB_BROWSE, browsePane); - userSplitPanel.addTab(USER_TAB_SEARCH, new UserSearchPane(userSplitPanel, browsePane)); - userSplitPanel.addTab(USER_TAB_CREATE_USER, new CreateUserPane(userSplitPanel)); +// final UserBrowsePane browsePane = new UserBrowsePane(); +// userSplitPanel.addTab(USER_TAB_SUMMARY, new UserSummaryPane(userSplitPanel, browsePane)); +// userSplitPanel.addTab(USER_TAB_BROWSE, browsePane); +// userSplitPanel.addTab(USER_TAB_SEARCH, new UserSearchPane(userSplitPanel, browsePane)); +// userSplitPanel.addTab(USER_TAB_CREATE_USER, new CreateUserPane(userSplitPanel)); - // Create the Admin's page tab bar, currently 2 elements: user & groups + // Create the Admin's page tab bar final TabbedPane tabbedPane = new TabbedPane(); tabbedPane.setIdAttr("page-body"); @@ -178,17 +178,15 @@ public class AdminServlet extends BaseApplicationServlet implements AdminConstan */ tabbedPane.addTab(APPLICATIONS_TAB_TITLE, new ApplicationsAdministrationTab()); /* - * Add user panel. - */ - tabbedPane.addTab(USER_TAB_TITLE, userSplitPanel); - /* - * Create and add group administration panel + * Create and add the user and group tabs. */ + //tabbedPane.addTab(USER_TAB_TITLE, userSplitPanel); final GroupAdministrationTab groupAdminTab = new GroupAdministrationTab(); + tabbedPane.addTab(USER_TAB_TITLE, new UserAdministrationTab(tabbedPane, groupAdminTab)); tabbedPane.addTab(GROUP_TAB_TITLE, groupAdminTab); - browsePane.setTabbedPane(tabbedPane); - browsePane.setGroupAdministrationTab(groupAdminTab); +// browsePane.setTabbedPane(tabbedPane); +// browsePane.setGroupAdministrationTab(groupAdminTab); page.add(tabbedPane); page.lock(); diff --git a/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java b/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java index 5df532ba8..2cae04c9f 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java +++ b/ccm-core/src/com/arsdigita/ui/admin/AdminSplitPanel.java @@ -40,6 +40,8 @@ import java.util.ArrayList; * * @author David Dao * @version $Id: AdminSplitPanel.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated Was only used for the User Administration Tab in {@link AdminServlet} which is now implmented as its own + * class. Will be removed soon. */ class AdminSplitPanel extends BoxPanel implements ChangeListener { diff --git a/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java b/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java index 02a382bde..3f3f0fb0d 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java +++ b/ccm-core/src/com/arsdigita/ui/admin/CreateUserPane.java @@ -25,6 +25,7 @@ import com.arsdigita.bebop.SegmentedPanel; /** * * @author David Dao + * @deprecated Replaced by {@link UserCreateSection}. Will be removed soon. */ class CreateUserPane extends SegmentedPanel implements AdminConstants, diff --git a/ccm-core/src/com/arsdigita/ui/admin/GroupAdministrationTab.java b/ccm-core/src/com/arsdigita/ui/admin/GroupAdministrationTab.java index 9087a75bb..89c239d76 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/GroupAdministrationTab.java +++ b/ccm-core/src/com/arsdigita/ui/admin/GroupAdministrationTab.java @@ -18,8 +18,6 @@ */ package com.arsdigita.ui.admin; -import com.arsdigita.ui.util.GlobalizationUtil; - import com.arsdigita.bebop.ActionLink; import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.Component; @@ -45,6 +43,7 @@ import com.arsdigita.kernel.Group; import com.arsdigita.kernel.GroupCollection; import com.arsdigita.kernel.User; import com.arsdigita.persistence.PersistenceException; +import com.arsdigita.toolbox.ui.LayoutPanel; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import java.util.ArrayList; @@ -56,67 +55,65 @@ import org.apache.log4j.Logger; * @author David Dao * */ -class GroupAdministrationTab extends BoxPanel - implements AdminConstants, - ChangeListener { +class GroupAdministrationTab extends BoxPanel implements AdminConstants, ChangeListener { - private static final Logger s_log = Logger.getLogger(GroupAdministrationTab.class); - private Tree m_tree; - private SearchAndList m_subMemberSearch; - private ActionLink m_addSubmemberLink; - private Component m_groupInfoPanel; - private Component m_subGroupPanel; - private Component m_subMemberPanel; - private Component m_extremeActionPanel; - private Component m_groupAddPanel; - private Component m_groupEditPanel; - private Component m_groupDeleteFailedPanel; - private Component m_existingGroupAddPanel; + private static final Logger LOGGER = Logger.getLogger(GroupAdministrationTab.class); + private final Tree groupTree; + private SearchAndList subMemberSearch; + private ActionLink addSubmemberLink; + private final Component groupInfoPanel; + private final Component subGroupPanel; + private final Component subMemberPanel; + private final Component extremeActionPanel; + private final Component groupAddPanel; + private final Component groupEditPanel; + private final Component groupDeleteFailedPanel; + private final Component existingGroupAddPanel; private ExistingGroupAddPane m_existingGroupAdd; - private ArrayList m_panelList = new ArrayList(); - private RequestLocal m_group; + private final java.util.List panelList = new ArrayList(); + private final RequestLocal requestLocalGroup; /** * - * @param p + * @param page */ @Override - public void register(Page p) { - for (int i = 0; i < m_panelList.size(); i++) { - p.setVisibleDefault((Component) m_panelList.get(i), false); + public void register(final Page page) { + for (int i = 0; i < panelList.size(); i++) { + page.setVisibleDefault((Component) panelList.get(i), false); } - p.setVisibleDefault(m_groupAddPanel, true); + page.setVisibleDefault(groupAddPanel, true); } /** * - * @param ps + * @param state * @return */ - public Group getGroup(PageState ps) { - return (Group) m_group.get(ps); + public Group getGroup(final PageState state) { + return (Group) requestLocalGroup.get(state); } - public void setGroup(PageState ps, Group group) { - String id = group.getID().toString(); - m_group.set(ps, group); - m_tree.setSelectedKey(ps, id); + public void setGroup(final PageState state, final Group group) { + final String groupId = group.getID().toString(); + requestLocalGroup.set(state, group); + groupTree.setSelectedKey(state, groupId); - if (!id.equals("-1")) { - expandGroups(ps, group); - m_tree.expand("-1", ps); + if (!"-1".equals(groupId)) { + expandGroups(state, group); + groupTree.expand("-1", state); } } - private void expandGroups(PageState ps, Group group) { - m_tree.expand(group.getID().toString(), ps); + private void expandGroups(final PageState state, final Group group) { + groupTree.expand(group.getID().toString(), state); - GroupCollection superGroups = group.getSupergroups(); - Group superGroup = null; + final GroupCollection superGroups = group.getSupergroups(); + Group superGroup; while (superGroups.next()) { superGroup = (Group) superGroups.getDomainObject(); - expandGroups(ps, superGroup); + expandGroups(state, superGroup); } } @@ -127,104 +124,107 @@ class GroupAdministrationTab extends BoxPanel setClassAttr("sidebarNavPanel"); setAttribute("navbar-title", "Groups"); - m_group = new RequestLocal() { + requestLocalGroup = new RequestLocal() { @Override - protected Object initialValue(PageState ps) { - String key = (String) m_tree.getSelectedKey(ps); - - Group group = null; + protected Object initialValue(final PageState state) { + String key = (String) groupTree.getSelectedKey(state); + Group group; if (key != null) { BigDecimal id = new BigDecimal(key); - try { group = new Group(id); + return group; } catch (DataObjectNotFoundException exc) { // Silently ignore if group does not // exist. - } + return null; + } } - return group; + return null; } }; - BoxPanel c = new BoxPanel(); - c.setClassAttr("navbar"); + //BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL); + final LayoutPanel panel = new LayoutPanel(); + panel.setClassAttr("navbar"); //m_tree = new Tree(new GroupTreeModel()); - m_tree = new Tree(new GroupTreeModelBuilder()); - m_tree.addChangeListener(this); - c.add(m_tree); + groupTree = new Tree(new GroupTreeModelBuilder()); + groupTree.addChangeListener(this); + //panel.add(m_tree); + panel.setLeft(groupTree); - add(c); + add(panel); - SegmentedPanel rightSide = new SegmentedPanel(); + final SegmentedPanel rightSide = new SegmentedPanel(); rightSide.setClassAttr("main"); - m_groupInfoPanel = buildGroupInfoPanel(rightSide); - m_panelList.add(m_groupInfoPanel); + groupInfoPanel = buildGroupInfoPanel(rightSide); + panelList.add(groupInfoPanel); - m_groupEditPanel = buildGroupEditPanel(rightSide); - m_panelList.add(m_groupEditPanel); + groupEditPanel = buildGroupEditPanel(rightSide); + panelList.add(groupEditPanel); - m_subGroupPanel = buildSubGroupPanel(rightSide); - m_panelList.add(m_subGroupPanel); + subGroupPanel = buildSubGroupPanel(rightSide); + panelList.add(subGroupPanel); - m_groupAddPanel = buildGroupAddPanel(rightSide); - m_panelList.add(m_groupAddPanel); + groupAddPanel = buildGroupAddPanel(rightSide); + panelList.add(groupAddPanel); - m_existingGroupAddPanel = buildExistingGroupAddPanel(rightSide); - m_panelList.add(m_existingGroupAddPanel); + existingGroupAddPanel = buildExistingGroupAddPanel(rightSide); + panelList.add(existingGroupAddPanel); - m_subMemberPanel = buildMemberListPanel(rightSide); - m_panelList.add(m_subMemberPanel); + subMemberPanel = buildMemberListPanel(rightSide); + panelList.add(subMemberPanel); - m_extremeActionPanel = buildExtremeActionPanel(rightSide); - m_panelList.add(m_extremeActionPanel); + extremeActionPanel = buildExtremeActionPanel(rightSide); + panelList.add(extremeActionPanel); - m_groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide); - m_panelList.add(m_groupDeleteFailedPanel); + groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide); + panelList.add(groupDeleteFailedPanel); - add(rightSide); + //add(rightSide); + panel.setRight(rightSide); } - public void displayAddGroupPanel(PageState ps) { - hideAll(ps); - m_groupAddPanel.setVisible(ps, true); + public void displayAddGroupPanel(final PageState state) { + hideAll(state); + groupAddPanel.setVisible(state, true); } - private void displayAddExistingGroupPanel(PageState ps) { - hideAll(ps); - m_existingGroupAddPanel.setVisible(ps, true); + private void displayAddExistingGroupPanel(final PageState state) { + hideAll(state); + existingGroupAddPanel.setVisible(state, true); } - public void displayEditPanel(PageState ps) { - hideAll(ps); - m_groupEditPanel.setVisible(ps, true); + public void displayEditPanel(final PageState state) { + hideAll(state); + groupEditPanel.setVisible(state, true); } - public void displayGroupInfoPanel(PageState ps) { - showAll(ps); - m_groupEditPanel.setVisible(ps, false); - m_groupAddPanel.setVisible(ps, false); - m_groupDeleteFailedPanel.setVisible(ps, false); - m_existingGroupAddPanel.setVisible(ps, false); + public void displayGroupInfoPanel(final PageState state) { + showAll(state); + groupEditPanel.setVisible(state, false); + groupAddPanel.setVisible(state, false); + groupDeleteFailedPanel.setVisible(state, false); + existingGroupAddPanel.setVisible(state, false); } - public void displayDeleteFailedPanel(PageState ps) { - hideAll(ps); - m_groupDeleteFailedPanel.setVisible(ps, true); + public void displayDeleteFailedPanel(final PageState state) { + hideAll(state); + groupDeleteFailedPanel.setVisible(state, true); } /** * - * @param e + * @param event */ - public void stateChanged(ChangeEvent e) { + public void stateChanged(final ChangeEvent event) { - PageState ps = e.getPageState(); - String key = (String) m_tree.getSelectedKey(ps); + final PageState ps = event.getPageState(); + final String key = (String) groupTree.getSelectedKey(ps); // added cg - reset existing group add panel to the search screen // when a new group is selected from the tree m_existingGroupAdd.showSearch(ps); @@ -243,8 +243,8 @@ class GroupAdministrationTab extends BoxPanel /** * Build a panel to display group basic information. */ - private Component buildGroupInfoPanel(SegmentedPanel main) { - BoxPanel body = new BoxPanel(); + private Component buildGroupInfoPanel(final SegmentedPanel main) { + final BoxPanel body = new BoxPanel(); body.add(new GroupInfo(this)); ActionLink link = new ActionLink(EDIT_GROUP_LABEL); @@ -266,39 +266,38 @@ class GroupAdministrationTab extends BoxPanel /** * Build group edit form. */ - private Component buildGroupEditPanel(SegmentedPanel main) { - + private Component buildGroupEditPanel(final SegmentedPanel main) { return main.addSegment(GROUP_EDIT_HEADER, new GroupEditForm(this)); } /** * Build panel to display direct subgroup information. */ - private Component buildSubGroupPanel(SegmentedPanel main) { - BoxPanel body = new BoxPanel(); - BoxPanel labelStatus = new BoxPanel(BoxPanel.HORIZONTAL); + private Component buildSubGroupPanel(final SegmentedPanel main) { + final BoxPanel body = new BoxPanel(); + final BoxPanel labelStatus = new BoxPanel(BoxPanel.HORIZONTAL); labelStatus.add(SUBGROUP_COUNT_LABEL); - Label countLabel = new Label(""); + final Label countLabel = new Label(""); countLabel.addPrintListener(new PrintListener() { - public void prepare(PrintEvent e) { - PageState ps = e.getPageState(); + public void prepare(final PrintEvent event) { + final PageState ps = event.getPageState(); - Label t = (Label) e.getTarget(); + final Label target = (Label) event.getTarget(); Group g = getGroup(ps); if (g != null) { - t.setLabel(String.valueOf(g.countSubgroups())); + target.setLabel(String.valueOf(g.countSubgroups())); } } }); - ActionLink status = new ActionLink(countLabel); + final ActionLink status = new ActionLink(countLabel); status.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PageState ps = e.getPageState(); - String key = (String) m_tree.getSelectedKey(ps); - m_tree.expand(key, ps); + public void actionPerformed(final ActionEvent event) { + PageState ps = event.getPageState(); + String key = (String) groupTree.getSelectedKey(ps); + groupTree.expand(key, ps); } }); @@ -308,17 +307,17 @@ class GroupAdministrationTab extends BoxPanel body.add(labelStatus); - List subGroupList = new List(new SubGroupListModelBuilder(this)); + final List subGroupList = new List(new SubGroupListModelBuilder(this)); subGroupList.setCellRenderer(new ListCellRenderer() { - public Component getComponent(List list, - PageState state, - Object value, - String key, - int index, - boolean isSelected) { - BoxPanel b = new BoxPanel(BoxPanel.HORIZONTAL); + public Component getComponent(final List list, + final PageState state, + final Object value, + final String key, + final int index, + final boolean isSelected) { + final BoxPanel b = new BoxPanel(BoxPanel.HORIZONTAL); b.add(new Label(((Group) value).getName())); - ControlLink removeLink = new ControlLink(REMOVE_SUBGROUP_LABEL); + final ControlLink removeLink = new ControlLink(REMOVE_SUBGROUP_LABEL); removeLink.setClassAttr("actionLink"); b.add(removeLink); return b; @@ -327,15 +326,15 @@ class GroupAdministrationTab extends BoxPanel }); subGroupList.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PageState ps = e.getPageState(); - String key = (String) ((List) e.getSource()).getSelectedKey(ps); + public void actionPerformed(final ActionEvent event) { + final PageState ps = event.getPageState(); + final String key = (String) ((List) event.getSource()).getSelectedKey(ps); if (key != null) { - BigDecimal groupID = new BigDecimal(key); + final BigDecimal groupID = new BigDecimal(key); try { - Group group = new Group(groupID); - Group parent = getGroup(ps); + final Group group = new Group(groupID); + final Group parent = getGroup(ps); if (parent != null) { parent.removeSubgroup(group); parent.save(); @@ -348,11 +347,11 @@ class GroupAdministrationTab extends BoxPanel }); body.add(subGroupList); - ActionLink addLink = new ActionLink(ADD_SUBGROUP_LABEL); + final ActionLink addLink = new ActionLink(ADD_SUBGROUP_LABEL); addLink.setClassAttr("actionLink"); addLink.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PageState ps = e.getPageState(); + public void actionPerformed(final ActionEvent event) { + PageState ps = event.getPageState(); displayAddGroupPanel(ps); } @@ -362,12 +361,12 @@ class GroupAdministrationTab extends BoxPanel body.add(addLink); // new actionlink and anonymous ActionListener class added cg - ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL); + final ActionLink addExistingLink = new ActionLink(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL); addExistingLink.setClassAttr("actionLink"); addExistingLink.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - s_log.debug("Add existing group link pressed"); - PageState ps = e.getPageState(); + public void actionPerformed(final ActionEvent event) { + LOGGER.debug("Add existing group link pressed"); + PageState ps = event.getPageState(); displayAddExistingGroupPanel(ps); } @@ -381,52 +380,52 @@ class GroupAdministrationTab extends BoxPanel /** * Build group add form. */ - private Component buildGroupAddPanel(SegmentedPanel main) { + private Component buildGroupAddPanel(final SegmentedPanel main) { - return main.addSegment(ADD_GROUP_LABEL, new GroupAddForm(m_tree, this)); + return main.addSegment(ADD_GROUP_LABEL, new GroupAddForm(groupTree, this)); } - private Component buildExistingGroupAddPanel(SegmentedPanel main) { - m_existingGroupAdd = new ExistingGroupAddPane(m_tree, this); + private Component buildExistingGroupAddPanel(final SegmentedPanel main) { + m_existingGroupAdd = new ExistingGroupAddPane(groupTree, this); return main.addSegment(ADD_EXISTING_GROUP_TO_SUBGROUPS_LABEL, m_existingGroupAdd); } /** * Build group's member panel. */ - private Component buildMemberListPanel(SegmentedPanel main) { + private Component buildMemberListPanel(final SegmentedPanel main) { BoxPanel body = new BoxPanel() { @Override - public void register(Page p) { - p.setVisibleDefault(m_subMemberSearch, false); + public void register(final Page page) { + page.setVisibleDefault(subMemberSearch, false); } }; body.add(new SubMemberPanel(this)); - m_addSubmemberLink = new ActionLink(ADD_SUBMEMBER_LABEL); - m_addSubmemberLink.setClassAttr("actionLink"); - m_addSubmemberLink.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PageState ps = e.getPageState(); - m_addSubmemberLink.setVisible(ps, false); - m_subMemberSearch.setVisible(ps, true); + addSubmemberLink = new ActionLink(ADD_SUBMEMBER_LABEL); + addSubmemberLink.setClassAttr("actionLink"); + addSubmemberLink.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent event) { + PageState ps = event.getPageState(); + addSubmemberLink.setVisible(ps, false); + subMemberSearch.setVisible(ps, true); } }); - m_subMemberSearch = new SearchAndList("searchsubmember"); - m_subMemberSearch.setListModel(new UserSearchAndListModel()); - m_subMemberSearch.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - PageState ps = e.getPageState(); + subMemberSearch = new SearchAndList("searchsubmember"); + subMemberSearch.setListModel(new UserSearchAndListModel()); + subMemberSearch.addChangeListener(new ChangeListener() { + public void stateChanged(final ChangeEvent event) { + PageState ps = event.getPageState(); - String key = (String) m_subMemberSearch.getSelectedKey(ps); + String key = (String) subMemberSearch.getSelectedKey(ps); if (key != null) { - BigDecimal userID = new BigDecimal(key); + final BigDecimal userID = new BigDecimal(key); - Group group = getGroup(ps); + final Group group = getGroup(ps); if (group != null) { try { @@ -441,15 +440,15 @@ class GroupAdministrationTab extends BoxPanel } } } - m_subMemberSearch.reset(ps); - m_subMemberSearch.setVisible(ps, false); - m_addSubmemberLink.setVisible(ps, true); + subMemberSearch.reset(ps); + subMemberSearch.setVisible(ps, false); + addSubmemberLink.setVisible(ps, true); } }); - body.add(m_subMemberSearch); - body.add(m_addSubmemberLink); + body.add(subMemberSearch); + body.add(addSubmemberLink); return main.addSegment(SUBMEMBER_HEADER, body); } @@ -457,24 +456,24 @@ class GroupAdministrationTab extends BoxPanel /** * Build extreme action panel. */ - private Component buildExtremeActionPanel(SegmentedPanel main) { - BoxPanel body = new BoxPanel(); + private Component buildExtremeActionPanel(final SegmentedPanel main) { + final BoxPanel body = new BoxPanel(); - ActionLink deleteLink = new ActionLink(DELETE_GROUP_LABEL); + final ActionLink deleteLink = new ActionLink(DELETE_GROUP_LABEL); deleteLink.setClassAttr("actionLink"); deleteLink.setConfirmation(GROUP_DELETE_CONFIRMATION); deleteLink.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent event) { - PageState ps = e.getPageState(); + PageState ps = event.getPageState(); - Group g = (Group) m_group.get(ps); - if (g != null) { + final Group group = (Group) requestLocalGroup.get(ps); + if (group != null) { try { - g.delete(); - m_tree.setSelectedKey(ps, "-1"); + group.delete(); + groupTree.setSelectedKey(ps, "-1"); } catch (PersistenceException exc) { - s_log.warn("Error deleting subgroup", exc); + LOGGER.warn("Error deleting subgroup", exc); displayDeleteFailedPanel(ps); } } @@ -493,34 +492,34 @@ class GroupAdministrationTab extends BoxPanel * Build a panel to display an error message when unable to delete * group. */ - private Component buildGroupDeleteFailedPanel(SegmentedPanel main) { - ActionLink link = new ActionLink(GROUP_ACTION_CONTINUE); + private Component buildGroupDeleteFailedPanel(final SegmentedPanel main) { + final ActionLink link = new ActionLink(GROUP_ACTION_CONTINUE); link.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - PageState ps = e.getPageState(); + public void actionPerformed(final ActionEvent event) { + PageState ps = event.getPageState(); displayGroupInfoPanel(ps); } }); link.setClassAttr("actionLink"); - Label label = new Label(GROUP_DELETE_FAILED_MSG); + final Label label = new Label(GROUP_DELETE_FAILED_MSG); label.setClassAttr("deleteFailedMessage"); - BoxPanel p = new BoxPanel(); - p.add(label); - p.add(link); + final BoxPanel panel = new BoxPanel(); + panel.add(label); + panel.add(link); - return main.addSegment(GROUP_DELETE_FAILED_HEADER, p); + return main.addSegment(GROUP_DELETE_FAILED_HEADER, panel); } /** * Hides all components of the in preparation for * turning selected components back on. */ - private void hideAll(PageState ps) { - for (int i = 0; i < m_panelList.size(); i++) { - ((Component) m_panelList.get(i)).setVisible(ps, false); + private void hideAll(final PageState state) { + for (int i = 0; i < panelList.size(); i++) { + ((Component) panelList.get(i)).setVisible(state, false); } } @@ -528,25 +527,24 @@ class GroupAdministrationTab extends BoxPanel * Show all components of the in preparation for * turning visibility of selected components off . */ - private void showAll(PageState ps) { - for (int i = 0; i < m_panelList.size(); i++) { - ((Component) m_panelList.get(i)).setVisible(ps, true); + private void showAll(final PageState state) { + for (int i = 0; i < panelList.size(); i++) { + ((Component) panelList.get(i)).setVisible(state, true); } } } -class SubGroupListModelBuilder extends LockableImpl - implements ListModelBuilder { +class SubGroupListModelBuilder extends LockableImpl implements ListModelBuilder { - private GroupAdministrationTab m_parent; + private final GroupAdministrationTab parent; - public SubGroupListModelBuilder(GroupAdministrationTab parent) { - m_parent = parent; + public SubGroupListModelBuilder(final GroupAdministrationTab parent) { + this.parent = parent; } - public ListModel makeModel(List l, PageState state) { - Group group = m_parent.getGroup(state); + public ListModel makeModel(final List list, final PageState state) { + final Group group = parent.getGroup(state); if (group != null) { return new SubGroupListModel(group.getSubgroups()); @@ -567,10 +565,10 @@ class SubGroupListModel implements ListModel { /** * - * @param coll + * @param collection */ - public SubGroupListModel(GroupCollection coll) { - m_coll = coll; + public SubGroupListModel(final GroupCollection collection) { + m_coll = collection; m_coll.addOrder("lower(" + Group.DISPLAY_NAME + ") asc"); } diff --git a/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java b/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java index dd2d46b59..1ebe2091b 100755 --- a/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java +++ b/ccm-core/src/com/arsdigita/ui/admin/UserAddForm.java @@ -36,6 +36,7 @@ import com.arsdigita.kernel.security.SecurityConfig; * Form used to add a new user to the system. * * @version $Id: UserAddForm.java 287 2005-02-22 00:29:02Z sskracic $ + * @deprecated Replaced by {@link UserCreateSection}. Will be removed soon. */ class UserAddForm extends UserForm implements FormProcessListener, diff --git a/ccm-core/src/com/arsdigita/ui/admin/UserAdministrationTab.java b/ccm-core/src/com/arsdigita/ui/admin/UserAdministrationTab.java new file mode 100644 index 000000000..9e6baf2a5 --- /dev/null +++ b/ccm-core/src/com/arsdigita/ui/admin/UserAdministrationTab.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2013 Jens Pelzetter + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.ui.admin; + +import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.List; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Resettable; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.TabbedPane; +import com.arsdigita.bebop.event.ChangeEvent; +import com.arsdigita.bebop.event.ChangeListener; +import com.arsdigita.bebop.list.ListModel; +import com.arsdigita.bebop.list.ListModelBuilder; +import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.toolbox.ui.LayoutPanel; +import static com.arsdigita.ui.admin.AdminConstants.USER_NAVBAR_TITLE; +import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_SUMMARY; +import com.arsdigita.util.Assert; +import com.arsdigita.util.LockableImpl; +import com.arsdigita.xml.Element; +import java.util.ArrayList; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +class UserAdministrationTab extends SimpleContainer implements AdminConstants { + + private final List sections; + private final java.util.List components = new ArrayList(); + private final java.util.List