Skip to content

Instantly share code, notes, and snippets.

@peteruhnak
Created November 24, 2017 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peteruhnak/5b7affccdc75706352d29cdd0005191e to your computer and use it in GitHub Desktop.
Save peteruhnak/5b7affccdc75706352d29cdd0005191e to your computer and use it in GitHub Desktop.
stereotypeText := BrRopedText string: '<<Metaclass>>'.
stereotypeText
attributes: { BrFontSizeAttribute size: 12 }
from: 1 to: stereotypeText size.
stereotype := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignCenter
];
text: stereotypeText.
nameText := BrRopedText string: 'Association'.
nameText
attributes: { BrFontSizeAttribute size: 16 }
from: 1 to: nameText size.
name := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignCenter
];
text: nameText.
comp1 := BlElement new
layout: BlLinearLayout vertical;
constraintsDo: [ :c |
c horizontal matchParent.
];
padding: (BlInsets all: 5);
addChildren: { stereotype. name };
background: Color red.
attribsCompNameText := BrRopedText string: 'attributes'.
attribsCompNameText
attributes: { BrFontSizeAttribute size: 12 }
from: 1 to: attribsCompNameText size.
attribsCompName := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignCenter
];
text: attribsCompNameText.
regularAttribute := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignLeft
];
text: (BrRopedText string: '/endType : Type[1..*] {readOnly}').
staticAttribute := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignLeft
];
text: (BrRopedText string: 'iShouldBeUnderlined : Boolean').
attribsComp := BlElement new
layout: BlLinearLayout vertical;
constraintsDo: [ :c |
c horizontal matchParent.
c vertical matchParent ];
addChildren: { attribsCompName. regularAttribute. staticAttribute };
padding: (BlInsets all: 5);
background: Color purple muchLighter.
methodsCompNameText := BrRopedText string: 'methods'.
methodsCompNameText
attributes: { BrFontSizeAttribute size: 12 }
from: 1 to: methodsCompNameText size.
methodsCompName := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignCenter
];
text: methodsCompNameText.
text := BrRopedText string: 'abstractMethod()'.
text
attributes: { BrFontEmphasisAttribute italic }
from: 1 to: text size.
abstractMethod := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignLeft
];
text: text.
"
anotherMethod := BlTextElement new
constraintsDo: [ :c |
c linear horizontal alignLeft
];
text: (BrRopedText string: 'doThings()').
methodsComp addChild: anotherMethod at: 3.
"
methodsComp := BlElement new
layout: BlLinearLayout vertical;
constraintsDo: [ :c |
c horizontal matchParent.
c vertical matchParent ];
padding: (BlInsets all: 5);
addChildren: { methodsCompName. abstractMethod };
background: Color green.
el := BlElement new
layout: (BlGridLayout new columnCount: 1; cellSpacing: 1);
size: 200@300;
relocate: 200 @ 100;
background: Color black;
addChildren: {comp1. attribsComp. methodsComp}.
el.
"
BlElementSelection on: el.
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment