Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better library #185

Merged
merged 7 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Pyramid-Bloc/PyramidAddChildrenCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'PyramidAddChildrenCommand',
#superclass : 'PyramidChildrenCommand',
#category : 'Pyramid-Bloc-plugin-bloc',
#package : 'Pyramid-Bloc',
#tag : 'plugin-bloc'
}

{ #category : 'as yet unclassified' }
PyramidAddChildrenCommand >> commandInverse [

^ PyramidRemoveChildrenCommand new
]

{ #category : 'as yet unclassified' }
PyramidAddChildrenCommand >> setValueFor: aBlElement with: aChildrenToAdd [

aBlElement addChildren: aChildrenToAdd
]
80 changes: 80 additions & 0 deletions src/Pyramid-Bloc/PyramidElementToAddCategory.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Class {
#name : 'PyramidElementToAddCategory',
#superclass : 'Object',
#instVars : [
'name',
'icon',
'factories'
],
#category : 'Pyramid-Bloc-plugin-tree-library',
#package : 'Pyramid-Bloc',
#tag : 'plugin-tree-library'
}

{ #category : 'comparing' }
PyramidElementToAddCategory >> <= aPyramidLibraryCategory [

^ self name <= aPyramidLibraryCategory name
]

{ #category : 'converting' }
PyramidElementToAddCategory >> asNotebookPage [

^ SpNotebookPage
title: self name
icon: self icon
provider: [self makeProvider]
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> factories [

^ factories
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> factories: anObject [

factories := anObject
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> icon [

^ icon
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> icon: anObject [

icon := anObject
]

{ #category : 'as yet unclassified' }
PyramidElementToAddCategory >> makeProvider [

^
SpTablePresenter new
addColumn: ((SpImageTableColumn
title: 'Icon'
evaluated: [ :aFactory | aFactory elementIcon ])
width: 50;
yourself);
addColumn:
(SpStringTableColumn title: 'Name' evaluated: #elementName);
items: self factories;
beResizable;
yourself
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> name [

^ name
]

{ #category : 'accessing' }
PyramidElementToAddCategory >> name: anObject [

name := anObject
]
79 changes: 79 additions & 0 deletions src/Pyramid-Bloc/PyramidElementToAddFactory.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Class {
#name : 'PyramidElementToAddFactory',
#superclass : 'Object',
#instVars : [
'elementIcon',
'elementName',
'elementBlock'
],
#category : 'Pyramid-Bloc-plugin-tree-library',
#package : 'Pyramid-Bloc',
#tag : 'plugin-tree-library'
}

{ #category : 'comparing' }
PyramidElementToAddFactory >> <= aPyramidLibraryCategory [

^ self elementName <= aPyramidLibraryCategory elementName
]

{ #category : 'testing' }
PyramidElementToAddFactory >> canMakeNewElement [

[self elementBlock value] on: Error do: [ ^ false ].
^ true
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementBlock [

^ elementBlock
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementBlock: anObject [

elementBlock := anObject
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementIcon [

^ elementIcon
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementIcon: anObject [

elementIcon := anObject
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementName [

^ elementName
]

{ #category : 'accessing' }
PyramidElementToAddFactory >> elementName: anObject [

elementName := anObject
]

{ #category : 'as yet unclassified' }
PyramidElementToAddFactory >> makeElement [

^ self elementBlock value
]

{ #category : 'as yet unclassified' }
PyramidElementToAddFactory >> makeForm [

| array |
array := self elementBlock value.
^ BlElement new
size: 800 @ 600;
addChildren: array;
clipChildren: false;
asForm
]
19 changes: 19 additions & 0 deletions src/Pyramid-Bloc/PyramidElementToAddFactoryEmpty.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Class {
#name : 'PyramidElementToAddFactoryEmpty',
#superclass : 'PyramidElementToAddFactory',
#category : 'Pyramid-Bloc-plugin-tree-library',
#package : 'Pyramid-Bloc',
#tag : 'plugin-tree-library'
}

{ #category : 'testing' }
PyramidElementToAddFactoryEmpty >> canMakeNewElement [

^ false
]

{ #category : 'as yet unclassified' }
PyramidElementToAddFactoryEmpty >> makeForm [

^ BlElement new asForm
]
128 changes: 128 additions & 0 deletions src/Pyramid-Bloc/PyramidElementToAddFactoryPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
Class {
#name : 'PyramidElementToAddFactoryPresenter',
#superclass : 'SpPresenter',
#instVars : [
'categoryPresenter',
'factoryPresenter',
'categories',
'selectedCategory',
'selectedFactory',
'whenItemChangeDo'
],
#category : 'Pyramid-Bloc-plugin-tree-library',
#package : 'Pyramid-Bloc',
#tag : 'plugin-tree-library'
}

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> categories [

^ categories
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> categories: anObject [

categories := anObject.
self categoryPresenter items: anObject
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> categoryPresenter [

^ categoryPresenter
]

{ #category : 'layout' }
PyramidElementToAddFactoryPresenter >> defaultLayout [

^ SpPanedLayout newHorizontal add: self categoryPresenter; add: self factoryPresenter ; yourself.
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> factoryPresenter [

^ factoryPresenter
]

{ #category : 'initialization - deprecated' }
PyramidElementToAddFactoryPresenter >> initialize [

super initialize.
whenItemChangeDo := [ :e | ].

]

{ #category : 'initialization - deprecated' }
PyramidElementToAddFactoryPresenter >> initializePresenter [

whenItemChangeDo := [ :e | ].
categoryPresenter := SpTablePresenter new
addColumn: ((SpImageTableColumn
title: 'Icon'
evaluated: [ :aCategory | aCategory icon ])
width: 20;
yourself);
addColumn:
(SpStringTableColumn
title: 'Name'
evaluated: #name);
whenSelectedItemChangedDo: [ :category |
self selectedCategory: category ];
beResizable;
yourself.
factoryPresenter := SpTablePresenter new
addColumn: ((SpImageTableColumn
title: 'Icon'
evaluated: [ :aFactory |
aFactory elementIcon ])
width: 20;
yourself);
addColumn:
(SpStringTableColumn
title: 'Name'
evaluated: #elementName);
whenSelectedItemChangedDo: [ :factory |
self selectedFactory: factory ];
beResizable;
yourself
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> selectedCategory [

^ selectedCategory
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> selectedCategory: anObject [

selectedCategory := anObject.
anObject ifNil: [ ^ self ].
self factoryPresenter items: anObject factories
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> selectedFactory [

^ selectedFactory
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> selectedFactory: anObject [

selectedFactory := anObject.
self whenItemChangeDo value: anObject
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> whenItemChangeDo [

^ whenItemChangeDo
]

{ #category : 'accessing' }
PyramidElementToAddFactoryPresenter >> whenItemChangeDo: anObject [

whenItemChangeDo := anObject
]
43 changes: 43 additions & 0 deletions src/Pyramid-Bloc/PyramidElementToAddModel.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Class {
#name : 'PyramidElementToAddModel',
#superclass : 'Object',
#instVars : [
'categories'
],
#category : 'Pyramid-Bloc-plugin-tree-library',
#package : 'Pyramid-Bloc',
#tag : 'plugin-tree-library'
}

{ #category : 'as yet unclassified' }
PyramidElementToAddModel class >> defaultLibrary [

| library |
library := self new.
TPyramidElementToAdd users do: [ :class | class addOnLibrary: library ].
^ library
]

{ #category : 'adding' }
PyramidElementToAddModel >> addCategoryWithName: aCategoryName withIcon: aCategoryIcon withAllFactories: aCollection [

| newCategory |
newCategory := PyramidElementToAddCategory new
name: aCategoryName;
icon: aCategoryIcon;
factories: aCollection;
yourself.
categories add: newCategory
]

{ #category : 'initialization' }
PyramidElementToAddModel >> allCategories [

^ categories
]

{ #category : 'initialization' }
PyramidElementToAddModel >> initialize [

categories := OrderedCollection new.
]
Loading
Loading