Package net.jsunit.action

Examples of net.jsunit.action.BrowserSelectionAware


import java.util.*;

public class BrowserSelectionInterceptor implements Interceptor {

    public String intercept(ActionInvocation invocation) throws Exception {
        BrowserSelectionAware aware = (BrowserSelectionAware) invocation.getAction();
        String[] browserIds = ServletActionContext.getRequest().getParameterValues("browserId");
        List<Browser> allBrowsers = aware.getAllBrowsers();
        Set<Browser> selectedBrowsers = null;
        if (browserIds != null && browserIds.length > 0) {
            try {
                selectedBrowsers = selectedBrowsers(browserIds, allBrowsers);
            } catch (InvalidBrowserIdException e) {
                aware.setErrorMessage("Invalid browser ID: " + e.getIdString());
            }
        }
        List<Browser> result;
        if (selectedBrowsers == null)
            result = allBrowsers;
        else
            result = new ArrayList<Browser>(selectedBrowsers);
        Collections.sort(result);
        aware.setSelectedBrowsers(result);
        return invocation.invoke();
    }
View Full Code Here

TOP

Related Classes of net.jsunit.action.BrowserSelectionAware

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.