~maphew/mindtouch-deki/dekiwiki

« back to all changes in this revision

Viewing changes to src/services/Scripts/res/isomorphic/8.1/system/modules/ISC_ClassBrowser.js

  • Committer: aaronm
  • Date: 2011-09-28 23:16:51 UTC
  • Revision ID: svn-v4:0eb84ffb-6e0e-0410-b475-cc1b69d517b7:public/dekiwiki/trunk:29562
Feature: CS-42 Add Isomorphic SmartClient library to fake cdn to facilitate skinning work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Isomorphic SmartClient
 
3
 * Version 8.1 (2011-08-02)
 
4
 * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
 
5
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 
6
 *
 
7
 * licensing@smartclient.com
 
8
 *
 
9
 * http://smartclient.com/license
 
10
 */
 
11
 
 
12
if(window.isc&&window.isc.module_Core&&!window.isc.module_ClassBrowser){isc.module_ClassBrowser=1;isc._moduleStart=isc._ClassBrowser_start=(isc.timestamp?isc.timestamp():new Date().getTime());if(isc._moduleEnd&&(!isc.Log||(isc.Log && isc.Log.logIsDebugEnabled('loadTime')))){isc._pTM={ message:'ClassBrowser load/parse time: ' + (isc._moduleStart-isc._moduleEnd) + 'ms', category:'loadTime'};
 
13
if(isc.Log && isc.Log.logDebug)isc.Log.logDebug(isc._pTM.message,'loadTime')
 
14
else if(isc._preLog)isc._preLog[isc._preLog.length]=isc._pTM
 
15
else isc._preLog=[isc._pTM]}isc.definingFramework=true;isc.defineClass("JavaClassPane","VLayout");isc.A=isc.JavaClassPane.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.sourceViewDefaults={_constructor:"HTMLFlow",autoDraw:false,height:"*"};isc.B.push(isc.A.initWidget=function isc_JavaClassPane_initWidget(){this.Super("initWidget",arguments);this.sourceView=this.createAutoChild("sourceView",{contents:"Loading..."});this.addMember(this.sourceView);this.loadSource()}
 
16
,isc.A.loadSource=function isc_JavaClassPane_loadSource(){isc.DMI.call("isc_builtin","com.isomorphic.tools.BuiltinRPC","getJavaSource",this.config.path,this.getID()+".loadSourceReply(data)")}
 
17
,isc.A.loadSourceReply=function isc_JavaClassPane_loadSourceReply(_1){var _2=isc.JSSyntaxHiliter.create();this.sourceView.setContents(_2.hilite(_1))}
 
18
);isc.B._maxIndex=isc.C+3;isc.DataSource.create({
 
19
ID:"JVMClassTreeDS",
 
20
fields:{
 
21
name:{
 
22
name:"name"
 
23
},
 
24
path:{
 
25
name:"path",
 
26
primaryKey:true
 
27
},
 
28
parentID:{
 
29
foreignKey:"JVMClassTreeDS.path",
 
30
hidden:true,
 
31
name:"parentID"
 
32
},
 
33
isFolder:{
 
34
name:"isFolder",
 
35
type:"boolean"
 
36
}
 
37
},
 
38
operationBindings:[
 
39
{
 
40
language:"groovy",
 
41
operationType:"fetch",
 
42
script:"\n            if (!com.isomorphic.auth.DevModeAuthFilter.devModeAuthorized(request)) throw new Exception(\"Not Authorized\");\n\n            def namespace = criteria.parentID;\n            def classLoader = Thread.currentThread().getContextClassLoader();\n\n            if (namespace == null) {\n                return classLoader.getPackages().collect{it.name}.collect{\n                    def dotIndex = it.indexOf(\".\");\n                    dotIndex != -1 ? it.substring(0, dotIndex) : it;\n                }.unique().sort().collect{\n                    [name: it, path: it, parentID: namespace];\n                }\n            }\n\n            // non-root\n            def namespaces = classLoader.getPackages().collect{it.name}.findAll{ it.startsWith(namespace+\".\") }.collect{ it.substring(namespace.length()+1) }.collect{\n                def dotIndex = it.indexOf(\".\");\n                dotIndex != -1 ? it.substring(0, dotIndex) : it;\n            }.unique().sort().collect{\n                [name: it, path: namespace+\".\"+it, parentID: namespace];\n            };\n\n            // lookup classes for this namespace...\n            def resources = classLoader.getResources(namespace.replace('.', '/'));\n            def resource = resources.hasMoreElements() ? resources.nextElement() : null;\n            def children;\n            def url;\n            if (resource) {\n                url = resource.getFile();\n                log.warn(url);\n                if (url.startsWith(\"jar:\")) {\n            \n                } else {\n                    try {\n                        def file = new File(url);\n                        children = file.list().findAll{ it =~ /\\.class$/}.sort().collect{ \n                            def name = it.substring(0, it.length()-6);\n                            [name:name,path:namespace+\".\"+name,parentID:namespace,isFolder:false] \n                        };\n                    } catch (ignore) {}\n                }\n            }\n\n            namespaces?.addAll(children?:[]);\n            return namespaces;\n           "
 
43
}
 
44
]
 
45
})
 
46
isc.defineClass("JVMClassTree","TreeGrid");isc.A=isc.JVMClassTree.getPrototype();isc.A.dataSource="JVMClassTreeDS";isc.A.animateFolders=false;isc.JVMClassTree.registerStringMethods({});isc.defineClass("ClassBrowser","VLayout");isc.A=isc.ClassBrowser;isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.B.push(isc.A.showWindow=function isc_c_ClassBrowser_showWindow(_1,_2){isc.Window.create({title:"Class Browser",width:"100%",height:"100%",canDragReposition:false,closeClick:function(){this.destroy()},items:[isc.ClassBrowser.create({autoDraw:false},_2)]},_1).show()}
 
47
);isc.B._maxIndex=isc.C+1;isc.A=isc.ClassBrowser.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.classTreeDefaults={_constructor:"JVMClassTree",autoDraw:false,autoFetchData:true,recordDoubleClick:function(_1,_2){if(this.data.isLeaf(_2))this.creator.showClassPane(_2)}};isc.A.leftSectionDefaults={_constructor:"SectionStack",headerHeight:25,width:300,showResizeBar:true,animateSections:isc.Browser.isSafari,visibilityMode:"visible",autoParent:"mainLayout"};isc.A.mainLayoutDefaults={_constructor:"HLayout",height:"*"};isc.A.rightPaneDefaults={_constructor:"TabSet",tabs:[{name:"welcome",title:"Welcome",ID:"dsb_welcome_tab",canClose:true,pane:isc.Label.create({height:10,autoDraw:false,overflow:"visible",contents:"Select a class on the left..."})}]};isc.A.autoChildren=["mainLayout"];isc.A.classPaneDefaults={_constructor:"JavaClassPane"};isc.B.push(isc.A.initWidget=function isc_ClassBrowser_initWidget(){this.Super("initWidget",arguments);this.classTree=this.createAutoChild("classTree",{selectionChanged:"if (state) this.creator.classChanged(record)"});this.leftSection=this.createAutoChild("leftSection",{sections:[{name:"classes",title:"Classes",expanded:true,controls:[],items:[this.classTree]}]});this.addAutoChildren(this.autoChildren);this.mainLayout.addMember(this.leftSection);this.rightPane=this.createAutoChild("rightPane");this.mainLayout.addMember(this.rightPane)}
 
48
,isc.A.classChanged=function isc_ClassBrowser_classChanged(_1){this.showClassPane(_1)}
 
49
,isc.A.showClassPane=function isc_ClassBrowser_showClassPane(_1){var _2="class_"+this.escapeForId(_1.path);this.showPane({ID:_2,title:"Class: "+_1.name,paneClass:"classPane"},_1)}
 
50
,isc.A.escapeForId=function isc_ClassBrowser_escapeForId(_1){return isc.isA.String(_1)?_1.replace(/(\/|\.)/g,'_'):_1}
 
51
,isc.A.showPane=function isc_ClassBrowser_showPane(_1,_2){var _3=this.rightPane.getTab(_1.ID);if(_3){this.currentPane=_3.pane;this.rightPane.selectTab(_3);return}
 
52
_3={};isc.addProperties(_3,_1,{canClose:true,pane:this.createAutoChild(_1.paneClass,{config:_2})});var _4=this.rightPane.getTab(0);if(_4&&_4.name=="welcome")this.rightPane.removeTab(0);this.rightPane.addTab(_3);this.rightPane.selectTab(_3);this.currentPane=_3.pane}
 
53
);isc.B._maxIndex=isc.C+5;isc._moduleEnd=isc._ClassBrowser_end=(isc.timestamp?isc.timestamp():new Date().getTime());if(isc.Log&&isc.Log.logIsInfoEnabled('loadTime'))isc.Log.logInfo('ClassBrowser module init time: ' + (isc._moduleEnd-isc._moduleStart) + 'ms','loadTime');delete isc.definingFramework;}else{if(window.isc && isc.Log && isc.Log.logWarn)isc.Log.logWarn("Duplicate load of module 'ClassBrowser'.");}
 
54
/*
 
55
 * Isomorphic SmartClient
 
56
 * Version 8.1 (2011-08-02)
 
57
 * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
 
58
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 
59
 *
 
60
 * licensing@smartclient.com
 
61
 *
 
62
 * http://smartclient.com/license
 
63
 */
 
64