本文整理汇总了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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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"));
}
示例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);
}
示例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());
}
示例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());
}
示例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));
}
示例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());
}
示例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"));
}
示例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());
}
示例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);
}