diff --git a/ccm-bundle-devel-wildfly/src/site/apt/index.apt b/ccm-bundle-devel-wildfly/src/site/apt/index.apt
index 3d91786ce..21efc60eb 100644
--- a/ccm-bundle-devel-wildfly/src/site/apt/index.apt
+++ b/ccm-bundle-devel-wildfly/src/site/apt/index.apt
@@ -54,7 +54,7 @@ LibreCCM Bundle for Wildfly
** Profile generic
- mvn -Djboss-as.home=/home/jensp/java-ee-servers/wildfly/wildfly-10.0.0.Final_ccm-runtime package wildfly:run -pl ccm-bundle-devel-wildfly -am -Pgeneric
+ mvn -Djboss-as.home=/home/mustermann/java-ee-servers/wildfly/wildfly-10.0.0.Final package wildfly:run -pl ccm-bundle-devel-wildfly -am -Pgeneric
** Additional options
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppInstanceForm.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppInstanceForm.java
new file mode 100644
index 000000000..909fb0bb4
--- /dev/null
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppInstanceForm.java
@@ -0,0 +1,80 @@
+/*
+ * 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.applications;
+
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+
+import org.libreccm.cdi.utils.CdiUtil;
+import org.libreccm.web.ApplicationRepository;
+import org.libreccm.web.ApplicationType;
+import org.libreccm.web.CcmApplication;
+
+import java.util.Optional;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public abstract class AbstractAppInstanceForm extends Form {
+
+ private final ParameterSingleSelectionModel selectedAppType;
+ private final ParameterSingleSelectionModel selectedAppInstance;
+
+ public AbstractAppInstanceForm(
+ final String name,
+ final ParameterSingleSelectionModel selectedAppType,
+ final ParameterSingleSelectionModel selectedAppInstance) {
+
+ super(name);
+
+ this.selectedAppType = selectedAppType;
+ this.selectedAppInstance = selectedAppInstance;
+
+ createWidgets();
+ }
+
+ protected abstract void createWidgets();
+
+ protected ApplicationType getSelectedAppType(final PageState state) {
+ final org.libreccm.web.ApplicationManager appManager = CdiUtil
+ .createCdiUtil().findBean(org.libreccm.web.ApplicationManager.class);
+
+ return appManager.getApplicationTypes().get(selectedAppType
+ .getSelectedKey(state));
+ }
+
+ protected Optional getSelectedAppInstance(
+ final PageState state) {
+
+ if (selectedAppInstance.getSelectedKey(state) == null
+ || selectedAppInstance.getSelectedKey(state).isEmpty()) {
+ return Optional.empty();
+ } else {
+ final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
+ .findBean(ApplicationRepository.class);
+
+ final CcmApplication result = appRepo.findById(Long.parseLong(
+ selectedAppInstance.getSelectedKey(state)));
+ return Optional.of(result);
+ }
+ }
+
+}
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppSettingsPane.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppSettingsPane.java
new file mode 100644
index 000000000..dd46acfa1
--- /dev/null
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/AbstractAppSettingsPane.java
@@ -0,0 +1,79 @@
+/*
+ * 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.applications;
+
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.bebop.SimpleContainer;
+
+import org.libreccm.cdi.utils.CdiUtil;
+import org.libreccm.web.ApplicationRepository;
+import org.libreccm.web.ApplicationType;
+import org.libreccm.web.CcmApplication;
+
+import java.util.Optional;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public abstract class AbstractAppSettingsPane extends SimpleContainer {
+
+ private final ParameterSingleSelectionModel selectedAppType;
+ private final ParameterSingleSelectionModel selectedAppInstance;
+
+ public AbstractAppSettingsPane(
+ final ParameterSingleSelectionModel selectedAppType,
+ final ParameterSingleSelectionModel selectedAppInstance) {
+
+ super();
+
+ this.selectedAppType = selectedAppType;
+ this.selectedAppInstance = selectedAppInstance;
+
+ createWidgets();
+ }
+
+ protected abstract void createWidgets();
+
+ protected ApplicationType getSelectedAppType(final PageState state) {
+ final org.libreccm.web.ApplicationManager appManager = CdiUtil
+ .createCdiUtil().findBean(org.libreccm.web.ApplicationManager.class);
+
+ return appManager.getApplicationTypes().get(selectedAppType
+ .getSelectedKey(state));
+ }
+
+ protected Optional getSelectedAppInstance(
+ final PageState state) {
+
+ if (selectedAppInstance.getSelectedKey(state) == null
+ || selectedAppInstance.getSelectedKey(state).isEmpty()) {
+ return Optional.empty();
+ } else {
+ final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
+ .findBean(ApplicationRepository.class);
+
+ final CcmApplication result = appRepo.findById(Long.parseLong(
+ selectedAppInstance.getSelectedKey(state)));
+ return Optional.of(result);
+ }
+ }
+
+}
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/ApplicationsTab.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/ApplicationsTab.java
index 69e1c3073..524caf2fa 100644
--- a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/ApplicationsTab.java
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/ApplicationsTab.java
@@ -20,6 +20,7 @@ package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.BoxPanel;
+import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
@@ -30,10 +31,18 @@ import com.arsdigita.bebop.Tree;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.LayoutPanel;
+import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.web.ApplicationType;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import static com.arsdigita.ui.admin.AdminUiConstants.*;
/**
@@ -54,6 +63,9 @@ public class ApplicationsTab extends LayoutPanel {
private final Text placeholderSingletonSettings;
private final BoxPanel appInfo;
+ private final Map instanceForms;
+ private final Map settingsPanes;
+
public ApplicationsTab() {
super();
@@ -67,6 +79,9 @@ public class ApplicationsTab extends LayoutPanel {
selectedAppInstance = new ParameterSingleSelectionModel<>(
selectedAppInstanceParam);
+ instanceForms = new HashMap<>();
+ settingsPanes = new HashMap<>();
+
applicationTree = new Tree(new ApplicationTreeModelBuilder());
applicationTree.addChangeListener(e -> {
final PageState state = e.getPageState();
@@ -155,6 +170,39 @@ public class ApplicationsTab extends LayoutPanel {
appInfo.add(appInfoSheet);
managementPanel.add(appInfo);
+ final org.libreccm.web.ApplicationManager appManager = CdiUtil
+ .createCdiUtil().findBean(org.libreccm.web.ApplicationManager.class);
+ final Map appTypes = appManager
+ .getApplicationTypes();
+
+ appTypes.entrySet().forEach(e -> {
+ final String appTypeName = e.getKey();
+ final Class extends AbstractAppInstanceForm> instanceFormClass
+ = e
+ .getValue().instanceForm();
+ final Class extends AbstractAppSettingsPane> settingsPaneClass
+ = e
+ .getValue().settingsPane();
+ final boolean singleton = e.getValue().singleton();
+
+ if (singleton) {
+ final AbstractAppSettingsPane settingsPane = createSettingsPane(
+ settingsPaneClass);
+ managementPanel.add(settingsPane);
+ settingsPanes.put(appTypeName, settingsPane);
+ } else {
+ final AbstractAppInstanceForm instanceForm = createInstanceForm(
+ instanceFormClass);
+ managementPanel.add(instanceForm);
+ instanceForms.put(appTypeName, instanceForm);
+ final AbstractAppSettingsPane settingsPane = createSettingsPane(
+ settingsPaneClass);
+ managementPanel.add(settingsPane);
+ settingsPanes.put(appTypeName, settingsPane);
+ }
+
+ });
+
setBody(managementPanel);
}
@@ -175,23 +223,33 @@ public class ApplicationsTab extends LayoutPanel {
protected void showManagementLinks(final PageState state) {
managementLinks.setVisible(state, true);
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
}
protected void hideManagementLinks(final PageState state) {
managementLinks.setVisible(state, false);
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
}
protected void showInstances(final PageState state) {
placeholderInstances.setVisible(state, true);
placeholderSingletonSettings.setVisible(state, false);
appInfo.setVisible(state, false);
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
}
protected void hideInstances(final PageState state) {
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
placeholderInstances.setVisible(state, false);
}
protected void showSingletonAppSettings(final PageState state) {
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
placeholderInstances.setVisible(state, false);
placeholderSingletonSettings.setVisible(state, true);
appInfo.setVisible(state, false);
@@ -199,18 +257,80 @@ public class ApplicationsTab extends LayoutPanel {
protected void hideSingletonAppSettings(final PageState state) {
placeholderSingletonSettings.setVisible(state, false);
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
}
protected void showAppInfo(final PageState state) {
placeholderInstances.setVisible(state, false);
placeholderSingletonSettings.setVisible(state, false);
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
appInfo.setVisible(state, true);
}
protected void hideAppInfo(final PageState state) {
+ hideAllInstanceForms(state);
+ hideAllSettingsPanes(state);
appInfo.setVisible(state, false);
}
+ private void hideAllInstanceForms(final PageState state) {
+ instanceForms.values().forEach(f -> {
+ f.setVisible(state, false);
+ });
+ }
+
+ private void hideAllSettingsPanes(final PageState state) {
+ settingsPanes.values().forEach(p -> {
+ p.setVisible(state, false);
+ });
+ }
+
+ private AbstractAppInstanceForm createInstanceForm(
+ Class extends AbstractAppInstanceForm> instanceFormClass) {
+
+ try {
+ final Constructor extends AbstractAppInstanceForm> constructor
+ = instanceFormClass
+ .getConstructor(ParameterSingleSelectionModel.class,
+ ParameterSingleSelectionModel.class);
+
+ return constructor.newInstance(selectedAppType,
+ selectedAppInstance);
+ } catch (NoSuchMethodException |
+ SecurityException |
+ InstantiationException |
+ IllegalAccessException |
+ IllegalArgumentException |
+ InvocationTargetException ex) {
+ throw new UncheckedWrapperException(ex);
+ }
+
+ }
+
+ private AbstractAppSettingsPane createSettingsPane(
+ Class extends AbstractAppSettingsPane> settingsPaneClass) {
+
+ try {
+ final Constructor extends AbstractAppSettingsPane> constructor
+ = settingsPaneClass
+ .getDeclaredConstructor(ParameterSingleSelectionModel.class,
+ ParameterSingleSelectionModel.class);
+
+ return constructor.newInstance(selectedAppType,
+ selectedAppInstance);
+
+ } catch (NoSuchMethodException |
+ SecurityException |
+ InstantiationException |
+ IllegalAccessException |
+ IllegalArgumentException |
+ InvocationTargetException ex) {
+ throw new UncheckedWrapperException(ex);
+ }
+ }
+
private class SingletonAppSettingsLink extends ActionLink {
public SingletonAppSettingsLink(final GlobalizedMessage label) {
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationInstanceForm.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationInstanceForm.java
new file mode 100644
index 000000000..2c6140393
--- /dev/null
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationInstanceForm.java
@@ -0,0 +1,47 @@
+/*
+ * 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.applications;
+
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.bebop.Text;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class DefaultApplicationInstanceForm
+ extends AbstractAppInstanceForm {
+
+ public DefaultApplicationInstanceForm(
+ final String name,
+ final ParameterSingleSelectionModel selectedAppType,
+ final ParameterSingleSelectionModel selectedAppInstance) {
+
+ super(name, selectedAppType, selectedAppInstance);
+
+ }
+
+ @Override
+ protected void createWidgets() {
+ add(new Text("placeholder"));
+ }
+
+
+
+}
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationSettingsPane.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationSettingsPane.java
new file mode 100644
index 000000000..6bc63ccff
--- /dev/null
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/applications/DefaultApplicationSettingsPane.java
@@ -0,0 +1,45 @@
+/*
+ * 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.applications;
+
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.bebop.Text;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class DefaultApplicationSettingsPane
+ extends AbstractAppSettingsPane {
+
+ public DefaultApplicationSettingsPane(
+ final ParameterSingleSelectionModel selectedAppType,
+ final ParameterSingleSelectionModel selectedAppInstance) {
+
+ super(selectedAppType, selectedAppInstance);
+ }
+
+ @Override
+ protected void createWidgets() {
+ add(new Text(""));
+ }
+
+
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
index e582b6cf0..e1365686e 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
@@ -18,6 +18,10 @@
*/
package org.libreccm.web;
+import com.arsdigita.ui.admin.applications.AbstractAppInstanceForm;
+import com.arsdigita.ui.admin.applications.AbstractAppSettingsPane;
+import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
+import com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -58,11 +62,11 @@ public @interface ApplicationType {
* bundle. Defaults to {@code application_title}
*
* @return
- *
- * @return
+ *
+ * @return
*/
String titleKey() default "application_title";
-
+
/**
* The (optional) key for the description of the application in its resource
* bundle. Defaults to {@code application_desc}
@@ -70,7 +74,7 @@ public @interface ApplicationType {
* @return
*/
String descKey() default "application_desc";
-
+
/**
* The application type class. Default is {@link CcmApplication}. Most
* application types will no need to extend these class and can leave the
@@ -111,9 +115,9 @@ public @interface ApplicationType {
* @return
*/
Class extends ApplicationCreator> creator();
-
- //Class extends AbstractApplicationTypePane> appTypePane default com.arsdigita.ui.admin.applications.DefaultApplicationTypePane.class;
-
-
+
+ Class extends AbstractAppInstanceForm> instanceForm() default DefaultApplicationInstanceForm.class;
+
+ Class extends AbstractAppSettingsPane> settingsPane() default DefaultApplicationSettingsPane.class;
}
diff --git a/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java b/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java
index c40148db6..3433156d9 100644
--- a/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java
+++ b/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java
@@ -40,8 +40,7 @@ import org.libreccm.web.ApplicationType;
@ApplicationType(name = ShortcutsConstants.SHORTCUTS_APP_TYPE,
descBundle = "org.libreccm.shortcuts.ShortcutsResources",
singleton = true,
- creator = ShortcutsApplicationCreator.class)}
-)
+ creator = ShortcutsApplicationCreator.class)})
public class Shortcuts implements CcmModule {
@Override
diff --git a/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources.properties b/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources.properties
new file mode 100644
index 000000000..5844878b0
--- /dev/null
+++ b/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources.properties
@@ -0,0 +1,19 @@
+# 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
+
+application_title=Shortcuts
+application_desc=Manage short URLs for internal and external redirects.
diff --git a/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources_de.properties b/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources_de.properties
new file mode 100644
index 000000000..5844878b0
--- /dev/null
+++ b/ccm-shortcuts/src/main/resources/org/libreccm/shortcuts/ShortcutsResources_de.properties
@@ -0,0 +1,19 @@
+# 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
+
+application_title=Shortcuts
+application_desc=Manage short URLs for internal and external redirects.