New GUI: Adding and removing nodes done. Next: Moving nodes up/down and promote/demote.
This commit is contained in:
parent
5d153256fd
commit
7e4dd89d94
@ -560,7 +560,7 @@ GrafoscopioBrowser >> treeOn: constructor [
|
|||||||
"Adding nodes"
|
"Adding nodes"
|
||||||
act: [:treePresentation |
|
act: [:treePresentation |
|
||||||
(treePresentation selection) isNotNil
|
(treePresentation selection) isNotNil
|
||||||
ifTrue: [treePresentation selection addNodeAfter].
|
ifTrue: [treePresentation selection addNodeAfterMe].
|
||||||
treePresentation update]
|
treePresentation update]
|
||||||
icon: GLMUIThemeExtraIcons glamorousZoomIn
|
icon: GLMUIThemeExtraIcons glamorousZoomIn
|
||||||
entitled: 'Adicionar nodo';
|
entitled: 'Adicionar nodo';
|
||||||
|
@ -613,7 +613,7 @@ GrafoscopioGUI class >> updateGrafoscopio [
|
|||||||
Gofer new
|
Gofer new
|
||||||
smalltalkhubUser: 'Offray' project: 'Grafoscopio';
|
smalltalkhubUser: 'Offray' project: 'Grafoscopio';
|
||||||
package: 'Grafoscopio';
|
package: 'Grafoscopio';
|
||||||
load.
|
loadVersion: #development.
|
||||||
self updateUI.
|
self updateUI.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ GrafoscopioNode >> addNode: aNode [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'add/remove nodes' }
|
{ #category : #'add/remove nodes' }
|
||||||
GrafoscopioNode >> addNodeAfter [
|
GrafoscopioNode >> addNodeAfterMe [
|
||||||
"Adds a generic node after the given node so they become slibings of the same parent"
|
"Adds a generic node after the given node so they become slibings of the same parent"
|
||||||
| genericNode |
|
| genericNode |
|
||||||
genericNode := GrafoscopioNode
|
genericNode := GrafoscopioNode
|
||||||
header: 'nuevoNodo' body: ''.
|
header: 'newNode' body: ''.
|
||||||
self parent children add: genericNode after: self.
|
self parent children add: genericNode after: self.
|
||||||
genericNode parent: self parent.
|
genericNode parent: self parent.
|
||||||
genericNode level: self level.
|
genericNode level: self level.
|
||||||
@ -578,9 +578,6 @@ GrafoscopioNode >> removeLastNode [
|
|||||||
|
|
||||||
{ #category : #'add/remove nodes' }
|
{ #category : #'add/remove nodes' }
|
||||||
GrafoscopioNode >> removeNode: aNode [
|
GrafoscopioNode >> removeNode: aNode [
|
||||||
"Adds the given node to the receivers collection of children, and sets this object as the parent
|
|
||||||
of the node"
|
|
||||||
|
|
||||||
self children remove: aNode.
|
self children remove: aNode.
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -48,7 +48,10 @@ GrafoscopioNotebook class >> defaultSpec [
|
|||||||
|
|
||||||
{ #category : #operation }
|
{ #category : #operation }
|
||||||
GrafoscopioNotebook >> addNode [
|
GrafoscopioNotebook >> addNode [
|
||||||
|
tree needRebuild: true.
|
||||||
|
tree selectedItem content addNodeAfterMe.
|
||||||
|
tree roots: tree roots.
|
||||||
|
self buildWithSpecLayout: self class defaultSpec.
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
@ -73,7 +76,7 @@ GrafoscopioNotebook >> changeBody: aNodeCollection [
|
|||||||
body := self instantiate: node specModelClass new.
|
body := self instantiate: node specModelClass new.
|
||||||
body content: node content.
|
body content: node content.
|
||||||
body needRebuild: true.
|
body needRebuild: true.
|
||||||
|
body body whenTextChanged: [ :arg | node body: arg ].
|
||||||
header text: node header.
|
header text: node header.
|
||||||
|
|
||||||
self buildWithSpecLayout: self class defaultSpec.
|
self buildWithSpecLayout: self class defaultSpec.
|
||||||
@ -112,15 +115,15 @@ GrafoscopioNotebook >> header: anObject [
|
|||||||
GrafoscopioNotebook >> initializePresenter [
|
GrafoscopioNotebook >> initializePresenter [
|
||||||
|
|
||||||
tree whenSelectedItemsChanged: [ :arg |
|
tree whenSelectedItemsChanged: [ :arg |
|
||||||
arg isEmpty ifFalse: [self changeBody: arg ]].
|
arg isEmpty ifFalse: [self changeBody: arg ]].
|
||||||
|
|
||||||
header whenTextChanged: [ :arg |
|
header whenTextChanged: [ :arg |
|
||||||
|
Transcript show: arg.
|
||||||
(tree selectedItem content header) = arg
|
(tree selectedItem content header) = arg
|
||||||
ifFalse: [
|
ifFalse: [
|
||||||
(tree selectedItem) content header: header text.
|
(tree selectedItem) content header: arg.
|
||||||
tree roots: tree roots]].
|
tree roots: tree roots]].
|
||||||
body whenTextChanged: [ :arg |
|
body whenTextChanged: [:arg |
|
||||||
(tree selectedItem) content body: body text
|
Transcript show: arg
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -129,15 +132,27 @@ GrafoscopioNotebook >> initializeWidgets [
|
|||||||
|
|
||||||
windowMainMenu := self newWindowMainMenu.
|
windowMainMenu := self newWindowMainMenu.
|
||||||
tree := TreeModel new.
|
tree := TreeModel new.
|
||||||
body := self newText.
|
|
||||||
|
|
||||||
header := self newTextInput.
|
header := self newTextInput.
|
||||||
|
body := self newText.
|
||||||
|
|
||||||
body disable.
|
body disable.
|
||||||
body text: '<-- Select a node in the left panel'.
|
body text: '<-- Select a node in the left panel'.
|
||||||
|
|
||||||
tree childrenBlock: [:node | node children];
|
tree
|
||||||
|
childrenBlock: [:node | node children];
|
||||||
displayBlock: [:node | node title ].
|
displayBlock: [:node | node title ].
|
||||||
|
self focusOrder
|
||||||
|
add: tree;
|
||||||
|
add: header;
|
||||||
|
add: body.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #operation }
|
||||||
|
GrafoscopioNotebook >> moveNodeBefore [
|
||||||
|
tree selectedItem content moveAfter.
|
||||||
|
tree needRebuild: true.
|
||||||
|
tree roots: tree roots.
|
||||||
|
self buildWithSpecLayout: self class defaultSpec.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
@ -404,6 +419,18 @@ GrafoscopioNotebook >> projectSubMenu [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #operation }
|
||||||
|
GrafoscopioNotebook >> removeNode [
|
||||||
|
| currentNode |
|
||||||
|
currentNode := tree selectedItem content.
|
||||||
|
currentNode parent removeNode: currentNode.
|
||||||
|
tree needRebuild: true.
|
||||||
|
tree roots: tree roots.
|
||||||
|
self buildWithSpecLayout: self class defaultSpec.
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #persistence }
|
{ #category : #persistence }
|
||||||
GrafoscopioNotebook >> saveToFile: aFileReference [
|
GrafoscopioNotebook >> saveToFile: aFileReference [
|
||||||
"I save the current tree/document to a file"
|
"I save the current tree/document to a file"
|
||||||
|
Loading…
Reference in New Issue
Block a user