125 lines
2.5 KiB
Smalltalk
125 lines
2.5 KiB
Smalltalk
"
|
|
Just an abstract node.
|
|
"
|
|
Class {
|
|
#name : #GrafoscopioAbstractNode,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'created',
|
|
'edited',
|
|
'tags',
|
|
'order',
|
|
'name'
|
|
],
|
|
#classInstVars : [
|
|
'clipboard'
|
|
],
|
|
#category : #'Grafoscopio-Model'
|
|
}
|
|
|
|
{ #category : #testing }
|
|
GrafoscopioAbstractNode class >> isAbstract [
|
|
^ self = GrafoscopioAbstractNode
|
|
]
|
|
|
|
{ #category : #testing }
|
|
GrafoscopioAbstractNode class >> isLeaf [
|
|
^ false
|
|
]
|
|
|
|
{ #category : #testing }
|
|
GrafoscopioAbstractNode class >> showInMenu [
|
|
^ false
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> addChild: aBlock ofClass: aClass [
|
|
self subclassResponsibility
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> addTag: aTag [
|
|
"Tags the recipient node with aTag (string). For the moment we will have only one tag.
|
|
In the future we will have several and there will be rules to know how tags interact with
|
|
each other"
|
|
self tags add: aTag
|
|
|
|
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> created [
|
|
|
|
^ created
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> created: aTimestamp [
|
|
"I tell when this object was created"
|
|
|
|
created := aTimestamp
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> edited [
|
|
^ edited
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> edited: aTimestamp [
|
|
"I store the last time when a node was edited.
|
|
Because nodes in the notebook have a autosave feature, I'm updated automatically when nodes are
|
|
edited from the GUI.
|
|
|
|
If I'm in the notebook root (i.e. node's level equals 0) I should store the last time the notebook
|
|
was saved on the hard drive."
|
|
edited := aTimestamp
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> initialize [
|
|
"I create a empty new node"
|
|
super initialize.
|
|
created := DateAndTime now.
|
|
edited := DateAndTime now
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> isLeaf [
|
|
^ self class isLeaf
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> name [
|
|
^ name
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> name: aName [
|
|
name := aName
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> tagAs: aTag [
|
|
self
|
|
error:
|
|
'tags are not used as markers anymore. Use addTag: instead and ensure you are not relying on text/codigo etc.'
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> tags [
|
|
"I returns the receiver tags."
|
|
|
|
^ tags ifNil: [ tags := Set new ]
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioAbstractNode >> tags: aCollection [
|
|
tags := aCollection
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioAbstractNode >> updateStamp [
|
|
self edited: DateAndTime now
|
|
]
|