Skip to content

Commit

Permalink
Form and file dialog improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 8, 2024
1 parent aafa5a0 commit 7a78f84
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 26 deletions.
40 changes: 40 additions & 0 deletions repository/OpenPonk-Core/StFileBrowserBookmark.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Extension { #name : 'StFileBrowserBookmark' }

{ #category : '*OpenPonk-Core' }
StFileBrowserBookmark class >> defaultBookmarks [

| presets |
self flag: 'Remove (let NewTools to replace it) in Pharo 13'.
presets := {
self home.
self workingDirectory.
self desktop.
self documents.
self downloads }.

^ OrderedCollection with: (StFileBrowserGroupBookmark
name: 'Bookmarks'
collection: presets
iconName: #book)
]

{ #category : '*OpenPonk-Core' }
StFileBrowserBookmark class >> root [

self flag: 'Remove in Pharo 13'.
^ self
name: '/'
location: FileLocator root
icon: (self iconNamed: #smallWindow)
]

{ #category : '*OpenPonk-Core' }
StFileBrowserBookmark class >> windowsDrives [

self flag: 'Remove in Pharo 13'.
^ FileLocator root asFileReference directories collect: [ :each |
self
name: each basename
location: each
icon: (self iconNamed: #smallWindow) ]
]
14 changes: 14 additions & 0 deletions repository/OpenPonk-Core/StFileSystemItemWrapper.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Extension { #name : 'StFileSystemItemWrapper' }

{ #category : '*OpenPonk-Core' }
StFileSystemItemWrapper class >> roots [

self flag: 'Remove (let it be replaced by NewTools version) in Pharo 13'.
^ Smalltalk os isWindows
ifTrue: [
FileSystem root directories
select: [ :each | each exists and: [ each isReadable ] ]
thenCollect: [ :each | StRootDriveWrapper on: each ] ]
ifFalse: [
Array with: (StRootDirectoryWrapper on: FileSystem root) ]
]
13 changes: 0 additions & 13 deletions repository/OpenPonk-Core/StRootDriveWrapper.extension.st

This file was deleted.

26 changes: 16 additions & 10 deletions repository/OpenPonk-Spec/OPDynamicForm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ OPDynamicForm >> addControl: aControl [
{ #category : 'public - adding' }
OPDynamicForm >> addDroplist: aName [
| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self newDropList.

Expand All @@ -136,7 +136,7 @@ OPDynamicForm >> addDroplist: aName [
OPDynamicForm >> addEditableDroplist: aName [

| control |
self addLabel: aName.
self addHeadingLabel: aName.
control := self instantiate: OPEditableDropListPresenter.
self addControl: control.
^ control
Expand All @@ -145,20 +145,26 @@ OPDynamicForm >> addEditableDroplist: aName [
{ #category : 'public - adding' }
OPDynamicForm >> addEntity: aName [
| control |
self addLabel: aName.
self addHeadingLabel: aName.
control := self instantiate: SpSelectEntity.
self addControl: control.
^ control
]

{ #category : 'public - adding' }
OPDynamicForm >> addHeadingLabel: aLabel [

^ (self addLabel: aLabel)
displayBold: [ true ];
yourself
]

{ #category : 'public - adding' }
OPDynamicForm >> addLabel: aLabel [

| control |
control := self newLabel.
control label: aLabel.
"control addStyle: 'bold'."
self flag: 'implement bold'.

self addControl: control.
^ control
Expand All @@ -167,7 +173,7 @@ OPDynamicForm >> addLabel: aLabel [
{ #category : 'public - adding' }
OPDynamicForm >> addList: aName [
| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self newList.

Expand All @@ -179,7 +185,7 @@ OPDynamicForm >> addList: aName [
OPDynamicForm >> addLongText: aName [

| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self instantiate: OPLongTextPresenter.

Expand All @@ -191,7 +197,7 @@ OPDynamicForm >> addLongText: aName [
OPDynamicForm >> addNumberInput: aName [

| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self newNumberInput.

Expand All @@ -208,7 +214,7 @@ OPDynamicForm >> addSeparator [
OPDynamicForm >> addText: aName [

| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self newText.

Expand All @@ -220,7 +226,7 @@ OPDynamicForm >> addText: aName [
OPDynamicForm >> addTextInput: aName [

| control |
self addLabel: aName.
self addHeadingLabel: aName.

control := self newTextInput.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ OPDynamicFormMagritteVisitor >> visitBooleanDescription: aBooleanDescription [
{ #category : 'visiting' }
OPDynamicFormMagritteVisitor >> visitLabelDescription: aStringDescription [

form addLabel: aStringDescription label.
form addHeadingLabel: aStringDescription label.
form addLabel: (aStringDescription accessor read: controller)
]

Expand Down Expand Up @@ -102,7 +102,7 @@ OPDynamicFormMagritteVisitor >> visitMultipleOptionDescription: aMultipleOptionD
{ #category : 'visiting' }
OPDynamicFormMagritteVisitor >> visitPriorityContainer: aContainer [
(self shouldIncludeLabelFor: aContainer)
ifTrue: [ form addLabel: aContainer label ].
ifTrue: [ form addHeadingLabel: aContainer label ].
aContainer children do: [ :each | self visit: each ].
form addSeparator
]
Expand Down Expand Up @@ -154,6 +154,7 @@ OPDynamicFormMagritteVisitor >> visitStringDescription: aStringDescription [

{ #category : 'visiting' }
OPDynamicFormMagritteVisitor >> visitToManyRelationDescription: aMAToManyRelationDescription [
form addLabel: aMAToManyRelationDescription label.

form addHeadingLabel: aMAToManyRelationDescription label.
(form addButton: 'Edit ') action: [ controller maEdit ]
]

0 comments on commit 7a78f84

Please sign in to comment.