-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from hpi-swa-teaching/load_json
Load json
- Loading branch information
Showing
63 changed files
with
368 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/addMorphFromSpec..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
loadJson | ||
addMorphFromSpec: aDictionary | ||
| morph morphProperty | | ||
morph := (self createMorphFromString: (aDictionary at: 'type')) openInWorld. | ||
self loadStartProperties: (aDictionary at: 'properties') with: morph. | ||
morphProperty := self addTargetMorph: morph. | ||
self loadFramesFromJson: (aDictionary at: 'frames') with: morphProperty. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...AnimationsEditor-Core.package/AnimationsEditor.class/instance/buildLoadJsonButtonWith..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
buildComponents | ||
buildLoadJsonButtonWith: aBuilder | ||
^ aBuilder pluggableButtonSpec new model: self; | ||
label: 'Load JSON'; | ||
action: #handleLoadJsonButton; | ||
frame: (LayoutFrame new | ||
topFraction: 0; | ||
bottomFraction: 1; | ||
rightFraction: 1; | ||
leftFraction: 0.8; | ||
yourself); | ||
yourself. |
20 changes: 20 additions & 0 deletions
20
.../AnimationsEditor-Core.package/AnimationsEditor.class/instance/buildLoadingMainWindow..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
buildComponents | ||
buildLoadingMainWindow: aBuilder | ||
| loadingMainWindow | | ||
|
||
PluggableWindowSpec new openInHand. | ||
loadingMainWindow:= (aBuilder build: (aBuilder pluggableWindowSpec new | ||
model: self; | ||
label: #editorTitle; | ||
extent: 500@350; | ||
children: { self buildButtonBarWith: aBuilder. | ||
self buildPropertiesTreeWith: aBuilder. | ||
self buildPositionUIPanelWith: aBuilder. | ||
self buildTimeline: aBuilder. | ||
self buildInformationBarWith: aBuilder. | ||
}; | ||
yourself)). | ||
|
||
^ loadingMainWindow. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...s/AnimationsEditor-Core.package/AnimationsEditor.class/instance/createMorphFromString..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
loadJson | ||
createMorphFromString: aString | ||
^ (self morphTypes at: aString asSymbol ifAbsent: [Morph new]) value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...nimationsEditor-Core.package/AnimationsEditor.class/instance/framePropertiesDictionary.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
loadJson | ||
framePropertiesDictionary | ||
^ {#rotation -> [:anDictionary :aValue | (anDictionary at: 'rotation') targetRotation: aValue]. | ||
#positionX -> [:anDictionary :aValue | (anDictionary at: 'position') positionX: aValue]. | ||
#positionY -> [:anDictionary :aValue | (anDictionary at: 'position') positionY: aValue]. | ||
#width -> [:anDictionary :aValue | (anDictionary at: 'size') targetWidth: aValue]. | ||
#height -> [:anDictionary :aValue | (anDictionary at: 'size') targetHeight: aValue]. | ||
#color -> [:anDictionary :aValue | (anDictionary at: 'color') targetColor: aValue]} as: IdentityDictionary. | ||
|
||
|
||
|
||
|
7 changes: 7 additions & 0 deletions
7
...ges/AnimationsEditor-Core.package/AnimationsEditor.class/instance/handleLoadJsonButton.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
eventHandling | ||
handleLoadJsonButton | ||
| path | | ||
path := UIManager default chooseFileMatching: '*.json'. | ||
path isString | ||
ifTrue: [self loadJsonWithExceptionHandling: (FileStream readOnlyFileNamed: path) contents]. | ||
|
6 changes: 6 additions & 0 deletions
6
...AnimationsEditor-Core.package/AnimationsEditor.class/instance/loadFramesFromJson.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loadJson | ||
loadFramesFromJson: anArray with: anAnimationEditorProperty | ||
(anArray first at: 'properties') | ||
do: [:each | (self framePropertiesDictionary at: (each at: 'name') asSymbol) | ||
value: anAnimationEditorProperty subproperties | ||
value: (each at: 'value')]. |
6 changes: 6 additions & 0 deletions
6
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/loadJson..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loadJson | ||
loadJson: aText | ||
| data | | ||
data:= STON fromString: aText. | ||
self loadStartEnd: data. | ||
self loadMorphs: (data at: 'morphs'). |
7 changes: 7 additions & 0 deletions
7
...ionsEditor-Core.package/AnimationsEditor.class/instance/loadJsonWithExceptionHandling..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
loadJson | ||
loadJsonWithExceptionHandling: aText | ||
[self loadJson: aText. | ||
self updateInformationText: 'Animation loaded'] | ||
on: KeyNotFound | ||
do: [:error | self updateInformationText: 'Invalid JSON (' , error messageText , ')']. | ||
|
3 changes: 3 additions & 0 deletions
3
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/loadMorphs..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
loadJson | ||
loadMorphs: anArray | ||
anArray do: [:each | self addMorphFromSpec: each]. |
4 changes: 4 additions & 0 deletions
4
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/loadStartEnd..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
loadJson | ||
loadStartEnd: aDictionary | ||
self propertyStartEnd startTime: (self propertyStartEnd startTime min: (aDictionary at: 'start')). | ||
self propertyStartEnd endTime: (self propertyStartEnd endTime max: (aDictionary at: 'end')). |
9 changes: 9 additions & 0 deletions
9
...nimationsEditor-Core.package/AnimationsEditor.class/instance/loadStartProperties.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
loadJson | ||
loadStartProperties: anArray with: aMorph | ||
|
||
anArray | ||
do: [:each | (self propertiesDictionary at: (each at: 'name') asSymbol) | ||
value: aMorph | ||
value: (each at: 'value')]. | ||
|
||
|
6 changes: 6 additions & 0 deletions
6
packages/AnimationsEditor-Core.package/AnimationsEditor.class/instance/morphTypes.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loadJson | ||
morphTypes | ||
^ {#Morph -> [Morph new]. | ||
#CircleMorph -> [CircleMorph new]. | ||
#RectangleMorph -> [RectangleMorph new]. | ||
#TextMorph -> [TextMorph new]} as: IdentityDictionary |
12 changes: 12 additions & 0 deletions
12
...ges/AnimationsEditor-Core.package/AnimationsEditor.class/instance/propertiesDictionary.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
loadJson | ||
propertiesDictionary | ||
^ {#rotation -> [:aMorph :aValue | aMorph rotationDegrees: aValue]. | ||
#positionX -> [:aMorph :aValue | aMorph left: aValue]. | ||
#positionY -> [:aMorph :aValue | aMorph top: aValue]. | ||
#width -> [:aMorph :aValue | aMorph width: aValue]. | ||
#height -> [:aMorph :aValue | aMorph height: aValue]. | ||
#color -> [:aMorph :aValue | aMorph color: (Color colorFrom: aValue)]} as: IdentityDictionary. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../AnimationsEditor-Core.package/AnimationsEditorProperty.class/instance/animationString.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
code-generation | ||
codeGeneration | ||
animationString | ||
self subclassResponsibility. |
2 changes: 1 addition & 1 deletion
2
...ges/AnimationsEditor-Core.package/AnimationsEditorProperty.class/instance/buildUIWith..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
build-component | ||
buildComponents | ||
buildUIWith: aBuilder | ||
self subclassResponsibility. |
2 changes: 1 addition & 1 deletion
2
...mationsEditor-Core.package/AnimationsEditorProperty.class/instance/createAnimationFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
code-generation | ||
codeGeneration | ||
createAnimationFor: aMorph | ||
self subclassResponsibility. |
2 changes: 1 addition & 1 deletion
2
...-Core.package/AnimationsEditorProperty.class/instance/createAnimationFor.withDuration..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
code-generation | ||
codeGeneration | ||
createAnimationFor: aMorph withDuration: aNumber | ||
self animationsEditor updateInformationText: 'Please select a valid Animation Field!'. |
2 changes: 1 addition & 1 deletion
2
...ationsEditor-Core.package/AnimationsEditorProperty.class/instance/defaultSubproperties.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defaults | ||
defaultSubproperties | ||
^ (OrderedCollection new). | ||
^ (Dictionary new). |
1 change: 1 addition & 0 deletions
1
...AnimationsEditor-Core.package/AnimationsEditorProperty.class/instance/resetTargetMorph.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...-Core.package/AnimationsEditorProperty.class/instance/resetTargetMorphForAllProperties.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
animation | ||
resetTargetMorphForAllProperties | ||
self subproperties collect: [ :each | each resetTargetMorph ]. | ||
self subproperties valuesDo: [ :each | each resetTargetMorph ]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
.../AnimationsEditor-Core.package/AnimationsEditorPropertyWrapper.class/instance/contents.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
accessing | ||
contents | ||
^ self item subproperties sorted collect: [ :each | | ||
|
||
^ self item subproperties sorted asOrderedCollection collect: [ :each | | ||
self class | ||
with: each | ||
model: self model]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.