CustomUserDialog.st
author Jakub Nesveda <jakubnesveda@seznam.cz>
Tue, 28 Oct 2014 09:39:46 +0100
changeset 711 605ab7fc9cd1
parent 669 13f049ec3b22
child 740 dcc444183c8c
permissions -rw-r--r--
return whole source code when selected interval is empty retrieve selector from method when none selector is specified
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     1
"{ Package: 'jn:refactoring_custom' }"
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     2
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     3
CustomDialog subclass:#CustomUserDialog
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
     4
	instanceVariableNames:'dialog'
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     5
	classVariableNames:''
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     6
	poolDictionaries:''
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     7
	category:'Interface-Refactoring-Custom'
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     8
!
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     9
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    10
!CustomUserDialog class methodsFor:'documentation'!
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    11
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    12
documentation
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    13
"
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    14
    CustomDialog implementation with real dialogs to provide human interaction.
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    15
    Currently it is a simple wrapper around DialogBox. 
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    16
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    17
    [author:]
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    18
        Jakub Nesveda <nesvejak@fit.cvut.cz>
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    19
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    20
"
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    21
! !
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    22
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    23
!CustomUserDialog class methodsFor:'instance creation'!
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    24
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    25
new
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    26
    "return an initialized instance"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    27
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    28
    ^ self basicNew initialize.
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    29
! !
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    30
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    31
!CustomUserDialog methodsFor:'construction-adding'!
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    32
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    33
addAbortAndOkButtons
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    34
    dialog addAbortAndOkButtons
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    35
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    36
    "Created: / 15-09-2014 / 16:21:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    37
!
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    38
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    39
addComponent:aView
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    40
    "Add given component. Component is automatically stretched to occupy windows' width"
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    41
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    42
    ^ dialog addComponent: aView
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    43
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    44
    "Created: / 15-09-2014 / 18:50:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    45
!
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    46
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    47
addComponent:aView labeled:aString
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    48
    "Add a label and some component side-by-side. Returns the component"
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    49
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    50
"/    aString notEmptyOrNil ifTrue:[
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    51
        ^ dialog
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    52
            addLabelledField:aView 
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    53
            label:aString ? ''
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    54
            adjust:#left 
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    55
            tabable:true 
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    56
            separateAtX:0.3
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    57
"/    ] ifFalse:[ 
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    58
"/        ^ dialog
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    59
"/            addComponent:aView indent: 0.3
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    60
"/    ].
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    61
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    62
    "Created: / 15-09-2014 / 15:45:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    63
    "Modified: / 15-09-2014 / 19:44:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    64
! !
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    65
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    66
!CustomUserDialog methodsFor:'initialization'!
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    67
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    68
initialize
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    69
    "Invoked when a new instance is created."
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    70
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    71
    "/ please change as required (and remove this comment)
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    72
    dialog := DialogBox new.
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    73
    dialog abortAction: [ AbortOperationRequest raiseRequest ]  
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    74
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    75
    "/ super initialize.   -- commented since inherited method does nothing
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    76
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    77
    "Modified: / 15-09-2014 / 16:23:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    78
! !
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    79
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    80
!CustomUserDialog methodsFor:'opening'!
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    81
669
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    82
open
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    83
    ^ dialog open
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    84
13f049ec3b22 CustomDialog refactored to support creation of a more complex dialogs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 617
diff changeset
    85
    "Created: / 15-09-2014 / 16:23:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    86
! !
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    87
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    88
!CustomUserDialog methodsFor:'user interaction & notifications'!
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    89
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    90
information: aString
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    91
617
184b586387b5 fix endless recursion in CustomUserDialog >> information:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 557
diff changeset
    92
    ^ Dialog information: aString
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    93
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    94
    "Created: / 02-06-2014 / 22:36:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
617
184b586387b5 fix endless recursion in CustomUserDialog >> information:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 557
diff changeset
    95
    "Modified: / 22-07-2014 / 21:25:18 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
557
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    96
! !
d0e228558858 make CustomDialog as abstract with CustomSilentDialog (system/test interaction) and CustomUserDialog (human interaction) implementations
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    97