/*
 * Copyright (c) 2015 Denys Lebediev and contributors. All rights reserved.
 * The use and distribution terms for this software are covered by the
 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 * which can be found in the file LICENSE at the root of this distribution.
 * By using this software in any fashion, you are agreeing to be bound by
 * the terms of this license.
 * You must not remove this notice, or any other, from this software.
 */

package flatgui.samples;

import flatgui.core.FGTemplate;
import flatgui.core.IFGTemplate;
import flatgui.core.websocket.FGAppServer;

import java.io.InputStream;
import java.util.Scanner;

/**
 * @author Denis Lebedev
 */
public class FGCompoundDemoServer
{
    public static final String CONTAINER_NS = "compound";
    public static final String CONTAINER_VAR_NAME = "compoundpanel";
    private static final int PORT = 13100;


    public static void main(String[] args) throws Exception
    {
        InputStream is = FGCompoundDemoServer.class.getClassLoader().getResourceAsStream("flatgui/samples/forms/compound.clj");
        String sourceCode = new Scanner(is).useDelimiter("\\Z").next();

        IFGTemplate bookPanelTemplate = new FGTemplate(sourceCode, CONTAINER_NS, CONTAINER_VAR_NAME);

        FGAppServer server = new FGAppServer(bookPanelTemplate, PORT);
        server.start();
        server.join();
    }
}


@@ -907,16 +907,215 @@
 13100;%0A%0A
+    private static final String FOCUS_CONTAINER_NS = %22fdemo%22;%0A    private static final String FOCUS_CONTAINER_VAR_NAME = %22fdemopanel%22;%0A    private static final String FOCUS_MAPPING = %22focus_sample%22;%0A
 %0A    pub
@@ -1193,17 +1193,31 @@
 tStream 
-i
+compoundSampleI
 s = FGCo
@@ -1330,17 +1330,31 @@
  String 
-s
+compoundSampleS
 ourceCod
@@ -1369,17 +1369,31 @@
 Scanner(
-i
+compoundSampleI
 s).useDe
@@ -1415,17 +1415,16 @@
 next();%0A
-%0A
         
@@ -1435,25 +1435,29 @@
 emplate 
-bookPanel
+compondSample
 Template
@@ -1474,17 +1474,31 @@
 emplate(
-s
+compoundSampleS
 ourceCod
@@ -1585,33 +1585,465 @@
 ver(
-bookPanelTemplate, PORT);
+compondSampleTemplate, PORT);%0A%0A%0A        InputStream focusSampleIs = FGCompoundDemoServer.class.getClassLoader().getResourceAsStream(%22flatgui/samples/forms/fdemo.clj%22);%0A        String focusSampleSourceCode = new Scanner(focusSampleIs).useDelimiter(%22%5C%5CZ%22).next();%0A        IFGTemplate focusSampleTemplate = new FGTemplate(focusSampleSourceCode, FOCUS_CONTAINER_NS, FOCUS_CONTAINER_VAR_NAME);%0A        server.addApplication(FOCUS_MAPPING, focusSampleTemplate);%0A%0A
 %0A   

Prepare live demo with new focus manager