当前位置: 首页>>代码示例>>Java>>正文


Java TableTagParameters类代码示例

本文整理汇总了Java中org.displaytag.tags.TableTagParameters的典型用法代码示例。如果您正苦于以下问题:Java TableTagParameters类的具体用法?Java TableTagParameters怎么用?Java TableTagParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TableTagParameters类属于org.displaytag.tags包,在下文中一共展示了TableTagParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isDataSortByExternal

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * 是否外部排序.
 * 
 * @param cq
 *            the cq
 * @param request
 *            the request
 * @return true, if is data sort by external
 */
public static boolean isDataSortByExternal(CriteriaQuery cq, HttpServletRequest request) {
	// String sortColumn = request.getParameter((new
	// ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_PAGE)));
	String sortName = request.getParameter((new ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_SORT)));
	String sortOrder = request.getParameter((new ParamEncoder("item").encodeParameterName(TableTagParameters.PARAMETER_ORDER)));
	if (AppUtils.isNotBlank(sortName)) {
		if ("1".equals(sortOrder)) {
			cq.addOrder("desc", sortName);
		} else {
			cq.addOrder("asc", sortName);
		}
		return true;
	}
	return false;
}
 
开发者ID:8090boy,项目名称:gomall.la,代码行数:25,代码来源:FoundationUtil.java

示例2: addHeader

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * @see javax.servlet.http.HttpServletResponse#addHeader(java.lang.String, java.lang.String)
 */
@Override
public void addHeader(String name, String value)
{
    // if the "magic parameter" is set, a table tag is going to call getOutputStream()
    if (TableTagParameters.PARAMETER_EXPORTING.equals(name))
    {
        log.debug("Magic header received, real response is now accessible");
        state = true;
    }
    else
    {
        if (!ArrayUtils.contains(FILTERED_HEADERS, StringUtils.lowerCase(name)))
        {
            ((HttpServletResponse) getResponse()).addHeader(name, value);
        }
    }
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:21,代码来源:BufferedResponseWrapper13Impl.java

示例3: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Check that model modifications made by table decorator specified with in the decorator property the table tag
 * show up in the csv export.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    request.setParameter(mediaParameter, Integer.toString(this.getCode()));

    WebResponse response = runner.getResponse(request);

    Assert.assertEquals("Expected a different content type.", this.getMimeType(), response.getContentType());
    String responseText = response.getText();

    String[] rows = StringUtils.split(responseText, "\n");

    Assert.assertEquals("Wrong number of rows exported", 4, rows.length);

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:Displ292Test.java

示例4: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test with filter enabled and no export written.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    // this will enable the filter!
    request.setParameter(TableTagParameters.PARAMETER_EXPORTING, "1");

    WebResponse response = runner.getResponse(request);

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Expected 1 table in result.", 1, tables.length);

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:22,代码来源:ExportFilterErrorTest.java

示例5: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Check that model modifications made by table decorator specified with in the decorator property the table tag
 * show up in the csv export.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    request.setParameter(mediaParameter, Integer.toString(this.getCode()));

    WebResponse response = runner.getResponse(request);

    Assert.assertEquals("Expected a different content type.", this.getMimeType(), response.getContentType());
    String responseText = response.getText();
    boolean expectedTextPresent = responseText != null && responseText.indexOf(ModelDecorator.DECORATED_VALUE) > -1;
    Assert.assertTrue("Missing content.", expectedTextPresent);
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:24,代码来源:Displ298CsvTest.java

示例6: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * No exception when an invalid page is requested.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "9");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    HTMLElement pagination = response.getElementWithID("pagination");
    Assert.assertNotNull("Paging banner not found.", pagination);
    Assert.assertEquals("Pagination links are not as expected.", "7, 8, [9], 10, 11", pagination.getText());

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:Displ109Test.java

示例7: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test that headers are correctly removed.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    // test keep
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.XML.getCode()));

    // this will enable the filter!
    request.setParameter(TableTagParameters.PARAMETER_EXPORTING, "1");
    WebResponse response = runner.getResponse(request);

    Assert.assertNull("Header Cache-Control not overwritten", response.getHeaderField("Cache-Control"));
    Assert.assertNull("Header Expires not overwritten", response.getHeaderField("Expires"));
    Assert.assertNull("Header Pragma not overwritten", response.getHeaderField("Pragma"));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:ExportHeadersFilterTest.java

示例8: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test response encoding.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    // test keep
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    // test remove
    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);
    request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.XML.getCode()));

    // this will enable the filter!
    request.setParameter(TableTagParameters.PARAMETER_EXPORTING, "1");

    WebResponse response = runner.getResponse(request);

    String encoding = response.getCharacterSet();

    Assert.assertEquals("Encoding is not utf-8 as expected.", "utf-8", encoding);

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:28,代码来源:ExportUTF8FilterTest.java

示例9: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test link generated using href="".
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    WebLink[] links = response.getLinks();
    Assert.assertEquals("Wrong number of links in result.", 1, links.length);

    URLAssert.assertEquals("/context/goforit?param=ant&d-148916-s=0&d-148916-o=2", links[0].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:30,代码来源:Displ117Test.java

示例10: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test link generated using href="".
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of table in result.", 2, tables.length);

    WebLink[] links = response.getLinks();
    Assert.assertEquals("Wrong number of links in result.", 2, links.length);

    URLAssert.assertEquals("?d-148916-s=0&d-148916-o=1", links[0].getURLString());
    URLAssert.assertEquals("?more=true&d-148916-s=0&d-148916-o=1", links[1].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:31,代码来源:Displ112Test.java

示例11: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * No exception when an invalid page is requested.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "3");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables.", 1, tables.length);
    Assert.assertEquals("Wrong number of rows.", 2, tables[0].getRowCount());
    Assert.assertEquals("Column content missing?", "ant", tables[0].getCellAsText(1, 0));

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:Displ136Test.java

示例12: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Last page should be loaded.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "3");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    HTMLElement pagination = response.getElementWithID("pagination");
    Assert.assertNotNull("Paging banner not found.", pagination);
    Assert.assertEquals("Pagination links are not as expected.", "1, [2]", pagination.getText());

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:Displ212Test.java

示例13: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test for content disposition and filename.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.XML.getCode()));

    WebResponse response = runner.getResponse(request);

    // we are really testing an xml output?
    Assert.assertEquals("Expected a different content type.", "text/xml", response.getContentType());
    Assert.assertEquals(
        "Wrong or missing disposition/filename.",
        "attachment; filename=\"file.txt\"",
        response.getHeaderField("CONTENT-DISPOSITION"));

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:ExportFileNameTest.java

示例14: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test for content disposition and filename.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.CSV.getCode()));

    WebResponse response = runner.getResponse(request);

    // we are really testing an xml output?
    Assert.assertEquals("Expected a different content type.", "text/csv", response.getContentType());
    Assert.assertEquals("Wrong content.", "bee,1\nbee,2\nbee,3\n", response.getText());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:23,代码来源:ExportFullTest.java

示例15: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Test response encoding.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    // test keep
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    // test remove
    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

    request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.XML.getCode()));

    WebResponse response = runner.getResponse(request);

    String encoding = response.getCharacterSet();

    Assert.assertEquals("Encoding is not utf-8 as expected", "utf-8", encoding);

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:ExportUTF8Test.java


注:本文中的org.displaytag.tags.TableTagParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。