2011年8月25日 星期四

DIV讓超出高度的文字隱藏

<div style="position: relative;overflow: hidden;height:45px;margin-top:0px;word-wrap:break-word;word-break:break-all;">

將comparator 寫在Collections.sort裡面

        List<TreemallNewCycleBannerVO> list = new ArrayList<TreemallNewCycleBannerVO>(cycleBannerTempMap.values());

        Collections.sort(list, new Comparator<TreemallNewCycleBannerVO>() {
            public int compare(TreemallNewCycleBannerVO o1,TreemallNewCycleBannerVO o2) {
                Integer priority1 = Integer.parseInt(o1.getPriority());
                Integer priority2 = Integer.parseInt(o2.getPriority());
                return (priority1<priority2 ? -1 : (priority1==priority2 ? 0 : 1));
            }
        });