GUI: Spec migration prototype with initial tree browsing working. Next issue: making interface react to node tags and show playground when tagged as code.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-01-07 20:40:22 +00:00
parent f54964c022
commit 373889f177
5 changed files with 250 additions and 131 deletions

View File

@ -15,17 +15,14 @@ Class {
'browser', 'browser',
'mainTree', 'mainTree',
'tagsAvailable', 'tagsAvailable',
'\r\t\t\t\t\t\t\t\t\tnonVar1',
'cacheNode', 'cacheNode',
'workingFile', 'workingFile',
'\r\t\t\t\t\t\t\t\t\tnonVar2',
'localRepository', 'localRepository',
'remoteRepository', 'remoteRepository',
'repositoryUser', 'repositoryUser',
'repositoryPassword' 'repositoryPassword'
], ],
#classVars : [ #classVars : [
'DefaultUbakyeBrowser',
'dockingBar', 'dockingBar',
'draftsLocation', 'draftsLocation',
'fossil', 'fossil',

View File

@ -12,7 +12,10 @@ Class {
#instVars : [ #instVars : [
'windowMainMenu', 'windowMainMenu',
'tree', 'tree',
'nodeDetails' 'nodeHeader',
'nodeBody',
'headerRefreshProcess',
'selected'
], ],
#category : #'Grafoscopio-UI' #category : #'Grafoscopio-UI'
} }
@ -30,17 +33,106 @@ GrafoscopioGUI class >> defaultSpec [
newRow: [:outlineView | newRow: [:outlineView |
outlineView outlineView
newColumn: [ :treePart | newColumn: [ :treePart |
treePart add: #tree]; treePart
newRow: [:tree | tree add: #tree];
addSplitter;
newRow: [:nodeHeader | nodeHeader add: #nodeHeader] height: 30
] right: 0.7;
addSplitter; addSplitter;
newColumn: [ :nodePart | newColumn: [ :nodePart |
nodePart add: #nodeDetails]. nodePart add: #nodeBody] left: 0.3.
]. ].
]; ];
yourself yourself
] ]
{ #category : #'as yet unclassified' } { #category : #examples }
GrafoscopioGUI >> documentSubMenu [ GrafoscopioGUI class >> exampleBootstrapUI [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas"
|ui lay notebook |
ui := DynamicComposableModel new.
ui title: 'new | Grafoscopio'.
ui instantiateModels: #(
tree TreeModel
header TextModel
play GlamourPresentationModel).
notebook := GrafoscopioNode new becomeDefaultTestTree.
ui tree
roots: notebook children;
childrenBlock: [:node | node children];
displayBlock: [:node | node title ].
lay := SpecLayout composed
newRow: [:row |
row
newColumn: [:column |
column
newRow: #tree top: 0.2;
addHSplitter;
newRow: #header bottom: 0.8] right: 0.7;
addVSplitter;
newColumn: #play];
yourself.
ui openWithSpecLayout: lay.
]
{ #category : #initialization }
GrafoscopioGUI >> initializePresenter [
tree.
nodeHeader acceptBlock: [ :text|
tree selectedItem
ifNotNil: [:x |
x content: text.
self updateTree
]
]
]
{ #category : #initialization }
GrafoscopioGUI >> initializeWidgets [
"Buils graphical interface elements"
windowMainMenu := self windowMainMenu.
tree := self tree.
nodeHeader := self newTextInput.
nodeBody := tree selectedItem notNil
ifTrue: [ self updateBody ]
ifFalse: [nodeBody := self newText].
windowMainMenu applyTo: self.
self focusOrder
add: windowMainMenu;
add: tree;
add: nodeHeader;
add: nodeBody.
]
{ #category : #accessing }
GrafoscopioGUI >> nodeBody [
^ nodeBody
]
{ #category : #accessing }
GrafoscopioGUI >> nodeBody: anObject [
nodeBody := anObject
]
{ #category : #accessing }
GrafoscopioGUI >> nodeHeader [
^ nodeHeader
]
{ #category : #accessing }
GrafoscopioGUI >> nodeHeader: anObject [
nodeHeader := anObject
]
{ #category : #'ui-building' }
GrafoscopioGUI >> notebookSubMenu [
^ MenuModel new ^ MenuModel new
addGroup: [ :group | addGroup: [ :group |
@ -78,18 +170,115 @@ GrafoscopioGUI >> documentSubMenu [
] ]
{ #category : #'as yet unclassified' } { #category : #'ui-building' }
GrafoscopioGUI >> initializeWidgets [ GrafoscopioGUI >> proyectSubMenu [
"Buils graphical interface elements" ^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Activar repositorio remoto...';
icon: Smalltalk ui icons smallPushpinIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Activar repositorio local...';
icon: Smalltalk ui icons homeIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Agregar archivo...';
icon: Smalltalk ui icons newerPackagesAvailableIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Eliminar archivo...';
icon: Smalltalk ui icons packageDeleteIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Enviar al histórico';
icon: Smalltalk ui icons smallScreenshotIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Acreditarse';
icon: Smalltalk ui icons userIcon;
action: [ self inform: 'Por implementar ...' ] ] ]
]
{ #category : #accessing }
GrafoscopioGUI >> selected [
^ selected value
]
{ #category : #accessing }
GrafoscopioGUI >> selected: aBoolean [
selected value: aBoolean
]
{ #category : #api }
GrafoscopioGUI >> title [
^ ' | Grafoscopio'
]
{ #category : #accessing }
GrafoscopioGUI >> tree [
| notebook |
notebook := GrafoscopioNode new becomeDefaultTestTree.
tree := TreeModel new.
tree
roots: notebook children;
childrenBlock: [:node | node children];
displayBlock: [:node | node title ].
tree whenHighlightedItemChanged:
[tree selectedItem notNil
ifTrue: [
self updateHeader.
self updateBody.
]
].
^ tree
]
{ #category : #accessing }
GrafoscopioGUI >> tree: anObject [
tree := anObject
]
{ #category : #update }
GrafoscopioGUI >> updateBody [
"update the displayed content associated to the body of a node"
(tree selectedItem content tags = 'código')
ifTrue: [
^ nodeBody text: 'I should be playground because I am tagged as ', tree selectedItem content tags
]
ifFalse: [
^ nodeBody text: tree selectedItem content body
]
]
{ #category : #update }
GrafoscopioGUI >> updateHeader [
"update the displayed text associated to the header of a node"
^ nodeHeader text: tree selectedItem content header.
]
{ #category : #accessing }
GrafoscopioGUI >> windowMainMenu [
windowMainMenu := MenuModel new windowMainMenu := MenuModel new
addGroup: [ :group | addGroup: [ :group |
group addItem: [ :item | group addItem: [ :item |
item item
name: 'Documento'; name: 'Cuaderno';
icon: Smalltalk ui icons smallObjectsIcon; icon: Smalltalk ui icons smallObjectsIcon;
subMenu: self documentSubMenu ]. subMenu: self notebookSubMenu ].
group addItem: [ :item | group addItem: [ :item |
item item
name: 'Proyecto'; name: 'Proyecto';
@ -176,80 +365,6 @@ GrafoscopioGUI >> initializeWidgets [
description: 'Editar etiquetas...'; description: 'Editar etiquetas...';
icon: FontAwesomeIcons new tagsIcon; icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'Por implementar...' ] ]. ]. action: [ self inform: 'Por implementar...' ] ]. ].
tree := self newTree.
nodeDetails := self newText.
windowMainMenu applyTo: self.
self focusOrder
add: windowMainMenu;
add: tree;
add: nodeDetails.
]
{ #category : #accessing }
GrafoscopioGUI >> nodeDetails [
^ nodeDetails
]
{ #category : #accessing }
GrafoscopioGUI >> nodeDetails: anObject [
nodeDetails := anObject
]
{ #category : #'as yet unclassified' }
GrafoscopioGUI >> proyectSubMenu [
^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Activar repositorio remoto...';
icon: Smalltalk ui icons smallPushpinIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Activar repositorio local...';
icon: Smalltalk ui icons homeIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Agregar archivo...';
icon: Smalltalk ui icons newerPackagesAvailableIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Eliminar archivo...';
icon: Smalltalk ui icons packageDeleteIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Enviar al histórico';
icon: Smalltalk ui icons smallScreenshotIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Acreditarse';
icon: Smalltalk ui icons userIcon;
action: [ self inform: 'Por implementar ...' ] ] ]
]
{ #category : #'as yet unclassified' }
GrafoscopioGUI >> title [
^ ' | Grafoscopio'
]
{ #category : #accessing }
GrafoscopioGUI >> tree [
^ tree
]
{ #category : #accessing }
GrafoscopioGUI >> tree: anObject [
tree := anObject
]
{ #category : #accessing }
GrafoscopioGUI >> windowMainMenu [
^ windowMainMenu ^ windowMainMenu
] ]

View File

@ -144,17 +144,45 @@ GrafoscopioNode >> asSton [
] ]
{ #category : #initialization }
GrafoscopioNode >> becomeDefaultTestTree [
| node1 node2 node3 |
self level: 0.
self header: 'Arbol principal'.
node1 := GrafoscopioNode new
header: 'Nodo 1';
body: 'Texto 1'.
node2 := GrafoscopioNode new
header: 'Nodo 2';
body: 'Texto 2'.
node3 := GrafoscopioNode new
header: 'Nodo 3';
body: 'ProfStef openPharoZenWorkspace';
tagAs: 'código'.
self
addNode: node1;
addNode: node2.
node2 addNode: node3.
]
{ #category : #initialization } { #category : #initialization }
GrafoscopioNode >> becomeDefaultTree [ GrafoscopioNode >> becomeDefaultTree [
| node1 | | node1 node2 node3 |
self level: 0. self level: 0.
self header: 'Arbol principal'. self header: 'Arbol principal'.
node1 := GrafoscopioNode node1 := GrafoscopioNode
header: 'Nodo 1' header: 'Nodo 1'
body: 'Texto 1'. body: 'Texto 1'.
node2 := GrafoscopioNode
header: 'Nodo 2'
body: 'Texto 2'.
node3 := GrafoscopioNode
header: 'Nodo 3'
body: 'Texto 3'.
self self
addNode: node1. addNode: node1;
addNode: node2.
node2 addNode: node3.
] ]
{ #category : #accessing } { #category : #accessing }
@ -234,6 +262,13 @@ GrafoscopioNode >> hasAncestorTaggedAs: aSpecialWord [
] ]
{ #category : #accessing }
GrafoscopioNode >> hasChildren [
(self children size > 0)
ifTrue: [ ^true ]
ifFalse: [ ^false ]
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNode >> header [ GrafoscopioNode >> header [
"Returns the receiver header" "Returns the receiver header"

View File

@ -1,41 +0,0 @@
"
Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:
I'm GrafoscopioTreeUI the Spec model wich reders grafoscopio trees.
For the Responsibility part: Three sentences about my main responsibility, what I'm doing, what services do I offer.
For the Collaborators Part: State my main collaborators and one line about how I interact with them.
Public API and Key Messages
- message one
- message two
- what is the way to create instances is a plus.
One simple example is simply gorgeous.
Internal Representation and Key Implementation Points.
Instance Variables
tree: <Object>
Implementation Points
"
Class {
#name : #GrafoscopioTreeUI,
#superclass : #ComposableModel,
#instVars : [
'tree'
],
#category : #'Grafoscopio-UI'
}
{ #category : #'as yet unclassified' }
GrafoscopioTreeUI >> initializeWidgets [
tree := self newTree
]

View File

@ -0,0 +1,13 @@
"
I store metadata for this package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : #ManifestGrafoscopio,
#superclass : #PackageManifest,
#category : #Grafoscopio
}
{ #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [
^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') )
]