data.java

来自「OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你」· Java 代码 · 共 419 行 · 第 1/2 页

JAVA
419
字号
                    }                }            }            rm = new DetailRowMaker(drf, ss);        } else if (drf.getTableName().endsWith(".fit")) {            rm = new FITRowMaker(drf);        } else if (drf.getTableName().endsWith(".cft")                || drf.getTableName().endsWith(".cjt")) {            rm = new ComplexFeatureJoinRowMaker(drf);        } else {            rm = new PlainRowMaker();        }        Iterator rowiter;        if (rowlist != null) {            rowiter = new TableSubsetRecordIterator(rowlist, drf);        } else if (printall) {            rowiter = new TableListIterator(drf);        } else if (parseall) {            rowiter = new TableTestParseIterator(drf);        } else {            rowiter = new TableSampleIterator(drf);        }        // response.getWriter().println("<hr>Tn = " +        // drf.getTableName() +        // "<hr>" + rm.getClass().getName() + " " +        // rowiter.getClass().getName() + "<hr>");        int rowcount = 0;        while (rowiter.hasNext()) {            if (rowcount++ >= 99) {                response.getWriter().println(redisplay);                table.generate(response.getWriter());                rows = new ListElement();                table = new WrapElement("table", "BORDER=1 ALIGN=CENTER", rows);                rows.addElement(new WrapElement("CAPTION", new StringElement("table data")));                rows.addElement(thr);                rowcount = 0;            }            rows.addElement(rm.generateRow((List) rowiter.next()));        }        rm.close();        response.getWriter().println(redisplay);        table.generate(response.getWriter());    }    public ContextInfo getContextInfo() {        return contextInfo;    }    public static String joinURL(HttpServletRequest request,                                 HttpServletResponse response, int tag,                                 String filename, String colname,                                 String othertable, String othertablekey,                                 boolean isTiled) {        String pathInfo = request.getPathInfo();        int index = pathInfo.lastIndexOf('/');        String subpath = pathInfo.substring(0, index + 1);        String url = request.getContextPath() + request.getServletPath()                + subpath + filename + "?" + JoinColumnParam + "=" + colname                + "&" + JoinOtherTableParam + "=" + othertable + "&"                + JoinOtherTableKeyParam + "=" + othertablekey + "&"                + IsTiledParam + "=" + isTiled;        String value = "<A HREF=\"" + response.encodeURL(url) + "\">" + tag                + "</A>\r\n";        return value;    }    /**     * An iterator that returns a subset of the table rows     */    private static class TableSampleIterator implements Iterator {        private final int recordCount;        private final int columnCount;        private int curRow = 0;        private final DcwRecordFile drf;        public TableSampleIterator(DcwRecordFile drf) throws FormatException {            this.drf = drf;            recordCount = drf.getRecordCount();            columnCount = drf.getColumnCount();        }        public void remove() {            throw new UnsupportedOperationException();        }        public boolean hasNext() {            return (curRow < recordCount);        }        public Object next() {            if (curRow < 10) {                curRow++;            } else if (curRow == 10) {                curRow = 100;            } else {                curRow += 100;            }            if (curRow > recordCount) {                curRow = recordCount;            }            ArrayList al = new ArrayList(columnCount);            try {                if (!drf.getRow(al, curRow)) {                    throw new NoSuchElementException();                }            } catch (FormatException fe) {                throw new NoSuchElementException();            }            return al;        }    }    /**     * An iterator that returns a subset of the table rows, but parses     * every record in the table.     */    private static class TableTestParseIterator implements Iterator {        final ListIterator base;        public TableTestParseIterator(DcwRecordFile drf) throws FormatException {            base = new TableListIterator(drf);        }        public void remove() {            throw new UnsupportedOperationException();        }        public boolean hasNext() {            return base.hasNext();        }        public Object next() {            int index;            Object ret;            do {                index = base.nextIndex();                ret = base.next();            } while ((index > 10) && ((index % 100) != 0) && base.hasNext());            return ret;        }    }    /**     * An iterator that will return every row in the table.     */    private static class TableListIterator implements java.util.ListIterator {        private int curRow = 1;        private final DcwRecordFile drf;        private final int columnCount;        private final int recordCount;        public TableListIterator(DcwRecordFile drf) throws FormatException {            this.drf = drf;            columnCount = drf.getColumnCount();            recordCount = drf.getRecordCount();        }        public void add(Object o) {            throw new UnsupportedOperationException();        }        public boolean hasPrevious() {            return (curRow > 1);        }        public boolean hasNext() {            return (curRow <= recordCount);        }        private ArrayList getRow(int row) {            ArrayList al = new ArrayList(columnCount);            try {                if (!drf.getRow(al, row)) {                    throw new NoSuchElementException();                }            } catch (FormatException fe) {                throw new NoSuchElementException();            }            return al;        }        public Object next() {            return getRow(curRow++);        }        public Object previous() {            return getRow(--curRow);        }        public int nextIndex() {            return curRow;        }        public int previousIndex() {            return (curRow - 1);        }        public void remove() {            throw new UnsupportedOperationException();        }        public void set(Object o) {            throw new UnsupportedOperationException();        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?