public static String transform(String filename) {

        List<String> knownComponents = new ArrayList<String>() {
            private static final long serialVersionUID = 1L;
            {
                add("panel");
                add("table");
            }
        };

        List<String> knownProperties = new ArrayList<String>() {
            private static final long serialVersionUID = 1L;
            {
                add("id");
                add("x");
                add("y");
                add("width");
                add("height");
            }
        };

        // String s =
        // "panel {    id \"mainPanel\"    table {      id \"table1Table\"      x 20     y 20      width 300     height 150    }  }";

        URL resource = Resources.getResource(filename);
        String code = "";
        try {
            code = Resources.toString(resource, Charsets.UTF_8);
        } catch (IOException e) {
            e.printStackTrace();
        }

        code = code.replaceAll("\r\n", " ");
        String[] tokens = code.split(" ");

        component = null;
        String property = "";

        for (int i = 0; i < tokens.length; i++) {

            String token = tokens[i];

            if (knownComponents.contains(token)) { // new component
                Component c = new Component();
                c.setType(token);
                if (component != null) {
                    component.addChild(c);
                    component = c;
                } else {
                    component = c;
                    component.setParent(c);
                }
            } else if (knownProperties.contains(token)) { // new property
                property = token;
            } else if ("{".equals(token)) {
            } else if ("}".equals(token)) {
                component = component.getParent();
            } else if (token.trim().length() > 0) {
                token = token.replace("\"", "");
                component.addProperty(property, token);
                if (property.equals("id")) {
                    component.setName(token);
                }
            }

        }

        String cssPath = Resources.getResource("style/style.css").getPath();
        cssPath = cssPath.substring(1);
        cssPath = cssPath.replaceAll("/", "\\\\");

        String jQueryPath = Resources.getResource("script/jquery-1.10.2.js").getPath();
        jQueryPath = jQueryPath.substring(1);
        jQueryPath = jQueryPath.replaceAll("/", "\\\\");

        String jQueryUIPath = Resources.getResource("script/jquery-ui.min.js").getPath();
        jQueryUIPath = jQueryUIPath.substring(1);
        jQueryUIPath = jQueryUIPath.replaceAll("/", "\\\\");

        String mainScript = Resources.getResource("script/main.js").getPath();
        mainScript = mainScript.substring(1);
        mainScript = mainScript.replaceAll("/", "\\\\");

        String html = "<!DOCTYPE html>\n";
        html += "<html>\n";
        html += "<head>\n";
        html += "  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\" />\n";
        html += "  <link rel=\"stylesheet\" type=\"text/css\" href=\"" + cssPath + "\">\n";
        html += "  <script type=\"text/javascript\" src=\"" + jQueryPath + "\"></script>\n";
        html += "  <script type=\"text/javascript\" src=\"" + jQueryUIPath + "\"></script>\n";
        html += "</head>\n";
        html += "<body>\n";
        html += "\n";
        html += new WebTransformer().html(component, "  ");
        html += "\n";
        html += "  <script type=\"text/javascript\" src=\"" + mainScript + "\"></script>\n";
        html += "</body>\n";
        html += "</html>";

        System.out.println(html);
        return html;

    }