海水正藍(lán)

          面朝大海,春暖花開
          posts - 145, comments - 29, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          2013年7月11日

          在用 extjs editorgridpanel 進(jìn)行輸入編輯的時候, 默認(rèn)情況下只支持使用 tab 鍵可以實(shí)現(xiàn)焦點(diǎn)切換, 如果想讓editorgridpanel 在編輯時通過方向鍵來實(shí)現(xiàn)焦點(diǎn)跳轉(zhuǎn)切換,只需加上以下代碼:

          //讓grid支持方向鍵盤 by liongis@163.com
          Ext.override(Ext.grid.CellSelectionModel, {
              onEditorKey : function(field, e) {
                  var smodel 
          = this;
                  var k 
          = e.getKey(), newCell, g = smodel.grid, ed = g.activeEditor;
                  
          switch(k){
                      
          case e.TAB:
                           e.stopEvent();
                           ed.completeEdit();
                           
          if (e.shiftKey) {
                               newCell 
          = g.walkCells(ed.row, ed.col-1-1, smodel.acceptsNav, smodel);
                           } 
          else {
                               newCell 
          = g.walkCells(ed.row, ed.col+11, smodel.acceptsNav, smodel);
                           }
                           
          if (ed.col == 1) {
                               
          if (e.shiftKey) {
                                   newCell 
          = g.walkCells(ed.row, ed.col+1-1, smodel.acceptsNav, smodel);
                               } 
          else {
                                   newCell 
          = g.walkCells(ed.row, ed.col+11, smodel.acceptsNav, smodel);
                               }
                           }
                          
          break;
                      
          case e.UP:
                           e.stopEvent();
                           ed.completeEdit();
                           newCell 
          = g.walkCells(ed.row-1, ed.col, -1, smodel.acceptsNav, smodel);
                          
          break;
                      
          case e.DOWN:
                           e.stopEvent();
                           ed.completeEdit();
                           newCell 
          = g.walkCells(ed.row+1, ed.col, 1, smodel.acceptsNav, smodel);
                          
          break;
                      
          case e.LEFT:
                           e.stopEvent();
                           ed.completeEdit();
                           newCell 
          = g.walkCells(ed.row, ed.col-1-1, smodel.acceptsNav, smodel);
                           
          break;
                       
          case e.RIGHT:
                           e.stopEvent();
                           ed.completeEdit();
                           newCell 
          = g.walkCells(ed.row, ed.col+11, smodel.acceptsNav, smodel);
                             
          break;
                  }
                 
          if (newCell) {
                      g.startEditing(newCell[
          0], newCell[1]);
                 }
               }
          });
          注意:這里重寫的是:CellSelectionModel ,而不是RowSelectionMode
          原文出自:
          http://www.cnblogs.com/liongis/p/3284620.html

          posted @ 2013-08-27 13:10 小胡子 閱讀(324) | 評論 (0)編輯 收藏

          序言:

             1.本文摘自網(wǎng)絡(luò),看控件命名像是4.0以前的版本,但控件屬性配置仍然可以借鑒(不足之處,以后項目用到時再續(xù)完善)。

          Ext.form.TimeField:

            配置項: 
                     maxValue:列表中允許的最大時間 
                     maxText:當(dāng)時間大于最大值時的錯誤提示信息 
                     minValue:列表中允許的最小時間 
                     minText:當(dāng)時間小于最小值時的錯誤提示信息 
                     increment:兩個相鄰選項間的時間間隔,默認(rèn)為15分鐘 
                     format:顯示格式,默認(rèn)為“g:i A”。一般使用“H:i:s” 
                          H:帶前綴0的24小時 
                           i:帶前綴0的分鐘 
                          s:帶前綴0的秒 
                     invalidText:當(dāng)時間值非法時顯示的提示信息 
                     altFormats:多個時間輸入格式組成的字符串,不同的格式之間使用“|”進(jìn)行分割

          Ext.form.FieldSet

              animCollapse:動畫折疊,默認(rèn)為false 
                     checkboxToggle:設(shè)置是否顯示字段集的checkbox選擇框,默認(rèn)為false 
                     checkboxName:指定字段集中用于展開或隱藏字段集面板的checkbox的名字,該屬性只有在checkboxToggle為true時生效 
                     labelWidth:字段標(biāo)簽的寬度,可以級聯(lián)到子容器 
                     layout:布局,默認(rèn)為form

          Ext.form.DateFied

              maxValue:允許選擇的最大日期 
                     maxText:當(dāng)日期大于最大值時的錯誤提示信息 
                     minValue:允許選擇的最小時間 
                     minText:當(dāng)日期小于最小值時的錯誤提示信息 
                     format:日期顯示格式,默認(rèn)為“m/d/y”,一般使用“Y-m-d” 
                         Y:四位年份 
                         m:帶前綴0的月份 
                         d:帶前綴0的日期 
                         y:兩位年份 
                         n:不帶前綴0的月份 
                         j:不帶前綴0的日期 
                         w:星期的數(shù)字,0表示星期日,1代表星期一 
                     showToday:是否顯示今天按鈕,默認(rèn)為true 
                     altFormats:多個日期輸入格式組成的字符串,不同的格式之間使用“|”進(jìn)行分割,默認(rèn)值為'm/d/Y|n/j/Y|n/j/y|m/j /y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d' 
                     disabledDates:禁止選擇的日期組成的數(shù)組 
                     disabledDatesText:選擇禁選日期時顯示的提示信息 
                     disabledDays:禁止選擇的星期組成的數(shù)組,0代表星期日,1代表星期一 
                     disabledDaysText:選擇禁選星期時顯示的提示信息 
                     invalidText:當(dāng)日期值非法時顯示的提示信息 
               方法: 
                     getValue():取得日期值

          Ext.form.ComboBox

              displayField:被顯示在下拉框中的字段名 
                     editable:是否可編輯,默認(rèn)為true 
                     forceSelection:輸入值是否嚴(yán)格為待選列表中存在的值。如果輸入不存在的值,會自動選擇第一個最接近的值。 
                     hiddenName:隱藏字段的名字,如果提供該參數(shù)則一個隱藏字段將被創(chuàng)建,用來存儲所選值,當(dāng)表單提交時在服務(wù)器端可以通過該名字取得列表中的所選值 
                     listWidth:下拉列表的寬度 
                     minListWidth:下拉列表的最小寬度,默認(rèn)為70像素 
                     loadingText:當(dāng)下拉框加載數(shù)據(jù)時顯示的提示信息,只有當(dāng)mode='remote'時才會生效 
                     maxHeight:下拉列表框的最大高度,默認(rèn)為300像素 
                     minChars:下拉列表框自動選擇前用戶需要輸入的最小字符數(shù)量。mode='remote'默認(rèn)為4,mode='local'默認(rèn)為0 
                     mode:下拉列表框的數(shù)據(jù)讀取模式。remote讀取遠(yuǎn)程數(shù)據(jù),local讀取本地數(shù)據(jù) 
                     pageSize:下拉列表框的分頁大小。該項設(shè)置只在mode='remote'時生效 
                     queryParam:查詢的名字,默認(rèn)為'query',將被傳遞到查詢字符串中 
                     allQuery:一個發(fā)往服務(wù)器用來查詢?nèi)啃畔⒌牟樵冏址J(rèn)為空字符串'' 
                     selectOnFocus:當(dāng)獲得焦點(diǎn)時立刻選擇一個已存在的列表項。默認(rèn)為false,此項只有在editable=true時才會生效 
                     store:列表框綁定的數(shù)據(jù)源 
                     transform:將頁面中已存在的元素轉(zhuǎn)換為組合框 
                     lazyInit:延時初始化下拉列表,默認(rèn)為true 
                     lazyRender:延時渲染,默認(rèn)為false 
                     triggerAction:設(shè)置單擊觸發(fā)按鈕時執(zhí)行的默認(rèn)操作,有效值包括all和query,默認(rèn)為query,如果設(shè)置為all則會執(zhí)行allQuery中設(shè)置的查詢 
                     typeAhead:設(shè)置在輸入過程中是否自動選擇匹配的剩余部分文本(選擇第一個滿足條件的),默認(rèn)為false 
                     value:初始化組合框中的值 
                     valueField:組合框的值字段 
                     valueNotFoundText:值不存在時的提示信息 
                     tpl:Ext模板字符串或模板對象,可以通過該配置項自定義下拉列表的顯示方式 
               方法: 
                     clearValue():清空字段當(dāng)前值 
                     doQuery( String query, Boolean forceAll ): 
                     getValue(): 
                     getStore(): 
                     setValue( String value ):

          Ext.from.RadioGroup

              allowBlank: 
                     blankText:

          Ext.form.Radio;

              getGroupValue(): 
                     setValue( value {String/Boolean} ):

          Ext.form.CheckboxGroup

               allowBlank:是否允許不選擇,默認(rèn)為true 
                     blankText: 
                     columns:顯示的列數(shù),可選值包括:固定值auto、數(shù)值、數(shù)組(整數(shù)、小數(shù)) 
                     items:對象數(shù)組 
                     vertical:是否垂直方向顯示對象,默認(rèn)為false

          Ext.form.Checkbox

            boxLabel:復(fù)選框的文字描述 
                     checked:復(fù)選框是否被選擇,默認(rèn)為false 
                     handler:當(dāng)checked值改變時觸發(fā)的函數(shù),函數(shù)包含兩個參數(shù):checkbox、checked 
                     inputValue: 
               方法: 
                     getValue():返回復(fù)選框的checked狀態(tài) 
                     setValue( Boolean/String checked ):

          Ext.form.NumberField

                allowDecimals:是否允許輸入小數(shù),默認(rèn)為true 
                     allowNegative:是否允許輸入負(fù)數(shù),默認(rèn)為true 
                     baseChars:輸入的有效數(shù)字集合,默認(rèn)為'0123456789' 
                     decimalPrecision:數(shù)字的精度,默認(rèn)保留小數(shù)點(diǎn)后2位 
                     decimalSeparator:十進(jìn)制分隔符,默認(rèn)為'.' 
                     maxValue:允許輸入的最大數(shù)值 
                     maxText:超過最大值之后的提示信息 
                     minValue:允許輸入的最小數(shù)值 
                     minText:超過最小值之后的提示信息 
                     nanText:輸入非有效數(shù)值之后的提示信息

          Ext.form.TextArea

              preventScrollbars:是否禁止出現(xiàn)滾動條,默認(rèn)為false

          Ext.form.TextField

              allowBlank:是否允許為空,默認(rèn)為true 
                    blankText:空驗(yàn)證失敗后顯示的提示信息 
                    emptyText:在一個空字段中默認(rèn)顯示的信息 
                    grow:字段是否自動伸展和收縮,默認(rèn)為false 
                    growMin:收縮的最小寬度 
                    growMax:伸展的最大寬度 
                    inputType:字段類型:默認(rèn)為text 
                    maskRe:用于過濾不匹配字符輸入的正則表達(dá)式 
                    maxLength:字段允許輸入的最大長度 
                    maxLengthText:最大長度驗(yàn)證失敗后顯示的提示信息 
                    minLength:字段允許輸入的最小長度 
                    minLengthText:最小長度驗(yàn)證失敗后顯示的提示信息 
                    regex:正則表達(dá)式 
                    regexText:正則表達(dá)式驗(yàn)證失敗后顯示的提示信息 
                    vtype:驗(yàn)證類型的名字 
                         alpha:限制只能輸入字母 
                         alphanum:限制只能輸入字母和數(shù)字 
                         email 
                         url 
                    vtypeText:驗(yàn)證失敗時的提示信息 
                    validator:自定義驗(yàn)證函數(shù) 
                    selectOnFocus:當(dāng)字段得到焦點(diǎn)時自動選擇已存在的文本,默認(rèn)為false

          Ext.form.Field

              name:字段名 
                    value:字段的初始化值 
                    disabled:字段是否不可用,默認(rèn)為false 
                    fieldLabel:字段標(biāo)簽說明 
                    hideLabel:隱藏字段標(biāo)簽,默認(rèn)為false 
                    labelSeparator:字段標(biāo)簽與字段之間的分隔符,默認(rèn)為':' 
                    labelStyle:字段標(biāo)簽樣式 
                    inputType:默認(rèn)為text 
                    invalidClass:默認(rèn)為x-form-invalid 
                    invalidText:字段非法文本提示 
                    msgTarget:錯誤信息顯示的位置,默認(rèn)為qtip 
                        qtip:顯示一個浮動的提示信息 
                        title:顯示一個瀏覽器的浮動提示信息 
                        under:在字段下方顯示一個提示信息 
                        side:在字段右邊顯示一個提示信息 
                    readOnly:字段是否只讀,默認(rèn)為false 
                    validateOnBlur:字段在失去焦點(diǎn)時被驗(yàn)證,默認(rèn)為true 
               方法: 
                    clearInvalid(): 
                    getRawValue() 
                    setRawValue( Mixed value ) 
                    getValue() 
                    setValue( Mixed value ) 
                    isDirty():字段值在裝載后是否被修改過 
                    isValid( Boolean preventMark ):當(dāng)前字段值是否合法 
                    markInvalid( [String msg] ) 
                    validate() 
                    reset()

          Ext.form.FormPanel

          items:一個元素或元素數(shù)組 
                    buttons:一個按鈕配置對象的數(shù)組,按鈕將被添加到表單頁腳中 
                    buttonAlign:按鈕的對齊方式,可選值有l(wèi)eft、center、right,默認(rèn)為center 
                    labelWidth:表單標(biāo)簽的寬度 
                    labelAlign:表單標(biāo)簽的對齊方式,可選值有l(wèi)eft、top、right,默認(rèn)為left 
                    labelSeparator:字段標(biāo)簽與字段之間的分隔符,默認(rèn)為':' 
                    minButtonWidth:按鈕的最小寬度,默認(rèn)為75 
               方法: 
                    getForm() : Ext.form.BasicForm 
                    load( Object options ) 
                    startMonitoring() 
                    stopMonitoring()

          Ext.form.BaseicForm

              baseParams:傳遞到請求中的參數(shù) 
                    method:表單的提交方式,有效值包括GET、POST 
                    url:表單默認(rèn)的提交路徑 
                    fileUpload:表單是否進(jìn)行文件上傳 
                    timeout:表單動作的超時時間,默認(rèn)為30秒 
                    trackResetOnLoad:是否在表單初次創(chuàng)建時清楚數(shù)據(jù) 
              方法: 
                    doAction( String/Object actionName, [Object options] ):執(zhí)行一個預(yù)訂的動作,可用選項包括: 
                        url:動作提交的路徑 
                        method:表單的提交方式,有效值包括GET、POST 
                        params:傳遞到請求中的參數(shù) 
                        headers: 
                        success:執(zhí)行成功后回調(diào)的函數(shù),包括兩個參數(shù):form和action 
                        failure:執(zhí)行失敗后回調(diào)的函數(shù),包括兩個參數(shù):form和action 
                        clientValidation:是否客戶端驗(yàn)證 
                    clearInvalid():清除表單中所有的無效驗(yàn)證信息 
                    findField( String id ):查找表單字段 
                    getValues( [Boolean asString] ): 
                    isDirty():表單數(shù)據(jù)是否被更改過 
                    isValid():客戶端驗(yàn)證是否成功 
                    load( Object options ):執(zhí)行表單讀取動作 
                    loadRecord( Record record ):從一個數(shù)據(jù)記錄中讀取數(shù)據(jù)到表單中 
                    markInvalid( Array/Object errors ):成批設(shè)置表單字段為驗(yàn)證無效 
                    reset():重置表單 
                    setValues( Array/Object values ):成批設(shè)置表單字段值 
                    submit( Object options ):執(zhí)行表單提交動作 
                    updateRecord( Record record ):持久化表單數(shù)據(jù)到記錄集中

          Ext.form.Action

              success:執(zhí)行成功后回調(diào)的函數(shù),包括兩個參數(shù):form和action 
                    failure:執(zhí)行失敗后回調(diào)的函數(shù),包括兩個參數(shù):form和action 
                    method:表單的提交方式,有效值包括GET、POST 
                    params:傳遞到請求中的參數(shù) 
                    url:動作提交的路徑 
                    waitMsg:動作執(zhí)行時顯示的等待信息 
               屬性: 
                    Action.CLIENT_INVALID:客戶端驗(yàn)證錯誤 
                    Action.CONNECT_FAILURE:通信錯誤 
                    Action.LOAD_FAILURE:加載數(shù)據(jù)時,沒有包含data屬性的字段被返回 
                    Action.SERVER_INVALID:服務(wù)端驗(yàn)證錯誤 
                    failureType:錯誤類型 
                    result:包含布爾類型的success屬性和其他屬性,如{success: true, msg: 'ok'} 
                    type:動作類型,可選值有submit和load 
                         Ext.form.Action.Submit:返回的信息中要包含一個布爾類型的success屬性和一個可選的errors屬性 
                         Ext.form.Action.Load:返回的信息中要包含一個布爾類型的success屬性和一個data屬性

          Ext.grid.EditorGridPanel

              clicksToEdit:設(shè)置點(diǎn)擊單元格進(jìn)入編輯模式的點(diǎn)擊次數(shù),默認(rèn)為2 
                      autoEncode:是否自動編碼/解碼HTML內(nèi)容,默認(rèn)為false 
                      selModel:默認(rèn)為Ext.grid.CellSelectionModel 
            
                主要方法: 
                      startEditing( Number rowIndex, Number colIndex ):開始編輯指定單元格 
                      stopEditing( [Boolean cancel] ):結(jié)束編輯操作

          Ext.grid.GroupinView

              enableGroupingMenu:是否在表頭菜單中進(jìn)行分組控制,默認(rèn)為true 
                      groupByText:表頭菜單中分組控制的菜單文字,默認(rèn)為'Group By This Field' 
            
                      enableNoGroups:是否允許用戶關(guān)閉分組功能,默認(rèn)為true 
                      showGroupsText:在表頭菜單中啟用分組和禁用分組的菜單文字,默認(rèn)為'Show in Groups' 
            
                      groupTextTpl:用于渲染分組信息的模板,默認(rèn)為'{text}',常用的可選值有: 
                            text:列標(biāo)題:組字段值 
                            gvalue:組字段的值 
                            startRow:組行索引 
            
                      enableGrouping:是否對數(shù)據(jù)分組,默認(rèn)為true 
                      hideGroupedColumn:是否隱藏分組列,默認(rèn)為false 
                      ignoreAdd:在向表格中添加數(shù)據(jù)時是否刷新表格,默認(rèn)為false 
                      showGroupName:是否在分組行上顯示分組字段的名字,默認(rèn)為true 
                      startCollapsed:初次顯示時分組是否處于收縮狀態(tài),默認(rèn)為false 
            
                主要方法: 
                      collapseAllGroups():收縮所有分組行 
                      expandAllGroups():展開所有分組行 
                      getGroupId( String value ):根據(jù)分組字段值取得組id 
                      toggleAllGroups( [Boolean expanded] ):切換所有分組行的展開或收縮狀態(tài) 
                      toggleGroup( String groupId, [Boolean expanded] ):切換指定分組行的展開或收縮狀態(tài) 


          2、Ext.data.GroupingStore 
                groupField:分組字段 

                groupOnSort:是否在分組字段上排序,默認(rèn)為false 
                remoteGroup:是否遠(yuǎn)程分組數(shù)據(jù),默認(rèn)為false。如果是遠(yuǎn)程分組數(shù)據(jù),則通過groupBy參數(shù)發(fā)送分組字段名

          Ext.grid.GridPanel:

              store:表格的數(shù)據(jù)集 
                    columns:表格列模式的配置數(shù)組,可自動創(chuàng)建ColumnModel列模式 
                    autoExpandColumn:自動充滿表格未用空間的列,參數(shù)為列id,該id不能為0 
                    stripeRows:表格是否隔行換色,默認(rèn)為false 
            
                    cm、colModel:表格的列模式,渲染表格時必須設(shè)置該配置項 
                    sm、selModel:表格的選擇模式,默認(rèn)為Ext.grid.RowSelectionModel 
                    enableHdMenu:是否顯示表頭的上下文菜單,默認(rèn)為true 
                    enableColumnHide:是否允許通過標(biāo)題中的上下文菜單隱藏列,默認(rèn)為true 
                    loadMask:是否在加載數(shù)據(jù)時顯示遮罩效果,默認(rèn)為false 
                    view:表格視圖,默認(rèn)為Ext.grid.GridView 
                    viewConfig:表格視圖的配置對象 
            
                    autoExpandMax:自動擴(kuò)充列的最大寬度,默認(rèn)為1000 
                    autoExpandMin:自動擴(kuò)充列的最小寬度,默認(rèn)為50 
                    columnLines:是否顯示列分割線,默認(rèn)為false 
                    disableSelection:是否禁止行選擇,默認(rèn)為false 
                    enableColumnMove:是否允許拖放列,默認(rèn)為true 
                    enableColumnResize:是否允許改變列寬,默認(rèn)為true 
                    hideHeaders:是否隱藏表頭,默認(rèn)為false 
                    maxHeight:最大高度 
                    minColumnWidth:最小列寬,默認(rèn)為25 
                    trackMouseOver:是否高亮顯示鼠標(biāo)所在的行,默認(rèn)為true 
            
                主要方法: 
                    getColumnModel():取得列模式 
                    getSelectionModel():取得選擇模式 
                    getStore():取得數(shù)據(jù)集 
                    getView():取得視圖對象 
                    reconfigure( Ext.data.Store store, Ext.grid.ColumnModel colModel ):使用一個新的數(shù)據(jù)集和列模式重新配置表格組件 

          2、Ext.grid.Column 
                主要配置項: 
                    id:列id 
                    header:表頭文字 
                    dataIndex:設(shè)置列與數(shù)據(jù)集中數(shù)據(jù)記錄的對應(yīng)關(guān)系,值為數(shù)據(jù)記錄中的字段名稱。如果沒有設(shè)置該項則使用列索引與數(shù)據(jù)記錄中字段的索引進(jìn)行對應(yīng) 
                    width:列寬 
                    align:列數(shù)據(jù)的對齊方式 
            
                    hidden:是否隱藏列,默認(rèn)為false 
                    fixed:是否固定列寬,默認(rèn)為false 
                    menuDisabled:是否禁用列的上下文菜單,默認(rèn)為false 
                    resizable:是否允許改變列寬,默認(rèn)為true 
                    sortable:是否允許排序,默認(rèn)為true 
                    renderer:設(shè)置列的自定義單元格渲染函數(shù) 
                          傳入函數(shù)的參數(shù)有: 
                              value:數(shù)據(jù)的原始值 
                              metadata:元數(shù)據(jù)對象,用于設(shè)置單元格的樣式和屬性,該對象包含的屬性有: 
                                    css:應(yīng)用到單元格TD元素上的樣式名稱 
                                    attr:一個HTML屬性定義字符串,例如'style="color:blue"' 
                              record:當(dāng)前數(shù)據(jù)記錄對象 
                              rowIndex:單元格的行索引 
                              colIndex:單元格的列索引 
                              store:數(shù)據(jù)集對象 
              
                    xtype:列渲染器類型,默認(rèn)為gridcolumn,其它可選值有booleancolumn、numbercolumn、datecolumn、templatecolumn等 
            
                    editable:是否可編輯,默認(rèn)為true 
                    editor:編輯器 
            
                    groupName: 
                    emptyGroupText: 
                    groupable: 

          3、Ext.grid.ColumnModel 
                主要配置項: 
                    columns:字段數(shù)組 
                    defaultSortable:是否進(jìn)行默認(rèn)排序,默認(rèn)為false 
                    defaultWidth:默認(rèn)寬度 
            
                主要方法: 
                    findColumnIndex( String col ):根據(jù)給定的dataIndex查找列索引 
                    getColumnById( String id ):取得指定id對應(yīng)的列 
                    getColumnCount( Boolean visibleOnly ):取得列總數(shù) 
                    getColumnHeader( Number col ):取得列的表頭 
                    getColumnId( Number index ):取得列id 
                    getDataIndex( Number col ):取得列對應(yīng)的數(shù)據(jù)字段名 
                    getIndexById( String id ):取得列索引 
                    getTotalWidth( Boolean includeHidden ) 
                    isCellEditable( Number colIndex, Number rowIndex ) 
                    isFixed() 
                    isHidden( Number colIndex ) 
                    setColumnHeader( Number col, String header ) 
                    setColumnWidth( Number col, Number width, Boolean suppressEvent ) 
                    setDataIndex( Number col, String dataIndex ) 
                    setEditable( Number col, Boolean editable ) 
                    setEditor( Number col, Object editor ) 
                    setHidden( Number colIndex, Boolean hidden ) 
                    setRenderer( Number col, Function fn ) 
          4、Ext.grid.AbstractSelectionModel 
                主要方法: 
                      lock():鎖定選擇區(qū)域 
                      unlock():解鎖選擇區(qū)域 
                      isLocked():當(dāng)前選擇區(qū)域是否被鎖定 
          5、Ext.grid.CellSelectionModel 
                主要方法: 
                      clearSelections( Boolean preventNotify ):清除選擇區(qū)域 
                      getSelectedCell():取得當(dāng)前選擇的單元格,返回一數(shù)組,其格式:[rowIndex, colIndex] 
                      hasSelection():當(dāng)前是否有選擇區(qū)域 
                      select( Number rowIndex, Number colIndex, [Boolean preventViewNotify], [Boolean preventFocus], [Ext.data.Record r] ):選擇指定單元格 
          6、Ext.grid.RowSelectionModel 
                主要配置項: 
                      singleSelect:是否單選模式,默認(rèn)為false,即可以選擇多條數(shù)據(jù) 

                主要方法: 
                      clearSelections( [Boolean fast] ):清除所有選擇區(qū)域 
                      deselectRange( Number startRow, Number endRow ):取消范圍內(nèi)的行選擇 
                      deselectRow( Number row, [Boolean preventViewNotify] ):取消指定行的選擇狀態(tài) 
                      each( Function fn, [Object scope] ):遍歷所有選擇行,并調(diào)用指定函數(shù)。當(dāng)前被選行將傳入該函數(shù)中 
                      getCount():得到選擇的總行數(shù) 
                      getSelected():得到第一個被選記錄 
                      getSelections():得到所有被選記錄的數(shù)組 
                      hasNext():判斷當(dāng)前被選行之后是否還有記錄可以選擇 
                      hasPrevious():判斷當(dāng)前被選行之前是否還有記錄可以選擇 
                      hasSelection():是否已選擇了數(shù)據(jù) 
                      isIdSelected( String id ):判斷指定id的記錄是否被選擇 
                      isSelected( Number/Record index ):判斷指定記錄或記錄索引的數(shù)據(jù)是否被選擇 
                      selectAll():選擇所有行 
                      selectFirstRow():選擇第一行 
                      selectLastRow( [Boolean keepExisting] ):選擇最后行 
                            keepExisting:是否保持已有的選擇 
                      selectNext( [Boolean keepExisting] ):選擇當(dāng)前選擇行的下一行 
                      selectPrevious( [Boolean keepExisting] ):選擇當(dāng)前選擇行的上一行 
                      selectRange( Number startRow, Number endRow, [Boolean keepExisting] ):選擇范圍內(nèi)的所有行 
                      selectRecords( Array records, [Boolean keepExisting] ):選擇一組指定記錄 
                      selectRow( Number row, [Boolean keepExisting], [Boolean preventViewNotify] ):選擇一行 
                            row:行索引 
                      selectRows( Array rows, [Boolean keepExisting] ):選擇多行 
                            rows:行索引數(shù)組 
          7、Ext.grid.CheckboxSelectionModel 
                主要配置項: 
                      singleSelect:是否單選模式,默認(rèn)為false,即可以選擇多條數(shù)據(jù) 
                      checkOnly:是否只能通過點(diǎn)擊checkbox列進(jìn)行選擇,默認(rèn)為false 
                      sortable:是否允許checkbox列排序,默認(rèn)為false 
                      width:checkbox列的寬度,默認(rèn)為20 
          8、Ext.grid.RowNumberer 
                主要配置項: 
                      header:行號列表頭顯示的內(nèi)容 
                      width:列寬,默認(rèn)為23
          9、Ext.grid.GridView 
                主要配置項: 
                      enableRowBody:是否包含行體 
                      sortAscText:表格標(biāo)題菜單中升序的文字描述 
                      sortDescText:表格標(biāo)題菜單中降序的文字描述 
                      columnsText:表格標(biāo)題菜單中列對應(yīng)的文字描述 
                      autoFill:是否自動擴(kuò)展列以充滿整個表格,默認(rèn)為false 
                      forceFit:是否強(qiáng)制調(diào)整表格列寬以適用表格的整體寬度,防止出現(xiàn)水平滾動條,默認(rèn)為false 

                主要方法: 
                      focusCell( Number row, Number col ):將焦點(diǎn)移到指定單元格 
                      focusRow( Number row ):將焦點(diǎn)移動指定行 
                      getCell( Number row, Number col ):取得指定單元格對應(yīng)的td元素 
                      getHeaderCell( Number index ):取得指定表頭對應(yīng)的td元素 
                      getRow( Number index ):取得指定行對應(yīng)的tr元素 
                      getRowClass( Record record, Number index, Object rowParams, Store store ):得到附加到表格行上的樣式名 
                            record:當(dāng)前行的數(shù)據(jù)記錄對象 
                            index:當(dāng)前行的索引 
                            rowParams:渲染時傳入到行模板中的配置對象,通過它可以為行體定制樣式,該對象只在enableRowBody為true時才生效,可能的屬性如下: 
                                  body:渲染到行體中的HTML代碼片段 
                                  bodyStyle:應(yīng)用到行體tr元素style屬性的字符串 
                                  cols:應(yīng)用到行體td元素colspan屬性的值,默認(rèn)為總列數(shù) 
                            store:表格數(shù)據(jù)集 
                      refresh( [Boolean headersToo] ):刷新表格組件 
                      scrollToTop():滾動表格到頂端

          Ext.TabPanel:

            activeTab:初始激活的tab,索引或者id值,默認(rèn)為none 
                autoTabs:是否自動將帶有'x-tab'樣式類的div轉(zhuǎn)成tabs添加到TabPanel中,默認(rèn)為false。 
                      當(dāng)該配置項設(shè)為true時,需要設(shè)置deferredRender為false,還必須使用applyTo。 
                deferredRender:是否延遲渲染,默認(rèn)為true。 
                autoTabSelector:默認(rèn)為'div.x-tab'。 

                resizeTabs:是否可以改變tab的尺寸,默認(rèn)為false。 
                minTabWidth:tab的最小寬度,默認(rèn)為30。 
                tabWidth:每個新增加的tab寬度,默認(rèn)為120。 
                tabTip:tab的提示信息 

                tabPosition:tab位置,可選值有top、bottom,默認(rèn)為top。 
                enableTabScroll:是否允許Tab溢出時可以滾動,默認(rèn)為false。 
                closable:tab是否可關(guān)閉,默認(rèn)為false 

                scrollDuration:每次的滾動時長,默認(rèn)為0.35毫秒。 
                scrollIncrement:每次的滾動步長,默認(rèn)為100像素。 
                wheelIncrement:每次鼠標(biāo)滑輪的滾動步長,默認(rèn)為20像素。 
          2、主要方法: 
                activate( String/Panel tab ) 
                getActiveTab():獲取當(dāng)前活動的tab 
                get( String/Number key ):根據(jù)組件id或者索引獲取組件 
                getItem(String id):根據(jù)tab id獲取tab 
                setActiveTab( String/Number item ) 
                remove( Component/String component, [Boolean autoDestroy] ) 
                removeAll( [Boolean autoDestroy] )
          在使用TabPanel時需要注意: 

           

                 1、在創(chuàng)建Ext.TabPanel時deferredRender配置項經(jīng)常會被忽略。該配置項的默認(rèn)值是true。true表示只有在用戶第一次訪問 選項卡時,該選項卡的panel才會被渲染。 所以當(dāng)我們有可能使用腳本操作選項卡時,謹(jǐn)記將該配置項設(shè)置為false。 

                 2、在FormPanel中使用TabPanel,如果在TabPanel中不定義deferredRender的值為false,那么,當(dāng)你使用 Load方法為Form加載數(shù)據(jù),或使用setValue為沒有激活過的Panel的控件賦值時,將會發(fā)生錯誤。原因是,在默認(rèn)設(shè)置下 deferredRender為true,TabPanel并不會渲染所有Panel上的控件,只有在該P(yáng)anel被激活時才渲染控件,所以當(dāng)你為這些控 件設(shè)置數(shù)據(jù)時,將會找不到這些控件,會出現(xiàn)錯誤。因而,在FormPanel中使用TabPanel,一定要在TabPanel中設(shè)置 deferredRender的值為false,強(qiáng)制TabPanel在Layout渲染時同時渲染所有Panel上的控件。




          本文轉(zhuǎn)自:
          http://www.cnblogs.com/knowledgesea/p/3284404.html

          posted @ 2013-08-27 12:42 小胡子 閱讀(2146) | 評論 (2)編輯 收藏

               摘要: 前言:最近公司有個Web要發(fā)布,但是以前都是由實(shí)施到甲方去發(fā)布,配置,這幾天有點(diǎn)閑,同事讓我搞一個一鍵發(fā)布,就和安裝軟件那樣的程序,好讓實(shí)施直接 配置一下數(shù)據(jù)庫就可以了,然后到網(wǎng)上搜了下,找到一些相關(guān)的教程,現(xiàn)在整理了一下,花了一個下午的時間來寫筆記,寫好了,首先奉獻(xiàn)給博客園的小伙伴們,和 大伙兒分享一下,好了,下面進(jìn)入主題~~~ 1,首先打開VS2010,新建一個項目,如圖1-1所示: &nbs...  閱讀全文

          posted @ 2013-08-27 12:37 小胡子 閱讀(1320) | 評論 (0)編輯 收藏

          大家可以參考下這個網(wǎng)站http://eoffice.im.fju.edu.tw/phpbb/viewtopic.php?p=28685


          1.先啟動項目上的h2/bin下的h2.bat或h2w.bat文件,把h2數(shù)據(jù)庫啟動起來

          2.SSH2框架和h2數(shù)據(jù)庫整合方法
          2.1先在數(shù)據(jù)庫下創(chuàng)建 schema目錄(相當(dāng)于一個數(shù)據(jù)庫實(shí)例)

            create schema fdrkftcode

          目的是解決這種異常org.h2.jdbc.JdbcSQLException: Schema "fdrkftcode" not found; ...

          2.2在schema目錄下創(chuàng)建表,如創(chuàng)建系統(tǒng)用戶表admin
            create table fdrkftcode.admin(
                id int primary key,
                adminname varchar(50),
                username varchar(50),
                userpwd varchar(50),
                adminrights varchar(50),
                createdate datetime,
                usedtimes int,
                lastlogin datetime,
                curstatus int,
                remark varchar(200)
            )
           
          3.為了使用hibernate操作h2,需要作如下設(shè)置,在sql編輯窗口輸入下面這些腳本
          對于實(shí)體pojo對象的映射,我是用的annotation,關(guān)鍵是id主鍵的映射,如下:
          @Column(name = "ID", nullable = false)

          @Id

          @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ABC_ID_SEQ")

          @SequenceGenerator(name = "ABC_ID_SEQ", sequenceName = "ABC_ID_SEQ")

          protected Long id;

           注意這里的GeneratedValue和SequenceGenerator的使用,這屬于JPA規(guī)范,全部來自javax.persisten

          4.配置applicationContext.xml文件,主要有三個地方要注意:
          4.1修改連接數(shù)據(jù)庫的JDBC驅(qū)動 driverClass的值為org.h2.Driver
          4.2修改連接數(shù)據(jù)庫所用的URL字符串 jdbcUrl的值為jdbc:h2:tcp://localhost/~/FDRKFTCODE;MODE=MySQL;AUTO_SERVER=TRUE
          4.3修改Hibernate的數(shù)據(jù)庫方言hibernate.dialect為org.hibernate.dialect.H2Dialect

          5.h2數(shù)據(jù)庫一些常用操作
          5.1幫助命令help
          5.2表中某字段重命名  ALTER TABLE  fdrkftcode.admin ALTER COLUMN usepwd rename to userpwd
          5.3表中新增字段  ALTER TABLE fdrkftcode.admin ADD IF NOT EXISTS abc varchar(50)
          5.4表中刪除字段  ALTER TABLE fdrkftcode.admin DROP COLUMN IF EXISTS abc
          5.5查找表中記錄 SELECT * from fdrkftcode.admin
          5.6往表中插入記錄 INSERT INTO fdrkftcode.admin VALUES (1,'管理員','admin','admin','10000000000000000000','2013-05-1 00:12:34',3,'2013-05-1 15:32:57',1,'超過級管理員')
          5.7修改表中某記錄 UPDATE fdrkftcode.admin SET fdrkftcode.admin.adminname='超級管理員' where fdrkftcode.admin.id=1

          5.8刪除表中某記錄 DELETE FROM fdrkftcode.admin WHERE fdrkftcode.admin.id=1


          6.下面是我項目的applicationContext.xml配置方法,大家可以參考下

          <?xml version="1.0" encoding="UTF-8"?>
          <beans
              xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:p="http://www.springframework.org/schema/p"
              xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
              
              <!-- 定義使用C3P0連接池的數(shù)據(jù)源 -->
              <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
                  <!-- 指定連接數(shù)據(jù)庫的JDBC驅(qū)動 -->
                  <property name="driverClass">
                       <value>org.h2.Driver</value>
                   </property>
                  <!-- 連接數(shù)據(jù)庫所用的URL -->
                  <property name="jdbcUrl">
                      <value>jdbc:h2:tcp://localhost/~/FDRKFTCODE;MODE=MySQL;AUTO_SERVER=TRUE</value>
                  </property>
                  <!-- 連接數(shù)據(jù)庫的用戶名 -->
                  <property name="user">
                      <value>sa</value>
                  </property>
                  <!-- 連接數(shù)據(jù)庫的密碼 -->
                  <property name="password">
                      <value></value>
                  </property>
                  <!-- 設(shè)置數(shù)據(jù)庫連接池的最大連接數(shù) -->
                  <property name="maxPoolSize">
                      <value>50</value>
                  </property>
                  <!-- 設(shè)置數(shù)據(jù)庫連接池的最小連接數(shù) -->
                  <property name="minPoolSize">
                      <value>5</value>
                  </property>
                  <!-- 設(shè)置數(shù)據(jù)庫連接池的初始化連接數(shù) -->
                  <property name="initialPoolSize">
                      <value>5</value>
                  </property>
                  <!-- 設(shè)置數(shù)據(jù)庫連接池的連接的最大空閑時間,單位為秒 -->
                  <property name="maxIdleTime">
                      <value>20</value>
                  </property>
              </bean>
              
              <!-- 定義Hibernate的SessionFactory -->
              <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                  <!-- 依賴注入上面定義的數(shù)據(jù)源dataSource -->
                  <property name="dataSource" ref="dataSource"/>
                  <!-- 注冊Hibernate的ORM映射文件 -->
                  <property name="mappingResources">
                      <list>
                         <value>com/sungoal/ORM/Admin.hbm.xml</value>
                      </list>
                  </property>
                  <!-- 設(shè)置Hibernate的相關(guān)屬性 -->
                  <property name="hibernateProperties">
                      <props>
                          <!-- 設(shè)置Hibernate的數(shù)據(jù)庫方言 -->
                          <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
                          <!-- 設(shè)置Hibernate是否在控制臺輸出SQL語句,開發(fā)調(diào)試階段通常設(shè)為true -->
                          <prop key="show_sql">true</prop>
                          <!-- 設(shè)置Hibernate一個提交批次中的最大SQL語句數(shù) -->
                          <prop key="hibernate.jdbc.batch_size">50</prop>
                      </props>
                  </property>
              </bean>
              
               <!--定義Hibernate的事務(wù)管理器HibernateTransactionManager -->
              <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                  <!-- 依賴注入上面定義的sessionFactory -->
                  <property name="sessionFactory" ref="sessionFactory"/>
              </bean>
              <!-- 裝配通用數(shù)據(jù)庫訪問類BaseDAOImpl -->    
              <bean id="dao" class="com.sungoal.DAO.BaseDAOImpl">
                  <!-- 依賴注入上面定義的sessionFactory -->
                  <property name="sessionFactory" ref="sessionFactory"/>
              </bean>
              <!-- 部署系統(tǒng)用戶管理業(yè)務(wù)控制器AdminAction -->
              <bean id="adminAction" class="com.sungoal.struts.action.AdminAction" scope="prototype">
                  <property name="dao" ref="dao"/>
              </bean>
          </beans>

          posted @ 2013-08-14 09:33 小胡子 閱讀(373) | 評論 (0)編輯 收藏

          hibernate.properties

          ######################
          ### Query Language ###
          ######################

          ## define query language constants / function names

          hibernate.query.substitutions yes 'Y', no 'N'


          ## select the classic query parser

          #hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory


          #################
          ### Platforms ###
          #################

          ## JNDI Datasource

          #hibernate.connection.datasource jdbc/test
          #hibernate.connection.username db2
          #hibernate.connection.password db2


          ## HypersonicSQL

          hibernate.dialect org.hibernate.dialect.HSQLDialect
          hibernate.connection.driver_class org.hsqldb.jdbcDriver
          hibernate.connection.username sa
          hibernate.connection.password
          hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
          #hibernate.connection.url jdbc:hsqldb:hsql://localhost
          #hibernate.connection.url jdbc:hsqldb:test

          ## H2 (www.h2database.com)
          #hibernate.dialect org.hibernate.dialect.H2Dialect
          #hibernate.connection.driver_class org.h2.Driver
          #hibernate.connection.username sa
          #hibernate.connection.password
          #hibernate.connection.url jdbc:h2:mem:./build/db/h2/hibernate
          #hibernate.connection.url jdbc:h2:testdb/h2test
          #hibernate.connection.url jdbc:h2:mem:imdb1
          #hibernate.connection.url jdbc:h2:tcp://dbserv:8084/sample;
          #hibernate.connection.url jdbc:h2:ssl://secureserv:8085/sample;
          #hibernate.connection.url jdbc:h2:ssl://secureserv/testdb;cipher=AES

          ## MySQL

          #hibernate.dialect org.hibernate.dialect.MySQLDialect
          #hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
          #hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
          #hibernate.connection.driver_class com.mysql.jdbc.Driver
          #hibernate.connection.url jdbc:mysql:///test
          #hibernate.connection.username gavin
          #hibernate.connection.password


          ## Oracle

          #hibernate.dialect org.hibernate.dialect.OracleDialect
          #hibernate.dialect org.hibernate.dialect.Oracle9Dialect
          #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
          #hibernate.connection.username ora
          #hibernate.connection.password ora
          #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
          #hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE


          ## PostgreSQL

          #hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
          #hibernate.connection.driver_class org.postgresql.Driver
          #hibernate.connection.url jdbc:postgresql:template1
          #hibernate.connection.username pg
          #hibernate.connection.password


          ## DB2

          #hibernate.dialect org.hibernate.dialect.DB2Dialect
          #hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
          #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
          #hibernate.connection.url jdbc:db2://localhost:50000/somename
          #hibernate.connection.url jdbc:db2:somename
          #hibernate.connection.username db2
          #hibernate.connection.password db2

          ## TimesTen

          #hibernate.dialect org.hibernate.dialect.TimesTenDialect
          #hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
          #hibernate.connection.url jdbc:timesten:direct:test
          #hibernate.connection.username
          #hibernate.connection.password

          ## DB2/400

          #hibernate.dialect org.hibernate.dialect.DB2400Dialect
          #hibernate.connection.username user
          #hibernate.connection.password password

          ## Native driver
          #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
          #hibernate.connection.url jdbc:db2://systemname

          ## Toolbox driver
          #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
          #hibernate.connection.url jdbc:as400://systemname


          ## Derby (not supported!)

          #hibernate.dialect org.hibernate.dialect.DerbyDialect
          #hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
          #hibernate.connection.username
          #hibernate.connection.password
          #hibernate.connection.url jdbc:derby:build/db/derby/hibernate;create=true


          ## Sybase

          #hibernate.dialect org.hibernate.dialect.SybaseDialect
          #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
          #hibernate.connection.username sa
          #hibernate.connection.password sasasa
          #hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb


          ## Mckoi SQL

          #hibernate.dialect org.hibernate.dialect.MckoiDialect
          #hibernate.connection.driver_class com.mckoi.JDBCDriver
          #hibernate.connection.url jdbc:mckoi:///
          #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
          #hibernate.connection.username admin
          #hibernate.connection.password nimda


          ## SAP DB

          #hibernate.dialect org.hibernate.dialect.SAPDBDialect
          #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
          #hibernate.connection.url jdbc:sapdb://localhost/TST
          #hibernate.connection.username TEST
          #hibernate.connection.password TEST
          #hibernate.query.substitutions yes 'Y', no 'N'


          ## MS SQL Server

          #hibernate.dialect org.hibernate.dialect.SQLServerDialect
          #hibernate.connection.username sa
          #hibernate.connection.password sa

          ## JSQL Driver
          #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
          #hibernate.connection.url jdbc:JSQLConnect://1E1/test

          ## JTURBO Driver
          #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
          #hibernate.connection.url jdbc:JTurbo://1E1:1433/test

          ## WebLogic Driver
          #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
          #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433

          ## Microsoft Driver (not recommended!)
          #hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
          #hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor

          ## The New Microsoft Driver
          #hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
          #hibernate.connection.url jdbc:sqlserver://localhost

          ## jTDS (since version 0.9)
          #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
          #hibernate.connection.url jdbc:jtds:sqlserver://1E1/test

          ## Interbase

          #hibernate.dialect org.hibernate.dialect.InterbaseDialect
          #hibernate.connection.username sysdba
          #hibernate.connection.password masterkey

          ## DO NOT specify hibernate.connection.sqlDialect

          ## InterClient

          #hibernate.connection.driver_class interbase.interclient.Driver
          #hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb

          ## Pure Java

          #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
          #hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb


          ## Pointbase

          #hibernate.dialect org.hibernate.dialect.PointbaseDialect
          #hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
          #hibernate.connection.url jdbc:pointbase:embedded:sample
          #hibernate.connection.username PBPUBLIC
          #hibernate.connection.password PBPUBLIC


          ## Ingres

          ## older versions (before Ingress 2006)

          #hibernate.dialect org.hibernate.dialect.IngresDialect
          #hibernate.connection.driver_class ca.edbc.jdbc.EdbcDriver
          #hibernate.connection.url jdbc:edbc://localhost:II7/database
          #hibernate.connection.username user
          #hibernate.connection.password password

          ## Ingres 2006 or later

          #hibernate.dialect org.hibernate.dialect.IngresDialect
          #hibernate.connection.driver_class com.ingres.jdbc.IngresDriver
          #hibernate.connection.url jdbc:ingres://localhost:II7/database;CURSOR=READONLY;auto=multi
          #hibernate.connection.username user
          #hibernate.connection.password password

          ## Mimer SQL

          #hibernate.dialect org.hibernate.dialect.MimerSQLDialect
          #hibernate.connection.driver_class com.mimer.jdbc.Driver
          #hibernate.connection.url jdbc:mimer:multi1
          #hibernate.connection.username hibernate
          #hibernate.connection.password hibernate


          ## InterSystems Cache

          #hibernate.dialect org.hibernate.dialect.Cache71Dialect
          #hibernate.connection.driver_class com.intersys.jdbc.CacheDriver
          #hibernate.connection.username _SYSTEM
          #hibernate.connection.password SYS
          #hibernate.connection.url jdbc:Cache://127.0.0.1:1972/HIBERNATE


          #################################
          ### Hibernate Connection Pool ###
          #################################

          hibernate.connection.pool_size 1


          ###########################
          ### C3P0 Connection Pool###
          ###########################

          #hibernate.c3p0.max_size 2
          #hibernate.c3p0.min_size 2
          #hibernate.c3p0.timeout 5000
          #hibernate.c3p0.max_statements 100
          #hibernate.c3p0.idle_test_period 3000
          #hibernate.c3p0.acquire_increment 2
          #hibernate.c3p0.validate false


          ##############################
          ### Proxool Connection Pool###
          ##############################

          ## Properties for external configuration of Proxool

          hibernate.proxool.pool_alias pool1

          ## Only need one of the following

          #hibernate.proxool.existing_pool true
          #hibernate.proxool.xml proxool.xml
          #hibernate.proxool.properties proxool.properties


          #################################
          ### Plugin ConnectionProvider ###
          #################################

          ## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)

          #hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
          #hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
          #hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
          #hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider


          #######################
          ### Transaction API ###
          #######################

          ## Enable automatic flush during the JTA beforeCompletion() callback
          ## (This setting is relevant with or without the Transaction API)

          #hibernate.transaction.flush_before_completion


          ## Enable automatic session close at the end of transaction
          ## (This setting is relevant with or without the Transaction API)

          #hibernate.transaction.auto_close_session


          ## the Transaction API abstracts application code from the underlying JTA or JDBC transactions

          #hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
          #hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory


          ## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
          ## default is java:comp/UserTransaction
          ## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class

          #jta.UserTransaction jta/usertransaction
          #jta.UserTransaction javax.transaction.UserTransaction
          #jta.UserTransaction UserTransaction


          ## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager

          #hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
          #hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
          #hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
          #hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
          #hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup


          ##############################
          ### Miscellaneous Settings ###
          ##############################

          ## print all generated SQL to the console

          #hibernate.show_sql true


          ## format SQL in log and console

          hibernate.format_sql true


          ## add comments to the generated SQL

          #hibernate.use_sql_comments true


          ## generate statistics

          #hibernate.generate_statistics true


          ## auto schema export

          #hibernate.hbm2ddl.auto create-drop
          #hibernate.hbm2ddl.auto create
          #hibernate.hbm2ddl.auto update
          #hibernate.hbm2ddl.auto validate


          ## specify a default schema and catalog for unqualified tablenames

          #hibernate.default_schema test
          #hibernate.default_catalog test


          ## enable ordering of SQL UPDATEs by primary key

          #hibernate.order_updates true


          ## set the maximum depth of the outer join fetch tree

          hibernate.max_fetch_depth 1


          ## set the default batch size for batch fetching

          #hibernate.default_batch_fetch_size 8


          ## rollback generated identifier values of deleted entities to default values

          #hibernate.use_identifer_rollback true


          ## enable bytecode reflection optimizer (disabled by default)

          #hibernate.bytecode.use_reflection_optimizer true


          #####################
          ### JDBC Settings ###
          #####################

          ## specify a JDBC isolation level

          #hibernate.connection.isolation 4


          ## enable JDBC autocommit (not recommended!)

          #hibernate.connection.autocommit true


          ## set the JDBC fetch size

          #hibernate.jdbc.fetch_size 25


          ## set the maximum JDBC 2 batch size (a nonzero value enables batching)

          #hibernate.jdbc.batch_size 5
          #hibernate.jdbc.batch_size 0


          ## enable batch updates even for versioned data

          hibernate.jdbc.batch_versioned_data true


          ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)

          #hibernate.jdbc.use_scrollable_resultset true


          ## use streams when writing binary types to / from JDBC

          hibernate.jdbc.use_streams_for_binary true


          ## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row

          #hibernate.jdbc.use_get_generated_keys false


          ## choose a custom JDBC batcher

          # hibernate.jdbc.factory_class


          ## enable JDBC result set column alias caching
          ## (minor performance enhancement for broken JDBC drivers)

          # hibernate.jdbc.wrap_result_sets


          ## choose a custom SQL exception converter

          #hibernate.jdbc.sql_exception_converter


          ##########################
          ### Second-level Cache ###
          ##########################

          ## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)

          #hibernate.cache.use_minimal_puts true


          ## set a prefix for cache region names

          hibernate.cache.region_prefix hibernate.test


          ## disable the second-level cache

          #hibernate.cache.use_second_level_cache false


          ## enable the query cache

          #hibernate.cache.use_query_cache true


          ## store the second-level cache entries in a more human-friendly format

          #hibernate.cache.use_structured_entries true


          ## choose a cache implementation

          #hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
          #hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
          hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
          #hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
          #hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
          #hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider


          ## choose a custom query cache implementation

          #hibernate.cache.query_cache_factory


          ############
          ### JNDI ###
          ############

          ## specify a JNDI name for the SessionFactory

          #hibernate.session_factory_name hibernate/session_factory


          ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
          ## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
          ## is the best approach in an application server

          #file system
          #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
          #hibernate.jndi.url file:/

          #WebSphere
          #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
          #hibernate.jndi.url iiop://localhost:900/

          posted @ 2013-08-14 09:29 小胡子 閱讀(392) | 評論 (0)編輯 收藏

               摘要: 這幾天學(xué)習(xí)了一下Spring Security3.1,從官網(wǎng)下載了Spring Security3.1版本進(jìn)行練習(xí),經(jīng)過多次嘗試才摸清了其中的一些原理。本人不才,希望能幫助大家。還有,這次我第二次寫博客啊,文體不是很行。希望 能讓觀看者不產(chǎn)生疲憊的感覺,我已經(jīng)心滿意足了。 一、數(shù)據(jù)庫結(jié)構(gòu)      先來看一下數(shù)據(jù)庫結(jié)構(gòu),采用的是基于角色-資源-用戶的權(quán)限...  閱讀全文

          posted @ 2013-08-13 17:49 小胡子 閱讀(328) | 評論 (0)編輯 收藏

          我們知道,EXT的全部js是比較大的,一個ext-all-debug.js就達(dá)2m多,它的壓縮版(去掉js中的換行及空格),也達(dá)600多k,這對于在網(wǎng)速不太快的時,下載js就得漫長的等待。
          JOffice中的日歷任務(wù)控件,js多達(dá)四五個,每個js大小都達(dá)70多k,盡管我們采用了后加載的方式,則當(dāng)用戶點(diǎn)擊我的任務(wù)功能時,才下載該js,但這樣仍然很慢,因?yàn)橄螺d的js很慢
          ,鑒于此,在互聯(lián)網(wǎng)上使用類似Joffice類似的程序,速度會使很多開發(fā)商不敢選用ext作為開發(fā)技術(shù)。據(jù)本人當(dāng)時參與移動一個內(nèi)部采購平臺的開發(fā),就是因?yàn)槠溥\(yùn)行程序慢,遭到移動的終端用戶的棄罵,
          所以,要想用EXT來開發(fā)應(yīng)用,需要解決其運(yùn)行慢的特點(diǎn)。


          我們可以從以下幾種方法來提高應(yīng)用程序的運(yùn)行速度:

          一.前期盡量少加載js.

             這點(diǎn)在Joffice中有比較好的運(yùn)用,采用的是由ScriptMgr.load方法來完成,加載完成后,其會在body中插入一個div,只要當(dāng)前頁面不被刷新,下次再訪問該功能時,不需要再加載js

             function $ImportJs(viewName,callback) {
              var b 
          = document.getElementById(viewName+'-hiden');
              
          if (b != null) {
                  var view 
          = eval('new ' + viewName + '()');
                  callback.call(
          this, view);
              } 
          else {
                  var jsArr 
          = eval('App.importJs.' + viewName);
                  
          if(jsArr==undefined){
                      var view 
          = eval('new ' + viewName + '()');
                      callback.call(
          this, view);
                      
          return ;
                  }
                  ScriptMgr.load({
                              scripts : jsArr,
                              callback : function() {
                                  
                                  Ext.DomHelper.append(document.body,
          "<div id='"
                                                          
          + viewName
                                                          
          + "-hiden' style='display:none'></div>");
                                  var view 
          = eval('new ' + viewName + '()');
                                  callback.call(
          this, view);
                              }
                  });
              }
          }


              package com.htsoft.core.web.filter;  
                  
          import java.io.IOException;  
                  
          import java.util.HashMap;  
                  
          import java.util.Iterator;  
                  
          import java.util.Map;  
                  
          import javax.servlet.Filter;  
                  
          import javax.servlet.FilterChain;  
                  
          import javax.servlet.FilterConfig;  
                  
          import javax.servlet.ServletException;  
                  
          import javax.servlet.ServletRequest;  
                  
          import javax.servlet.ServletResponse;  
                  
          import javax.servlet.http.HttpServletRequest;  
                  
          import javax.servlet.http.HttpServletResponse;  
                    
                  
          public class GzipJsFilter implements Filter {  
                      Map headers 
          = new HashMap();  
                      
          public void destroy() {  
                      }  
                      
          public void doFilter(ServletRequest req, ServletResponse res,  
                              FilterChain chain) 
          throws IOException, ServletException {  
                          
          if(req instanceof HttpServletRequest) {  
                              doFilter((HttpServletRequest)req, (HttpServletResponse)res, chain);  
                          }
          else {  
                              chain.doFilter(req, res);  
                          }  
                      }  
                      
          public void doFilter(HttpServletRequest request,  
                              HttpServletResponse response, FilterChain chain)  
                              
          throws IOException, ServletException {  
                              request.setCharacterEncoding(
          "UTF-8");  
                              
          for(Iterator it = headers.entrySet().iterator();it.hasNext();) {  
                                  Map.Entry entry 
          = (Map.Entry)it.next();  
                                  response.addHeader((String)entry.getKey(),(String)entry.getValue());  
                              }  
                              chain.doFilter(request, response);  
                      }  
                    
                      
          public void init(FilterConfig config) throws ServletException {  
                          String headersStr 
          = config.getInitParameter("headers");  
                          String[] headers 
          = headersStr.split(",");  
                          
          for(int i = 0; i < headers.length; i++) {  
                              String[] temp 
          = headers[i].split("=");  
                              
          this.headers.put(temp[0].trim(), temp[1].trim());  
                          }  
                      }  
                  } 

          3.在WEB.xml 文件中,添加以下配置:

          <filter>    
              
          <filter-name>GzipJsFilter</filter-name>    
              
          <filter-class>com.htsoft.core.web.filter.GzipJsFilter</filter-class>    
              
          <init-param>    
                  
          <param-name>headers</param-name>    
                  
          <param-value>Content-Encoding=gzip</param-value>    
              
          </init-param>  
          </filter>  
          <filter-mapping>  
          <filter-name>GzipJsFilter</filter-name>  
          <url-pattern>*.gzjs</url-pattern>  
          lt;
          /filter-mapping>  
          <servlet-mapping> 
          4.在index.jsp中引入該壓縮文件:
            <script type="text/javascript" src="<%=request.getContextPath()%>/ext3/ext-all.gzjs"></script>
           

          可以看到瀏覽器解壓后,其代碼是一樣的:

           

           

          大家可以看到以上,這塊是在外網(wǎng)使用的,其速度是比較快的。當(dāng)然,瀏覽器解壓這個文件需要一點(diǎn)時間,不過在本地解壓是非常快的,可以不用管。

           

           

          三、通過Js緩存,更加可以提高EXT的加載速度,關(guān)于緩存,本文不作討論。

          原文出自:
          http://man1900.iteye.com/blog/515058

          posted @ 2013-08-13 16:48 小胡子 閱讀(352) | 評論 (0)編輯 收藏

          我們常常在代碼中讀取一些資源文件(比如圖片,音樂,文本等等)。在單獨(dú)運(yùn)行的時候這些簡單的處理當(dāng)然不會有問題。但是,如果我們把代碼打成一個jar包以后,即使將資源文件一并打包,這些東西也找不出來了。看看下面的代碼:

          //源代碼1:
          package edu.hxraid;
          import java.io.*;
          public class Resource {
              
          public  void getResource() throws IOException{
                  File file
          =new File("bin/resource/res.txt");
                  BufferedReader br
          =new BufferedReader(new FileReader(file));
                  String s
          ="";
                  
          while((s=br.readLine())!=null)
                      System.out.println(s);
              }
          }   
          這段代碼寫在Eclipse建立的java Project中,其目錄為:(其中將資源文件res.txt放在了bin目錄下,以便打成jar包)
                1、src/
                        src/edu/hxraid/Resource.java
                2、bin/
                        bin/resource/res.txt
                        bin/edu/hxraid/Resource.class

                很顯然運(yùn)行源代碼1是能夠找到資源文件res.txt。但當(dāng)我們把整個工程打成jar包以后(ResourceJar.jar),這個jar包內(nèi)的目錄為:
                        edu/hxraid/Resource.class
                        resource/res.txt

           

                   而這時jar包中Resource.class字節(jié) 碼:ldc <String "bin/resource/res.txt"> [20] 將無法定位到j(luò)ar包中的res.txt位置上。就算把bin/目錄去掉:ldc <String "resource/res.txt"> [20] 仍然無法定位到j(luò)ar包中res.txt上。


          這主要是因?yàn)閖ar包是一個單獨(dú)的文件而非文件夾,絕對不可能通過"file:/e:/.../ResourceJar.jar/resource /res.txt"這種形式的文件URL來定位res.txt。所以即使是相對路徑,也無法定位到j(luò)ar文件內(nèi)的txt文件(讀者也許對這段原因解釋有些費(fèi)解,在下面我們會用一段代碼運(yùn)行的結(jié)果來進(jìn)一步闡述)。
          那么把資源打入jar包,無論ResourceJar.jar在系統(tǒng)的什么路徑下,jar包中的字節(jié)碼程序都可以找到該包中的資源。這會是幻想嗎?


                當(dāng)然不是,我們可以用類裝載器(ClassLoader)來做到這一點(diǎn):

                   (1) ClassLoader 是類加載器的抽象類。它可以在運(yùn)行時動態(tài)的獲取加載類的運(yùn)行信息。 可以這樣說,當(dāng)我們調(diào)用ResourceJar.jar中的Resource類時,JVM加載進(jìn)Resource類,并記錄下Resource運(yùn)行時信息 (包括Resource所在jar包的路徑信息)。而ClassLoader類中的方法可以幫助我們動態(tài)的獲取這些信息:
                    ● public URL getResource(String name)
                      查找具有給定名稱的資源。資源是可以通過類代碼以與代碼基無關(guān)的方式訪問的一些數(shù)據(jù)(圖像、聲音、文本等)。并返回資源的URL對象。
                    ● public InputStream getResourceAsStream(String name);
                       返回讀取指定資源的輸入流。這個方法很重要,可以直接獲得jar包中文件的內(nèi)容。

                   

                    (2) ClassLoader是abstract的,不可能實(shí)例化對象,更加不可能通過ClassLoader調(diào)用上面兩個方法。所以我們真正寫代碼的時候,是通過Class類中的getResource()和getResourceAsStream()方法,這兩個方法會委托ClassLoader中的getResource()和getResourceAsStream()方法 。好了,現(xiàn)在我們重新寫一段Resource代碼,來看看上面那段費(fèi)解的話是什么意思了:


          //源代碼2:
          package edu.hxraid;
          import java.io.*;
          import java.net.URL;
          public class Resource {
              
          public  void getResource() throws IOException{    
                        
          //查找指定資源的URL,其中res.txt仍然開始的bin目錄下 
                  URL fileURL=this.getClass().getResource("/resource/res.txt"); 
                  System.out.println(fileURL.getFile());
              }
              
          public static void main(String[] args) throws IOException {
                  Resource res
          =new Resource();
                  res.getResource();
              }
          }

          運(yùn)行這段源代碼結(jié)果:/E:/Code_Factory/WANWAN/bin/resource/res.txt  (../ Code_Factory/WANWAN/.. 是java project所在的路徑)

                     我們將這段代碼打包成ResourceJar.jar ,并將ResourceJar.jar放在其他路徑下(比如 c:\ResourceJar.jar)。然后另外創(chuàng)建一個java project并導(dǎo)入ResourceJar.jar,寫一段調(diào)用jar包中Resource類的測試代碼:


          import java.io.IOException;
          import edu.hxraid.Resource;
          public class TEST {
              
          public static void main(String[] args) throws IOException {
                  Resource res
          =new Resource();
                  res.getResource();
              }
          }
          這時的運(yùn)行結(jié)果是:file:/C:/ResourceJar.jar!/resource/res.txt
          我們成功的在運(yùn)行時動態(tài)獲得了res.txt的位置。然而,問題來了,你是否可以通過下面這樣的代碼來得到res.txt文件?
                                File f=new File("C:/ResourceJar.jar!/resource/res.txt");
                      當(dāng)然不可能,因?yàn)?.../ResourceJar.jar!/resource/...."并不是文件資源定位符的格式 (jar中資源有其專門的URL形式:
          jar:<url>!/{entry} )。所以,如果jar包中的類源代碼用File f=new File(相對路徑);的形式,是不可能定位到文件資源的。這也是為什么源代碼1打包成jar文件后,調(diào)用jar包時會報出FileNotFoundException的癥結(jié)所在了。

           

                    (3) 我們不能用常規(guī)操作文件的方法來讀取ResourceJar.jar中的資源文件res.txt,但可以通過Class類的getResourceAsStream()方法來獲取 ,這種方法是如何讀取jar中的資源文件的,這一點(diǎn)對于我們來說是透明的。我們將Resource.java改寫成:


          //源代碼3:
          package edu.hxraid;
          import java.io.*;
          public class Resource {
              
          public void getResource() throws IOException{
                  
          //返回讀取指定資源的輸入流
                  InputStream is=this.getClass().getResourceAsStream("/resource/res.txt"); 
                  BufferedReader br
          =new BufferedReader(new InputStreamReader(is));
                  String s
          ="";
                  
          while((s=br.readLine())!=null)
                      System.out.println(s);
              }
          }

          我們將java工程下/bin目錄中的edu/hxraid /Resource.class和資源文件resource/res.txt一并打包進(jìn)ResourceJar.jar中,不管jar包在系統(tǒng)的任何目錄 下,調(diào)用jar包中的Resource類都可以獲得jar包中的res.txt資源,再也不會找不到res.txt文件了。

          原文出自:
          http://www.iteye.com/topic/483115

          posted @ 2013-08-12 15:19 小胡子 閱讀(288) | 評論 (0)編輯 收藏

          編輯代碼常用快捷鍵

          格式化代碼的快捷鍵 Ctrl + Shift + F

          格式化縮進(jìn)的快捷鍵是 Ctrl + I,只能對選中的文本進(jìn)行縮進(jìn)

          刪除一行的快捷鍵是 Ctrl + D

          當(dāng)前窗口最大化最小化切換 Ctrl + M

          轉(zhuǎn)到最后進(jìn)行修改的位置 Ctrl + Q

          快速查找選中的字符 Ctrl + K(向下) Ctrl + Shift + K(向上)

          光標(biāo)放到一個括號,切換到另一個成對的括號 Ctrl + Shirt + P

          在編輯過的位置進(jìn)行切換 Alt + 左右方向鍵

          閱讀代碼常用的快捷鍵

          F3不解釋(一些人喜歡用Ctrl + 鼠標(biāo)左鍵)

          選中方法或者變量 Ctrl + Alt + H,查找在哪些地方調(diào)用,快速閱讀代碼和評估代碼修改必須要用到的

          繼承關(guān)系 F4,了解代碼的框架

          快速查找函數(shù)和變量 Ctrl + O,輸入函數(shù)或變量的名字,比在Outline中一個一個找要快很多,但是要對代碼有了解

          全工程查找 Ctrl + H,代碼巨多的情況下必不可少。

          由于水平有限,筆者只用到了這些快捷鍵

          如果想知道其他的快捷鍵 Ctrl + Shift + L

          自定義格式化代碼

          在Preference中打開Java的Format

          內(nèi)建的模版是不能修改的,點(diǎn)擊New...,隨便輸入一個名字,新建一個自己的模板,彈出自定義Edit窗口

          可以定義的項目非常豐富,在右邊還可以進(jìn)行預(yù)覽,就算對英文不感冒,也可以捉摸出大致的意思。對代碼進(jìn)行格式化的好處是不僅僅是美觀,便于閱讀,在 進(jìn)行團(tuán)隊開發(fā)的時候,使用統(tǒng)一的格式,在合并代碼的時候可以避免許多的沖突。修改完成的模版就是使用Ctrl + Shift + F格式化時的模板

          自動去除無用的import,自動補(bǔ)全@Override和@deprecated,eclipse的Clean up

          在Code Style中,除了Format還有Clean Up

          和Format進(jìn)行同樣的操作,新建一個模板,有幾個地方我決定有必要改一下

          Code Organizing標(biāo)簽選擇Remove trailing whitespace(移除尾部的空格)

          Organzie imports

          選擇Organzie imports前效果

          import org.model.*;

          選擇Organzie imports后效果

          import org.model.Engine;

          切換到Code Style標(biāo)簽

           

          Use blocks in if/while/for/do statements if/while/for/do自動添加括號,這個因人而異,我決定即使只用一行,也應(yīng)該添加括號。

          點(diǎn)擊菜單里的Source - Clean up,可以對代碼進(jìn)行清理,清理代碼最大的好處是——移除沒用的import,自動添加@Deprecated和@Override


          特別是自動添加@Override,可以很清楚的明白那些函數(shù)是繼承的。

          代碼提示

          用過visual assistx的一定非常系統(tǒng)它的代碼提示功能,我是個沒有代碼提示就無法Coding的人,點(diǎn)擊菜單Windows-Preference,切換到以下窗口

          找到Auto Activation,也就是紅色方框中的部分,將Auto activation delay(ms): 修改為 50

          Auto activation triggers for Java:修改為 .abcdefghigklmnoprstuvwxyz,這樣就能隨時提示了。

           

          最后介紹兩個工具,Search Everything 根據(jù)文件名快速查找文件,ClipX剪貼板歷史記錄。


          原文出自:http://www.cnblogs.com/sw926/p/3209615.html

          posted @ 2013-07-25 01:00 小胡子 閱讀(967) | 評論 (0)編輯 收藏

           1 @Entity
           2 @Table(name="T_ADM_USER")
           3 public class User extends GenericEntity implements Serializable {
           4     
           5     @OneToOne(cascade = CascadeType.PERSIST)
           6     @JoinColumn(name="grade_id")
           7     public Grade getGrade() {
           8         return grade;
           9     }
          10     public void setGrade(Grade grade) {
          11         this.grade = grade;
          12     }
          13     @Column(name="user_name", insertable = true, updatable = true, nullable = true)
          14     public String getUsername() {
          15         return username;
          16     }
          17     public void setUsername(String username) {
          18         this.username = username;
          19     }
          20 
          21 }

           1 public class TableUtil {
           2 
           3     public static void main(String[] args) {
           4         try{
           5             
           6             AnnotationConfiguration cfg = new AnnotationConfiguration();
           7             cfg.addAnnotatedClass(com.mygogo.grade.user.entity.User.class);                        
           9             SchemaExport se = new SchemaExport(cfg);
          10             se.setDelimiter(";");
          11             se.drop(truetrue);
          12             se.create(truetrue);
          13         }catch(Exception e){
          14             e.printStackTrace();
          15         }
          16         
          17     }
          18 }













          posted @ 2013-07-11 14:13 小胡子 閱讀(318) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 保康县| 平顺县| 房山区| 永平县| 灵宝市| 桐梓县| 宜兴市| 通城县| 鹿泉市| 南昌县| 分宜县| 莱阳市| 诸城市| 商南县| 正宁县| 隆林| 温州市| 清河县| 开远市| 安吉县| 丰宁| 卢氏县| 赞皇县| 长垣县| 太仓市| 会东县| 家居| 余江县| 城市| 铁力市| 灌阳县| 迁西县| 嘉定区| 长葛市| 武冈市| 海原县| 南江县| 古蔺县| 随州市| 罗山县| 中牟县|