Java && C#

要学得东西很多,但我们的时间却不是很多!
数据加载中……
程序片段
//数据库中对于时间的查询操作
public static String getDateSql(Date sDate, String dateType) {
        String start = sDate.getYear() + 1900 + "-" + (sDate.getMonth() + 1)
                + "-" + sDate.getDate() + " 00:00:00";
        String end = sDate.getYear() + 1900 + "-" + (sDate.getMonth() + 1)
                + "-" + sDate.getDate() + " 23:59:59";
        String sql = " and " + dateType + " >= TO_DATE('" + start
                + "','YYYY-MM-DD HH24:MI:SS') and " + dateType
                + " <= TO_DATE('" + end
                + "','YYYY-MM-DD HH24:MI:SS') order by " + dateType;
        return sql;
    }

//Java SWT中对于文本框只能输入数字的限制
/**
     * 数字校验
     *
     * @param text
     */
    private void checkNumber(Text text) {
        text.addVerifyListener(new VerifyListener() {
            public void verifyText(VerifyEvent e) {
                e.doit = ("0123456789.".indexOf(e.text) >= 0);
                if (e.keyCode == SWT.BS || e.keyCode == SWT.DEL
                        || e.keyCode == SWT.HOME || e.keyCode == SWT.END)
                    e.doit = true;
            }
        });
    }

//对于一些复杂的查询时可以用HashMap来处理
private String getHql(List<Long> respList,List<Long> customerList, Map<String, Object> map){
        String hql = " from CrmFeedBack t where 1=1";
        Object key, value;
        if (respList != null && respList.size() > 0) {
            hql += " and t.resp_Idx in (";
            for (Long id : respList) {
                hql += id + ",".trim();
            }
            hql += ")";
            hql = hql.replace(",)", ")");
        }
        if (customerList != null && customerList.size() > 0) {
            hql += " and t.client_Name in (";
            for (Long id : customerList) {
                hql += id + ",".trim();
            }
            hql += ")";
            hql = hql.replace(",)", ")");
        }
        if (map != null && map.size() > 0) {
            Iterator it = map.entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry entry = (Map.Entry) it.next();
                key = entry.getKey();
                value = entry.getValue();
                if (key.equals("resp_Idx") || key.equals("priority")) {
                    hql += " and t." + key + "= " + value;
                } else {
                    hql += " and t." + key + " like '%" + value + "%'";
                }
            }
        }
        return hql;
}

///////////////
   /**
     * Creates the initial layout for a page.
     */
    public void createInitialLayout(IPageLayout layout) {
        String editorArea = layout.getEditorArea();
        layout.setEditorAreaVisible(false);
        IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT,
                0.2f, editorArea);
        left.addView(MyTreeView.ID);
        left.addView(NavigationView.ID);
        IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT,
                0.8f, editorArea);
        right.addView(MyTableView.ID);
        addFastViews(layout);
        addViewShortcuts(layout);
        addPerspectiveShortcuts(layout);
    }
//得到系统文件夹的方法
    Image image=PlatformUI.getWorkbench().getSharedImages().getImage(
                ISharedImages.IMG_OBJ_FOLDER);

private bool IsNumeric(string str) 
{  
   System.Text.RegularExpressions.Regex reg
       = new System.Text.RegularExpressions.Regex(@"^[-]?\d+[.]?\d*$");  
   return reg.IsMatch(str); 
}

MarQuee的用法
基本语法
<marquee> ... </marquee>
移动属性的设置 ,这种移动不仅仅局限于文字,也可以应用于图片,表格等等
方向
<direction=#> #=left, right ,up ,down <marquee
direction=left>从右向左移!</marquee>
方式
<bihavior=#> #=scroll, slide, alternate <marquee
behavior=scroll>一圈一圈绕着走!</marquee>
<marquee behavior=slide>只走一次就歇了!</marquee>
<marquee behavior=alternate>来回走</marquee>
循环
<loop=#> #=次数;若未指定则循环不止(infinite) <marquee loop=3 width=50%
behavior=scroll>只走 3 趟</marquee> <P>
<marquee loop=3 width=50% behavior=slide>只走 3 趟</marquee>
<marquee loop=3 width=50% behavior=alternate>只走 3 趟!</marquee>
速度
<scrollamount=#> <marquee scrollamount=20>啦啦啦,我走得好快哟!</marquee>
延时
<scrolldelay=#> <marquee scrolldelay=500
scrollamount=100>啦啦啦,我走一步,停一停!</marquee>
外观(Layout)设置
对齐方式(Align)
<align=#> #=top, middle, bottom <font size=6>
<marquee align=# width=400>啦啦啦,我会移动耶!</marquee>
</font>
底色
<bgcolor=#> #=rrggbb 16 进制数码,或者是下列预定义色彩:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua <marquee
bgcolor=aaaaee>颜色!</marquee>
面积
<height=# width=#> <marquee height=40 width=50%
bgcolor=aaeeaa>面积!</marquee>
空白
(Margins)<hspace=# vspace=#>
<marquee hspace=20 vspace=20 width=150 bgcolor=ffaaaa
align=middle>面积!</marquee>

posted on 2007-03-09 16:07 Bill111 阅读(411) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: