- Admin-Oberfläche für Instanzen von ccm-navigation in den ApplicationsAdministrationTab unter /ccm/admin integriert.
- Einige Verbesserungen an Tabs für /ccm/admin. Unter anderem sind diese jetzt direkt von LayoutPanel abgeleitet. git-svn-id: https://svn.libreccm.org/ccm/trunk@2295 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
397a8a4622
commit
6a06a18e8c
|
|
@ -54,7 +54,8 @@ public class LayoutPanel extends ComponentMap {
|
||||||
put("bottom", bottom);
|
put("bottom", bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void generateXML(final PageState state, final Element parent) {
|
@Override
|
||||||
|
public void generateXML(final PageState state, final Element parent) {
|
||||||
if (isVisible(state)) {
|
if (isVisible(state)) {
|
||||||
final Element layout = parent.newChildElement
|
final Element layout = parent.newChildElement
|
||||||
("bebop:layoutPanel", BEBOP_XML_NS);
|
("bebop:layoutPanel", BEBOP_XML_NS);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.Tree;
|
import com.arsdigita.bebop.Tree;
|
||||||
import com.arsdigita.bebop.event.ChangeEvent;
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
import com.arsdigita.bebop.event.ChangeListener;
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||||
import com.arsdigita.ui.admin.applications.ApplicationInstancePane;
|
import com.arsdigita.ui.admin.applications.ApplicationInstancePane;
|
||||||
import com.arsdigita.ui.admin.applications.ApplicationManager;
|
import com.arsdigita.ui.admin.applications.ApplicationManager;
|
||||||
import com.arsdigita.ui.admin.applications.BaseApplicationPane;
|
import com.arsdigita.ui.admin.applications.BaseApplicationPane;
|
||||||
|
|
@ -46,7 +46,7 @@ import java.util.Map;
|
||||||
* @author pb
|
* @author pb
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class ApplicationsAdministrationTab extends SimpleContainer implements AdminConstants {
|
public class ApplicationsAdministrationTab extends LayoutPanel implements AdminConstants {
|
||||||
|
|
||||||
private final Tree applicationTree;
|
private final Tree applicationTree;
|
||||||
private final Map<String, BaseApplicationPane> appPanes = new HashMap<String, BaseApplicationPane>();
|
private final Map<String, BaseApplicationPane> appPanes = new HashMap<String, BaseApplicationPane>();
|
||||||
|
|
@ -65,17 +65,10 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
|
|
||||||
applicationTree = new Tree(new ApplicationTreeModelBuilder());
|
applicationTree = new Tree(new ApplicationTreeModelBuilder());
|
||||||
applicationTree.addChangeListener(new TreeStateChangeListener());
|
applicationTree.addChangeListener(new TreeStateChangeListener());
|
||||||
|
|
||||||
//final Section treeSection = new Section();
|
setClassAttr("navbar");
|
||||||
//treeSection.setHeading(GlobalizationUtil.globalize("ui.admin.applications.tree.heading"));
|
|
||||||
//treeSection.setBody(applicationTree);
|
setLeft(applicationTree);
|
||||||
|
|
||||||
//final LayoutPanel panel = new LayoutPanel();
|
|
||||||
//panel.setLeft(treeSection);
|
|
||||||
final BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
|
||||||
panel.setClassAttr("navbar");
|
|
||||||
//panel.add(treeSection);
|
|
||||||
panel.add(applicationTree);
|
|
||||||
|
|
||||||
|
|
||||||
final ApplicationTypeCollection applicationTypes = ApplicationType.retrieveAllApplicationTypes();
|
final ApplicationTypeCollection applicationTypes = ApplicationType.retrieveAllApplicationTypes();
|
||||||
|
|
@ -90,8 +83,7 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
createAppPane(applicationTypes.getApplicationType(), appManagers);
|
createAppPane(applicationTypes.getApplicationType(), appManagers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//final BoxPanel
|
|
||||||
appPanel = new BoxPanel();
|
appPanel = new BoxPanel();
|
||||||
appPanel.setClassAttr("main");
|
appPanel.setClassAttr("main");
|
||||||
for (Map.Entry<String, BaseApplicationPane> entry : appPanes.entrySet()) {
|
for (Map.Entry<String, BaseApplicationPane> entry : appPanes.entrySet()) {
|
||||||
|
|
@ -101,32 +93,10 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.entrySet()) {
|
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.entrySet()) {
|
||||||
appPanel.add(entry.getValue());
|
appPanel.add(entry.getValue());
|
||||||
}
|
}
|
||||||
//panel.setRight(appPanel);
|
|
||||||
panel.add(appPanel);
|
setRight(appPanel);
|
||||||
|
|
||||||
add(panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @SuppressWarnings("rawtypes")
|
|
||||||
// private Map<String, ApplicationCreateForm<?>> retrieveAppCreateForms() {
|
|
||||||
// final Map<String, ApplicationCreateForm<?>> appCreateForms = new HashMap<String, ApplicationCreateForm<?>>();
|
|
||||||
// final ServiceLoader<ApplicationCreateForm> loader = ServiceLoader.load(ApplicationCreateForm.class);
|
|
||||||
// for (ApplicationCreateForm<?> appCreateForm : loader) {
|
|
||||||
// appCreateForms.put(appCreateForm.getAppClassName(), appCreateForm);
|
|
||||||
// }
|
|
||||||
// return appCreateForms;
|
|
||||||
// }
|
|
||||||
// @SuppressWarnings("rawtypes")
|
|
||||||
// private Map<String, ApplicationManager<?>> retrieveAppManagers() {
|
|
||||||
// final Map<String, ApplicationManager<?>> appManagers = new HashMap<String, ApplicationManager<?>>();
|
|
||||||
//
|
|
||||||
// final ServiceLoader<ApplicationManager> loader = ServiceLoader.load(ApplicationManager.class);
|
|
||||||
// for (ApplicationManager<?> appManager : loader) {
|
|
||||||
// appManagers.put(appManager.getApplication().getName(), appManager);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return appManagers;
|
|
||||||
// }
|
|
||||||
private void createSingletonAppPane(final ApplicationType applicationType,
|
private void createSingletonAppPane(final ApplicationType applicationType,
|
||||||
final Map<String, ApplicationManager<?>> appManagers) {
|
final Map<String, ApplicationManager<?>> appManagers) {
|
||||||
final String appObjectType = applicationType.getApplicationObjectType();
|
final String appObjectType = applicationType.getApplicationObjectType();
|
||||||
|
|
@ -156,13 +126,6 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
final MultiInstanceApplicationPane<?> appPane = new MultiInstanceApplicationPane(applicationType, createForm);
|
final MultiInstanceApplicationPane<?> appPane = new MultiInstanceApplicationPane(applicationType, createForm);
|
||||||
appPanes.put(applicationType.getApplicationObjectType(), appPane);
|
appPanes.put(applicationType.getApplicationObjectType(), appPane);
|
||||||
createInstancePane(applicationType, appManagers);
|
createInstancePane(applicationType, appManagers);
|
||||||
|
|
||||||
// final ApplicationCollection instances = Application.retrieveAllApplications(
|
|
||||||
// applicationType.getApplicationObjectType());
|
|
||||||
//
|
|
||||||
// while (instances.next()) {
|
|
||||||
// createInstancePane(instances.getApplication(), appManagers);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createInstancePane(final ApplicationType applicationType,
|
private void createInstancePane(final ApplicationType applicationType,
|
||||||
|
|
@ -179,22 +142,6 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
instancePanes.put(applicationType.getApplicationObjectType(), instPane);
|
instancePanes.put(applicationType.getApplicationObjectType(), instPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void createInstancePane(final Application application,
|
|
||||||
// final Map<String, ApplicationManager<?>> managementForms) {
|
|
||||||
// final ApplicationManager<?> manager = managementForms.get(application.getClass().getName());
|
|
||||||
//
|
|
||||||
// final ApplicationInstancePane instPane;
|
|
||||||
// if (manager == null) {
|
|
||||||
// instPane = new ApplicationInstancePane(application, null);
|
|
||||||
// } else {
|
|
||||||
// instPane = new ApplicationInstancePane(
|
|
||||||
// application,
|
|
||||||
// managementForms.get(application.getClass().getName()).getApplicationAdminForm());
|
|
||||||
// }
|
|
||||||
// //instancePanes.put(application.getClass().getName(), instPane);
|
|
||||||
// instancePanes.put(application.getPath(), instPane);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(final Page page) {
|
public void register(final Page page) {
|
||||||
super.register(page);
|
super.register(page);
|
||||||
|
|
@ -208,10 +155,6 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPaneVisible(final SimpleContainer pane, final PageState state) {
|
private void setPaneVisible(final SimpleContainer pane, final PageState state) {
|
||||||
// if (visiblePane != null) {
|
|
||||||
// visiblePane.setVisible(state, false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
for (Map.Entry<String, BaseApplicationPane> entry : appPanes.entrySet()) {
|
for (Map.Entry<String, BaseApplicationPane> entry : appPanes.entrySet()) {
|
||||||
entry.getValue().setVisible(state, false);
|
entry.getValue().setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
@ -219,8 +162,7 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
entry.getValue().setVisible(state, false);
|
entry.getValue().setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
pane.setVisible(state, true);
|
pane.setVisible(state, true);
|
||||||
//visiblePane = pane;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TreeStateChangeListener implements ChangeListener {
|
private class TreeStateChangeListener implements ChangeListener {
|
||||||
|
|
@ -242,9 +184,7 @@ public class ApplicationsAdministrationTab extends SimpleContainer implements Ad
|
||||||
setPaneVisible(pane, state);
|
setPaneVisible(pane, state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Selected key is the name of a instance pane
|
// Selected key is the name of a instance pane
|
||||||
// final ApplicationInstancePane pane = instancePanes.get(selectedKey);
|
|
||||||
|
|
||||||
final ApplicationCollection applications = Application.retrieveAllApplications();
|
final ApplicationCollection applications = Application.retrieveAllApplications();
|
||||||
applications.addEqualsFilter(Application.PRIMARY_URL, selectedKey + "/");
|
applications.addEqualsFilter(Application.PRIMARY_URL, selectedKey + "/");
|
||||||
final ApplicationInstancePane pane;
|
final ApplicationInstancePane pane;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ import org.apache.log4j.Logger;
|
||||||
* @author David Dao
|
* @author David Dao
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class GroupAdministrationTab extends SimpleContainer implements AdminConstants, ChangeListener {
|
class GroupAdministrationTab extends LayoutPanel implements AdminConstants, ChangeListener {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(GroupAdministrationTab.class);
|
private static final Logger LOGGER = Logger.getLogger(GroupAdministrationTab.class);
|
||||||
private final Tree groupTree;
|
private final Tree groupTree;
|
||||||
|
|
@ -81,7 +81,7 @@ class GroupAdministrationTab extends SimpleContainer implements AdminConstants,
|
||||||
@Override
|
@Override
|
||||||
public void register(final Page page) {
|
public void register(final Page page) {
|
||||||
for (int i = 0; i < panelList.size(); i++) {
|
for (int i = 0; i < panelList.size(); i++) {
|
||||||
page.setVisibleDefault((Component) panelList.get(i), false);
|
page.setVisibleDefault(panelList.get(i), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
page.setVisibleDefault(groupAddPanel, true);
|
page.setVisibleDefault(groupAddPanel, true);
|
||||||
|
|
@ -148,19 +148,13 @@ class GroupAdministrationTab extends SimpleContainer implements AdminConstants,
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
setClassAttr("navbar");
|
||||||
//final LayoutPanel panel = new LayoutPanel();
|
|
||||||
panel.setClassAttr("navbar");
|
|
||||||
|
|
||||||
//m_tree = new Tree(new GroupTreeMode());
|
|
||||||
groupTree = new Tree(new GroupTreeModelBuilder());
|
groupTree = new Tree(new GroupTreeModelBuilder());
|
||||||
groupTree.addChangeListener(this);
|
groupTree.addChangeListener(this);
|
||||||
panel.add(groupTree);
|
setLeft(groupTree);
|
||||||
//panel.setLeft(groupTree);
|
|
||||||
|
|
||||||
add(panel);
|
|
||||||
|
|
||||||
final SegmentedPanel rightSide = new SegmentedPanel();
|
final SegmentedPanel rightSide = new SegmentedPanel();
|
||||||
rightSide.setClassAttr("main");
|
rightSide.setClassAttr("main");
|
||||||
|
|
||||||
|
|
@ -187,9 +181,8 @@ class GroupAdministrationTab extends SimpleContainer implements AdminConstants,
|
||||||
|
|
||||||
groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide);
|
groupDeleteFailedPanel = buildGroupDeleteFailedPanel(rightSide);
|
||||||
panelList.add(groupDeleteFailedPanel);
|
panelList.add(groupDeleteFailedPanel);
|
||||||
|
|
||||||
panel.add(rightSide);
|
setRight(rightSide);
|
||||||
//panel.setRight(rightSide);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayAddGroupPanel(final PageState state) {
|
public void displayAddGroupPanel(final PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@ import com.arsdigita.bebop.List;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.Resettable;
|
import com.arsdigita.bebop.Resettable;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
|
||||||
import com.arsdigita.bebop.TabbedPane;
|
import com.arsdigita.bebop.TabbedPane;
|
||||||
import com.arsdigita.bebop.event.ChangeEvent;
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
import com.arsdigita.bebop.event.ChangeListener;
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
import com.arsdigita.bebop.list.ListModel;
|
import com.arsdigita.bebop.list.ListModel;
|
||||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
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_NAVBAR_TITLE;
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_SUMMARY;
|
import static com.arsdigita.ui.admin.AdminConstants.USER_TAB_SUMMARY;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
@ -44,7 +44,7 @@ import java.util.ArrayList;
|
||||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
class UserAdministrationTab extends LayoutPanel implements AdminConstants {
|
||||||
|
|
||||||
private final List sections;
|
private final List sections;
|
||||||
private final java.util.List<Component> components = new ArrayList<Component>();
|
private final java.util.List<Component> components = new ArrayList<Component>();
|
||||||
|
|
@ -54,16 +54,13 @@ class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
public UserAdministrationTab(final TabbedPane parent, final GroupAdministrationTab groupAdminTab) {
|
public UserAdministrationTab(final TabbedPane parent, final GroupAdministrationTab groupAdminTab) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
//final LayoutPanel panel = new LayoutPanel();
|
|
||||||
final BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
|
||||||
setClassAttr("sidebarNavPanel");
|
setClassAttr("sidebarNavPanel");
|
||||||
|
|
||||||
sections = new List(new GlobalizedTabModelBuilder());
|
sections = new List(new GlobalizedTabModelBuilder());
|
||||||
sections.addChangeListener(new SectionChangeListener());
|
sections.addChangeListener(new SectionChangeListener());
|
||||||
sections.setClassAttr("navbar");
|
sections.setClassAttr("navbar");
|
||||||
//panel.setLeft(sections);
|
setLeft(sections);
|
||||||
panel.add(sections);
|
|
||||||
|
|
||||||
final UserBrowsePane browsePane = new UserBrowsePane();
|
final UserBrowsePane browsePane = new UserBrowsePane();
|
||||||
final UserSummarySection summarySection = new UserSummarySection(this, browsePane);
|
final UserSummarySection summarySection = new UserSummarySection(this, browsePane);
|
||||||
final UserSearchSection searchSection = new UserSearchSection(this, browsePane);
|
final UserSearchSection searchSection = new UserSearchSection(this, browsePane);
|
||||||
|
|
@ -77,9 +74,7 @@ class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
addSection(USER_TAB_SEARCH, searchSection, right);
|
addSection(USER_TAB_SEARCH, searchSection, right);
|
||||||
addSection(USER_TAB_CREATE_USER, createSection, right);
|
addSection(USER_TAB_CREATE_USER, createSection, right);
|
||||||
|
|
||||||
//panel.setRight(right);
|
setRight(right);
|
||||||
panel.add(right);
|
|
||||||
add(panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -140,6 +135,7 @@ class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stateChanged(final ChangeEvent event) {
|
public void stateChanged(final ChangeEvent event) {
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final int selectedIndex = Integer.parseInt((String) sections.getSelectedKey(state));
|
final int selectedIndex = Integer.parseInt((String) sections.getSelectedKey(state));
|
||||||
|
|
@ -154,6 +150,7 @@ class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ListModel makeModel(final List list, final PageState state) {
|
public ListModel makeModel(final List list, final PageState state) {
|
||||||
return new TabNameListModel(state);
|
return new TabNameListModel(state);
|
||||||
}
|
}
|
||||||
|
|
@ -169,10 +166,12 @@ class UserAdministrationTab extends SimpleContainer implements AdminConstants {
|
||||||
pageState = state;
|
pageState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getElement() {
|
public Object getElement() {
|
||||||
return keys.get(index).getLabel(pageState);
|
return keys.get(index).getLabel(pageState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return String.valueOf(index);
|
return String.valueOf(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.Link;
|
import com.arsdigita.bebop.Link;
|
||||||
import com.arsdigita.bebop.event.PrintEvent;
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
import com.arsdigita.bebop.event.PrintListener;
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.navigation.ui.admin.CategoryPanel;
|
||||||
import com.arsdigita.navigation.ui.admin.NavigationCreateForm;
|
import com.arsdigita.navigation.ui.admin.NavigationCreateForm;
|
||||||
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||||
import com.arsdigita.ui.admin.applications.ApplicationManager;
|
import com.arsdigita.ui.admin.applications.ApplicationManager;
|
||||||
|
|
@ -37,10 +38,12 @@ import com.arsdigita.ui.admin.applications.ApplicationManager;
|
||||||
*/
|
*/
|
||||||
public class NavigationAppManager implements ApplicationManager<Navigation> {
|
public class NavigationAppManager implements ApplicationManager<Navigation> {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Class<Navigation> getApplication() {
|
public Class<Navigation> getApplication() {
|
||||||
return Navigation.class;
|
return Navigation.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ApplicationInstanceAwareContainer getApplicationAdminForm() {
|
public ApplicationInstanceAwareContainer getApplicationAdminForm() {
|
||||||
// final ApplicationInstanceAwareContainer container = new ApplicationInstanceAwareContainer();
|
// final ApplicationInstanceAwareContainer container = new ApplicationInstanceAwareContainer();
|
||||||
// final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
|
// final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
|
@ -52,6 +55,7 @@ public class NavigationAppManager implements ApplicationManager<Navigation> {
|
||||||
return new ApplicationAdminForm();
|
return new ApplicationAdminForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Form getApplicationCreateForm() {
|
public Form getApplicationCreateForm() {
|
||||||
return new NavigationCreateForm();
|
return new NavigationCreateForm();
|
||||||
}
|
}
|
||||||
|
|
@ -60,19 +64,23 @@ public class NavigationAppManager implements ApplicationManager<Navigation> {
|
||||||
|
|
||||||
public ApplicationAdminForm() {
|
public ApplicationAdminForm() {
|
||||||
super();
|
super();
|
||||||
final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
|
// final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
add(panel);
|
// add(panel);
|
||||||
|
//
|
||||||
panel.add(new Label(NavigationGlobalizationUtil.globalize("ui.admin.instance_not_compatible_yet")));
|
// panel.add(new Label(NavigationGlobalizationUtil.globalize("ui.admin.instance_not_compatible_yet")));
|
||||||
panel.add(new Link(new PrintListener() {
|
// panel.add(new Link(new PrintListener() {
|
||||||
public void prepare(final PrintEvent event) {
|
// @Override
|
||||||
final Link link = (Link) event.getTarget();
|
// public void prepare(final PrintEvent event) {
|
||||||
|
// final Link link = (Link) event.getTarget();
|
||||||
link.setTarget(String.format("%s/admin", getAppInstance().getPath()));
|
//
|
||||||
link.setChild(new Label(getAppInstance().getTitle()));
|
// link.setTarget(String.format("%s/admin", getAppInstance().getPath()));
|
||||||
}
|
// link.setChild(new Label(getAppInstance().getTitle()));
|
||||||
|
// }
|
||||||
}));
|
//
|
||||||
|
// }));
|
||||||
|
|
||||||
|
final CategoryPanel categoryPanel = new CategoryPanel(this);
|
||||||
|
add(categoryPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,47 +24,64 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.ChangeListener;
|
import com.arsdigita.bebop.event.ChangeListener;
|
||||||
import com.arsdigita.bebop.event.ChangeEvent;
|
import com.arsdigita.bebop.event.ChangeEvent;
|
||||||
import com.arsdigita.navigation.Navigation;
|
import com.arsdigita.navigation.Navigation;
|
||||||
|
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Panel for managing the JSP templates assigned to categories. The templates are
|
||||||
|
* describing which components and which data is rendered when accessing a category
|
||||||
|
* using the navigation application.
|
||||||
|
*
|
||||||
|
* @author Unknown
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
*/
|
||||||
public class CategoryPanel extends SimpleContainer {
|
public class CategoryPanel extends SimpleContainer {
|
||||||
|
|
||||||
private CategorySelectionModel m_category;
|
private final CategorySelectionModel category;
|
||||||
private CategoryTree m_tree;
|
private final CategoryTree tree;
|
||||||
private CategoryFormAddContext m_addForm;
|
private final CategoryFormAddContext addForm;
|
||||||
private CategoryForm m_form;
|
private final CategoryForm form;
|
||||||
private QuickLinkPanel m_links;
|
private final QuickLinkPanel links;
|
||||||
|
|
||||||
public CategoryPanel() {
|
public CategoryPanel() {
|
||||||
super(Navigation.NAV_PREFIX + ":categoryPanel",
|
super(Navigation.NAV_PREFIX + ":categoryPanel",
|
||||||
Navigation.NAV_NS);
|
Navigation.NAV_NS);
|
||||||
|
|
||||||
m_category = new CategorySelectionModel();
|
category = new CategorySelectionModel();
|
||||||
m_category.addChangeListener(
|
category.addChangeListener(
|
||||||
new ChangeListener() {
|
new ChangeListener() {
|
||||||
public void stateChanged(ChangeEvent e) {
|
@Override
|
||||||
PageState state = e.getPageState();
|
public void stateChanged(final ChangeEvent event) {
|
||||||
boolean selected = m_category.isSelected(state);
|
final PageState state = event.getPageState();
|
||||||
m_addForm.setVisible(state, selected);
|
final boolean selected = category.isSelected(state);
|
||||||
m_form.setVisible(state, selected);
|
addForm.setVisible(state, selected);
|
||||||
m_links.setVisible(state, selected);
|
form.setVisible(state, selected);
|
||||||
|
links.setVisible(state, selected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_tree = new CategoryTree(m_category);
|
tree = new CategoryTree(category);
|
||||||
m_addForm = new CategoryFormAddContext(m_category);
|
addForm = new CategoryFormAddContext(category);
|
||||||
m_form = new CategoryForm(m_category);
|
form = new CategoryForm(category);
|
||||||
m_links = new QuickLinkPanel(m_category);
|
links = new QuickLinkPanel(category);
|
||||||
|
|
||||||
add(m_tree);
|
add(tree);
|
||||||
add(m_addForm);
|
add(addForm);
|
||||||
add(m_form);
|
add(form);
|
||||||
add(m_links);
|
add(links);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(Page p) {
|
public CategoryPanel(final ApplicationInstanceAwareContainer parent) {
|
||||||
super.register(p);
|
this();
|
||||||
|
|
||||||
p.setVisibleDefault(m_addForm, false);
|
tree.setParent(parent);
|
||||||
p.setVisibleDefault(m_form, false);
|
}
|
||||||
p.setVisibleDefault(m_links, false);
|
|
||||||
|
@Override
|
||||||
|
public void register(final Page page) {
|
||||||
|
super.register(page);
|
||||||
|
|
||||||
|
page.setVisibleDefault(addForm, false);
|
||||||
|
page.setVisibleDefault(form, false);
|
||||||
|
page.setVisibleDefault(links, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,49 +17,71 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.navigation.ui.admin;
|
package com.arsdigita.navigation.ui.admin;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Tree;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.tree.TreeModelBuilder;
|
import com.arsdigita.bebop.Tree;
|
||||||
import com.arsdigita.bebop.tree.TreeModel;
|
import com.arsdigita.bebop.tree.TreeModel;
|
||||||
|
import com.arsdigita.bebop.tree.TreeModelBuilder;
|
||||||
import com.arsdigita.categorization.Category;
|
import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.categorization.CategoryTreeModelLite;
|
import com.arsdigita.categorization.CategoryTreeModelLite;
|
||||||
import com.arsdigita.cms.TemplateContext;
|
import com.arsdigita.cms.TemplateContext;
|
||||||
import com.arsdigita.web.Web;
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
|
||||||
|
|
||||||
import com.arsdigita.navigation.Navigation;
|
import com.arsdigita.navigation.Navigation;
|
||||||
|
import com.arsdigita.ui.admin.applications.ApplicationInstanceAwareContainer;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists category tree.
|
* Lists category tree.
|
||||||
*
|
*
|
||||||
* @author Tri Tran (tri@arsdigita.com)
|
* @author Tri Tran (tri@arsdigita.com)
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id: CategoryTree.java 2070 2010-01-28 08:47:41Z pboy $
|
* @version $Id: CategoryTree.java 2070 2010-01-28 08:47:41Z pboy $
|
||||||
*/
|
*/
|
||||||
public class CategoryTree extends Tree {
|
public class CategoryTree extends Tree {
|
||||||
|
|
||||||
|
private final SectionTreeModelBuilder modelBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new CategoryTree
|
* Construct a new CategoryTree
|
||||||
|
*
|
||||||
|
* @param model The {@link CategorySelectionModel} used for storing the selected category.
|
||||||
*/
|
*/
|
||||||
public CategoryTree(CategorySelectionModel model) {
|
public CategoryTree(final CategorySelectionModel model) {
|
||||||
super(new SectionTreeModelBuilder());
|
super(new SectionTreeModelBuilder());
|
||||||
|
modelBuilder = (SectionTreeModelBuilder) getModelBuilder();
|
||||||
setSelectionModel(model);
|
setSelectionModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setParent(final ApplicationInstanceAwareContainer parent) {
|
||||||
|
modelBuilder.setParent(parent);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A TreeModelBuilder that loads the tree from the current category
|
* A TreeModelBuilder that loads the tree from the current category
|
||||||
*/
|
*/
|
||||||
private static class SectionTreeModelBuilder extends LockableImpl
|
private static class SectionTreeModelBuilder extends LockableImpl implements TreeModelBuilder {
|
||||||
implements TreeModelBuilder {
|
|
||||||
|
private ApplicationInstanceAwareContainer parent;
|
||||||
|
|
||||||
public SectionTreeModelBuilder() {
|
public SectionTreeModelBuilder() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TreeModel makeModel(Tree t, PageState s) {
|
public void setParent(final ApplicationInstanceAwareContainer parent) {
|
||||||
Navigation app = (Navigation) Web.getContext().getApplication();
|
this.parent = parent;
|
||||||
TemplateContext ctx = Navigation.getContext().getTemplateContext();
|
}
|
||||||
String dispatcherContext = ctx == null ? null : ctx.getContext();
|
|
||||||
Category root = Category.getRootForObject(app, dispatcherContext);
|
@Override
|
||||||
|
public TreeModel makeModel(final Tree tree, final PageState state) {
|
||||||
|
final Navigation app;
|
||||||
|
if (parent == null) {
|
||||||
|
app = (Navigation) Web.getContext().getApplication();
|
||||||
|
} else {
|
||||||
|
app = (Navigation) parent.getAppInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
final TemplateContext ctx = Navigation.getContext().getTemplateContext();
|
||||||
|
final String dispatcherContext = ctx == null ? null : ctx.getContext();
|
||||||
|
final Category root = Category.getRootForObject(app, dispatcherContext);
|
||||||
return new CategoryTreeModelLite(root);
|
return new CategoryTreeModelLite(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue