NewInspectorView.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jul 2009 20:02:02 +0200
changeset 2570 4e663bc64364
parent 2298 d5467f85544f
child 2621 285fa261cbcb
permissions -rw-r--r--
changed #requestPackage
cg@809
     1
"
cg@809
     2
 COPYRIGHT (c) 1997 by eXept Software AG
cg@809
     3
              All Rights Reserved
cg@809
     4
cg@809
     5
 This software is furnished under a license and may be used
cg@809
     6
 only in accordance with the terms of that license and with the
cg@809
     7
 inclusion of the above copyright notice.   This software may not
cg@809
     8
 be provided or otherwise made available to, or used by, any
cg@809
     9
 other person.  No title to or ownership of the software is
cg@809
    10
 hereby transferred.
cg@809
    11
"
cg@2298
    12
"{ Package: 'stx:libtool2' }"
cg@809
    13
ca@32
    14
"{ NameSpace: NewInspector }"
ca@32
    15
cg@1213
    16
VariableVerticalPanel subclass:#NewInspectorView
ca@32
    17
	instanceVariableNames:'inspectorView userSpace workSpace inspectedObject'
ca@32
    18
	classVariableNames:''
ca@32
    19
	poolDictionaries:''
cg@1213
    20
	category:'Interface-NewInspector'
ca@32
    21
!
ca@32
    22
cg@1213
    23
!NewInspectorView class methodsFor:'documentation'!
ca@32
    24
cg@809
    25
copyright
cg@809
    26
"
cg@809
    27
 COPYRIGHT (c) 1997 by eXept Software AG
cg@809
    28
              All Rights Reserved
cg@809
    29
cg@809
    30
 This software is furnished under a license and may be used
cg@809
    31
 only in accordance with the terms of that license and with the
cg@809
    32
 inclusion of the above copyright notice.   This software may not
cg@809
    33
 be provided or otherwise made available to, or used by, any
cg@809
    34
 other person.  No title to or ownership of the software is
cg@809
    35
 hereby transferred.
cg@809
    36
"
cg@809
    37
cg@809
    38
cg@809
    39
!
cg@809
    40
cg@809
    41
documentation
cg@809
    42
"
cg@809
    43
    a new (multipane) inspector;
cg@809
    44
    open with:
cg@2298
    45
        NewInspector::NewInspectorView inspect:Object
cg@809
    46
cg@809
    47
    install as standard inspector:
cg@1213
    48
        Smalltalk at:#Inspector put:(NewInspector::NewInspectorView)
cg@809
    49
cg@809
    50
    [open with:]
cg@1213
    51
        NewInspector::NewInspectorView 
cg@809
    52
                inspect:(Array with:#hello with:'hello' with:#(1 2 3) asSortedCollection with:Display)
cg@809
    53
cg@809
    54
    [author:]
cg@809
    55
        Claus Atzkern
cg@809
    56
"
cg@809
    57
!
cg@809
    58
ca@32
    59
examples
ca@32
    60
ca@32
    61
"
ca@39
    62
    open an inspector on an array
ca@39
    63
                                                                        [exBegin]
ca@39
    64
    |array|
ca@39
    65
ca@39
    66
    array := Array new:5.
ca@39
    67
    array at:1 put:(Array new:400).
cg@1213
    68
    NewInspector::NewInspectorView inspect:array
ca@39
    69
                                                                        [exEnd]
ca@32
    70
"
ca@32
    71
! !
ca@32
    72
cg@1213
    73
!NewInspectorView class methodsFor:'instance creation'!
ca@32
    74
cg@811
    75
inspect:anObject
ca@32
    76
    "start inspector on an instance
ca@32
    77
    "
cg@811
    78
    ^ self openOn:anObject
cg@811
    79
!
cg@811
    80
cg@811
    81
openOn:anObject
cg@811
    82
    "start an inspector on some object
cg@811
    83
    "
cg@811
    84
ca@32
    85
    |top isp|
ca@32
    86
ca@32
    87
    top := StandardSystemView new extent:600@400.
cg@1213
    88
    isp := NewInspectorView origin:0.0@0.0  corner:1.0@1.0 in:top.
cg@811
    89
    isp inspect:anObject.
ca@32
    90
    top open.
ca@32
    91
cg@811
    92
    ^ isp.
ca@32
    93
! !
ca@32
    94
cg@1213
    95
!NewInspectorView methodsFor:'accessing'!
ca@32
    96
ca@32
    97
inspect:anInstance
ca@32
    98
ca@32
    99
    inspectedObject := anInstance.
ca@32
   100
    self topView label:(inspectedObject class name asString).
ca@32
   101
    inspectorView inspect:anInstance.
ca@32
   102
    self updateWorkSpace.
ca@32
   103
ca@32
   104
! !
ca@32
   105
cg@1213
   106
!NewInspectorView methodsFor:'initialization'!
ca@32
   107
ca@32
   108
initialize
cg@88
   109
    |view wsHeight|
ca@32
   110
ca@32
   111
    super initialize.
ca@32
   112
ca@32
   113
    view := SimpleView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:self.
ca@32
   114
cg@1213
   115
    inspectorView := NewInspectorPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:view.
ca@32
   116
    workSpace     := Workspace          origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:view.
ca@32
   117
    userSpace     := Workspace          origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:self.
ca@32
   118
cg@88
   119
    wsHeight := (workSpace preferredExtentForLines:1 cols:10) y.
cg@88
   120
    workSpace     topInset:wsHeight negated.
cg@88
   121
    inspectorView bottomInset:wsHeight.
ca@32
   122
ca@32
   123
    userSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
ca@32
   124
    workSpace acceptAction:[:theText|inspectorView accept:theText notifying:workSpace].
ca@32
   125
ca@32
   126
    userSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
ca@32
   127
    workSpace   doItAction:[:theCode|inspectorView doIt:theCode notifying:workSpace].
ca@32
   128
ca@32
   129
    inspectorView action:[:el|self updateWorkSpace].
ca@32
   130
ca@32
   131
    inspectorView valueChangedAction:[:el||lbl|
ca@32
   132
        workSpace list:(Array with:(el displayString)).
ca@32
   133
    ].
cg@88
   134
cg@88
   135
    "Modified: 18.3.1997 / 10:57:34 / cg"
ca@32
   136
! !
ca@32
   137
cg@1213
   138
!NewInspectorView methodsFor:'update'!
ca@32
   139
ca@32
   140
updateWorkSpace
ca@32
   141
    "update the workSpace
ca@32
   142
    "
ca@32
   143
    workSpace list:(Array with:(inspectorView selectedInstanceVar displayString)).
ca@32
   144
! !
ca@32
   145
cg@1213
   146
!NewInspectorView class methodsFor:'documentation'!
ca@32
   147
ca@32
   148
version
ca@32
   149
    ^ '$Header$'
ca@32
   150
! !