"{ Package: 'cvut:stx/goodies/libtool3' }"
"{ NameSpace: Tools }"
ApplicationModel subclass:#Inspector2
instanceVariableNames:'tabViewAspect navigationHistoryHolder navigationStateAspect'
classVariableNames:''
poolDictionaries:''
category:'Interface-Inspector 2'
!
Object subclass:#NavigationState
instanceVariableNames:'theObject index tabs selectionIndex displayString'
classVariableNames:''
poolDictionaries:''
privateIn:Inspector2
!
!Inspector2 class methodsFor:'interface specs'!
windowSpec
"This resource specification was automatically generated
by the UIPainter of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
UIPainter new openOnClass:Inspector2 andSelector:#windowSpec
Inspector2 new openInterface:#windowSpec
Inspector2 open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
window:
(WindowSpec
label: 'Inspector2'
name: 'Inspector2'
labelChannel: windowTitleAspect
min: (Point 0 0)
bounds: (Rectangle 0 0 388 421)
)
component:
(SpecCollection
collection: (
(MenuPanelSpec
name: 'ToolBar'
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
menu: toolbarMenu
textDefault: true
)
(NoteBookViewSpec
name: 'NoteBook'
layout: (LayoutFrame 0 0 30 0 0 1 0 1)
model: tabSelectionIndexAspect
menu: tabLabelsAspect
useIndex: true
fitLastRow: false
canvas: tabViewAspect
keepCanvasAlive: true
)
)
)
)
"Modified: / 17-02-2008 / 08:42:31 / janfrog"
! !
!Inspector2 class methodsFor:'menu specs'!
toolbarMenu
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:Inspector2 andSelector:#toolbarMenu
(Menu new fromLiteralArrayEncoding:(Inspector2 toolbarMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
enabled: backButtonEnabledHolder
label: 'Back'
itemValue: backButtonAction
translateLabel: true
submenuChannel: backButtonMenuChannel
labelImage: (ResourceRetriever XPToolbarIconLibrary historyBackIcon)
)
(MenuItem
enabled: forwardButtonEnabledHolder
label: 'Forward'
itemValue: forwardButtonAction
translateLabel: true
submenuChannel: forwardButtonMenuChannel
labelImage: (ResourceRetriever XPToolbarIconLibrary historyForwardIcon)
)
)
nil
nil
)
"Modified: / 12-01-2008 / 19:18:36 / janfrog"
! !
!Inspector2 class methodsFor:'startup'!
openOn: anObject
self new openOn: anObject.
"Modified: / 17-02-2008 / 10:29:45 / janfrog"
! !
!Inspector2 class methodsFor:'testing'!
testSimpleShow
|ins|
ins := Inspector2 openOn:4.
ins inspect:10.
ins inspect:42.
ins inspect:'dead one'.
ins inspect:'rolled back'.
"/ins inspectItem: (ins history at: 3). "/ Rollback history, zustanou jen prvni 3
ins inspect:'xFuj'.
"Modified: / 11-01-2008 / 20:36:37 / janfrog"
! !
!Inspector2 methodsFor:'accessing'!
backButtonEnabled: value
^self backButtonEnabledHolder value: value
"Created: / 12-01-2008 / 19:14:35 / janfrog"
!
currentObject
^ self navigationState theObject
"Created: / 13-01-2008 / 10:14:47 / janfrog"
"Modified: / 17-02-2008 / 09:49:01 / janfrog"
!
currentState
^ self navigationHistoryHolder currentItem
"Created: / 21-02-2008 / 19:39:45 / janfrog"
"Modified: / 27-02-2008 / 11:56:55 / janfrog"
!
forwardButtonEnabled: value
^self forwardButtonEnabledHolder value: value
"Created: / 12-01-2008 / 19:14:48 / janfrog"
!
navigationState
^ self navigationHistoryHolder value
"Created: / 17-02-2008 / 09:49:01 / janfrog"
"Modified: / 21-02-2008 / 19:34:14 / janfrog"
!
navigationState:historyItem
self navigationHistoryHolder "subjectChannel:" value:historyItem.
"/self fixNavigation. "Nevola se kvuli problemu s prekreslovanim"
"/self updateTabs.
"Created: / 17-02-2008 / 09:49:11 / janfrog"
"Modified: / 21-02-2008 / 19:47:26 / janfrog"
! !
!Inspector2 methodsFor:'aspects'!
backButtonEnabledHolder
"return/create the 'backButtonEnabledHolder' value holder (automatically generated)"
^(AspectAdaptor forAspect:#canGoBack)
subjectChannel: self navigationHistoryHolder
"Created: / 12-01-2008 / 19:13:49 / janfrog"
"Modified: / 27-02-2008 / 12:11:30 / janfrog"
!
forwardButtonEnabledHolder
"return/create the 'backButtonEnabledHolder' value holder (automatically generated)"
^(AspectAdaptor forAspect:#canGoForward)
subjectChannel: self navigationHistoryHolder
"Created: / 12-01-2008 / 19:13:49 / janfrog"
"Modified: / 27-02-2008 / 12:11:26 / janfrog"
!
navigationHistoryHolder
"return/create the 'currentItemHolder' value holder (automatically generated)"
navigationHistoryHolder isNil ifTrue:[
navigationHistoryHolder := Tools::NavigationHistory new.
].
^ navigationHistoryHolder
"Created: / 21-02-2008 / 19:34:14 / janfrog"
!
navigationStateAspect
navigationStateAspect ifNil:
[navigationStateAspect :=
(AspectAdaptor forAspect: #currentItem)
subjectChannel:self navigationHistoryHolder].
^navigationStateAspect
"Created: / 27-02-2008 / 12:05:22 / janfrog"
!
tabLabelsAspect
^ (AspectAdaptor forAspect:#tabLabels)
subjectChannel: self navigationStateAspect
"Created: / 16-01-2008 / 17:29:52 / janfrog"
"Modified: / 27-02-2008 / 12:05:32 / janfrog"
!
tabSelectionIndexAspect
^ ((AspectAdaptor forAspect:#selectionIndex)
subjectChannel:self navigationStateAspect)
onChangeEvaluate:[ self tabViewAspect changed ];
yourself
"Created: / 16-01-2008 / 17:29:29 / janfrog"
"Modified: / 27-02-2008 / 12:06:05 / janfrog"
!
tabViewAspect
tabViewAspect
ifNil:[
tabViewAspect :=
(AspectAdaptor forAspect:#selectionView)
subjectChannel: self navigationStateAspect
].
^ tabViewAspect
"Created: / 16-01-2008 / 17:30:05 / janfrog"
"Modified: / 27-02-2008 / 12:05:46 / janfrog"
!
windowTitleAspect
^ (AspectAdaptor forAspect:#displayString)
subjectChannel:self navigationStateAspect
"Created: / 17-02-2008 / 08:42:21 / janfrog"
"Modified: / 27-02-2008 / 12:05:56 / janfrog"
! !
!Inspector2 methodsFor:'menu & menu actions'!
backButtonAction
self navigationHistoryHolder goBack
"Modified: / 21-02-2008 / 19:40:23 / janfrog"
!
backButtonMenuChannel
^ [ self navigationHistoryHolder goBackMenu ]
"Created: / 12-01-2008 / 18:57:08 / janfrog"
"Modified: / 22-02-2008 / 16:57:46 / janfrog"
!
forwardButtonAction
self navigationHistoryHolder goForward
"Created: / 21-02-2008 / 19:52:03 / janfrog"
!
forwardButtonMenuChannel
^ [ self navigationHistoryHolder goForwardMenu ]
"Created: / 12-01-2008 / 18:57:30 / janfrog"
"Modified: / 22-02-2008 / 16:58:11 / janfrog"
! !
!Inspector2 methodsFor:'opening'!
historyTryPush: anObject
"/ Pokud uz na anObject byl tak tam skocit, jinak pridat na konec
self history do: [:item |
item theObject == anObject ifTrue:[ ^item ]
].
^ self history push:anObject.
"Modified: / 16-01-2008 / 14:25:30 / janfrog"
!
inspect:anObject
self navigationHistoryHolder
currentItem: (NavigationState for: anObject)
"Modified: / 27-02-2008 / 12:06:52 / janfrog"
!
openOn: anObject
self open.
self inspect: anObject.
"Modified: / 13-01-2008 / 13:55:27 / janfrog"
! !
!Inspector2::NavigationState class methodsFor:'creating classes'!
for: anObject
| item |
item := self new.
item theObject: anObject.
^ item.
! !
!Inspector2::NavigationState class methodsFor:'documentation'!
version_SVN
^'§Id: Tools__Inspector2.st 115 2009-04-16 12:47:07Z vranyj1 §'
! !
!Inspector2::NavigationState methodsFor:'accessing'!
index
^ index
!
index:something
index := something.
!
selectionIndex
selectionIndex ifNil:[^1].
selectionIndex < 1 ifTrue:[^1].
selectionIndex > tabs size ifTrue:[^tabs size].
^selectionIndex
"Created: / 16-01-2008 / 17:24:27 / janfrog"
"Modified: / 17-02-2008 / 10:20:35 / janfrog"
!
selectionIndex: anInteger
selectionIndex := anInteger.
self changed:#selectionIndex
"Created: / 16-01-2008 / 17:27:52 / janfrog"
"Modified: / 17-02-2008 / 09:46:45 / janfrog"
!
selectionView
|tab|
tab := self tabs at: self selectionIndex.
^tab
ifNil:[nil]
ifNotNil:[tab view].
"Created: / 16-01-2008 / 17:31:19 / janfrog"
!
tabLabels
^self tabs collect:[:tab | tab label]
"Created: / 16-01-2008 / 17:14:07 / janfrog"
!
tabViews
^self tabs collect:[:tab | tab view]
"Created: / 16-01-2008 / 17:14:13 / janfrog"
!
tabs
tabs ifNil:[self initializeTabs].
^tabs
"Created: / 16-01-2008 / 16:51:53 / janfrog"
!
theObject
^ theObject
!
theObject:anObject
theObject := anObject.
"Modified: / 17-02-2008 / 08:38:44 / janfrog"
! !
!Inspector2::NavigationState methodsFor:'comparing'!
= anotherState
^self class == anotherState class
and:[self theObject == anotherState theObject]
"Created: / 21-02-2008 / 19:39:01 / janfrog"
!
hash
^theObject hash
"Created: / 21-02-2008 / 19:38:08 / janfrog"
! !
!Inspector2::NavigationState methodsFor:'displaying'!
displayString
displayString ifNil:
[displayString := theObject printString.
displayString size > 15 ifTrue:[displayString := (displayString copyTo:12), '...'].
displayString := displayString , ' [', theObject class name , ']'].
^ displayString
"Created: / 21-02-2008 / 19:53:07 / janfrog"
! !
!Inspector2::NavigationState methodsFor:'initialization'!
initializeCommonTabs
tabs add:
(Tools::Inspector2Tab new
priority: 50;
label:'Object';
view: ((theObject inspectorClass new inspect:theObject)
yourself))
"Created: / 16-01-2008 / 16:56:48 / janfrog"
"Modified: / 17-02-2008 / 10:29:54 / janfrog"
!
initializeExtraTabs
theObject class allSelectors
select:
[:selector|selector startsWith:#inspector2Tab]
thenDo:
[:selector|
| tab |
tab := [ theObject perform: selector ]
on: Error do:
[:ex|
Tools::Inspector2Tab new
label: selector;
text:
(ex description, Character cr, Character cr,
ex suspendedContext fullPrintString)].
(tab notNil and:[tab isKindOf: Tools::Inspector2Tab])
ifTrue:[tabs add: tab]].
"Created: / 16-01-2008 / 17:25:24 / janfrog"
"Modified: / 17-02-2008 / 10:30:43 / janfrog"
"Modified: / 07-11-2008 / 08:40:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!
initializeTabs
tabs := OrderedCollection new.
self initializeCommonTabs.
self initializeExtraTabs.
tabs := tabs asSortedCollection:[:a :b|a priority > b priority].
"Created: / 16-01-2008 / 16:54:28 / janfrog"
"Modified: / 17-02-2008 / 10:08:04 / janfrog"
! !
!Inspector2 class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.4 2009-10-08 11:57:22 fm Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.4 2009-10-08 11:57:22 fm Exp $'
!
version_CVS_jvrany
^ '§Header: /opt/data/cvs/stx/goodies/libtool3/Inspector2.st,v 1.6 2008-02-27 13:45:23 vranyj1 Exp §'
! !