~hilaire-fernandes/drgeo/trunk

« back to all changes in this revision

Viewing changes to src/DrGeoII-Core/DrGMathItemCommand.class.st

  • Committer: Hilaire Fernandes
  • Date: 2017-11-15 13:17:03 UTC
  • Revision ID: hilaire.fernandes@gmail.com-20171115131703-pz09obavthi53ebt
DrGeo code under Tonel file format

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"
 
2
A command to record a mathItem construction
 
3
"
 
4
Class {
 
5
        #name : #DrGMathItemCommand,
 
6
        #superclass : #DrGCommand,
 
7
        #instVars : [
 
8
                'mathItems'
 
9
        ],
 
10
        #category : #'DrGeoII-Core-Command'
 
11
}
 
12
 
 
13
{ #category : #'as yet unclassified' }
 
14
DrGMathItemCommand class >> for: aMathItem in: aDomain [ 
 
15
        ^self new
 
16
                domain: aDomain;
 
17
                fromMathItem: aMathItem .
 
18
]
 
19
 
 
20
{ #category : #'as yet unclassified' }
 
21
DrGMathItemCommand class >> with: aBuilder in: aDomain [ 
 
22
        ^self new
 
23
                domain: aDomain;
 
24
                createMathItem: aBuilder.
 
25
]
 
26
 
 
27
{ #category : #accessing }
 
28
DrGMathItemCommand >> createMathItem: aBuilder [
 
29
        mathItems := aBuilder getItem.
 
30
 
 
31
]
 
32
 
 
33
{ #category : #command }
 
34
DrGMathItemCommand >> execute [
 
35
        "Remove any previous dependant"
 
36
        mathItems do: [:aMathItem| 
 
37
                "record the mathItem in the factory"
 
38
                domain factory add: aMathItem.
 
39
                domain triggerEvent: #redoMathItem with: aMathItem].
 
40
        ^mathItems
 
41
]
 
42
 
 
43
{ #category : #accessing }
 
44
DrGMathItemCommand >> fromMathItem: aMathItem [
 
45
        mathItems := {aMathItem}.
 
46
 
 
47
]
 
48
 
 
49
{ #category : #'dependents access' }
 
50
DrGMathItemCommand >> release [
 
51
        super release.
 
52
        mathItems do: [:m | m release]
 
53
]
 
54
 
 
55
{ #category : #command }
 
56
DrGMathItemCommand >> unexecute [
 
57
        "remove the mathItem in the factory"
 
58
        domain factory remove: mathItems
 
59
 
 
60
]