From da91cb4eb9a39d92bf351c22d03aa58f66f52ec4 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 17 Feb 2016 11:48:57 +0000 Subject: [PATCH] First minimalist configuration of the project to ease installation for upcoming data week and beyond :-) --- repository/Grafoscopio/DynamicDict.class.st | 107 ---------- .../Grafoscopio/GrafoscopioBrowser.class.st | 29 +-- .../Grafoscopio/GrafoscopioGUI.class.st | 197 ++---------------- .../Grafoscopio/GrafoscopioNode.class.st | 17 +- 4 files changed, 29 insertions(+), 321 deletions(-) delete mode 100644 repository/Grafoscopio/DynamicDict.class.st diff --git a/repository/Grafoscopio/DynamicDict.class.st b/repository/Grafoscopio/DynamicDict.class.st deleted file mode 100644 index a43ecda..0000000 --- a/repository/Grafoscopio/DynamicDict.class.st +++ /dev/null @@ -1,107 +0,0 @@ -" -I'm just a way to explore Spec and its documentation for learning purposes. -" -Class { - #name : #DynamicDict, - #superclass : #ComposableModel, - #instVars : [ - 'list', - 'content' - ], - #category : #'Grafoscopio-UI' -} - -{ #category : #'as yet unclassified' } -DynamicDict class >> defaultSpec [ - - - ^ SpecLayout composed - newRow: [:row | - row - add: #list right: 0.7; - add: #content left: 0.3]; - yourself -] - -{ #category : #accessing } -DynamicDict >> content [ - ^ content -] - -{ #category : #accessing } -DynamicDict >> content: anObject [ - content := anObject -] - -{ #category : #'as yet unclassified' } -DynamicDict >> initializePresenter [ - list whenSelectedItemChanged: [:item | - item = 'first' - ifTrue: [ self rebuildWithTextLayout ]. - item = 'second' - ifTrue: [ self rebuildWithCodeLayout ]. - ] -] - -{ #category : #initialization } -DynamicDict >> initializeWidgets [ - - | data | - data := { 'first' -> 'I\"m just text' . 'second' -> 'ProfStef openPharoZenWorkspace'} asOrderedDictionary. - list := self newList. - list items: data keys. - content := self newText. - self focusOrder - add: list; - add: content. -] - -{ #category : #accessing } -DynamicDict >> list [ - ^ list -] - -{ #category : #accessing } -DynamicDict >> list: anObject [ - list := anObject -] - -{ #category : #'as yet unclassified' } -DynamicDict >> rebuildWithCodeLayout [ - | newLayout | - - content := self instantiate: (GlamourPresentationModel). - newLayout := SpecLayout composed - newRow: [:row | - row - add: #list right: 0.7; - add: #content left: 0.3]; - yourself. - self needRebuild: false. - content needRebuild: true. - Transcript show: 'código + ', self content asString, String cr. - self buildWithSpecLayout: newLayout. -] - -{ #category : #'as yet unclassified' } -DynamicDict >> rebuildWithTextLayout [ - | newLayout | - - content := self newText. - newLayout := SpecLayout composed - newRow: [:row | - row - add: #list right: 0.7; - add: #content left: 0.3]; - yourself. - self needRebuild: false. - list needRebuild: false. - content needRebuild: true. - Transcript show: 'texto + ', self content asString, String cr.. - self buildWithSpecLayout: newLayout. -] - -{ #category : #api } -DynamicDict >> title [ - ^'Dynamic UI | test' -] diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 39ff482..2dcf1a0 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -89,35 +89,18 @@ GrafoscopioBrowser class >> messageAbout [ "Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web" UIManager default alert: - '_.:| Grafoscopio |:._', + 'Grafosocpio', (String with: Character cr), - '(c) Copyright 2014-2016 by Offray Vladimir Luna Cárdenas', + '(c) Copyright 2014 by Offray Vladimir Luna Cárdenas', (String with: Character cr), 'Covered under MIT license.', (String with: Character cr), (String with: Character cr), - '[ Sponsors ]', + 'SPONSORS:', (String with: Character cr), 'mutabiT | www.mutabit.com ', (String with: Character cr), - 'HiTec Lab, Fundación Universitaria Los Libertadores | www.ulibertadores.edu.co ', - (String with: Character cr), - (String with: Character cr), - '[ Thanks to ]', - (String with: Character cr), - 'HackBo, Hackerspace Bogota | http://hackbo.co', - (String with: Character cr), - '// Regular workshops attendees \\ - Rafael Medida, Iván Pulido, Camilo Hurtado', - (String with: Character cr), - '// Coffe talk (mostly about grafoscopio) \\ - Yanneth Gil, Andrés Calderón, Luis Alejandro Bernal', - (String with: Character cr), - '// Pharo, Moose and Agile Visualization communities \\ - Tudor Girba, Alexandre Bergel, Nicolai Hess, Peter Uhnák, Milton Mamani ', - (String with: Character cr), - '// Family support while writing, coding & travelling (among others!) \\ - Divian Luna, Hilda Cárdenas', + 'Fundación Universitaria Los Libertadores | www.ulibertadores.edu.co ', (String with: Character cr), (String with: Character cr), 'For further details and versions go to:', @@ -639,8 +622,8 @@ GrafoscopioBrowser >> bodyIn: constructor [ { #category : #'graphical interface' } GrafoscopioBrowser >> bodyIn: constructor for: aNode [ - "Shows the body in a constructor for selected node, if node is not tagged. - If it is tagged it will return itself, so it can be rendered properly for other messages" + "Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered + properly for other messages" | specialTags | diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index b8c8519..c3bcb22 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -8,12 +8,12 @@ My main responsability is to provide grafoscopio with graphical widgets and othe " Class { #name : #GrafoscopioGUI, - #superclass : #DynamicComposableModel, + #superclass : #ComposableModel, #instVars : [ 'windowMainMenu', 'tree', 'nodeHeader', - 'nodeBody', + 'nodeDetails', 'headerRefreshProcess', 'selected' ], @@ -40,158 +40,12 @@ GrafoscopioGUI class >> defaultSpec [ ] right: 0.7; addSplitter; newColumn: [ :nodePart | - nodePart add: #nodeBody] left: 0.3. + nodePart add: #nodeDetails] left: 0.3. ]. ]; yourself ] -{ #category : #examples } -GrafoscopioGUI class >> exampleBootstrapDynamicUI1 [ - "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio - UI and get some ideas" - - |notebook leftUpperPanel leftPanel treeBrowser | - - "Creating a notebook-tree with dummy data" - notebook := GrafoscopioNode new becomeDefaultTestTree. - - "Defining the tree roots part" - leftUpperPanel := DynamicComposableModel new. - leftUpperPanel instantiateModels: #(tree TreeModel). - leftUpperPanel tree - roots: notebook children; - childrenBlock: [:node | node children ]; - displayBlock: [:node | node title ]. - leftUpperPanel layout: (SpecLayout composed - add: #tree; - yourself). - "to debug upto here uncomment the next line, and comment all other 'openWithSpec' ones" - "leftUpperPanel openWithSpec." - - "Integrating the previous tree with the node header and creating the body according to - the tags on the node" - leftPanel := DynamicComposableModel new. - leftPanel assign: leftUpperPanel to: #roots. - leftPanel instantiateModels: #(header TextInputFieldModel). - treeBrowser := DynamicComposableModel new. - leftUpperPanel tree - whenSelectedItemChanged: [:node | - node - ifNil:[ - leftPanel header text: ''. - treeBrowser instantiateModels: #(body TextModel). - Transcript show: 'Nada que mostrar', String cr] - ifNotNil: [ - leftPanel header text: (leftUpperPanel tree selectedItem content header). - leftUpperPanel tree selectedItem content tags = 'código' - ifTrue: [ - treeBrowser instantiateModels: #(body GlamourPresentationModel). - Transcript show: 'I am code', String cr. - Transcript show: treeBrowser body asString, String cr. - ] - ifFalse: [ - treeBrowser instantiateModels: #(body TextModel). - treeBrowser body text: (leftUpperPanel tree selectedItem content body). - Transcript show: 'I am NOT code', String cr. - Transcript show: treeBrowser body asString, String cr. - ] - ] - ]. - leftPanel layout: - (SpecLayout composed - newColumn: [:column | - column - add: #roots; - add: #header height: 35]; - yourself). - - "Integrating the previous tree with node body content" - treeBrowser assign: leftPanel to: #leftTree. - treeBrowser layout: - (SpecLayout composed - newRow: [:r | r add: #leftTree; add: #body ]; - yourself - ). - treeBrowser openWithSpec. -] - -{ #category : #examples } -GrafoscopioGUI class >> exampleBootstrapDynamicUI2 [ - "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio - UI and get some ideas" - - |notebook leftUpperPanel leftPanel treeBrowser | - - "Creating a notebook-tree with dummy data" - notebook := GrafoscopioNode new becomeDefaultTestTree. - - "Defining the tree roots part" - leftUpperPanel := DynamicComposableModel new. - leftUpperPanel instantiateModels: #(tree TreeModel). - leftUpperPanel tree - roots: notebook children; - childrenBlock: [:node | node children ]; - displayBlock: [:node | node title ]. - leftUpperPanel layout: (SpecLayout composed - add: #tree; - yourself). - "to debug upto here uncomment the next line, and comment all other 'openWithSpec' ones" - "leftUpperPanel openWithSpec." - - "Integrating the previous tree with the node header and creating the body according to - the tags on the node" - leftPanel := DynamicComposableModel new. - leftPanel assign: leftUpperPanel to: #roots. - leftPanel instantiateModels: #(header TextInputFieldModel). - treeBrowser := DynamicComposableModel new. - leftUpperPanel tree - whenSelectedItemChanged: [:node | - node - ifNil:[ - leftPanel header text: ''. - treeBrowser instantiateModels: #(body TextModel). - Transcript show: 'Nada que mostrar', String cr] - ifNotNil: [ - leftPanel header text: (leftUpperPanel tree selectedItem content header). - leftUpperPanel tree selectedItem content tags = 'código' - ifTrue: [ - treeBrowser instantiateModels: #(body GlamourPresentationModel). - treeBrowser assign: leftPanel to: #leftTree. - treeBrowser layout: - (SpecLayout composed - newRow: [:r | r add: #leftTree; add: #body ]; - yourself - ). - Transcript show: 'I am code', String cr. - Transcript show: treeBrowser body asString, String cr. - ] - ifFalse: [ - treeBrowser instantiateModels: #(body TextModel). - treeBrowser body text: (leftUpperPanel tree selectedItem content body). - treeBrowser assign: leftPanel to: #leftTree. - treeBrowser layout: - (SpecLayout composed - newRow: [:r | r add: #leftTree; add: #body ]; - yourself - ). - Transcript show: 'I am NOT code', String cr. - Transcript show: treeBrowser body asString, String cr. - ] - ] - ]. - leftPanel layout: - (SpecLayout composed - newColumn: [:column | - column - add: #roots; - add: #header height: 35]; - yourself). - - "Integrating the previous tree with node body content" - treeBrowser openWithSpec. -] - { #category : #examples } GrafoscopioGUI class >> exampleBootstrapUI [ "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio @@ -203,9 +57,8 @@ GrafoscopioGUI class >> exampleBootstrapUI [ ui title: 'new | Grafoscopio'. ui instantiateModels: #( tree TreeModel - header TextInputFieldModel - bodyWhenMarkup TextModel - bodyWhenCode GlamourPresentationModel). + header TextModel + play GlamourPresentationModel). notebook := GrafoscopioNode new becomeDefaultTestTree. ui tree roots: notebook children; @@ -221,7 +74,7 @@ GrafoscopioGUI class >> exampleBootstrapUI [ addHSplitter; newRow: #header bottom: 0.8] right: 0.7; addVSplitter; - newColumn: #bodyWhenCode]; + newColumn: #play]; yourself. ui openWithSpecLayout: lay. @@ -247,26 +100,23 @@ GrafoscopioGUI >> initializeWidgets [ windowMainMenu := self windowMainMenu. tree := self tree. nodeHeader := self newTextInput. - nodeBody := - tree selectedItem - ifNotNil: [ self updateBody ] - ifNil: [nodeBody := self newText]. + nodeDetails := self newText. windowMainMenu applyTo: self. self focusOrder add: windowMainMenu; add: tree; add: nodeHeader; - add: nodeBody. + add: nodeDetails. ] { #category : #accessing } -GrafoscopioGUI >> nodeBody [ - ^ nodeBody +GrafoscopioGUI >> nodeDetails [ + ^ nodeDetails ] { #category : #accessing } -GrafoscopioGUI >> nodeBody: anObject [ - nodeBody := anObject +GrafoscopioGUI >> nodeDetails: anObject [ + nodeDetails := anObject ] { #category : #accessing } @@ -383,9 +233,8 @@ GrafoscopioGUI >> tree [ tree whenHighlightedItemChanged: [tree selectedItem notNil ifTrue: [ - self updateHeader. - self updateBody. - ] + Transcript show: tree selectedItem content header, String cr. + self updateHeader] ]. ^ tree ] @@ -395,25 +244,9 @@ 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 := self newText." - ^ nodeBody text: tree selectedItem content body - ] - - -] - { #category : #update } GrafoscopioGUI >> updateHeader [ - "update the displayed text associated to the header of a node" + "update the displayed text associated to the header" ^ nodeHeader text: tree selectedItem content header. diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index e0d63b7..3406ce3 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -146,19 +146,18 @@ GrafoscopioNode >> asSton [ { #category : #initialization } GrafoscopioNode >> becomeDefaultTestTree [ - | node1 node2 node3 | + | node1 node2 node3 | self level: 0. self header: 'Arbol principal'. - node1 := GrafoscopioNode new - header: 'Nodo 1'; + node1 := GrafoscopioNode + header: 'Nodo 1' body: 'Texto 1'. - node2 := GrafoscopioNode new - header: 'Nodo 2'; + node2 := GrafoscopioNode + header: 'Nodo 2' body: 'Texto 2'. - node3 := GrafoscopioNode new - header: 'Nodo 3'; - body: 'ProfStef openPharoZenWorkspace'; - tagAs: 'código'. + node3 := GrafoscopioNode + header: 'Nodo 3' + body: 'Texto 3'. self addNode: node1; addNode: node2.