Skip to content

Commit

Permalink
tinkering to create a Demo UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingmar Vogel committed May 28, 2024
1 parent 821d718 commit 9d54f32
Show file tree
Hide file tree
Showing 117 changed files with 854 additions and 25 deletions.
5 changes: 5 additions & 0 deletions packages/Liquid-Core.package/LQUIDemoPoll.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
A specific type of LQQuestion for Single- and Multiple-Choice-Questions. A LQChoicesQuestion contains a number of choices as well as the maximum number of choices one participant can choose when answering the question.

Notable Instance Variables:
- choiceList: An OrderedCollection of Strings containing the Choices participants are presented.
- maxNumberOfChoices: A Number between 1 and choiceList size.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
modifying
addChoice: aChoice

self choiceList add: aChoice
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
converting
asString
self title
ifNil: [^ 'Untitled Poll'].
^ self title
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialize-release
buildEmptyAnswer

^ LQChoicesAnswer new
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
choiceDescriptions

^ self choiceList collect: [:choice | choice description]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
choiceList: aListOfChoices

choiceList := aListOfChoices
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
choiceList

^ choiceList
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
id: aString

id := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
id

^ id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialize-release
initialize

super initialize.
self id: UUID new asString.
self choiceList: OrderedCollection new.
self maxNumberOfChoices: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isVotedChoice: votedChoice ValidFrom: aUser

^ self choiceList noneSatisfy: [:choice | (choice description = votedChoice) and: [choice excludesGroup: aUser group]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
maxNumberOfChoices: aNumber

maxNumberOfChoices := aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
maxNumberOfChoices

^ maxNumberOfChoices
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
title: aString

title := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
title

^ title
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
toolTip

^ 'Select multiple answers - In the bottom left you can find the number of choices left!'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
type

^ 'choices'
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"class" : {
},
"instance" : {
"addChoice:" : "bwe 6/5/2022 22:20",
"asString" : "Ingmar Vogel 5/28/2024 12:05",
"buildEmptyAnswer" : "CG 7/30/2021 19:06",
"choiceDescriptions" : "kge 8/1/2022 18:51",
"choiceList" : "JT 8/2/2022 17:01",
"choiceList:" : "CG 7/30/2021 19:06",
"id" : "JT 8/2/2022 17:01",
"id:" : "JT 8/2/2022 17:01",
"initialize" : "kge 8/1/2022 18:51",
"isVotedChoice:ValidFrom:" : "ms 8/4/2022 21:31",
"maxNumberOfChoices" : "CG 7/30/2021 19:06",
"maxNumberOfChoices:" : "CG 7/30/2021 19:06",
"title" : "JT 8/2/2022 17:02",
"title:" : "JT 8/2/2022 17:02",
"toolTip" : "bn 5/12/2022 22:11",
"type" : "CG 7/30/2021 19:06" } }
17 changes: 17 additions & 0 deletions packages/Liquid-Core.package/LQUIDemoPoll.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"category" : "Liquid-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
"id",
"title",
"maxNumberOfChoices",
"choiceList" ],
"name" : "LQUIDemoPoll",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
2 changes: 2 additions & 0 deletions packages/Liquid-UI.package/LQDemoAssets.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UI-Component responsible for biulding single questions.
Is part of a LQPollDraftBuilder.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
toolbuilder
buildChoicesInputWith: aBuilder
^ aBuilder pluggableTextSpec new model: self;
getText: #choiceDescriptions;
editText: #choiceList:;
help: 'A visualization of the current results of the selected poll.';
indicateUnacceptedChanges: false;

frame: (LayoutFrame
fractions: (0 @ 0.1 extent: 1 @ 0.8)
offsets: (0 @ 0 extent: 0 @ 0));
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
toolbuilder
buildTitleInputWith: aBuilder
^ aBuilder pluggableTextSpec new model: self;
getText: #title;
editText: #title:;
help: 'Poll ID';
indicateUnacceptedChanges: false;

frame: (LayoutFrame
fractions: (0 @ 0 extent: 1 @ 0.1)
offsets: (0 @ 0 extent: 0 @ 0));
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
toolbuilder
buildWith: aBuilder
^ aBuilder build: (aBuilder pluggablePanelSpec new model: self;
children: {self buildTitleInputWith: aBuilder. self buildChoicesInputWith: aBuilder};
yourself)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
choiceDescriptions

^ LQDuplicateDetector new markDuplicatesIn: self question choiceList
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
choiceList: aText

self question choiceList: (((self orderedLinesFor: aText)
select: [:value | (value withBlanksTrimmed = '') not])
collect: [:value | LQChoice newFrom: value]).
self changed: #choiceDescriptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
text-processing
determineMaxNumberOfChoicesFrom: aText

^ (1 max: (aText asNumber min: self question choiceDescriptions size))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
text-processing
isTextNumber: aText

^ aText asString isAllDigits
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
accessing
maxNumberOfChoices: aText

((self isTextNumber: aText) and: [aText notEmpty])
ifTrue: [self question maxNumberOfChoices: (self determineMaxNumberOfChoicesFrom: aText)]
ifFalse: [aText isEmpty ifTrue: [self question maxNumberOfChoices: nil]].
self changed: #maxNumberOfChoices
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
maxNumberOfChoices

self question maxNumberOfChoices ifNil: [^ ''].
^ self question maxNumberOfChoices asString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
text-processing
orderedLinesFor: aText

^ aText asString lines asOrderedCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
question: aQuestion

question := aQuestion
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
question
^ question
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
title: aText

self question title: aText asString.
self changed: #title
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
title
^ self question title
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"class" : {
},
"instance" : {
"buildChoicesInputWith:" : "Ingmar Vogel 5/28/2024 11:50",
"buildTitleInputWith:" : "Ingmar Vogel 5/28/2024 11:49",
"buildWith:" : "Ingmar Vogel 5/28/2024 11:49",
"choiceDescriptions" : "bn 8/2/2022 16:59",
"choiceList:" : "kge 8/3/2022 22:31",
"determineMaxNumberOfChoicesFrom:" : "kge 8/4/2022 10:28",
"isTextNumber:" : "kge 8/4/2022 10:30",
"maxNumberOfChoices" : "bn 6/2/2022 22:04",
"maxNumberOfChoices:" : "kge 8/4/2022 10:31",
"orderedLinesFor:" : "kge 8/3/2022 22:31",
"question" : "Ingmar Vogel 5/28/2024 11:59",
"question:" : "bn 6/23/2022 21:45",
"title" : "Ingmar Vogel 5/28/2024 11:59",
"title:" : "bn 6/23/2022 21:47" } }
14 changes: 14 additions & 0 deletions packages/Liquid-UI.package/LQDemoAssets.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Liquid-UI",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
"question" ],
"name" : "LQDemoAssets",
"pools" : [
],
"super" : "LQModel",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
toolbuilder
buildStopServerButtonWith: aBuilder

^ aBuilder pluggableButtonSpec new
model: self;
label: 'Stop Liquid Server';
help: 'Stops the liquid server which allows access to your local polls.';
action: #stopServer;
frame: (LayoutFrame new
topFraction: 0.35;
bottomFraction: 0.65;
leftFraction: 0.35;
rightFraction: 0.65;
yourself);
yourself
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildWith: aBuilder
label: 'Liquid - Host';
extent: self extent;
children: {
self buildUserSetButtonWith: aBuilder.
self buildStopServerButtonWith: aBuilder.
self buildPollInteractionButtonWith: aBuilder.
self buildShowResultsButtonWith: aBuilder.
self buildCreatePollButtonWith: aBuilder.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
modifying
stopServer

LQRemotePollRepoServer startServer.
UIManager default inform: 'Stopped Liquid-Server'
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"buildCreatePollButtonWith:" : "bn 8/2/2022 16:52",
"buildPollInteractionButtonWith:" : "NM 7/30/2021 19:42",
"buildShowResultsButtonWith:" : "JT 5/19/2022 22:11",
"buildUserSetButtonWith:" : "ape 6/15/2022 17:24",
"buildStopServerButtonWith:" : "Ingmar Vogel 5/24/2024 16:41",
"buildVisualizeResultsButtonWith:" : "JT 8/5/2022 18:28",
"buildWith:" : "ms 8/4/2022 10:55",
"buildWith:" : "Ingmar Vogel 5/24/2024 16:42",
"closePoll" : "JT 8/5/2022 18:29",
"createPoll" : "bn 8/2/2022 18:05",
"extent" : "ms 8/4/2022 10:55",
"openUserSetMenu" : "bn 8/2/2022 16:52",
"showResults" : "JT 8/5/2022 18:29",
"stopServer" : "Ingmar Vogel 5/24/2024 16:42",
"visualizeResults" : "JT 8/5/2022 18:29" } }
2 changes: 2 additions & 0 deletions packages/Liquid-UI.package/LQHostMenuDemo.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UI-Component to create new polls.
Encapsulates instances of LQQueastionBuilder which are responsible for creating the questions in the poll.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
instance creation
newWithTitle: aString

| newPollDraftBuilder |
newPollDraftBuilder := self new.
newPollDraftBuilder pollDraft title: aString.
^ newPollDraftBuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toolbuilder
addManageUserSetsFrame

^ self
frame: 1
fromTop: 0.85
fromLeft: 0
width: 0.25
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
modifying
addQuestion
| question builder |
question := LQUIDemoPoll new.
builder := LQDemoAssets new.
builder question: question.
self pollDraft addQuestion: question.
self addQuestionBuilder: builder.
self setIndex: self questionBuilders size.
self changed: #list
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
addQuestionBuilder: aQuestionBuilder

self questionBuilders add: aQuestionBuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toolbuilder
addQuestionButtonFrame

^ self
frame: 0.925
fromTop: 0.85
fromLeft: 0.25
width: 0.50
Loading

0 comments on commit 9d54f32

Please sign in to comment.