diff --git a/ccm-core/src/main/java/com/arsdigita/pagemodel/layout/ui/FlexLayoutComponentForm.java b/ccm-core/src/main/java/com/arsdigita/pagemodel/layout/ui/FlexLayoutComponentForm.java
new file mode 100644
index 000000000..f953ea6d1
--- /dev/null
+++ b/ccm-core/src/main/java/com/arsdigita/pagemodel/layout/ui/FlexLayoutComponentForm.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2018 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.pagemodel.layout.ui;
+
+import com.arsdigita.bebop.BoxPanel;
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.ui.admin.pagemodels.AbstractComponentModelForm;
+import com.arsdigita.ui.admin.pagemodels.PageModelsTab;
+
+import org.libreccm.pagemodel.layout.FlexLayout;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class FlexLayoutComponentForm
+ extends AbstractComponentModelForm {
+
+ public FlexLayoutComponentForm(
+ final PageModelsTab pageModelsTab,
+ final ParameterSingleSelectionModel selectedModelId,
+ final ParameterSingleSelectionModel selectedComponentId) {
+
+
+ super("FlexLayoutComponentForm",
+ pageModelsTab,
+ selectedModelId,
+ selectedComponentId);
+ }
+
+ @Override
+ protected void addWidgets() {
+
+ final BoxPanel horizontalPanel = new BoxPanel(BoxPanel.HORIZONTAL);
+
+ add(horizontalPanel);
+ }
+
+ @Override
+ protected FlexLayout createComponentModel() {
+ return new FlexLayout();
+ }
+
+ @Override
+ protected void updateComponentModel(final FlexLayout componentModel,
+ final PageState state,
+ final FormData data) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmCore.java b/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
index 3b3a96ef6..927c0b816 100644
--- a/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
+++ b/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
@@ -18,6 +18,7 @@
*/
package org.libreccm.core;
+import com.arsdigita.pagemodel.layout.ui.FlexLayoutComponentForm;
import com.arsdigita.ui.admin.AdminServlet;
import com.arsdigita.ui.admin.AdminUiConstants;
import com.arsdigita.ui.admin.applications.AdminApplicationCreator;
@@ -37,6 +38,8 @@ import org.libreccm.modules.InstallEvent;
import org.libreccm.modules.Module;
import org.libreccm.modules.ShutdownEvent;
import org.libreccm.modules.UnInstallEvent;
+import org.libreccm.pagemodel.PageModelComponentModel;
+import org.libreccm.pagemodel.layout.FlexLayout;
import org.libreccm.security.SystemUsersSetup;
import org.libreccm.web.ApplicationType;
@@ -47,6 +50,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
+import static com.arsdigita.ui.admin.AdminUiConstants.*;
+
/**
*
* @author Jens Pelzetter
@@ -56,17 +61,28 @@ import java.util.Properties;
descBundle = "com.arsdigita.ui.login.LoginResources",
singleton = true,
creator = LoginApplicationCreator.class,
- servlet = LoginServlet.class),
+ servlet = LoginServlet.class)
+ ,
@ApplicationType(name = AdminUiConstants.ADMIN_APP_TYPE,
descBundle = "com.arsdigita.ui.admin.AdminResources",
singleton = true,
creator = AdminApplicationCreator.class,
- servlet = AdminServlet.class),
+ servlet = AdminServlet.class)
+ ,
@ApplicationType(name = "org.libreccm.ui.admin.AdminFaces",
descBundle = "com.arsdigita.ui.admin.AdminResources",
singleton = true,
creator = AdminJsfApplicationCreator.class,
servletPath = "/admin-jsf/admin.xhtml")},
+ pageModelComponentModels = {
+ @PageModelComponentModel(
+ modelClass = FlexLayout.class,
+ editor = FlexLayoutComponentForm.class,
+ descBundle = ADMIN_BUNDLE,
+ titleKey = "ui.pagemodel.components.flexlayout.title",
+ descKey = "ui.pagemodel.components.flexlayout.desc"
+ )
+ },
configurations = {
com.arsdigita.bebop.BebopConfig.class,
com.arsdigita.dispatcher.DispatcherConfig.class,
@@ -104,7 +120,7 @@ public class CcmCore implements CcmModule {
LOGGER.info("Setting up admin-jsf application (/ccm/admin-jsf/)...");
final AdminJsfApplicationSetup adminJsfSetup
- = new AdminJsfApplicationSetup(event);
+ = new AdminJsfApplicationSetup(event);
adminJsfSetup.setup();
LOGGER.info("Setting up login application...");
diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/layout/FlexLayoutRenderer.java b/ccm-core/src/main/java/org/libreccm/pagemodel/layout/FlexLayoutRenderer.java
new file mode 100644
index 000000000..298e3520e
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/pagemodel/layout/FlexLayoutRenderer.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2018 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 org.libreccm.pagemodel.layout;
+
+import org.libreccm.pagemodel.ComponentModel;
+import org.libreccm.pagemodel.ComponentRenderer;
+import org.libreccm.pagemodel.ComponentRendererManager;
+import org.libreccm.pagemodel.RendersComponent;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@RequestScoped
+@RendersComponent(componentModel = FlexLayout.class)
+public class FlexLayoutRenderer implements ComponentRenderer {
+
+ @Inject
+ private ComponentRendererManager componentRendererManager;
+
+ @Override
+ public Map renderComponent(
+ final FlexLayout componentModel,
+ final Map parameters) {
+
+ Objects.requireNonNull(componentModel);
+ Objects.requireNonNull(parameters);
+
+ final Map result = new HashMap<>();
+ result.put("type", FlexLayout.class.getName());
+ result.put("direction", componentModel.getDirection().toString());
+
+ result.put("boxes",
+ componentModel
+ .getBoxes()
+ .stream()
+ .map(this::renderBox)
+ .collect(Collectors.toList()));
+
+ return result;
+ }
+
+ private Map renderBox(
+ final FlexBox box,
+ final Map parameters) {
+
+ final Map result = new HashMap<>();
+
+ result.put("order", box.getOrder());
+ result.put("size", box.getSize());
+
+ result.put("component",
+ renderComponent(box.getComponent(),
+ box.getComponent().getClass(),
+ parameters));
+
+ return result;
+ }
+
+ private Object renderComponent(
+ final ComponentModel componentModel,
+ final Class componentModelClass,
+ final Map parameters) {
+
+ final Optional> renderer = componentRendererManager
+ .findComponentRenderer(componentModelClass);
+
+ if (renderer.isPresent()) {
+ @SuppressWarnings("unchecked")
+ final M model = (M) componentModel;
+ return renderer.get().renderComponent(model, parameters);
+ } else {
+ return null;
+ }
+ }
+
+}