Search in sources :

Example 1 with WebSession

use of com.genexus.webpanels.WebSession in project JavaClasses by genexuslabs.

the class GXGridStateHandler method saveGridState.

public void saveGridState() {
    WebSession session = ((HttpContext) context.getHttpContext()).getWebSession();
    state.fromJSonString(session.getValue(gridName));
    runVarsToState();
    session.setValue(gridName, state.toJSonString());
    dirty = true;
}
Also used : WebSession(com.genexus.webpanels.WebSession) HttpContext(com.genexus.internet.HttpContext)

Example 2 with WebSession

use of com.genexus.webpanels.WebSession in project JavaClasses by genexuslabs.

the class GXGridStateHandler method getState.

public SdtGridState getState() {
    try {
        if (dirty || state == null) {
            HttpContext httpContext = (HttpContext) context.getHttpContext();
            WebSession session = httpContext.getWebSession();
            state = new SdtGridState(context);
            state.fromJSonString(session.getValue(gridName));
            dirty = false;
        }
        return state;
    } catch (Exception ex) {
        logger.error("Can't create " + sdtGridStateClass, ex);
        return null;
    }
}
Also used : WebSession(com.genexus.webpanels.WebSession) HttpContext(com.genexus.internet.HttpContext)

Example 3 with WebSession

use of com.genexus.webpanels.WebSession in project JavaClasses by genexuslabs.

the class GXGridStateHandler method loadGridState.

public void loadGridState() {
    HttpContext httpContext = (HttpContext) context.getHttpContext();
    HttpRequest httpRequest = httpContext.getHttpRequest();
    if (GXutil.strcmp(httpRequest.getMethod(), "GET") == 0) {
        WebSession session = httpContext.getWebSession();
        state = new SdtGridState(context);
        state.fromJSonString(session.getValue(gridName));
        runVarsFromState();
        dirty = true;
    }
}
Also used : HttpRequest(com.genexus.internet.HttpRequest) WebSession(com.genexus.webpanels.WebSession) HttpContext(com.genexus.internet.HttpContext)

Example 4 with WebSession

use of com.genexus.webpanels.WebSession in project JavaClasses by genexuslabs.

the class HttpContext method getLanguage.

public String getLanguage() {
    if (currentLanguage == null) {
        WebSession session = getWebSession();
        String language = session != null ? session.getAttribute(GXLanguage) : null;
        if (language != null && !language.equals("")) {
            currentLanguage = language;
        } else {
            // Por ahora obtengo el del modelo, mas adelante puede haber uno por cada session
            currentLanguage = Application.getClientPreferences().getProperty("LANG_NAME", "English");
        }
    }
    return currentLanguage;
}
Also used : WebSession(com.genexus.webpanels.WebSession)

Example 5 with WebSession

use of com.genexus.webpanels.WebSession in project JavaClasses by genexuslabs.

the class GXGridStateHandler method setState.

public void setState(SdtGridState state) {
    this.state = state;
    String jsonState = state.toJSonString();
    HttpContext httpContext = (HttpContext) context.getHttpContext();
    WebSession session = httpContext.getWebSession();
    session.setValue(gridName, jsonState);
}
Also used : WebSession(com.genexus.webpanels.WebSession) HttpContext(com.genexus.internet.HttpContext)

Aggregations

WebSession (com.genexus.webpanels.WebSession)6 HttpContext (com.genexus.internet.HttpContext)4 HttpRequest (com.genexus.internet.HttpRequest)1 HashMap (java.util.HashMap)1