Helios-Core.st 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709
  1. Smalltalk current createPackage: 'Helios-Core'!
  2. Object subclass: #HLModel
  3. instanceVariableNames: 'announcer environment'
  4. package: 'Helios-Core'!
  5. !HLModel commentStamp!
  6. I am the abstract superclass of all models of Helios.
  7. I am the "Model" part of the MVC pattern implementation in Helios.
  8. I provide access to an `Environment` object and both a local (model-specific) and global (system-specific) announcer.
  9. The `#withChangesDo:` method is handy for performing model changes ensuring that all widgets are aware of the change and can prevent it from happening.
  10. Modifications of the system should be done via commands (see `HLCommand` and subclasses).!
  11. !HLModel methodsFor: 'accessing'!
  12. announcer
  13. ^ announcer ifNil: [ announcer := Announcer new ]
  14. !
  15. environment
  16. ^ environment ifNil: [ self manager environment ]
  17. !
  18. environment: anEnvironment
  19. environment := anEnvironment
  20. !
  21. manager
  22. ^ HLManager current
  23. !
  24. systemAnnouncer
  25. ^ self environment systemAnnouncer
  26. ! !
  27. !HLModel methodsFor: 'error handling'!
  28. withChangesDo: aBlock
  29. [
  30. self announcer announce: (HLAboutToChange new
  31. actionBlock: aBlock).
  32. aBlock value.
  33. ]
  34. on: HLChangeForbidden
  35. do: [ :ex | ]
  36. ! !
  37. !HLModel methodsFor: 'testing'!
  38. isBrowserModel
  39. ^ false
  40. !
  41. isReferencesModel
  42. ^ false
  43. !
  44. isToolModel
  45. ^ false
  46. ! !
  47. HLModel subclass: #HLToolModel
  48. instanceVariableNames: 'selectedClass selectedPackage selectedProtocol selectedSelector'
  49. package: 'Helios-Core'!
  50. !HLToolModel commentStamp!
  51. I am a model specific to package and class manipulation. All browsers should either use me or a subclass as their model.
  52. I provide methods for package, class, protocol and method manipulation and access, forwarding to my environment.
  53. I also handle compilation of classes and methods as well as compilation and parsing errors.!
  54. !HLToolModel methodsFor: 'accessing'!
  55. allSelectors
  56. ^ self environment allSelectors
  57. !
  58. availableClassNames
  59. ^ self environment availableClassNames
  60. !
  61. availablePackageNames
  62. ^ self environment availablePackageNames
  63. !
  64. availablePackages
  65. ^ self environment availablePackageNames
  66. !
  67. availableProtocols
  68. ^ self environment availableProtocolsFor: self selectedClass
  69. !
  70. packages
  71. ^ self environment packages
  72. !
  73. selectedClass
  74. ^ selectedClass
  75. !
  76. selectedClass: aClass
  77. (self selectedClass = aClass and: [ aClass isNil ])
  78. ifTrue: [ ^ self ].
  79. self withChangesDo: [
  80. selectedClass = aClass ifTrue: [
  81. self selectedProtocol: nil ].
  82. aClass
  83. ifNil: [ selectedClass := nil ]
  84. ifNotNil: [
  85. self selectedPackage: aClass theNonMetaClass package.
  86. self showInstance
  87. ifTrue: [ selectedClass := aClass theNonMetaClass ]
  88. ifFalse: [ selectedClass := aClass theMetaClass ] ].
  89. self selectedProtocol: nil.
  90. self announcer announce: (HLClassSelected on: self selectedClass) ]
  91. !
  92. selectedMethod
  93. ^ self selectedClass ifNotNil: [
  94. self selectedClass methodDictionary
  95. at: selectedSelector
  96. ifAbsent: [ nil ] ]
  97. !
  98. selectedMethod: aCompiledMethod
  99. selectedSelector = aCompiledMethod ifTrue: [ ^ self ].
  100. self withChangesDo: [
  101. aCompiledMethod
  102. ifNil: [ selectedSelector := nil ]
  103. ifNotNil: [
  104. selectedClass := aCompiledMethod methodClass.
  105. selectedPackage := selectedClass theNonMetaClass package.
  106. selectedSelector := aCompiledMethod selector ].
  107. self announcer announce: (HLMethodSelected on: aCompiledMethod) ]
  108. !
  109. selectedPackage
  110. ^ selectedPackage
  111. !
  112. selectedPackage: aPackage
  113. selectedPackage = aPackage ifTrue: [ ^ self ].
  114. self withChangesDo: [
  115. selectedPackage := aPackage.
  116. self selectedClass: nil.
  117. self announcer announce: (HLPackageSelected on: aPackage) ]
  118. !
  119. selectedProtocol
  120. ^ selectedProtocol
  121. !
  122. selectedProtocol: aString
  123. selectedProtocol = aString ifTrue: [ ^ self ].
  124. self withChangesDo: [
  125. selectedProtocol := aString.
  126. self selectedMethod: nil.
  127. self announcer announce: (HLProtocolSelected on: aString) ]
  128. ! !
  129. !HLToolModel methodsFor: 'actions'!
  130. addInstVarNamed: aString
  131. self environment addInstVarNamed: aString to: self selectedClass.
  132. self announcer announce: (HLInstVarAdded new
  133. theClass: self selectedClass;
  134. variableName: aString;
  135. yourself)
  136. !
  137. save: aString
  138. self announcer announce: HLSourceCodeSaved new.
  139. (self shouldCompileClassDefinition: aString)
  140. ifTrue: [ self compileClassDefinition: aString ]
  141. ifFalse: [ self compileMethod: aString ]
  142. !
  143. saveSourceCode
  144. self announcer announce: HLSaveSourceCode new
  145. ! !
  146. !HLToolModel methodsFor: 'commands actions'!
  147. commitPackage
  148. "self
  149. withHelperLabelled: 'Committing package ', self selectedPackage name, '...'
  150. do: [ "self environment commitPackage: self selectedPackage" ]"
  151. !
  152. copyClassTo: aClassName
  153. self withChangesDo: [
  154. self environment
  155. copyClass: self selectedClass theNonMetaClass
  156. to: aClassName ]
  157. !
  158. moveClassToPackage: aPackageName
  159. self withChangesDo: [
  160. self environment
  161. moveClass: self selectedClass theNonMetaClass
  162. toPackage: aPackageName ]
  163. !
  164. moveMethodToClass: aClassName
  165. self withChangesDo: [
  166. self environment
  167. moveMethod: self selectedMethod
  168. toClass: aClassName ]
  169. !
  170. moveMethodToProtocol: aProtocol
  171. self withChangesDo: [
  172. self environment
  173. moveMethod: self selectedMethod
  174. toProtocol: aProtocol ]
  175. !
  176. openClassNamed: aString
  177. | class |
  178. self withChangesDo: [
  179. class := self environment classNamed: aString.
  180. self selectedPackage: class package.
  181. self selectedClass: class ]
  182. !
  183. removeClass
  184. self withChangesDo: [
  185. self manager
  186. confirm: 'Do you REALLY want to remove class ', self selectedClass name
  187. ifTrue: [ self environment removeClass: self selectedClass ] ]
  188. !
  189. removeMethod
  190. self withChangesDo: [
  191. self manager
  192. confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector
  193. ifTrue: [ self environment removeMethod: self selectedMethod ] ]
  194. !
  195. removeProtocol
  196. self withChangesDo: [
  197. self manager
  198. confirm: 'Do you REALLY want to remove protocol ', self selectedProtocol
  199. ifTrue: [ self environment
  200. removeProtocol: self selectedProtocol
  201. from: self selectedClass ] ]
  202. !
  203. renameClassTo: aClassName
  204. self withChangesDo: [
  205. self environment
  206. renameClass: self selectedClass theNonMetaClass
  207. to: aClassName ]
  208. !
  209. renameProtocolTo: aString
  210. self withChangesDo: [
  211. self environment
  212. renameProtocol: self selectedProtocol
  213. to: aString
  214. in: self selectedClass ]
  215. ! !
  216. !HLToolModel methodsFor: 'compiling'!
  217. compileClassComment: aString
  218. self environment
  219. compileClassComment: aString
  220. for: self selectedClass
  221. !
  222. compileClassDefinition: aString
  223. self environment compileClassDefinition: aString
  224. !
  225. compileMethod: aString
  226. | method |
  227. self withCompileErrorHandling: [
  228. method := self environment
  229. compileMethod: aString
  230. for: self selectedClass
  231. protocol: self compilationProtocol.
  232. self selectedMethod: method ]
  233. ! !
  234. !HLToolModel methodsFor: 'defaults'!
  235. allProtocol
  236. ^ '-- all --'
  237. !
  238. unclassifiedProtocol
  239. ^ 'as yet unclassified'
  240. ! !
  241. !HLToolModel methodsFor: 'error handling'!
  242. handleCompileError: anError
  243. self announcer announce: (HLCompileErrorRaised new
  244. error: anError;
  245. yourself)
  246. !
  247. handleParseError: anError
  248. | split line column messageToInsert |
  249. split := anError messageText tokenize: ' : '.
  250. messageToInsert := split second.
  251. "21 = 'Parse error on line ' size + 1"
  252. split := split first copyFrom: 21 to: split first size.
  253. split := split tokenize: ' column '.
  254. line := split first.
  255. column := split second.
  256. self announcer announce: (HLParseErrorRaised new
  257. line: line asNumber;
  258. column: column asNumber;
  259. message: messageToInsert;
  260. error: anError;
  261. yourself)
  262. !
  263. handleUnkownVariableError: anError
  264. self announcer announce: (HLUnknownVariableErrorRaised new
  265. error: anError;
  266. yourself)
  267. !
  268. withCompileErrorHandling: aBlock
  269. self environment
  270. evaluate: [
  271. self environment
  272. evaluate: [
  273. self environment
  274. evaluate: aBlock
  275. on: ParseError
  276. do: [:ex | self handleParseError: ex ] ]
  277. on: UnknownVariableError
  278. do: [ :ex | self handleUnkownVariableError: ex ] ]
  279. on: CompilerError
  280. do: [ :ex | self handleCompileError: ex ]
  281. ! !
  282. !HLToolModel methodsFor: 'private'!
  283. compilationProtocol
  284. | currentProtocol |
  285. currentProtocol := self selectedProtocol.
  286. currentProtocol ifNil: [ currentProtocol := self unclassifiedProtocol ].
  287. self selectedMethod ifNotNil: [ currentProtocol := self selectedMethod protocol ].
  288. ^ currentProtocol = self allProtocol
  289. ifTrue: [ self unclassifiedProtocol ]
  290. ifFalse: [ currentProtocol ]
  291. !
  292. withHelperLabelled: aString do: aBlock
  293. "TODO: doesn't belong here"
  294. (window jQuery: '#helper') remove.
  295. [ :html |
  296. html div
  297. id: 'helper';
  298. with: aString ] appendToJQuery: 'body' asJQuery.
  299. [
  300. aBlock value.
  301. (window jQuery: '#helper') remove
  302. ]
  303. valueWithTimeout: 10
  304. ! !
  305. !HLToolModel methodsFor: 'testing'!
  306. isToolModel
  307. ^ true
  308. !
  309. shouldCompileClassDefinition: aString
  310. ^ self selectedClass isNil or: [
  311. aString match: '^[A-Z]' ]
  312. ! !
  313. !HLToolModel class methodsFor: 'actions'!
  314. on: anEnvironment
  315. ^ self new
  316. environment: anEnvironment;
  317. yourself
  318. ! !
  319. ProgressHandler subclass: #HLProgressHandler
  320. instanceVariableNames: ''
  321. package: 'Helios-Core'!
  322. !HLProgressHandler commentStamp!
  323. I am a specific progress handler for Helios, displaying progresses in a modal window.!
  324. !HLProgressHandler methodsFor: 'progress handling'!
  325. do: aBlock on: aCollection displaying: aString
  326. HLProgressWidget default
  327. do: aBlock
  328. on: aCollection
  329. displaying: aString
  330. ! !
  331. Widget subclass: #HLTabWidget
  332. instanceVariableNames: 'widget label root'
  333. package: 'Helios-Core'!
  334. !HLTabWidget commentStamp!
  335. I am a widget specialized into building another widget as an Helios tab.
  336. I should not be used directly, `HLWidget class >> #openAsTab` should be used instead.
  337. ## Example
  338. HLWorkspace openAsTab!
  339. !HLTabWidget methodsFor: 'accessing'!
  340. activate
  341. self manager activate: self
  342. !
  343. add
  344. self manager addTab: self
  345. !
  346. cssClass
  347. ^ self widget tabClass
  348. !
  349. displayLabel
  350. ^ self label size > 20
  351. ifTrue: [ (self label first: 20), '...' ]
  352. ifFalse: [ self label ]
  353. !
  354. focus
  355. self widget canHaveFocus ifTrue: [
  356. self widget focus ]
  357. !
  358. label
  359. ^ label ifNil: [ '' ]
  360. !
  361. label: aString
  362. label := aString
  363. !
  364. manager
  365. ^ HLManager current
  366. !
  367. widget
  368. ^ widget
  369. !
  370. widget: aWidget
  371. widget := aWidget
  372. ! !
  373. !HLTabWidget methodsFor: 'actions'!
  374. hide
  375. root ifNotNil: [ root asJQuery css: 'visibility' put: 'hidden' ]
  376. !
  377. registerBindings
  378. self widget registerBindings
  379. !
  380. remove
  381. self widget unregister.
  382. root ifNotNil: [ root asJQuery remove ]
  383. !
  384. show
  385. root
  386. ifNil: [ self appendToJQuery: 'body' asJQuery ]
  387. ifNotNil: [ root asJQuery css: 'visibility' put: 'visible' ]
  388. ! !
  389. !HLTabWidget methodsFor: 'rendering'!
  390. renderOn: html
  391. root := html div
  392. class: 'tab';
  393. yourself.
  394. self renderTab
  395. !
  396. renderTab
  397. root contents: [ :html |
  398. html div
  399. class: 'amber_box';
  400. with: [ self widget renderOn: html ] ]
  401. ! !
  402. !HLTabWidget methodsFor: 'testing'!
  403. isActive
  404. ^ self manager activeTab = self
  405. ! !
  406. !HLTabWidget class methodsFor: 'instance creation'!
  407. on: aWidget labelled: aString
  408. ^ self new
  409. widget: aWidget;
  410. label: aString;
  411. yourself
  412. ! !
  413. Widget subclass: #HLWidget
  414. instanceVariableNames: 'wrapper'
  415. package: 'Helios-Core'!
  416. !HLWidget commentStamp!
  417. I am the abstract superclass of all Helios widgets.
  418. I provide common methods, additional behavior to widgets useful for Helios, like dialog creation, command execution and tab creation.
  419. ## API
  420. 1. Rendering
  421. Instead of overriding `#renderOn:` as with other Widget subclasses, my subclasses should override `#renderContentOn:`.
  422. 2. Refreshing
  423. To re-render a widget, use `#refresh`.
  424. 3. Key bindings registration and tabs
  425. When displayed as a tab, the widget has a chance to register keybindings with the `#registerBindingsOn:` hook method.
  426. 4. Unregistration
  427. When a widget has subscribed to announcements or other actions that need to be cleared when closing the tab, the hook method `#unregister` will be called by helios.
  428. 5. Tabs
  429. To enable a widget class to be open as a tab, override the class-side `#canBeOpenAsTab` method to answer `true`. `#tabClass` and `#tabPriority` can be overridden too to respectively change the css class of the tab and the order of tabs in the main menu.
  430. 6. Command execution
  431. An helios command (instance of `HLCommand` or one of its subclass) can be executed with `#execute:`.!
  432. !HLWidget methodsFor: 'accessing'!
  433. manager
  434. ^ HLManager current
  435. !
  436. tabClass
  437. ^ self class tabClass
  438. !
  439. wrapper
  440. ^ wrapper
  441. ! !
  442. !HLWidget methodsFor: 'actions'!
  443. alert: aString
  444. window alert: aString
  445. !
  446. confirm: aString ifTrue: aBlock
  447. self manager confirm: aString ifTrue: aBlock
  448. !
  449. execute: aCommand
  450. HLManager current keyBinder
  451. activate;
  452. applyBinding: aCommand asBinding
  453. !
  454. openAsTab
  455. HLManager current addTab: (HLTabWidget on: self labelled: self class tabLabel)
  456. !
  457. request: aString do: aBlock
  458. self manager request: aString do: aBlock
  459. !
  460. request: aString value: valueString do: aBlock
  461. self manager
  462. request: aString
  463. value: valueString
  464. do: aBlock
  465. !
  466. unregister
  467. "This method is called whenever the receiver is closed (as a tab).
  468. Widgets subscribing to announcements should unregister there"
  469. ! !
  470. !HLWidget methodsFor: 'keybindings'!
  471. bindKeyDown: keyDownBlock up: keyUpBlock
  472. self wrapper asJQuery
  473. keydown: keyDownBlock;
  474. keyup: keyUpBlock
  475. !
  476. registerBindings
  477. self registerBindingsOn: self manager keyBinder bindings
  478. !
  479. registerBindingsOn: aBindingGroup
  480. !
  481. unbindKeyDownUp
  482. self wrapper asJQuery
  483. unbind: 'keydown';
  484. unbind: 'keyup'
  485. ! !
  486. !HLWidget methodsFor: 'rendering'!
  487. renderContentOn: html
  488. !
  489. renderOn: html
  490. wrapper := html div.
  491. [ :renderer | self renderContentOn: renderer ] appendToJQuery: wrapper asJQuery
  492. ! !
  493. !HLWidget methodsFor: 'testing'!
  494. canHaveFocus
  495. ^ false
  496. ! !
  497. !HLWidget methodsFor: 'updating'!
  498. refresh
  499. self wrapper ifNil: [ ^ self ].
  500. self wrapper asJQuery empty.
  501. [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery
  502. ! !
  503. !HLWidget class methodsFor: 'accessing'!
  504. openAsTab
  505. HLManager current addTab: (HLTabWidget on: self new labelled: self tabLabel)
  506. !
  507. tabClass
  508. ^ ''
  509. !
  510. tabLabel
  511. ^ 'Tab'
  512. !
  513. tabPriority
  514. ^ 500
  515. ! !
  516. !HLWidget class methodsFor: 'testing'!
  517. canBeOpenAsTab
  518. ^ false
  519. ! !
  520. HLWidget subclass: #HLFocusableWidget
  521. instanceVariableNames: ''
  522. package: 'Helios-Core'!
  523. !HLFocusableWidget commentStamp!
  524. I am a widget that can be focused.
  525. ## API
  526. Instead of overriding `#renderOn:` as with other `Widget` subclasses, my subclasses should override `#renderContentOn:`.
  527. To bring the focus to the widget, use the `#focus` method.!
  528. !HLFocusableWidget methodsFor: 'accessing'!
  529. focusClass
  530. ^ 'focused'
  531. ! !
  532. !HLFocusableWidget methodsFor: 'events'!
  533. blur
  534. self wrapper asJQuery blur
  535. !
  536. focus
  537. self wrapper asJQuery focus
  538. ! !
  539. !HLFocusableWidget methodsFor: 'rendering'!
  540. renderContentOn: html
  541. !
  542. renderOn: html
  543. wrapper := html div
  544. class: 'hl_widget';
  545. yourself.
  546. wrapper with: [ self renderContentOn: html ].
  547. wrapper
  548. at: 'tabindex' put: '0';
  549. onBlur: [ self wrapper asJQuery removeClass: self focusClass ];
  550. onFocus: [ self wrapper asJQuery addClass: self focusClass ]
  551. ! !
  552. !HLFocusableWidget methodsFor: 'testing'!
  553. canHaveFocus
  554. ^ true
  555. !
  556. hasFocus
  557. ^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]
  558. ! !
  559. HLFocusableWidget subclass: #HLListWidget
  560. instanceVariableNames: 'items selectedItem mapping'
  561. package: 'Helios-Core'!
  562. !HLListWidget methodsFor: 'accessing'!
  563. cssClassForItem: anObject
  564. ^ ''
  565. !
  566. items
  567. ^ items ifNil: [ items := self defaultItems ]
  568. !
  569. items: aCollection
  570. items := aCollection
  571. !
  572. listCssClassForItem: anObject
  573. ^ self selectedItem = anObject
  574. ifTrue: [ 'active' ]
  575. ifFalse: [ 'inactive' ]
  576. !
  577. positionOf: aListItem
  578. <
  579. return aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1
  580. >
  581. !
  582. selectedItem
  583. ^ selectedItem
  584. !
  585. selectedItem: anObject
  586. selectedItem := anObject
  587. ! !
  588. !HLListWidget methodsFor: 'actions'!
  589. activateFirstListItem
  590. self activateListItem: (window jQuery: ((wrapper asJQuery find: 'li.inactive') get: 0))
  591. !
  592. activateItem: anObject
  593. self activateListItem: (mapping
  594. at: anObject
  595. ifAbsent: [ ^ self ]) asJQuery
  596. !
  597. activateListItem: aListItem
  598. | item |
  599. (aListItem get: 0) ifNil: [ ^self ].
  600. aListItem parent children removeClass: 'active'.
  601. aListItem addClass: 'active'.
  602. self ensureVisible: aListItem.
  603. "Activate the corresponding item"
  604. item := (self items at: (aListItem attr: 'list-data') asNumber).
  605. self selectedItem == item ifFalse: [
  606. self selectItem: item ]
  607. !
  608. activateNextListItem
  609. self activateListItem: (self wrapper asJQuery find: 'li.active') next.
  610. "select the first item if none is selected"
  611. (self wrapper asJQuery find: ' .active') get ifEmpty: [
  612. self activateFirstListItem ]
  613. !
  614. activatePreviousListItem
  615. self activateListItem: (self wrapper asJQuery find: 'li.active') prev
  616. !
  617. ensureVisible: aListItem
  618. "Move the scrollbar to show the active element"
  619. | perent position |
  620. position := self positionOf: aListItem.
  621. parent := aListItem parent.
  622. aListItem position top < 0 ifTrue: [
  623. (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].
  624. aListItem position top + aListItem height > parent height ifTrue: [
  625. (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ]
  626. !
  627. focus
  628. super focus.
  629. self items isEmpty ifFalse: [
  630. self selectedItem ifNil: [ self activateFirstListItem ] ]
  631. !
  632. refresh
  633. super refresh.
  634. self ensureVisible: (mapping
  635. at: self selectedItem
  636. ifAbsent: [ ^ self ]) asJQuery
  637. !
  638. selectItem: anObject
  639. self selectedItem: anObject
  640. ! !
  641. !HLListWidget methodsFor: 'defaults'!
  642. defaultItems
  643. ^ #()
  644. ! !
  645. !HLListWidget methodsFor: 'events'!
  646. setupKeyBindings
  647. (HLRepeatingKeyBindingHandler forWidget: self)
  648. whileKeyPressed: 38 do: [ self activatePreviousListItem ];
  649. whileKeyPressed: 40 do: [ self activateNextListItem ];
  650. rebindKeys
  651. ! !
  652. !HLListWidget methodsFor: 'initialization'!
  653. initialize
  654. super initialize.
  655. mapping := Dictionary new.
  656. ! !
  657. !HLListWidget methodsFor: 'private'!
  658. registerMappingFrom: anObject to: aTag
  659. mapping at: anObject put: aTag
  660. ! !
  661. !HLListWidget methodsFor: 'rendering'!
  662. renderButtonsOn: html
  663. !
  664. renderContentOn: html
  665. html ul
  666. class: 'nav nav-pills nav-stacked';
  667. with: [ self renderListOn: html ].
  668. html div class: 'pane_actions form-actions'; with: [
  669. self renderButtonsOn: html ].
  670. self setupKeyBindings
  671. !
  672. renderItem: anObject on: html
  673. | li |
  674. li := html li.
  675. self registerMappingFrom: anObject to: li.
  676. li
  677. at: 'list-data' put: (self items indexOf: anObject) asString;
  678. class: (self listCssClassForItem: anObject);
  679. with: [
  680. html a
  681. with: [
  682. (html tag: 'i') class: (self cssClassForItem: anObject).
  683. self renderItemLabel: anObject on: html ];
  684. onClick: [
  685. self activateListItem: li asJQuery ] ]
  686. !
  687. renderItemLabel: anObject on: html
  688. html with: anObject asString
  689. !
  690. renderListOn: html
  691. mapping := Dictionary new.
  692. self items do: [ :each |
  693. self renderItem: each on: html ]
  694. ! !
  695. HLListWidget subclass: #HLNavigationListWidget
  696. instanceVariableNames: 'previous next'
  697. package: 'Helios-Core'!
  698. !HLNavigationListWidget methodsFor: 'accessing'!
  699. next
  700. ^ next
  701. !
  702. next: aWidget
  703. next := aWidget.
  704. aWidget previous = self ifFalse: [ aWidget previous: self ]
  705. !
  706. previous
  707. ^ previous
  708. !
  709. previous: aWidget
  710. previous := aWidget.
  711. aWidget next = self ifFalse: [ aWidget next: self ]
  712. ! !
  713. !HLNavigationListWidget methodsFor: 'actions'!
  714. nextFocus
  715. self next ifNotNil: [ self next focus ]
  716. !
  717. previousFocus
  718. self previous ifNotNil: [ self previous focus ]
  719. ! !
  720. !HLNavigationListWidget methodsFor: 'events'!
  721. setupKeyBindings
  722. super setupKeyBindings.
  723. self wrapper asJQuery keydown: [ :e |
  724. e which = 39 ifTrue: [
  725. self nextFocus ].
  726. e which = 37 ifTrue: [
  727. self previousFocus ] ]
  728. ! !
  729. HLNavigationListWidget subclass: #HLToolListWidget
  730. instanceVariableNames: 'model'
  731. package: 'Helios-Core'!
  732. !HLToolListWidget methodsFor: 'accessing'!
  733. commandCategory
  734. ^ self label
  735. !
  736. label
  737. ^ 'List'
  738. !
  739. menuCommands
  740. "Answer a collection of commands to be put in the cog menu"
  741. ^ ((HLToolCommand concreteClasses
  742. select: [ :each | each isValidFor: self model ])
  743. collect: [ :each | each for: self model ])
  744. select: [ :each |
  745. each category = self commandCategory and: [
  746. each isAction and: [ each isActive ] ] ]
  747. !
  748. model
  749. ^ model
  750. !
  751. model: aBrowserModel
  752. model := aBrowserModel.
  753. self
  754. observeSystem;
  755. observeModel
  756. !
  757. selectedItem: anItem
  758. "Selection changed, update the cog menu"
  759. super selectedItem: anItem.
  760. self updateMenu
  761. ! !
  762. !HLToolListWidget methodsFor: 'actions'!
  763. activateListItem: anItem
  764. self model withChangesDo: [ super activateListItem: anItem ]
  765. !
  766. activateNextListItem
  767. self model withChangesDo: [ super activateNextListItem ]
  768. !
  769. activatePreviousListItem
  770. self model withChangesDo: [ super activatePreviousListItem ]
  771. !
  772. observeModel
  773. !
  774. observeSystem
  775. !
  776. unregister
  777. super unregister.
  778. self model announcer unsubscribe: self.
  779. self model systemAnnouncer unsubscribe: self
  780. ! !
  781. !HLToolListWidget methodsFor: 'rendering'!
  782. renderContentOn: html
  783. self renderHeadOn: html.
  784. super renderContentOn: html
  785. !
  786. renderHeadOn: html
  787. html div
  788. class: 'list-label';
  789. with: [
  790. html with: self label.
  791. self renderMenuOn: html ]
  792. !
  793. renderMenuOn: html
  794. | commands |
  795. commands := self menuCommands.
  796. commands isEmpty ifTrue: [ ^ self ].
  797. html div
  798. class: 'btn-group cog';
  799. with: [
  800. html a
  801. class: 'btn dropdown-toggle';
  802. at: 'data-toggle' put: 'dropdown';
  803. with: [ (html tag: 'i') class: 'icon-cog' ].
  804. html ul
  805. class: 'dropdown-menu pull-right';
  806. with: [
  807. self menuCommands do: [ :each |
  808. html li with: [ html a
  809. with: each menuLabel;
  810. onClick: [ self execute: each ] ] ] ] ]
  811. ! !
  812. !HLToolListWidget methodsFor: 'updating'!
  813. updateMenu
  814. (self wrapper asJQuery find: '.cog') remove.
  815. [ :html | self renderMenuOn: html ]
  816. appendToJQuery: (self wrapper asJQuery find: '.list-label')
  817. ! !
  818. !HLToolListWidget class methodsFor: 'instance creation'!
  819. on: aModel
  820. ^ self new
  821. model: aModel;
  822. yourself
  823. ! !
  824. HLWidget subclass: #HLManager
  825. instanceVariableNames: 'tabs activeTab keyBinder environment history'
  826. package: 'Helios-Core'!
  827. !HLManager methodsFor: 'accessing'!
  828. activeTab
  829. ^ activeTab
  830. !
  831. environment
  832. "The default environment used by all Helios objects"
  833. ^ environment ifNil: [ environment := self defaultEnvironment ]
  834. !
  835. environment: anEnvironment
  836. environment := anEnvironment
  837. !
  838. history
  839. ^ history ifNil: [ history := OrderedCollection new ]
  840. !
  841. history: aCollection
  842. history := aCollection
  843. !
  844. keyBinder
  845. ^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]
  846. !
  847. tabs
  848. ^ tabs ifNil: [ tabs := OrderedCollection new ]
  849. ! !
  850. !HLManager methodsFor: 'actions'!
  851. activate: aTab
  852. self keyBinder flushBindings.
  853. aTab registerBindings.
  854. activeTab := aTab.
  855. self
  856. refresh;
  857. addToHistory: aTab;
  858. show: aTab
  859. !
  860. addTab: aTab
  861. self tabs add: aTab.
  862. self activate: aTab
  863. !
  864. addToHistory: aTab
  865. self removeFromHistory: aTab.
  866. self history add: aTab
  867. !
  868. confirm: aString ifFalse: aBlock
  869. (HLConfirmationWidget new
  870. confirmationString: aString;
  871. cancelBlock: aBlock;
  872. yourself)
  873. appendToJQuery: 'body' asJQuery
  874. !
  875. confirm: aString ifTrue: aBlock
  876. (HLConfirmationWidget new
  877. confirmationString: aString;
  878. actionBlock: aBlock;
  879. yourself)
  880. appendToJQuery: 'body' asJQuery
  881. !
  882. registerErrorHandler: anErrorHandler
  883. self environment registerErrorHandler: anErrorHandler
  884. !
  885. registerInspector: anInspector
  886. self environment registerInspector: anInspector
  887. !
  888. registerProgressHandler: aProgressHandler
  889. self environment registerProgressHandler: aProgressHandler
  890. !
  891. removeActiveTab
  892. self removeTab: self activeTab
  893. !
  894. removeFromHistory: aTab
  895. self history: (self history reject: [ :each | each == aTab ])
  896. !
  897. removeTab: aTab
  898. (self tabs includes: aTab) ifFalse: [ ^ self ].
  899. self removeFromHistory: aTab.
  900. self tabs remove: aTab.
  901. self keyBinder flushBindings.
  902. aTab remove.
  903. self refresh.
  904. self history ifNotEmpty: [
  905. self history last activate ]
  906. !
  907. request: aString do: aBlock
  908. self
  909. request: aString
  910. value: ''
  911. do: aBlock
  912. !
  913. request: aString value: valueString do: aBlock
  914. (HLRequestWidget new
  915. confirmationString: aString;
  916. actionBlock: aBlock;
  917. value: valueString;
  918. yourself)
  919. appendToJQuery: 'body' asJQuery
  920. ! !
  921. !HLManager methodsFor: 'defaults'!
  922. defaultEnvironment
  923. "If helios is loaded from within a frame, answer the parent window environment"
  924. | parent |
  925. parent := window opener ifNil: [ window parent ].
  926. (parent isNil or: [ (parent at: 'smalltalk') isNil ])
  927. ifTrue: [ ^ Environment new ].
  928. ^ ((parent at: 'smalltalk')
  929. at: 'Environment') new
  930. ! !
  931. !HLManager methodsFor: 'initialization'!
  932. initialize
  933. super initialize.
  934. HLErrorHandler register.
  935. HLProgressHandler register.
  936. self registerInspector: HLInspector.
  937. self registerErrorHandler: ErrorHandler current.
  938. self registerProgressHandler: ProgressHandler current.
  939. self keyBinder setupEvents
  940. ! !
  941. !HLManager methodsFor: 'rendering'!
  942. refresh
  943. (window jQuery: '.navbar') remove.
  944. self appendToJQuery: 'body' asJQuery
  945. !
  946. renderAddOn: html
  947. html li
  948. class: 'dropdown';
  949. with: [
  950. html a
  951. class: 'dropdown-toggle';
  952. at: 'data-toggle' put: 'dropdown';
  953. with: [
  954. html with: 'Open...'.
  955. (html tag: 'b') class: 'caret' ].
  956. html ul
  957. class: 'dropdown-menu';
  958. with: [
  959. ((HLWidget withAllSubclasses
  960. select: [ :each | each canBeOpenAsTab ])
  961. sorted: [ :a :b | a tabPriority < b tabPriority ])
  962. do: [ :each |
  963. html li with: [
  964. html a
  965. with: each tabLabel;
  966. onClick: [ each openAsTab ] ] ] ] ]
  967. !
  968. renderContentOn: html
  969. html div
  970. class: 'navbar navbar-fixed-top';
  971. with: [ html div
  972. class: 'navbar-inner';
  973. with: [ self renderTabsOn: html ] ]
  974. !
  975. renderTabsOn: html
  976. html ul
  977. class: 'nav';
  978. with: [
  979. self tabs do: [ :each |
  980. html li
  981. class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);
  982. with: [
  983. html a
  984. with: [
  985. ((html tag: 'i') class: 'close')
  986. onClick: [ self removeTab: each ].
  987. html span
  988. class: each cssClass;
  989. with: each displayLabel ];
  990. onClick: [ each activate ] ] ].
  991. self renderAddOn: html ]
  992. !
  993. show: aTab
  994. self tabs do: [ :each | each hide ].
  995. aTab show; focus
  996. ! !
  997. HLManager class instanceVariableNames: 'current'!
  998. !HLManager class methodsFor: 'accessing'!
  999. current
  1000. ^ current ifNil: [ current := self basicNew initialize ]
  1001. ! !
  1002. !HLManager class methodsFor: 'initialization'!
  1003. initialize
  1004. self current appendToJQuery: 'body' asJQuery.
  1005. self clearKeydownEvent
  1006. ! !
  1007. !HLManager class methodsFor: 'instance creation'!
  1008. new
  1009. "Use current instead"
  1010. self shouldNotImplement
  1011. ! !
  1012. !HLManager class methodsFor: 'private'!
  1013. clearKeydownEvent
  1014. "Prevent default keydown event with arrow key from scrolling the parent page
  1015. when helios is run inside a frame."
  1016. (window jQuery: 'body') keydown: [ :e |
  1017. (e keyCode >= 37 and: [ e keyCode <= 40 ])
  1018. ifTrue: [ false ] ]
  1019. ! !
  1020. HLWidget subclass: #HLModalWidget
  1021. instanceVariableNames: ''
  1022. package: 'Helios-Core'!
  1023. !HLModalWidget commentStamp!
  1024. I implement an abstract modal widget.!
  1025. !HLModalWidget methodsFor: 'accessing'!
  1026. cssClass
  1027. ^ ''
  1028. ! !
  1029. !HLModalWidget methodsFor: 'actions'!
  1030. cancel
  1031. self remove
  1032. !
  1033. remove
  1034. (window jQuery: '.dialog') removeClass: 'active'.
  1035. [
  1036. (window jQuery: '#overlay') remove.
  1037. (window jQuery: '.dialog') remove
  1038. ] valueWithTimeout: 300
  1039. ! !
  1040. !HLModalWidget methodsFor: 'rendering'!
  1041. renderButtonsOn: html
  1042. !
  1043. renderContentOn: html
  1044. | confirmButton |
  1045. html div id: 'overlay'.
  1046. html div
  1047. class: 'dialog ', self cssClass;
  1048. with: [
  1049. self
  1050. renderMainOn: html;
  1051. renderButtonsOn: html ].
  1052. (window jQuery: '.dialog') addClass: 'active'.
  1053. self setupKeyBindings
  1054. !
  1055. renderMainOn: html
  1056. !
  1057. setupKeyBindings
  1058. (window jQuery: '.dialog') keyup: [ :e |
  1059. e keyCode = 27 ifTrue: [ self cancel ] ]
  1060. ! !
  1061. HLModalWidget subclass: #HLConfirmationWidget
  1062. instanceVariableNames: 'confirmationString actionBlock cancelBlock'
  1063. package: 'Helios-Core'!
  1064. !HLConfirmationWidget commentStamp!
  1065. I display confirmation messages.
  1066. Instead of creating an instance directly, use `HLWidget >> #confirm:ifTrue:`.!
  1067. !HLConfirmationWidget methodsFor: 'accessing'!
  1068. actionBlock
  1069. ^ actionBlock ifNil: [ [] ]
  1070. !
  1071. actionBlock: aBlock
  1072. actionBlock := aBlock
  1073. !
  1074. cancelBlock
  1075. ^ cancelBlock ifNil: [ [] ]
  1076. !
  1077. cancelBlock: aBlock
  1078. cancelBlock := aBlock
  1079. !
  1080. confirmationString
  1081. ^ confirmationString ifNil: [ 'Confirm' ]
  1082. !
  1083. confirmationString: aString
  1084. confirmationString := aString
  1085. ! !
  1086. !HLConfirmationWidget methodsFor: 'actions'!
  1087. cancel
  1088. self cancelBlock value.
  1089. self remove
  1090. !
  1091. confirm
  1092. self actionBlock value.
  1093. self remove
  1094. !
  1095. remove
  1096. (window jQuery: '.dialog') removeClass: 'active'.
  1097. [
  1098. (window jQuery: '#overlay') remove.
  1099. (window jQuery: '.dialog') remove
  1100. ] valueWithTimeout: 300
  1101. ! !
  1102. !HLConfirmationWidget methodsFor: 'rendering'!
  1103. renderButtonsOn: html
  1104. | confirmButton |
  1105. html div
  1106. class: 'buttons';
  1107. with: [
  1108. html button
  1109. class: 'button';
  1110. with: 'Cancel';
  1111. onClick: [ self cancel ].
  1112. confirmButton := html button
  1113. class: 'button default';
  1114. with: 'Confirm';
  1115. onClick: [ self confirm ] ].
  1116. confirmButton asJQuery focus
  1117. !
  1118. renderMainOn: html
  1119. html span with: self confirmationString
  1120. ! !
  1121. HLConfirmationWidget subclass: #HLRequestWidget
  1122. instanceVariableNames: 'input value'
  1123. package: 'Helios-Core'!
  1124. !HLRequestWidget commentStamp!
  1125. I display a modal window requesting user input.
  1126. Instead of creating instances manually, use `HLWidget >> #request:do:` and `#request:value:do:`.!
  1127. !HLRequestWidget methodsFor: 'accessing'!
  1128. cssClass
  1129. ^ 'large'
  1130. !
  1131. value
  1132. ^ value ifNil: [ '' ]
  1133. !
  1134. value: aString
  1135. value := aString
  1136. ! !
  1137. !HLRequestWidget methodsFor: 'actions'!
  1138. confirm
  1139. self actionBlock value: input asJQuery val.
  1140. self remove
  1141. ! !
  1142. !HLRequestWidget methodsFor: 'rendering'!
  1143. renderMainOn: html
  1144. super renderMainOn: html.
  1145. input := html textarea.
  1146. input asJQuery val: self value
  1147. ! !
  1148. HLModalWidget subclass: #HLProgressWidget
  1149. instanceVariableNames: 'progressBars visible'
  1150. package: 'Helios-Core'!
  1151. !HLProgressWidget commentStamp!
  1152. I am a widget used to display progress modal dialogs.
  1153. My default instance is accessed with `HLProgressWidget class >> #default`.
  1154. See `HLProgressHandler` for usage.!
  1155. !HLProgressWidget methodsFor: 'accessing'!
  1156. progressBars
  1157. ^ progressBars ifNil: [ progressBars := OrderedCollection new ]
  1158. ! !
  1159. !HLProgressWidget methodsFor: 'actions'!
  1160. addProgressBar: aProgressBar
  1161. self show.
  1162. self progressBars add: aProgressBar.
  1163. aProgressBar appendToJQuery: (self wrapper asJQuery find: '.dialog')
  1164. !
  1165. do: aBlock on: aCollection displaying: aString
  1166. | progressBar |
  1167. progressBar := HLProgressBarWidget new
  1168. parent: self;
  1169. label: aString;
  1170. workBlock: aBlock;
  1171. collection: aCollection;
  1172. yourself.
  1173. self addProgressBar: progressBar.
  1174. progressBar start
  1175. !
  1176. flush
  1177. self progressBars do: [ :each |
  1178. self removeProgressBar: each ]
  1179. !
  1180. remove
  1181. self isVisible ifTrue: [
  1182. visible := false.
  1183. super remove ]
  1184. !
  1185. removeProgressBar: aProgressBar
  1186. self progressBars remove: aProgressBar ifAbsent: [].
  1187. aProgressBar wrapper asJQuery remove.
  1188. self progressBars ifEmpty: [ self remove ]
  1189. !
  1190. show
  1191. self isVisible ifFalse: [
  1192. visible := true.
  1193. self appendToJQuery: 'body' asJQuery ]
  1194. ! !
  1195. !HLProgressWidget methodsFor: 'rendering'!
  1196. renderButtonsOn: html
  1197. !
  1198. renderMainOn: html
  1199. self progressBars do: [ :each |
  1200. html with: each ]
  1201. ! !
  1202. !HLProgressWidget methodsFor: 'testing'!
  1203. isVisible
  1204. ^ visible ifNil: [ false ]
  1205. ! !
  1206. HLProgressWidget class instanceVariableNames: 'default'!
  1207. !HLProgressWidget class methodsFor: 'accessing'!
  1208. default
  1209. ^ default ifNil: [ default := self new ]
  1210. ! !
  1211. HLWidget subclass: #HLProgressBarWidget
  1212. instanceVariableNames: 'label parent workBlock collection bar'
  1213. package: 'Helios-Core'!
  1214. !HLProgressBarWidget commentStamp!
  1215. I am a widget used to display a progress bar while iterating over a collection.!
  1216. !HLProgressBarWidget methodsFor: 'accessing'!
  1217. collection
  1218. ^ collection
  1219. !
  1220. collection: aCollection
  1221. collection := aCollection
  1222. !
  1223. label
  1224. ^ label
  1225. !
  1226. label: aString
  1227. label := aString
  1228. !
  1229. parent
  1230. ^ parent
  1231. !
  1232. parent: aProgress
  1233. parent := aProgress
  1234. !
  1235. workBlock
  1236. ^ workBlock
  1237. !
  1238. workBlock: aBlock
  1239. workBlock := aBlock
  1240. ! !
  1241. !HLProgressBarWidget methodsFor: 'actions'!
  1242. evaluateAt: anInteger
  1243. self updateProgress: (anInteger / self collection size) * 100.
  1244. anInteger <= self collection size
  1245. ifTrue: [
  1246. [
  1247. self workBlock value: (self collection at: anInteger).
  1248. self evaluateAt: anInteger + 1 ] valueWithTimeout: 10 ]
  1249. ifFalse: [ [ self remove ] valueWithTimeout: 500 ]
  1250. !
  1251. remove
  1252. self parent removeProgressBar: self
  1253. !
  1254. start
  1255. "Make sure the UI has some time to update itself between each iteration"
  1256. self evaluateAt: 1
  1257. !
  1258. updateProgress: anInteger
  1259. bar asJQuery css: 'width' put: anInteger asString, '%'
  1260. ! !
  1261. !HLProgressBarWidget methodsFor: 'rendering'!
  1262. renderContentOn: html
  1263. html span with: self label.
  1264. html div
  1265. class: 'progress';
  1266. with: [
  1267. bar := html div
  1268. class: 'bar';
  1269. style: 'width: 0%' ]
  1270. ! !
  1271. HLProgressBarWidget class instanceVariableNames: 'default'!
  1272. !HLProgressBarWidget class methodsFor: 'accessing'!
  1273. default
  1274. ^ default ifNil: [ default := self new ]
  1275. ! !
  1276. HLWidget subclass: #HLSUnit
  1277. instanceVariableNames: ''
  1278. package: 'Helios-Core'!
  1279. !HLSUnit class methodsFor: 'accessing'!
  1280. tabClass
  1281. ^ 'sunit'
  1282. !
  1283. tabLabel
  1284. ^ 'SUnit'
  1285. !
  1286. tabPriority
  1287. ^ 1000
  1288. ! !
  1289. !HLSUnit class methodsFor: 'testing'!
  1290. canBeOpenAsTab
  1291. ^ true
  1292. ! !