Tools__Inspector2Tab.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 21 May 2015 21:56:44 +0100
branchjv
changeset 15659 bdc9e920f640
parent 15566 184cea584be5
child 16664 ef51c9c52b52
permissions -rw-r--r--
Improved API for inspector 2 tabs: allow view to be actually a block returning the view. This allow for lazy-initialization of the view while using short an conncise #view: setter.

"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Tools }"

Object subclass:#Inspector2Tab
	instanceVariableNames:'label view application priority viewHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Inspector2'
!

!Inspector2Tab class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!Inspector2Tab methodsFor:'accessing'!

application
    ^ application

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
!

application:anApplicationModelOrBlock
    application := anApplicationModelOrBlock.

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
    "Modified: / 17-02-2008 / 08:58:34 / janfrog"
!

label
    ^ label

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
!

label:aString
    label := aString.

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
    "Modified: / 17-02-2008 / 08:58:41 / janfrog"
!

priority
    ^ priority ? 25

    "Created: / 17-02-2008 / 10:05:51 / janfrog"
!

priority:something
    priority := something.

    "Created: / 17-02-2008 / 10:05:51 / janfrog"
!

text:aStringOrValueModel

    self view:((HVScrollableView for:TextView) model: aStringOrValueModel; yourself)

    "Modified: / 17-02-2008 / 08:58:41 / janfrog"
    "Created: / 07-11-2008 / 08:40:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

view
    view isNil ifTrue:[
        viewHolder notNil ifTrue:[
            view := viewHolder value
        ] ifFalse:[
            application notNil ifTrue:[
                view := ApplicationSubView new client: application value
            ]
        ]
    ].
    ^ view

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
    "Modified: / 17-02-2008 / 10:38:59 / janfrog"
    "Modified: / 13-06-2012 / 14:57:25 / cg"
    "Modified: / 24-03-2014 / 18:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

view:aViewOrBlock
    aViewOrBlock isBlock ifTrue:[ 
        viewHolder := aViewOrBlock
    ] ifFalse:[
        view := aViewOrBlock.
    ]

    "Created: / 16-01-2008 / 16:51:05 / janfrog"
    "Modified: / 17-02-2008 / 08:58:46 / janfrog"
    "Modified: / 21-05-2015 / 21:31:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

viewHolder:something
    viewHolder := something.
!

viewOrNil
    ^ view

    "Created: / 24-03-2014 / 18:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Inspector2Tab class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2Tab.st,v 1.8 2014-03-24 22:38:21 vrany Exp $'
!

version_CVS_jvrany
    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2Tab.st,v 1.8 2014-03-24 22:38:21 vrany Exp $'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '$Id: Tools__Inspector2Tab.st,v 1.8 2014-03-24 22:38:21 vrany Exp $'
! !