Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在运行时更改GWT/SmartGWT主题_Gwt_Smartgwt - Fatal编程技术网

如何在运行时更改GWT/SmartGWT主题

如何在运行时更改GWT/SmartGWT主题,gwt,smartgwt,Gwt,Smartgwt,我想在运行时从代码更改SmartGWT应用程序的主题 我可以在SmartGWT showcase中看到此功能,但在SmartGWT showcase中看不到任何用于此功能的代码 我现在正在做的是 这是我的XML类 <?xml version="1.0" encoding="UTF-8"?> <inherits name="com.smartgwt.SmartGwtNoTheme"/> <inherits name="com.sma

我想在运行时从代码更改SmartGWT应用程序的主题

我可以在SmartGWT showcase中看到此功能,但在SmartGWT showcase中看不到任何用于此功能的代码

我现在正在做的是

这是我的XML类

<?xml version="1.0" encoding="UTF-8"?>
         <inherits name="com.smartgwt.SmartGwtNoTheme"/>
         <inherits name="com.smartclient.theme.graphite.Graphite"/>
         <inherits name="com.smartclient.theme.blackops.BlackOps"/>
         <inherits name="com.smartclient.theme.enterprise.Enterprise"/>
         <inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue"/>
这里我不确定确切的路径是什么, 我的类路径中有smatgwt-skins.jar

谢谢

当您更改外观并重新加载应用程序时,html文件中的“alert(currentSkin)”行会显示什么?它是否显示新选择的皮肤名称

看起来您正在使用SmartGWT showcase中的代码,或者恰好与之几乎相同

当您更改外观并重新加载应用程序时,html文件中的“alert(currentSkin)”行显示什么?它是否显示新选择的皮肤名称

看起来您正在使用SmartGWT showcase中的代码,或者恰好与之几乎相同

也许这会有帮助:

查看Smartclient论坛了解这种情况,这里有很多相关信息。

也许这会有帮助:

查看Smartclient论坛了解这种情况,有很多相关信息

             <title>My Web</title>


              <script>
          function readCookie(name) {
        var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for ( var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ')
            c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0)
            return c.substring(nameEQ.length, c.length);
    }
    return null;
}

// Determine what skin file to load
var currentSkin = readCookie('skin');
if (currentSkin == null){
    currentSkin = "Enterprise";
}
alert(currentSkin);
        </script>
           <script type="text/javascript">
        document.write("<" + "script src=testtheme/sc/skins/"
        + currentSkin + "/load_skin.js><"+"/script>");
           </script>     
       SelectItem selectItem = new SelectItem("skin", "Choose Skin");
    DynamicForm df = new DynamicForm();
    hpnlMain.add(df);
    df.setItems(selectItem);
    selectItem.setWidth(130);
    java.util.LinkedHashMap<String, String> valueMap = new java.util.LinkedHashMap<String, String>();
    valueMap.put("Enterprise", "Enterprise");
    valueMap.put("EnterpriseBlue", "EnterpriseBlue");
    valueMap.put("TreeFrog", "TreeFrog");
    valueMap.put("BlackOps", "BlackOps");
    valueMap.put("Graphite", "Graphite");


    selectItem.setValueMap(valueMap);

    String currentSkin = Cookies.getCookie("skin");

    if (currentSkin == null) {
        currentSkin = "Enterprise";
    }
    selectItem.setDefaultValue(currentSkin);
    selectItem.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            // TODO Auto-generated method stub
            Cookies.setCookie("skin", event.getValue().toString());
            Window.Location.reload();
        }
    });
         <script type="text/javascript">
document.write("<" + "script src=testtheme/sc/skins/"
        + currentSkin + "/load_skin.js><"+"/script>");