Cancel-Button beim Anlegen von Child-Apps gefixt
git-svn-id: https://svn.libreccm.org/ccm/trunk@1882 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a4b6fa2a04
commit
04ae9b5867
|
|
@ -15,7 +15,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.portalworkspace.ui.admin;
|
package com.arsdigita.portalworkspace.ui.admin;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -42,15 +41,10 @@ import com.arsdigita.web.ApplicationTypeCollection;
|
||||||
public class ApplicationPane extends SimpleContainer {
|
public class ApplicationPane extends SimpleContainer {
|
||||||
|
|
||||||
private Map m_edit; // Map of application type -> edit config form
|
private Map m_edit; // Map of application type -> edit config form
|
||||||
|
|
||||||
private Map m_create;
|
private Map m_create;
|
||||||
|
|
||||||
private NewApplicationForm m_newApp;
|
private NewApplicationForm m_newApp;
|
||||||
|
|
||||||
private ApplicationDetails m_appDetails;
|
private ApplicationDetails m_appDetails;
|
||||||
|
|
||||||
private ActionLink m_editLink;
|
private ActionLink m_editLink;
|
||||||
|
|
||||||
private ApplicationSelectionModel m_app;
|
private ApplicationSelectionModel m_app;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,144 +52,156 @@ public class ApplicationPane extends SimpleContainer {
|
||||||
* @param app
|
* @param app
|
||||||
*/
|
*/
|
||||||
public ApplicationPane(ApplicationSelectionModel app) {
|
public ApplicationPane(ApplicationSelectionModel app) {
|
||||||
super("portal:applicationPane", PortalConstants.PORTAL_XML_NS);
|
super("portal:applicationPane", PortalConstants.PORTAL_XML_NS);
|
||||||
|
|
||||||
m_app = app;
|
m_app = app;
|
||||||
|
|
||||||
m_create = new HashMap();
|
m_create = new HashMap();
|
||||||
m_edit = new HashMap();
|
m_edit = new HashMap();
|
||||||
|
|
||||||
m_appDetails = new ApplicationDetails(app);
|
m_appDetails = new ApplicationDetails(app);
|
||||||
add(m_appDetails);
|
add(m_appDetails);
|
||||||
|
|
||||||
m_editLink = new ActionLink("edit");
|
m_editLink = new ActionLink("edit");
|
||||||
m_editLink.addActionListener(new ApplicationEditListener());
|
m_editLink.addActionListener(new ApplicationEditListener());
|
||||||
add(m_editLink);
|
add(m_editLink);
|
||||||
|
|
||||||
m_newApp = new NewApplicationForm();
|
m_newApp = new NewApplicationForm();
|
||||||
m_newApp.addCompletionListener(new ApplicationCreateListener());
|
m_newApp.addCompletionListener(new ApplicationCreateListener());
|
||||||
add(m_newApp);
|
add(m_newApp);
|
||||||
|
|
||||||
final RequestLocal appRL = new RequestLocal() {
|
final RequestLocal appRL = new RequestLocal() {
|
||||||
public Object initialValue(PageState state) {
|
public Object initialValue(PageState state) {
|
||||||
return m_app.getSelectedObject(state);
|
return m_app.getSelectedObject(state);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
ApplicationTypeCollection types = ApplicationType
|
};
|
||||||
.retrieveAllApplicationTypes();
|
|
||||||
while (types.next()) {
|
|
||||||
ApplicationType type = types.getApplicationType();
|
|
||||||
|
|
||||||
ResourceConfigComponent create = type.getCreateComponent(appRL);
|
ApplicationTypeCollection types = ApplicationType
|
||||||
create.addCompletionListener(new ApplicationCompleteCreateListener(
|
.retrieveAllApplicationTypes();
|
||||||
create));
|
while (types.next()) {
|
||||||
m_create.put(type.getOID(), create);
|
ApplicationType type = types.getApplicationType();
|
||||||
add(create);
|
|
||||||
|
|
||||||
ResourceConfigComponent modify = type.getModifyComponent(appRL);
|
ResourceConfigComponent create = type.getCreateComponent(appRL);
|
||||||
modify.addCompletionListener(new ApplicationCompleteEditListener(
|
create.addCompletionListener(new ApplicationCompleteCreateListener(
|
||||||
modify));
|
create));
|
||||||
m_edit.put(type.getOID(), modify);
|
m_create.put(type.getOID(), create);
|
||||||
add(modify);
|
add(create);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
ResourceConfigComponent modify = type.getModifyComponent(appRL);
|
||||||
|
modify.addCompletionListener(new ApplicationCompleteEditListener(
|
||||||
|
modify));
|
||||||
|
m_edit.put(type.getOID(), modify);
|
||||||
|
add(modify);
|
||||||
|
}
|
||||||
|
|
||||||
public void register(Page p) {
|
}
|
||||||
super.register(p);
|
|
||||||
|
|
||||||
Iterator c = m_create.keySet().iterator();
|
public void register(Page p) {
|
||||||
while (c.hasNext()) {
|
super.register(p);
|
||||||
OID type = (OID) c.next();
|
|
||||||
p.setVisibleDefault((Component) m_create.get(type), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator e = m_edit.keySet().iterator();
|
Iterator c = m_create.keySet().iterator();
|
||||||
while (e.hasNext()) {
|
while (c.hasNext()) {
|
||||||
OID type = (OID) e.next();
|
OID type = (OID) c.next();
|
||||||
p.setVisibleDefault((Component) m_edit.get(type), false);
|
p.setVisibleDefault((Component) m_create.get(type), false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private class ApplicationCreateListener implements ActionListener {
|
Iterator e = m_edit.keySet().iterator();
|
||||||
public void actionPerformed(ActionEvent e) {
|
while (e.hasNext()) {
|
||||||
PageState state = e.getPageState();
|
OID type = (OID) e.next();
|
||||||
|
p.setVisibleDefault((Component) m_edit.get(type), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationType type = m_newApp.getApplicationType(state);
|
private class ApplicationCreateListener implements ActionListener {
|
||||||
|
|
||||||
Component editor = (Component) m_create.get(type.getOID());
|
public void actionPerformed(ActionEvent e) {
|
||||||
editor.setVisible(state, true);
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
m_newApp.setVisible(state, false);
|
ApplicationType type = m_newApp.getApplicationType(state);
|
||||||
m_appDetails.setVisible(state, false);
|
|
||||||
m_editLink.setVisible(state, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ApplicationEditListener implements ActionListener {
|
Component editor = (Component) m_create.get(type.getOID());
|
||||||
public void actionPerformed(ActionEvent e) {
|
editor.setVisible(state, true);
|
||||||
PageState state = e.getPageState();
|
|
||||||
|
|
||||||
Application app = (Application) m_app.getSelectedObject(state);
|
m_newApp.setVisible(state, false);
|
||||||
|
m_appDetails.setVisible(state, false);
|
||||||
|
m_editLink.setVisible(state, false);
|
||||||
|
}
|
||||||
|
|
||||||
Component editor = (Component) m_edit.get(app.getResourceType()
|
}
|
||||||
.getOID());
|
|
||||||
editor.setVisible(state, true);
|
|
||||||
|
|
||||||
m_newApp.setVisible(state, false);
|
private class ApplicationEditListener implements ActionListener {
|
||||||
m_appDetails.setVisible(state, false);
|
|
||||||
m_editLink.setVisible(state, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ApplicationCompleteCreateListener implements ActionListener {
|
public void actionPerformed(ActionEvent e) {
|
||||||
private Component m_src;
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
public ApplicationCompleteCreateListener(Component src) {
|
Application app = (Application) m_app.getSelectedObject(state);
|
||||||
m_src = src;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
Component editor = (Component) m_edit.get(app.getResourceType()
|
||||||
PageState state = e.getPageState();
|
.getOID());
|
||||||
|
editor.setVisible(state, true);
|
||||||
|
|
||||||
ResourceConfigComponent c = (ResourceConfigComponent) m_src;
|
m_newApp.setVisible(state, false);
|
||||||
Resource newResource = c.createResource(state);
|
m_appDetails.setVisible(state, false);
|
||||||
c.setVisible(state, false);
|
m_editLink.setVisible(state, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Copy categorization from nav app instance
|
}
|
||||||
Resource parentResource = newResource.getParentResource();
|
|
||||||
Category.setRootForObject(newResource, Category
|
|
||||||
.getRootForObject(parentResource));
|
|
||||||
|
|
||||||
m_newApp.setVisible(state, true);
|
private class ApplicationCompleteCreateListener implements ActionListener {
|
||||||
m_appDetails.setVisible(state, true);
|
|
||||||
m_editLink.setVisible(state, true);
|
|
||||||
|
|
||||||
m_app.clearSelection(state);
|
private Component m_src;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ApplicationCompleteEditListener implements ActionListener {
|
public ApplicationCompleteCreateListener(Component src) {
|
||||||
private Component m_src;
|
m_src = src;
|
||||||
|
}
|
||||||
|
|
||||||
public ApplicationCompleteEditListener(Component src) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
m_src = src;
|
PageState state = e.getPageState();
|
||||||
}
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
ResourceConfigComponent c = (ResourceConfigComponent) m_src;
|
||||||
PageState state = e.getPageState();
|
Resource newResource = c.createResource(state);
|
||||||
|
if (newResource != null) {
|
||||||
|
|
||||||
ResourceConfigComponent c = (ResourceConfigComponent) m_src;
|
|
||||||
c.modifyResource(state);
|
|
||||||
c.setVisible(state, false);
|
|
||||||
|
|
||||||
m_newApp.setVisible(state, true);
|
c.setVisible(state, false);
|
||||||
m_appDetails.setVisible(state, true);
|
|
||||||
m_editLink.setVisible(state, true);
|
|
||||||
|
|
||||||
m_app.clearSelection(state);
|
// Copy categorization from nav app instance
|
||||||
}
|
Resource parentResource = newResource.getParentResource();
|
||||||
}
|
Category.setRootForObject(newResource, Category
|
||||||
|
.getRootForObject(parentResource));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_newApp.setVisible(state, true);
|
||||||
|
m_appDetails.setVisible(state, true);
|
||||||
|
m_editLink.setVisible(state, true);
|
||||||
|
|
||||||
|
m_app.clearSelection(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ApplicationCompleteEditListener implements ActionListener {
|
||||||
|
|
||||||
|
private Component m_src;
|
||||||
|
|
||||||
|
public ApplicationCompleteEditListener(Component src) {
|
||||||
|
m_src = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
PageState state = e.getPageState();
|
||||||
|
|
||||||
|
ResourceConfigComponent c = (ResourceConfigComponent) m_src;
|
||||||
|
c.modifyResource(state);
|
||||||
|
c.setVisible(state, false);
|
||||||
|
|
||||||
|
m_newApp.setVisible(state, true);
|
||||||
|
m_appDetails.setVisible(state, true);
|
||||||
|
m_editLink.setVisible(state, true);
|
||||||
|
|
||||||
|
m_app.clearSelection(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue