Starting node links: this will allow to store web and local bookmarks and load content in the web browser, reload shared playgrounds, preview images and so on. Interesting possibilities.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-12-19 12:50:07 +00:00 committed by SantiagoBragagnolo
parent cba173f6a7
commit b804779da6
2 changed files with 39 additions and 5 deletions

View File

@ -23,7 +23,8 @@ Class {
'node',
'level',
'nodesInPreorder',
'metadata'
'metadata',
'links'
],
#classInstVars : [
'clipboard'
@ -384,8 +385,7 @@ GrafoscopioNode >> header: anObject [
{ #category : #accessing }
GrafoscopioNode >> headers [
"Returns the headers of the receiver children"
"I returns the headers of the receiver children"
^ headers := self children collect: [:currentNode | currentNode header ]
]
@ -433,6 +433,12 @@ GrafoscopioNode >> key: aUniqueKey [
key := aUniqueKey
]
{ #category : #accessing }
GrafoscopioNode >> lastLink [
links ifNil: [ ^ '' ].
^ links last
]
{ #category : #accessing }
GrafoscopioNode >> level [
"Returns the level of the node. See the setter message for details"
@ -448,6 +454,17 @@ GrafoscopioNode >> level: anInteger [
level := anInteger
]
{ #category : #accessing }
GrafoscopioNode >> links [
"I model local or remote links that are associated to a particular node."
^ links ifNil: [ ^ links := OrderedCollection new ]
]
{ #category : #accessing }
GrafoscopioNode >> links: anObject [
links add: anObject
]
{ #category : #exporting }
GrafoscopioNode >> margin [
"I define the same margin of the page used for PDF exportations"

View File

@ -15,6 +15,7 @@ Class {
'tree',
'header',
'body',
'links',
'windowMainMenu',
'workingFile',
'notebook'
@ -43,7 +44,7 @@ GrafoscopioNotebook class >> defaultSpec [
] width: 300.
row newColumn: [ :bc |
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight.
bc add: #body ]]]
bc add: #body; add: #links height: self toolbarHeight ]]]
]
{ #category : #'editing nodes' }
@ -155,6 +156,9 @@ GrafoscopioNotebook >> initializePresenter [
(tree highlightedItem) content header: arg.
tree roots: tree roots.
self updateForSpecialHeader]].
links whenTextChanged: [ :arg |
(tree highlightedItem content links) = arg
ifFalse: [ (tree highlightedItem) content links: arg]]
]
{ #category : #initialization }
@ -164,6 +168,7 @@ GrafoscopioNotebook >> initializeWidgets [
body := self newText.
body disable.
body text: '<- Select a node'.
links := self newTextInput.
tree := TreeModel new.
tree
childrenBlock: [:node | node children];
@ -171,7 +176,18 @@ GrafoscopioNotebook >> initializeWidgets [
self focusOrder
add: tree;
add: header;
add: body.
add: body;
add: links.
]
{ #category : #accessing }
GrafoscopioNotebook >> links [
^ links
]
{ #category : #accessing }
GrafoscopioNotebook >> links: anObject [
links := anObject
]
{ #category : #'editing nodes' }
@ -575,6 +591,7 @@ GrafoscopioNotebook >> updateBodyFor: aNodeContainer [
header text: aNode header.
body := self instantiate: aNode specModelClass new.
body content: aNode body.
links text: aNode lastLink.
self autoSaveBodyOf: aNode.
self buildWithSpecLayout: self class defaultSpec
]