package org.jboss.as.console.client.tools.modelling.workbench.repository;

import org.jboss.as.console.mbui.model.mapping.DMRMapping;
import org.useware.kernel.model.Dialog;
import org.useware.kernel.model.mapping.Mapping;
import org.useware.kernel.model.structure.Container;
import org.useware.kernel.model.structure.InteractionUnit;
import org.useware.kernel.model.structure.QName;
import org.useware.kernel.model.structure.builder.Builder;

import static org.jboss.as.console.mbui.model.StereoTypes.Form;
import static org.useware.kernel.model.structure.TemporalOperator.Concurrency;

/**
 * @author Heiko Braun
 * @date 5/14/13
 */
public class ServletContainerExample implements Sample {


    private final Dialog dialog;

    public ServletContainerExample() {
        this.dialog = build();
    }

    public Dialog build()
    {
        String ns = "org.jboss.undertow.servlet";

        // entities
        Mapping global = new DMRMapping()
                .setAddress("/{selected.profile}/subsystem=undertow/servlet-container=default/setting=jsp");


        Container overview = new Container(ns, "servletContainer", "Servlet Container", Concurrency);


        Container attributes = new Container(ns, "servletContainer#attributes", "Attributes", Form);
        Mapping attributesMapping = new DMRMapping()
                .addAttributes(
                        "trim-spaces", "smap",
                        "development", "keep-generated",
                        "recompile-on-fail","check-interval",
                        "scratch-dir","modification-test-interval",
                        "display-source-fragment","error-on-use-bean-invalid-class-attribute",
                        "java-encoding","tag-pooling",
                        "generate-strings-as-char-arrays","target-vm",
                        "x-powered-by","dump-smap",
                        "mapped-file","disabled",
                        "source-vm"

                );

        // structure & mapping
        InteractionUnit root = new Builder()
                .start(overview)
                    .mappedBy(global)
                    .add(attributes).mappedBy(attributesMapping)
                .end()
        .build();

        Dialog dialog = new Dialog(QName.valueOf("org.jboss.as:servlet-container"), root);
        return dialog;
    }

    @Override
    public String getName() {
        return "Servlet Container";
    }

    @Override
    public Dialog getDialog() {
        return dialog;
    }
}

@@ -68,16 +68,68 @@
 itory;%0A%0A
+import org.jboss.as.console.mbui.model.StereoTypes;%0A
 import o
@@ -429,16 +429,76 @@
 .QName;%0A
+import org.useware.kernel.model.structure.TemporalOperator;%0A
 import o
@@ -1255,27 +1255,64 @@
 ainer%22, 
-Concurrency
+TemporalOperator.Choice, StereoTypes.EditorPanel
 );%0A%0A%0A   
@@ -1389,25 +1389,27 @@
 utes%22, %22
-Attribute
+JSP Setting
 s%22, Form

rename JSP Settings