SLGuiRuntime.sleela
lib/gui/version-gual/SLGuiRuntime.sleela · 92 line(s) · sleela
<< lib/gui/version-gual/SLGuiRuntime.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLGuiRuntime — Path 2 of gui/INTEGRATION.md: SLeeLa owns
GUI intent and the host (Swing/JavaFX) supplies the desktop controls.
Mirrors SleelaGuiRuntime: window(title,w,h), text(...), action(name,op),
and the listen(...) document-change option that refreshes the running
window directly on an OS call. >>
#sleela 2.5
material;
< SLeeLa gui front-end contract — Path 2 (SLeeLa intent -> Java GUI). >
< Family: gui. The .sleela Wrapper describes the UI behavior; Java/native is a >
< presentation/runtime substrate. >
class SLGuiRuntime {
< ---- 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 = 11250;
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-16";
< 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; }
SLGuiWindow window;
SLGuiDocumentListener listener;
< 1 when the listen option is enabled >
int listening;
void configure(SLGuiWindow w) {
window = w; listening = 0;
}
< Open/describe the window at the requested size. >
void openWindow(String title, int width, int height) {
window.configure(title, width, height);
window.show();
}
< Publish text to the running window. >
void text(String value) { window.setText(value); }
< Enable the document-change listener option over 1..14 documents; the >
< listener refreshes the running window directly when a document changes. >
boolean listen(SLGuiDocumentListener l) {
listener = l;
if (!listener.watch()) { listening = 0; return false; }
listening = 1;
return true;
}
boolean isListening() { return listening == 1 && listener != null && listener.isRunning(); }
< An OS call reports `realChanges`; refresh the window for the change. >
int onDocumentChange(String documentId, String revision, int realChanges) {
if (!isListening()) { return 0; }
int emitted = listener.onOsCall(realChanges);
if (emitted > 0) { window.refresh(documentId, revision); }
return emitted;
}
int refreshNow(int realChanges) {
if (listener == null) { return 0; }
return listener.refreshNow(realChanges);
}
void stopListening() { if (listener != null) { listener.close(); } listening = 0; }
void close() { stopListening(); }
}