SunBurst
classin packageklyn.gui.windows.filesystem
public class SunBurst extends Canvas
└ Canvas
└ SunBurst

Displays a directory hierarchy as concentric rings weighted by file bytes. The center shows the current folder name and its recursive logical size. Each sector represents a subdirectory; space occupied by files directly in its parent remains blank in the next ring. Zero-byte subtrees have no sector in byte mode. When the entire current subtree is zero bytes, sectors instead use recursive entry counts (including one unit per directory). Siblings are ordered by decreasing recursive size counterclockwise from the top of their parent sector; zero-byte ties use entry counts, then names. Up to 64 main folder names are drawn tangentially when their measured width and estimated font height fit inside the sector, with padding at both arcs and side edges.

Hovering displays the full path, bytes, recursive file/folder counts and excluded entries. Click a sector to enter it; click the center or press Backspace to return within the scanned tree. F5 explicitly refreshes it. Symbolic links, Windows reparse points and special files are excluded. Hard links are counted per directory entry; sizes describe logical bytes rather than disk blocks.

background=true and loadFolder() scan on a worker thread, keeping the GUI responsive. A rotating center ring indicates loading; totals and sectors are partial until isLoading becomes false. Progress is published in bounded batches and coalesced approximately every 240 ms. Intermediate reads accumulate data, never queued graphical snapshots: each refresh lays out only the latest accumulated state available on the GUI thread. There is no percentage of completion because the number of entries is unknown until traversal finishes. setFolder() remains synchronous for callers needing immediate statistics. Scanning is iterative, with O(entries) filesystem work and O(directories) retained metadata, plus a bounded publication queue. Windows enumeration supplies sizes without separate per-file queries; POSIX reads type and size together once per entry. Geometry is cached until bounds, zoom, progress or selection change. Hover uses a binary search in one ring and performs no I/O. Sibling sorting costs O(children * log(children)) for visible dirty parents; unchanged and invisible sibling lists are not repeatedly sorted. Subpixel sectors are omitted from drawing and hit testing, retaining their statistics. Text measurements and label placement are cached until geometry or font changes. Descendants beyond maxDepth still contribute to all subtree statistics.

import klyn.gui.windows.filesystem
import klyn.io

chart = SunBurst(Path.cwd, background=true)
chart.maxDepth = 6
Properties
Modifier and Type Member Description
public readonly property currentFolder
currentFolder as FolderPath
Directory currently displayed at the center of the chart.
public readonly property fileCount
fileCount as ULong
Number of regular file entries in the current subtree, partial while loading.
public readonly property folderCount
folderCount as ULong
Number of discovered descendant directories, excluding the current directory.
public readonly property isLoading
isLoading as Boolean
True while a background scan or its pending publications remain active.
public readonly property loadError
loadError as String
Last background failure; empty for successful or newly started loads.
public property maxDepth
maxDepth as Int
Maximum visible directory depth; must be positive.
public readonly property skippedCount
skippedCount as ULong
Number of excluded links, special files or vanished entries.
public readonly property totalSize
totalSize as ULong
Recursive logical file size in bytes, excluding symbolic links.
public readonly property unreadableCount
unreadableCount as ULong
Number of subtree directories whose enumeration raised IOException.
Inherited Properties
propertyInherited Properties from Widget: accentColor, acceptFileDrops, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, width, window, x, y
Events
Modifier and Type Member Description
public event changed
changed as ActionEvent
Emitted after loading, refreshing or navigating to a folder.
public event loadFailed
loadFailed as ActionEvent
Emitted on the GUI thread on background failure; loadError describes it.
public event loaded
loaded as ActionEvent
Emitted on the GUI thread after a successful background scan finishes.
public event progressChanged
progressChanged as ActionEvent
Emitted on the GUI thread after partial statistics/geometry are updated.
Inherited Events
eventInherited Events from Widget: filesDropped, focusGained, focusLost, keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public SunBurst
SunBurst(folder as FolderPath = null, background as Boolean = false)
Creates the chart and scans the requested folder once.
Methods
Modifier and Type Member Description
public goUp
goUp() as Void
Returns to the cached parent, or does nothing at the scanned root.
public loadFolder
loadFolder(folder as FolderPath) as Void
Starts a background scan and immediately displays the requested root.
public override paint
paint(painter as Painter) as Void
Paints cached sectors, the named center and the pointer tooltip.
public pollLoading
pollLoading() as Boolean
Publishes a bounded portion of background results on the calling thread.
public reload
reload() as Void
Refreshes the current folder, making it the new navigation root.
public setFolder
setFolder(folder as FolderPath) as Void
Scans a new root and replaces the snapshot only after a successful scan.
public stopLoading
stopLoading() as Void
Cancels loading without blocking, retaining already displayed statistics.
Inherited Methods
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFilesDropped, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintForeground, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds