<Script type = 'text/javascript '>
Function editEsOrder (options, success, response ){
If (success ){
Var tagModelManager_maxOrderIdJson = Ext. util. JSON. decode (response. responseText );
Var orderValue = tagModelManager_maxOrderIdJson.maxOrderId;
Ext. getCmp ('esorder'). setValue (orderValue );
}
}
Var tagModelManager_toolBar = new Ext. Toolbar ({
Items :[
{Id: 'tagmodel _ save', text: 'add', iconCls: 'add', handler: tagModel_Save}
,'-',
{Id: 'tagmodel _ dropselected', text: 'delete', iconCls: 'delete', handler: tagModel_dropSelected}
]});
New Ext. grid. GridPanel ({
Id: 'tagmodelmanager _ tagmodelgrid ',
AutoScroll: true, store: new Ext. data. Store (),
Cm: new Ext. grid. ColumnModel ([new Ext. grid. RowNumberer ()]),
Sm: new Ext. grid. CheckboxSelectionModel (),
RenderTo: 'tagmodelmanager _ tagModelDiv ',
Width: Ext. getCmp ('tagmodel _ win'). getSize (). width-16,
Height: Ext. getCmp ('tagmodel _ win'). getSize (). height-35,
HideHeaders: false,
LoadMask: {msg: 'loading data. Please wait ....'},
Collapsible: true,
Collapsed: false,
Bbar: new Ext. PagingToolbar ({
Id: 'tagmodelmanager _ tagmodelpagingbar ',
PageSize: getComboValue (),
Store: new Ext. data. Store (),
DisplayInfo: true
}),
Tbar: tagModelManager_toolBar
});
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). render ();
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). on ('rowdblclick', tagModelSelectRowDblClickEvent );
Function tagModelSelectRowDblClickEvent (selectionModel, rowIndex, selectedRecord ){
Var selectedRows = Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). getSelectionModel (). getSelections ();
Var row = selectedRows [0];
TagModel_SaveOrEdit ('edit', row );
}
Function tagModel_Save (){
TagModel_SaveOrEdit ('save ');
}
Function tagModelList_search (){
Ext. Ajax. request ({
Url: 'editTagModel.html? Method = getParams ',
Callback: getSearchList
});
}
Function getSearchList (options, success, response ){
If (success ){
Var tagModelManager_json = Ext. util. JSON. decode (response. responseText );
TagModelManager_tagModelGridTitle = tagModelManager_json.tagModelManager_tagModelGridTitle;
Var record = tagModelManager_json.record;
Var tagModelManager_tagModelColumnModels = tagModelManager_json.tagModelManager_tagModelColumnModels;
Var tagModelManager_tagModelColumnModel = new Ext. grid. columnModel (Ext. util. JSON. decode ("[" + "new Ext. grid. rowNumberer () "+", "+" new Ext. grid. checkboxSelectionModel () "+", "+ tagModelManager_tagModelColumnModels +"] ");
TagModelManager_tagModelColumnModel.defaultSortable = true;
Var strucutreModelManager_tagModelDataStore = new Ext. data. Store ({
BaseParams: {tagModelKeyword: Ext. getCmp ('tagmodelmanager _ search_button '). el. dom. value. trim ()},
Proxy: new Ext. data. HttpProxy ({
Url: 'editTagModel.html? Method = getTagModelDataList'
}),
Reader: new Ext. data. JsonReader ({
TotalProperty: 'result', root: 'tagmodellist'}, Ext. util. JSON. decode (record ))});
Ext. getCmp ('tagmodelmanager _ tagmodelpagingbar'). bind (strucutreModelManager_tagModelDataStore );
StrucutreModelManager_tagModelDataStore.load ({params: {start: 0, limit: getComboValue ()}});
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). setTitle (tagModelManager_tagModelGridTitle );
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). reconfigure (strucutreModelManager_tagModelDataStore, tagModelManager_tagModelColumnModel );
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). expand (false );
}
}
Function tagModelList_all (){
Ext. Ajax. request ({
Url: 'editTagModel.html? Method = getParams ',
Callback: getTagModel
});
}
Function getTagModel (options, success, response ){
If (success ){
Var tagModelManager_json = Ext. util. JSON. decode (response. responseText );
TagModelManager_tagModelGridTitle = tagModelManager_json.tagModelManager_tagModelGridTitle;
Var record = tagModelManager_json.record;
Var tagModelManager_tagModelColumnModels = tagModelManager_json.tagModelManager_tagModelColumnModels;
Var tagModelManager_tagModelColumnModel = new Ext. grid. columnModel (Ext. util. JSON. decode ("[" + "new Ext. grid. rowNumberer () "+", "+" new Ext. grid. checkboxSelectionModel () "+", "+ tagModelManager_tagModelColumnModels +"] ");
TagModelManager_tagModelColumnModel.defaultSortable = true;
Var strucutreModelManager_tagModelDataStore = new Ext. data. Store ({
Proxy: new Ext. data. HttpProxy ({
Url: 'editTagModel.html? Method = getTagModelDataList'
}),
Reader: new Ext. data. JsonReader ({
TotalProperty: 'result', root: 'tagmodellist'}, Ext. util. JSON. decode (record ))});
Ext. getCmp ('tagmodelmanager _ tagmodelpagingbar'). bind (strucutreModelManager_tagModelDataStore );
StrucutreModelManager_tagModelDataStore.load ({params: {start: 0, limit: getComboValue ()}});
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). reconfigure (strucutreModelManager_tagModelDataStore, tagModelManager_tagModelColumnModel );
Ext. getCmp ('tagmodelmanager _ tagmodelgrid'). expand (false );
}
}
Ext. Ajax. request ({
Url: 'editTagModel.html? Method = getParams ',
Callback: getTagModel
});
</Script>
Public void getTagModelDataList (ActionMapping mapping, ActionForm actionform, HttpServletRequest request, HttpServletResponse response ){
ITagModelManager tagmgr = this. getPkgServer (). getDriver (). getOperateServer (). getTagModelManager ();
List <HashMap <String, String> models = new ArrayList <HashMap <String, String> ();
String tagModelKeyword = request. getParameter ("tagModelKeyword ");
List <EssTagModel> tagModels;
TagModels = tagmgr. getEssTagModels ();
Int resultSize = 0;
If (null! = TagModels &&! TagModels. isEmpty ()){
// Display data by PAGE
ResultSize = tagModels. size ();
String start = request. getParameter ("start ");
String perPage = request. getParameter ("limit ");
String esType = "";
If (null! = Start & null! = PerPage ){
Int fromIdx = Integer. parseInt (start );
Int per = Integer. parseInt (perPage );
Int toIdx = fromIdx + per;
If (toIdx> resultSize) toIdx = resultSize;
TagModels = tagModels. subList (fromIdx, toIdx );
}
For (EssTagModel panel: tagModels ){
HashMap <String, String> map = new HashMap <String, String> ();
Map. put ("id", Long. toString (etm. getId ()));
Map. put ("esidentifier", etm. getEsidentifier ());
Map. put ("estype", EZ. getEstype ());
Map. put ("esdescription", EZ. getEsdescription ());
Map. put ("esorder", Long. toString (etm. getEsorder ()));
Map. put ("metadata", EZ. getMetadata ());
Models. add (map );
}
}
JSONObject json = new JSONObject ();
JSONArray ary = new JSONArray (models );
Json. put ("tagModelList", ary );
Json. put ("resultSize", resultSize );
WriteJson (response, json. toString ());
}
Public void getParams (ActionMapping mapping, ActionForm actionform, HttpServletRequest request, HttpServletResponse response ){
LinkedHashMap <String, String> tags = new LinkedHashMap <String, String> ();
Tags. put ("id", "id ");
Tags. put ("esidentifier", "field ");
Tags. put ("estype", "type ");
Tags. put ("esdescription", "Description ");
Tags. put ("esorder", "sequence ");
Tags. put ("metadata", "metadata ");
Tags. put ("esisnull", "required ");
Tags. put ("eslength", "field length ");
Tags. put ("esdotlength", "decimal place ");
Tags. put ("esissystem", "whether it is a system field ");
JSONObject json = new JSONObject ();
Json. put ("record", getJsonRecord (tags ));
Json. put ("tagModelManager_tagModelColumnModels", getJsonColumnModel (tags ));
WriteJson (response, json. toString ());
}