GraphColumnViewSpec.st
author ca
Fri, 13 Feb 1998 14:50:32 +0100
changeset 753 0b6aaced2915
parent 751 616686a9b678
child 789 c2401c3c9e29
permissions -rw-r--r--
add more functionality to spec

MenuComponentSpec subclass:#GraphColumnViewSpec
	instanceVariableNames:'listHolder references referenceSelector showGrid showDefaultMenu
		level borderWidth zoomY windowSize graphOriginX
		scrollUpdatesOriginX'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support-UI-Specs'
!


!GraphColumnViewSpec class methodsFor:'class initialization'!

initialize
    "add an entry for my new components to the UIPainters 
     userDef gallery"

    UISelectionPanel userClass
        addUserSpecHolder:[self graphSpec]
        label:'Graphs'

    "
     self initialize
    "


!

removeFromSystem
    "remove myself - this implies deinstallation from the UIGallery"

    UISelectionPanel userClass removeUserSpecWithLabel:'Graphs'.
    ^ super removeFromSystem.

! !

!GraphColumnViewSpec class methodsFor:'interface - painter'!

addBindingsTo:env for:inst channel:aChannel 

    super addBindingsTo:env for:inst channel:aChannel.

    self 
        adaptApects:
                    #(  
                        showGrid
                        showDefaultMenu
                        scrollUpdatesOriginX
                     )
        to:env 
        for:inst 
        channel:aChannel.

    self 
        adaptApects:
                    #(  
                        zoomY
                        windowSize
                        graphOriginX
                        references
                        referenceSelector
                     )
        to:env 
        for:inst 
        channel:aChannel
        converter:#symbolOrNil.

    self 
        adaptApects:
                    #(  
                        level
                        borderWidth
                     )
        to:env 
        for:inst 
        channel:aChannel
        converter:#numberOrNil.
! !

!GraphColumnViewSpec class methodsFor:'interface gallery'!

graphSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:self andSelector:#graphSpec
     self new openInterface:#graphSpec
    "

    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Views'
              #'layout:' #(#LayoutFrame 212 0 194 0 691 0 422 0)
              #'label:' 'Views'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 212 194 692 423)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#GraphColumnView2DSpec
                    #'name:' '2D Graph'
                    #'layout:' #(#LayoutFrame 15 0 10 0 180 0 90 0)
                    #'showGrid:' true
                    #'gridX:' 2
                    #'gridY:' 2
                )
                 #(#LabelSpec
                    #'name:' '2D Graph Label'
                    #'layout:' #(#Point 15 96)
                    #'label:' 'Graph Column View 2D'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#GraphColumnView3DSpec
                    #'name:' '3D Graph'
                    #'layout:' #(#LayoutFrame 206 0 10 0 371 0 90 0)
                    #'showGrid:' true
                )
                 #(#LabelSpec
                    #'name:' '3D Graph Label'
                    #'layout:' #(#Point 206 96)
                    #'label:' 'Graph Column View 3D'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )


! !

!GraphColumnViewSpec class methodsFor:'interface specs'!

basicsEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:GraphColumnViewSpec andSelector:#basicsEditSpec
     GraphColumnViewSpec new openInterface:#basicsEditSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Graph 2D Basic'
              #'layout:' #(#LayoutFrame 61 0 160 0 372 0 426 0)
              #'label:' 'Graph 2D Basic'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 61 160 373 427)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'nameLabel'
                    #'layout:' #(#AlignmentOrigin 73 0 31 0 1 0.5)
                    #'label:' 'ID:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'nameField'
                    #'layout:' #(#LayoutFrame 75 0 20 0 -2 1.0 45 0)
                    #'activeHelpKey:' #id
                    #'model:' #name
                )
                 #(#LabelSpec
                    #'name:' 'modelLabel'
                    #'layout:' #(#AlignmentOrigin 73 0 60 0 1 0.5)
                    #'label:' 'Model:'
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'modelField'
                    #'layout:' #(#LayoutFrame 75 0 49 0 -2 1 74 0)
                    #'activeHelpKey:' #model
                    #'tabable:' true
                    #'model:' #model
                )
                 #(#LabelSpec
                    #'name:' 'referencesLabel'
                    #'layout:' #(#AlignmentOrigin 168 0 90 0 1 0.5)
                    #'label:' 'References:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'referencesField'
                    #'layout:' #(#LayoutFrame 171 0 80 0 -2 1.0 102 0)
                    #'model:' #references
                )
                 #(#LabelSpec
                    #'name:' 'referencesSelLabel'
                    #'layout:' #(#AlignmentOrigin 168 0 116 0 1 0.5)
                    #'label:' 'Access Selector:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'referencesSelField'
                    #'layout:' #(#LayoutFrame 171 0 106 0 -2 1.0 128 0)
                    #'model:' #referenceSelector
                )
                 #(#UISubSpecification
                    #'name:' 'menuSubSpec'
                    #'layout:' #(#LayoutFrame 0 0.0 144 0 0 1.0 201 0)
                    #'majorKey:' #UISpecification
                    #'minorKey:' #menuSubSpec
                )
                 #(#CheckBoxSpec
                    #'name:' 'showDefaultMenu'
                    #'layout:' #(#AlignmentOrigin 97 0 218 0 0 0.5)
                    #'model:' #showDefaultMenu
                    #'label:' 'Default Menu'
                )
              )
          )
      )
!

subDetailsEditSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:GraphColumnViewSpec andSelector:#subDetailsEditSpec
     GraphColumnViewSpec new openInterface:#subDetailsEditSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Graph 2D Detail'
              #'layout:' #(#LayoutFrame 43 0 157 0 387 0 509 0)
              #'label:' 'Graph 2D Detail'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 43 157 388 510)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'borderWidthLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 35 0 1 0.5)
                    #'label:' 'Border Width:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'borderWidthField'
                    #'layout:' #(#LayoutFrame 161 0 24 0 197 0 46 0)
                    #'activeHelpKey:' #borderWidth
                    #'tabable:' true
                    #'model:' #borderWidth
                )
                 #(#LabelSpec
                    #'name:' 'levelLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 58 0 1 0.5)
                    #'label:' 'Level:'
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'levelField'
                    #'layout:' #(#LayoutFrame 161 0 48 0 197 0 70 0)
                    #'activeHelpKey:' #level
                    #'tabable:' true
                    #'model:' #level
                )
                 #(#LabelSpec
                    #'name:' 'windowSizeLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 149 0 1 0.5)
                    #'label:' 'Window Size:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'windowSizeField'
                    #'layout:' #(#LayoutFrame 161 0 139 0 -2 1.0 161 0)
                    #'model:' #windowSize
                )
                 #(#LabelSpec
                    #'name:' 'zoomYLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 173 0 1 0.5)
                    #'label:' 'Zoom-Y Factor:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'zoomYField'
                    #'layout:' #(#LayoutFrame 161 0 163 0 -2 1.0 185 0)
                    #'model:' #zoomY
                )
                 #(#LabelSpec
                    #'name:' 'graphOriginXLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 91 0 1 0.5)
                    #'label:' 'Origin X'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'graphOriginXField'
                    #'layout:' #(#LayoutFrame 161 0 81 0 -2 1.0 103 0)
                    #'model:' #graphOriginX
                )
                 #(#CheckBoxSpec
                    #'name:' 'scrollUpdatesOriginX'
                    #'layout:' #(#AlignmentOrigin 158 0 115 0 0 0.5)
                    #'model:' #scrollUpdatesOriginX
                    #'label:' 'Scroll updates Origin X'
                )
              )
          )
      )
! !

!GraphColumnViewSpec methodsFor:'accessing'!

borderWidth
    "return the value of the instance variable 'borderWidth' (automatically generated)"

    ^ borderWidth ? 0
!

borderWidth:something
    "set the value of the instance variable 'borderWidth' (automatically generated)"

    borderWidth := something.!

graphOriginX
    "return the value of the instance variable 'graphOriginX' (automatically generated)"

    ^ graphOriginX!

graphOriginX:something
    "set the value of the instance variable 'graphOriginX' (automatically generated)"

    graphOriginX := something.!

level
    "return the value of the instance variable 'level' (automatically generated)"

    ^ level ? 0
!

level:something
    "set the value of the instance variable 'level' (automatically generated)"

    level := something.!

listHolder
    "return the value of the instance variable 'listHolder' (automatically generated)"

    ^ listHolder!

listHolder:something
    "set the value of the instance variable 'listHolder' (automatically generated)"

    listHolder := something.!

referenceSelector
    "return the value of the instance variable 'referenceSelector' (automatically generated)"

    ^ referenceSelector!

referenceSelector:something
    "set the value of the instance variable 'referenceSelector' (automatically generated)"

    referenceSelector := something.!

references
    "return the value of the instance variable 'references' (automatically generated)"

    ^ references
!

references:something
    "set the value of the instance variable 'references' (automatically generated)"

    references := something.
!

scrollUpdatesOriginX
    "return the value of the instance variable 'scrollUpdatesOriginX' (automatically generated)"

    ^ scrollUpdatesOriginX ? false
!

scrollUpdatesOriginX:something
    "set the value of the instance variable 'scrollUpdatesOriginX' (automatically generated)"

    scrollUpdatesOriginX := something.
!

showDefaultMenu
    "return the value of the instance variable 'showDefaultMenu' (automatically generated)"

    ^ showDefaultMenu ? false
!

showDefaultMenu:something
    "set the value of the instance variable 'showDefaultMenu' (automatically generated)"

    showDefaultMenu := something.!

showGrid
    "return the value of the instance variable 'showGrid' (automatically generated)"

    ^ showGrid ? false
!

showGrid:something
    "set the value of the instance variable 'showGrid' (automatically generated)"

    showGrid := something.!

windowSize
    "return the value of the instance variable 'windowSize' (automatically generated)"

    ^ windowSize!

windowSize:something
    "set the value of the instance variable 'windowSize' (automatically generated)"

    windowSize := something.!

zoomY
    "return the value of the instance variable 'zoomY' (automatically generated)"

    ^ zoomY!

zoomY:something
    "set the value of the instance variable 'zoomY' (automatically generated)"

    zoomY := something.! !

!GraphColumnViewSpec methodsFor:'building'!

aspectSelectors
    "add more aspect selectors
    "
    |more|

    more := super aspectSelectors.

    windowSize   notNil ifTrue:[more add:windowSize].
    graphOriginX notNil ifTrue:[more add:graphOriginX].
    references   notNil ifTrue:[more add:references].
    zoomY        notNil ifTrue:[more add:zoomY].

  ^ more
!

createViewFor:aBuilder in:aView
    "low level create - no attributes are set.
    "
    aBuilder isEditing ifFalse:[
        ^ super createViewFor:aBuilder in:aView
    ].
    ^ GraphColumnView in:aView

!

setAttributesIn:aView with:aBuilder

    super setAttributesIn:aView with:aBuilder.

    aView level:(self level).
    aView showGrid:(self showGrid).
    aView scrollUpdatesOriginX:(self scrollUpdatesOriginX).
    aView showDefaultMenu:(self showDefaultMenu).

    aView borderWidth:(self borderWidth).

    aBuilder isEditing ifFalse:[
        windowSize notNil ifTrue:[
            aView windowSizeHolder:(self getBindingIn:aBuilder binding:windowSize)
        ].

        graphOriginX notNil ifTrue:[
            aView graphOriginXHolder:(self getBindingIn:aBuilder binding:graphOriginX)
        ].

        referenceSelector notNil ifTrue:[
            aView referenceSelector:referenceSelector
        ].

        references notNil ifTrue:[
            aView referenceHolder:(self getBindingIn:aBuilder binding:references)
        ].

        zoomY notNil ifTrue:[
            aView zoomYHolder:(self getBindingIn:aBuilder binding:zoomY)
        ].

        self setModelAttributeIn:aView with:aBuilder.
        self setMenuIn:aView with:aBuilder.
    ]
! !

!GraphColumnViewSpec methodsFor:'converting'!

skippedInLiteralEncoding
    "define the inst-slots which are skiped when generating a literalArrayEncoding"

    |l|

    l := super skippedInLiteralEncoding asOrderedCollection.

    zoomY             isNil ifTrue:[l add:#zoomY].
    windowSize        isNil ifTrue:[l add:#windowSize].
    graphOriginX      isNil ifTrue:[l add:#graphOriginX].
    references        isNil ifTrue:[l add:#references].
    referenceSelector isNil ifTrue:[l add:#referenceSelector].

    self showGrid ifFalse:[
        l add:#showGrid
    ].

    self scrollUpdatesOriginX ifFalse:[
        l add:#scrollUpdatesOriginX
    ].

    (self showDefaultMenu and:[menu isNil]) ifFalse:[
        l add:#showDefaultMenu
    ].        

    self level       == 0 ifTrue:[ l add:#level ].
    self borderWidth == 0 ifTrue:[ l add:#borderWidth ].

  ^ l




! !

!GraphColumnViewSpec methodsFor:'parsing a view'!

fromView:aView callBack:aBlock

    showGrid             := aView showGrid.
    showDefaultMenu      := aView showDefaultMenu.
    level                := aView level.
    borderWidth          := aView borderWidth.
    scrollUpdatesOriginX := aView scrollUpdatesOriginX.

    super fromView:aView callBack:aBlock


! !

!GraphColumnViewSpec methodsFor:'queries'!

defaultModelClassFor:someAspect
    "used by the UIPainters aspectGenerator
    "
    ^ someAspect == model ifTrue:[List] ifFalse:[ValueHolder]
! !

!GraphColumnViewSpec class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnViewSpec.st,v 1.5 1998-02-13 13:50:10 ca Exp $'
! !
GraphColumnViewSpec initialize!