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"
|
||||
act: [:treePresentation |
|
||||
(treePresentation selection) isNotNil
|
||||
ifTrue: [treePresentation selection addNodeAfter].
|
||||
ifTrue: [treePresentation selection addNodeAfterMe].
|
||||
treePresentation update]
|
||||
icon: GLMUIThemeExtraIcons glamorousZoomIn
|
||||
entitled: 'Adicionar nodo';
|
||||
|
@ -613,7 +613,7 @@ GrafoscopioGUI class >> updateGrafoscopio [
|
||||
Gofer new
|
||||
smalltalkhubUser: 'Offray' project: 'Grafoscopio';
|
||||
package: 'Grafoscopio';
|
||||
load.
|
||||
loadVersion: #development.
|
||||
self updateUI.
|
||||
]
|
||||
|
||||
|
@ -82,11 +82,11 @@ GrafoscopioNode >> addNode: aNode [
|
||||
]
|
||||
|
||||
{ #category : #'add/remove nodes' }
|
||||
GrafoscopioNode >> addNodeAfter [
|
||||
GrafoscopioNode >> addNodeAfterMe [
|
||||
"Adds a generic node after the given node so they become slibings of the same parent"
|
||||
| genericNode |
|
||||
genericNode := GrafoscopioNode
|
||||
header: 'nuevoNodo' body: ''.
|
||||
header: 'newNode' body: ''.
|
||||
self parent children add: genericNode after: self.
|
||||
genericNode parent: self parent.
|
||||
genericNode level: self level.
|
||||
@ -578,9 +578,6 @@ GrafoscopioNode >> removeLastNode [
|
||||
|
||||
{ #category : #'add/remove nodes' }
|
||||
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.
|
||||
|
||||
]
|
||||
|
@ -48,7 +48,10 @@ GrafoscopioNotebook class >> defaultSpec [
|
||||
|
||||
{ #category : #operation }
|
||||
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 content: node content.
|
||||
body needRebuild: true.
|
||||
|
||||
body body whenTextChanged: [ :arg | node body: arg ].
|
||||
header text: node header.
|
||||
|
||||
self buildWithSpecLayout: self class defaultSpec.
|
||||
@ -113,14 +116,14 @@ GrafoscopioNotebook >> initializePresenter [
|
||||
|
||||
tree whenSelectedItemsChanged: [ :arg |
|
||||
arg isEmpty ifFalse: [self changeBody: arg ]].
|
||||
|
||||
header whenTextChanged: [ :arg |
|
||||
Transcript show: arg.
|
||||
(tree selectedItem content header) = arg
|
||||
ifFalse: [
|
||||
(tree selectedItem) content header: header text.
|
||||
(tree selectedItem) content header: arg.
|
||||
tree roots: tree roots]].
|
||||
body whenTextChanged: [ :arg |
|
||||
(tree selectedItem) content body: body text
|
||||
body whenTextChanged: [:arg |
|
||||
Transcript show: arg
|
||||
]
|
||||
]
|
||||
|
||||
@ -129,15 +132,27 @@ GrafoscopioNotebook >> initializeWidgets [
|
||||
|
||||
windowMainMenu := self newWindowMainMenu.
|
||||
tree := TreeModel new.
|
||||
body := self newText.
|
||||
|
||||
header := self newTextInput.
|
||||
body := self newText.
|
||||
|
||||
body disable.
|
||||
body text: '<-- Select a node in the left panel'.
|
||||
|
||||
tree childrenBlock: [:node | node children];
|
||||
tree
|
||||
childrenBlock: [:node | node children];
|
||||
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 }
|
||||
@ -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 }
|
||||
GrafoscopioNotebook >> saveToFile: aFileReference [
|
||||
"I save the current tree/document to a file"
|
||||
|
Loading…
Reference in New Issue
Block a user