<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    lyyb2001

    只是為方便自己找記錄而已
    posts - 57, comments - 27, trackbacks - 0, articles - 5
      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理

    extremetable應(yīng)用

    Posted on 2008-02-29 15:30 skycity 閱讀(504) 評論(0)  編輯  收藏 所屬分類: J2EE技術(shù)
    ?自定義html視圖
    eXtremeTable使用View接口來生成HTML。你可以使用發(fā)行包已經(jīng)提供的視圖,或者你可以插入自己的視圖實現(xiàn)。如果要定義自己的視圖只需實現(xiàn)View接口,擴展AbstractHtmlView類便可。
    一個改變eXtremeTable工具條的實例:(定義兩個類)
    1.Mytoolbar.java
    public class MyToolbar extends TwoColumnTableLayout {
    ?????? ?public MyToolbar(HtmlBuilder html, TableModel model) {
    ?????? ??????? super(html, model);
    ?????? ??? }
    ?????? ??? protected boolean showLayout(TableModel model) {
    ?????? ??????? boolean showPagination = BuilderUtils.showPagination(model);
    ?????? ??????? boolean showExports = BuilderUtils.showExports(model);
    ?????? ??????? boolean showTitle = BuilderUtils.showTitle(model);
    ?????? ??????? if (!showPagination && !showExports && !showTitle) {
    ?????? ??????????? return false;
    ?????? ??????? }
    ?????? ??????? return true;
    ?????? ??? }
    ?????? ?? protected void columnLeft(HtmlBuilder html, TableModel model) {
    ?????? ??????? html.td(2).close();
    ?????? ??????? new TableBuilder(html, model).title();
    ?????? ??????? html.tdEnd();
    ?????? ??? }
    ?????? ??? protected void columnRight(HtmlBuilder html, TableModel model) {
    ?????? ??????? boolean showPagination = BuilderUtils.showPagination(model);
    ?????? ??????? boolean showExports = BuilderUtils.showExports(model);
    ?????? ??????? ToolbarBuilder toolbarBuilder = new ToolbarBuilder(html, model);
    ?????? ??????? html.td(2).align("right").close();
    ???????????????????? ??????? html.table(2).border("0").cellPadding("0").cellSpacing("1").styleClass(BuilderConstants.TOOLBAR_CSS).close();
    ?????? ??????? html.tr(3).close();
    ?????? ??????? if (showPagination) {
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.firstPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.prevPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.nextPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.lastPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.separator();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ???????????? // 在工具條里面添加一個文本框以便手動的控制頁面顯示的行數(shù)
    ?????? ??????????? /* StringBuffer action = new StringBuffer("javascript:");
    ?????? ??????????? TableActions ta = new TableActions(model);
    ?????? ??????????? int currentRowsDisplayed = model.getLimit().getCurrentRowsDisplayed()
    ???????????????????? ??? html.input("text").name(model.getTableHandler().prefixWithTableId() + TableConstants.ROWS_DISPLAYED).value(String.valueOf(currentRowsDisplayed);
    ?????? ??????????? action.append(ta.getClearedExportTableIdParameters());
    ?????? ??????????? String form = BuilderUtils.getForm(model);
    ?????? ??????????? action.append("document.forms.").append(form).append(".");
    ??????????????????????????? ?? action.append(model.getTableHandler().prefixWithTableId()).append(TableConstants.CURRENT_ROWS_DISPLAYED);
    ?????? ??????????? action.append(".value=").append("this.value").append(";");
    ?????? ??????????? action.append(ta.getFormParameter(TableConstants.PAGE, "1"));
    ?????? ??????????? action.append("if(event.keyCode==13){");
    ?????? ??????????? action.append(ta.getOnInvokeAction());
    ?????? ??????????? action.append("}");
    ?????? ??????????? html.onkeypress(action.toString());
    ?????? ??????????? html.xclose();
    ?????? ??????????? html.tdEnd();*/
    ?????? ???????????
    ?????? ??????????? html.td(4).style("width:10px").close();
    ?????? ??????????? html.newline();
    ?????? ??????????? html.tabs(4);
    ?????? ??????????? toolbarBuilder.rowsDisplayedDroplist();
    ?????? ??????????? html.img();
    ?html.src(BuilderUtils.getImage(model, BuilderConstants.TOOLBAR_ROWS_DISPLAYED_IMAGE));
    ?????? ???????????html.style("border:0");
    ?????? ??????????? html.alt("Rows Displayed");
    ?????? ??????????? html.xclose();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? if (showExports) {
    ?????? ??????????????? html.td(4).close();
    ?????? ??????????????? toolbarBuilder.separator();
    ?????? ?????????? ?????html.tdEnd();
    ?????? ??????????? }
    ?????? ??????? }
    ?????? ??????? if (showExports) {
    ?????? ??????????? Iterator iterator = model.getExportHandler().getExports().iterator();
    ?????? ??????????? for (Iterator iter = iterator; iter.hasNext();) {
    ?????? ??????????????? html.td(4).close();
    ?????? ??????????????? Export export = (Export) iter.next();
    ?????? ??????????????? toolbarBuilder.exportItemAsImage(export);
    ?????? ??????????????? html.tdEnd();
    ?????? ??????????? }
    ?????? ??????? }
    ?????? ??????? html.trEnd(3);
    ?????? ??????? html.tableEnd(2);
    ?????? ??????? html.newline();
    ?????? ??????? html.tabs(2);
    ?????? ??????? html.tdEnd();
    ?????? ??? }
    }
    2.MyView.java
    public class MyView?extends AbstractHtmlView {
    ?????? ?protected void beforeBodyInternal(TableModel model) {
    ?????? ??????? getTableBuilder().tableStart();
    ?????? ??????? getTableBuilder().theadStart();
    ?????? ??????? getTableBuilder().filterRow();
    ?????? ??????? getTableBuilder().headerRow();
    ?????? ??????? getTableBuilder().theadEnd();
    ?????? ??????? getTableBuilder().tbodyStart();
    ?????? ??? }
    ?????? ??? protected void afterBodyInternal(TableModel model) {
    ?????? ??????? getCalcBuilder().defaultCalcLayout();
    ?????? ??????? getTableBuilder().tbodyEnd();
    ?????? ??????? getTableBuilder().tableEnd();
    ?????? ??????? toolbar(getHtmlBuilder(), getTableModel());
    ?????? ??????? statusBar(getHtmlBuilder(), get自定義html視圖
    eXtremeTable使用View接口來生成HTML。你可以使用發(fā)行包已經(jīng)提供的視圖,或者你可以插入自己的視圖實現(xiàn)。如果要定義自己的視圖只需實現(xiàn)View接口,擴展AbstractHtmlView類便可。
    一個改變eXtremeTable工具條的實例:(定義兩個類)
    1.Mytoolbar.java
    public class MyToolbar extends TwoColumnTableLayout {
    ?????? ?public MyToolbar(HtmlBuilder html, TableModel model) {
    ?????? ??????? super(html, model);
    ?????? ??? }
    ?????? ??? protected boolean showLayout(TableModel model) {
    ?????? ??????? boolean showPagination = BuilderUtils.showPagination(model);
    ?????? ??????? boolean showExports = BuilderUtils.showExports(model);
    ?????? ??????? boolean showTitle = BuilderUtils.showTitle(model);
    ?????? ??????? if (!showPagination && !showExports && !showTitle) {
    ?????? ??????????? return false;
    ?????? ??????? }
    ?????? ??????? return true;
    ?????? ??? }
    ?????? ?? protected void columnLeft(HtmlBuilder html, TableModel model) {
    ?????? ??????? html.td(2).close();
    ?????? ??????? new TableBuilder(html, model).title();
    ?????? ??????? html.tdEnd();
    ?????? ??? }
    ?????? ??? protected void columnRight(HtmlBuilder html, TableModel model) {
    ?????? ??????? boolean showPagination = BuilderUtils.showPagination(model);
    ?????? ??????? boolean showExports = BuilderUtils.showExports(model);
    ?????? ??????? ToolbarBuilder toolbarBuilder = new ToolbarBuilder(html, model);
    ?????? ??????? html.td(2).align("right").close();
    ???????????????????? ??????? html.table(2).border("0").cellPadding("0").cellSpacing("1").styleClass(BuilderConstants.TOOLBAR_CSS).close();
    ?????? ??????? html.tr(3).close();
    ?????? ??????? if (showPagination) {
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.firstPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.prevPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.nextPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.lastPageItemAsImage();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ?????? ??????????? toolbarBuilder.separator();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? html.td(4).close();
    ???????????? //在工具條里面添加一個文本框以便手動的控制頁面顯示的行數(shù)
    ?????? ??????????? /* StringBuffer action = new StringBuffer("javascript:");
    ?????? ??????????? TableActions ta = new TableActions(model);
    ?????? ??????????? int currentRowsDisplayed = model.getLimit().getCurrentRowsDisplayed()
    ???????????????????? ??? html.input("text").name(model.getTableHandler().prefixWithTableId() + TableConstants.ROWS_DISPLAYED).value(String.valueOf(currentRowsDisplayed);
    ?????? ??????????? action.append(ta.getClearedExportTableIdParameters());
    ?????? ??????????? String form = BuilderUtils.getForm(model);
    ?????? ??????????? action.append("document.forms.").append(form).append(".");
    ??????????????????????????? ?? action.append(model.getTableHandler().prefixWithTableId()).append(TableConstants.CURRENT_ROWS_DISPLAYED);
    ?????? ??????????? action.append(".value=").append("this.value").append(";");
    ?????? ??????????? action.append(ta.getFormParameter(TableConstants.PAGE, "1"));
    ?????? ??????????? action.append("if(event.keyCode==13){");
    ?????? ??????????? action.append(ta.getOnInvokeAction());
    ?????? ??????????? action.append("}");
    ?????? ??????????? html.onkeypress(action.toString());
    ?????? ??????????? html.xclose();
    ?????? ??????????? html.tdEnd();*/
    ?????? ???????????
    ?????? ??????????? html.td(4).style("width:10px").close();
    ?????? ??????????? html.newline();
    ?????? ??????????? html.tabs(4);
    ?????? ??????????? toolbarBuilder.rowsDisplayedDroplist();
    ?????? ??????????? html.img();
    ?html.src(BuilderUtils.getImage(model, BuilderConstants.TOOLBAR_ROWS_DISPLAYED_IMAGE));
    ?????? ???????????html.style("border:0");
    ?????? ??????????? html.alt("Rows Displayed");
    ?????? ??????????? html.xclose();
    ?????? ??????????? html.tdEnd();
    ?????? ??????????? if (showExports) {
    ?????? ??????????????? html.td(4).close();
    ?????? ??????????????? toolbarBuilder.separator();
    ?????? ?????????? ?????html.tdEnd();
    ?????? ??????????? }
    ?????? ??????? }
    ?????? ??????? if (showExports) {
    ?????? ??????????? Iterator iterator = model.getExportHandler().getExports().iterator();
    ?????? ??????????? for (Iterator iter = iterator; iter.hasNext();) {
    ?????? ??????????????? html.td(4).close();
    ?????? ??????????????? Export export = (Export) iter.next();
    ?????? ??????????????? toolbarBuilder.exportItemAsImage(export);
    ?????? ??????????????? html.tdEnd();
    ?????? ??????????? }
    ?????? ??????? }
    ?????? ??????? html.trEnd(3);
    ?????? ??????? html.tableEnd(2);
    ?????? ??????? html.newline();
    ?????? ??????? html.tabs(2);
    ?????? ??????? html.tdEnd();
    ?????? ??? }
    }
    2.MyView.java
    public class MyView?extends AbstractHtmlView {
    ?????? ?protected void beforeBodyInternal(TableModel model) {
    ?????? ??????? getTableBuilder().tableStart();
    ?????? ??????? getTableBuilder().theadStart();
    ?????? ??????? getTableBuilder().filterRow();
    ?????? ??????? getTableBuilder().headerRow();
    ?????? ??????? getTableBuilder().theadEnd();
    ?????? ??????? getTableBuilder().tbodyStart();
    ?????? ??? }
    ?????? ??? protected void afterBodyInternal(TableModel model) {
    ?????? ??????? getCalcBuilder().defaultCalcLayout();
    ?????? ??????? getTableBuilder().tbodyEnd();
    ?????? ??????? getTableBuilder().tableEnd();
    ?????? ??????? toolbar(getHtmlBuilder(), getTableModel());
    ?????? ??????? statusBar(getHtmlBuilder(), getTableModel());
    ?????? ??? }
    ?????? ??? protected void toolbar(HtmlBuilder html, TableModel model) {
    ?????? ??????? new MyToolbar(html, model).layout();
    ?????? ??? }
    ?????? ??? protected void statusBar(HtmlBuilder html, TableModel model) {
    ?????? ??????? new DefaultStatusBar(html, model).layout();
    ?????? ??? }
    }
    然后在<ec:table>中添加一個屬性view=”MyView的完整類名”,運行效果如下:
    TableModel());
    ?????? ??? }
    ?????? ??? protected void toolbar(HtmlBuilder html, TableModel model) {
    ?????? ??????? new MyToolbar(html, model).layout();
    ?????? ??? }
    ?????? ??? protected void statusBar(HtmlBuilder html, TableModel model) {
    ?????? ??????? new DefaultStatusBar(html, model).layout();
    ?????? ??? }
    }
    然后在<ec:table>中添加一個屬性view=”MyView的完整類名”。
    為表格添加操作
    在實際應(yīng)用,特別是在一些管理系統(tǒng)中前臺頁面往往查看信息與編輯、刪除都放在一起。對于eXtremeTable達到這樣的效果只需在jsp文件中(自定義一列)如下:
    <ec:column alias="操作" filterable="false" sortable="false" >
    <a href="${pageContext.request.contextPath}/servlet/EmployeeServlet?param=edit&id=${employee.id}">編輯</a>
    <!--使用圖片的好處就是可以避免國際化的問題-->
    <a onclick="confirm('真的刪除');" ><img border="0" src ="${pageContext.request.contextPath}/images/delete.jpg"></a>
    </ec:column>


    Lyyb2001
    主站蜘蛛池模板: 亚洲午夜精品久久久久久浪潮| 四虎在线最新永久免费| 成人毛片免费观看视频在线| 亚洲欧洲日产国产最新| 中文字幕在线免费| 亚洲国产日韩女人aaaaaa毛片在线 | 2021免费日韩视频网| 亚洲婷婷天堂在线综合| 人成午夜免费视频在线观看| 亚洲无线一二三四区| 一个人看的www在线观看免费| 亚洲伦理中文字幕| 免费国产在线观看老王影院| 日韩在线视频线视频免费网站| 久久久久亚洲AV成人网人人网站| A毛片毛片看免费| 久久亚洲美女精品国产精品| 成年免费大片黄在线观看岛国 | 亚洲性69影院在线观看| 免费看韩国黄a片在线观看| 亚洲经典千人经典日产| 亚洲精品456播放| 日韩精品在线免费观看| 亚洲乱码卡三乱码新区| 一区二区三区亚洲视频| 免费国产成人18在线观看| 亚洲另类图片另类电影| 一级毛片直播亚洲| 无码av免费网站| 亚洲精品无码专区| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 亚洲av无码国产综合专区| 丁香亚洲综合五月天婷婷| 久久精品国产免费| 亚洲一区二区三区成人网站 | 久久久久国产精品免费免费搜索| 美女被免费视频网站a| 亚洲国产精品久久久久久| 午夜私人影院免费体验区| 国产精品免费看久久久香蕉 | 亚洲欧洲国产综合|