SLLoadingDemo.sleela
lib/user-interface/SLLoadingDemo.sleela · 112 line(s) · sleela
<< lib/user-interface/SLLoadingDemo.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLLoadingDemo — a worked, runnable example that builds a
Slick Black window from pure SLeeLa source showing the activity family: a
flowing SLThrobber, an arc SLSpinner, a determinate SLProgressBar, and the
unified SLLoadingIndicator stepping from an indeterminate "Resolving…"
phase into a determinate "Compiling… NN%" phase and finally done(). It is
the SLeeLa-source twin of the gallery, proving the loading indicators are
fully usable from the language itself.
Family: user-interface. Native VM/UI work crosses the explicit `ui*` SLVM
bridge. >>
#sleela 2.5
material;
class SLLoadingDemo {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 11072;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-13";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
SLUserInterface ui;
SLWindow win;
SLLoadingIndicator loader;
int run() {
ui = new SLUserInterface();
ui.configure("com.mearvk.SleelaUI.Loading");
< headless: no display >
if (!ui.open()) { return 1; }
SLTheme theme = new SLTheme();
theme.slickBlack();
win = ui.openWindow("SleelaUI Loading Indicators - MEARVK LLC", 520, 300,
theme.handle());
SLWidget root = win.rootWidget();
SLBox content = new SLBox();
content.vertical(root, 16);
content.setMarginAll(20);
content.setExpand(true, true);
< The three primitives, each on its own row. >
SLLabel t1 = new SLLabel(); t1.createIn(content, "Throbber (flowing field):");
SLThrobber throb = new SLThrobber();
throb.createIn(content, 200);
throb.setSizeRequest(0, 8);
throb.setIntensity(0.7);
throb.setHue(150.0);
SLLabel t2 = new SLLabel(); t2.createIn(content, "Spinner (accent arc):");
SLSpinner spin = new SLSpinner();
spin.createIn(content);
SLLabel t3 = new SLLabel(); t3.createIn(content, "Progress bar (determinate):");
SLProgressBar bar = new SLProgressBar();
bar.createIn(content, 0.35);
bar.setExpand(true, false);
SLSeparator rule = new SLSeparator();
rule.horizontal(content);
< The unified loading indicator: starts indeterminate, then determinate. >
loader = new SLLoadingIndicator();
loader.createIn(content, SLLoadingIndicator.STYLE_THROBBER, 160);
loader.beginIndeterminate("Resolving library...");
< (A host would later call these as work proceeds:) >
loader.beginDeterminate("Compiling", 0.0);
< caption becomes "Compiling 60%" >
loader.setFraction(0.6);
loader.done("Build succeeded");
win.show();
return ui.run();
}
}