//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.wb.controls;

import com.wb.common.Resource;
import com.wb.util.StringUtil;
import com.wb.util.WebUtil;

public class ExtGrid extends ExtControl {
    public ExtGrid() {
    }

    protected void extendConfig() throws Exception {
        String syncStateId = this.gs("syncStateId");
        String allowExportUrl = this.gs("allowExportUrl");
        String gridName = this.gs("itemId");
        syncStateId = request.getQueryString().replace("xwl=","").replace("&xwlt=1","") + "#" + gridName;
        if (!allowExportUrl.isEmpty()) {
            if (this.hasItems) {
                this.headerScript.append(',');
            } else {
                this.hasItems = true;
            }
            this.headerScript.append("hideExportBtns:true");
        }

        if (!syncStateId.isEmpty()) {
            String headersData = this.getHeadersData(syncStateId);

            if (!StringUtil.isEmpty(headersData)) {
                if (this.hasItems) {
                    this.headerScript.append(',');
                } else {
                    this.hasItems = true;
                }

                this.headerScript.append("syncHeadersData:");
                           this.headerScript.append(headersData);
            }
        }

    }

    public String getHeadersData(String syncStateId) {
        //获取wb_resources,通过 gridState#+syncStateId+userid
        return Resource.getString(this.request, "gridState#" + syncStateId, (String)null);
    }
}
