• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TableTagParameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * The last page should show up in the list.
 * @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.", "6, 7, 8, [9], 10", pagination.getText());

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


示例17: doTest

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
/**
 * Check sorted column.
 * @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 pe = new ParamEncoder("table");

    request.setParameter(pe.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug("RESPONSE: " + response.getText());
    }
    // <span class="pagebanner">3 items found, displaying 1 to 1.</span>

    HTMLElement pagebanner = response.getElementWithID("pagebanner");
    Assert.assertEquals("Wrong page banner", "4|3|4", pagebanner.getText());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:Displ304Test.java


示例18: 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.assertNotNull("Not in page 2 as expected?", response.getElementWithID("PAGETWO"));

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


示例19: runPage

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
public byte[] runPage(String jspPage) throws Exception
{

    ParamEncoder encoder = new ParamEncoder("table");
    String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);
    WebRequest request = new GetMethodWebRequest(getJspUrl(jspPage));

    // this will force media type initialization
    ExportViewFactory.getInstance();
    MediaTypeEnum excelMedia = MediaTypeEnum.EXCEL;
    Assert.assertNotNull("Excel export view not correctly registered.", excelMedia);
    request.setParameter(mediaParameter, Integer.toString(excelMedia.getCode()));

    WebResponse response = runner.getResponse(request);

    // we are really testing an xml output?
    Assert
        .assertEquals("Expected a different content type.", "application/vnd.ms-excel", response.getContentType());

    InputStream stream = response.getInputStream();
    byte[] result = new byte[9000];
    stream.read(result);
    return result;
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:25,代码来源:ExportExcelTest.java


示例20: MockDisplayTablePageContext

import org.displaytag.tags.TableTagParameters; //导入依赖的package包/类
public MockDisplayTablePageContext(String exportType, ApplicationContext applicationContext) 
{	
	request.setupAddParameter(new ParamEncoder(null).encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE), exportType);

	HashMap<String,String> map = new HashMap<String,String>();
	map.put(TableTagParameters.BEAN_BUFFER, "placeholder");
	
	request.setAttribute(TableTag.FILTER_CONTENT_OVERRIDE_BODY, map);	
	
	servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
}
 
开发者ID:mtpettyp,项目名称:openreports,代码行数:12,代码来源:MockDisplayTablePageContext.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Sequential类代码示例发布时间:2022-05-22
下一篇:
Java GraphvizGraph类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap