pub struct RetainedFileExplorer<T, A = ()> { /* private fields */ }Expand description
Filesystem explorer backed by a retained TreeModelHandle. Node
metadata is resolved only for the row being interacted with; ordinary
build, layout, paint, and scroll never reconstruct a recursive snapshot.
The inner tree is always virtualized and uses intent-only mutation mode. Callers own the authoritative model/store and apply emitted identity-aware events. Reserved create IDs must be unique and must remain valid until commit or the matching release callback.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(
model, |_| None, |_| None, |_parent, _kind| Some(1), |_id| {},
);
let _ = explorer;Implementations§
Source§impl<T, A> RetainedFileExplorer<T, A>
impl<T, A> RetainedFileExplorer<T, A>
Sourcepub fn new(
model: TreeModelHandle<T>,
resolve_node: impl Fn(T) -> Option<FileExplorerNode> + 'static,
resolve_id: impl Fn(&FileUri) -> Option<T> + 'static,
reserve_node: impl Fn(Option<&T>, FileKind) -> Option<T> + 'static,
release_node: impl Fn(T) + 'static,
) -> Self
pub fn new( model: TreeModelHandle<T>, resolve_node: impl Fn(T) -> Option<FileExplorerNode> + 'static, resolve_id: impl Fn(&FileUri) -> Option<T> + 'static, reserve_node: impl Fn(Option<&T>, FileKind) -> Option<T> + 'static, release_node: impl Fn(T) + 'static, ) -> Self
Creates a virtualized explorer over an authoritative retained model.
resolve_node supplies current URI/metadata for one ID, resolve_id
maps context-menu URI commands back to identity, reserve_node allocates
a transient file/directory draft ID, and release_node rolls it back on
cancellation or invalid commit. Returning None rejects that operation.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u32>::new());
let explorer = RetainedFileExplorer::<u32, ()>::new(
model, |_| None, |_| None, |_parent, _kind| Some(10), |_id| {},
);
let _ = explorer;Sourcepub fn selected(self, selected: impl Into<Binding<T>>) -> Self
pub fn selected(self, selected: impl Into<Binding<T>>) -> Self
Sets static/generic retained selection and clears writable selection state.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).selected(1);
let _ = explorer;Sourcepub fn bind_selected(self, selected: impl Into<Signal<T>>) -> Self
pub fn bind_selected(self, selected: impl Into<Signal<T>>) -> Self
Binds selection to writable shared retained identity state.
§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).bind_selected(State::new(1));
let _ = explorer;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Binds whether retained-tree interaction is disabled.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).disabled(true);
let _ = explorer;Sourcepub fn clipboard_can_paste(self, can_paste: impl Into<Binding<bool>>) -> Self
pub fn clipboard_can_paste(self, can_paste: impl Into<Binding<bool>>) -> Self
Binds keyboard and blank-menu paste eligibility.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).clipboard_can_paste(true);
let _ = explorer;Sourcepub fn file_style(self, style: FileExplorerStyle) -> Self
pub fn file_style(self, style: FileExplorerStyle) -> Self
Replaces the complete retained tree style.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerStyle, RetainedFileExplorer};
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).file_style(FileExplorerStyle::default());
let _ = explorer;Sourcepub fn file_size(self, size: FileExplorerSize) -> Self
pub fn file_size(self, size: FileExplorerSize) -> Self
Applies a density preset under the default theme, replacing prior style.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerSize, RetainedFileExplorer};
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).file_size(FileExplorerSize::Compact);
let _ = explorer;Sourcepub fn scrollable(self, scrollable: bool) -> Self
pub fn scrollable(self, scrollable: bool) -> Self
Wraps the retained tree in a vertical scroll view when true.
Scrolling defaults to true; row virtualization remains enabled either way.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).scrollable(false);
let _ = explorer;Sourcepub fn tree_diagnostics(self, diagnostics: TreeViewDiagnostics) -> Self
pub fn tree_diagnostics(self, diagnostics: TreeViewDiagnostics) -> Self
Attaches permanent structural counters to the retained tree.
The handle is UI-local and does not affect model ownership or worker scheduling. It is intended for performance gates and diagnostics.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle, TreeViewDiagnostics};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let diagnostics = TreeViewDiagnostics::new();
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).tree_diagnostics(diagnostics.clone());
assert_eq!(diagnostics.snapshot().layout_calls, 0);
let _ = explorer;Sourcepub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
pub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
Maps high-level URI actions into application actions.
Identity-aware model events are emitted separately and first where both representations exist.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerAction, RetainedFileExplorer};
enum Action { Explorer(FileExplorerAction) }
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, Action>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_action(Action::Explorer);
let _ = explorer;Sourcepub fn on_action_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static,
) -> Self
pub fn on_action_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static, ) -> Self
Handles high-level URI actions with event-context access.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_action_ctx(|_ctx, _action| {});
let _ = explorer;Sourcepub fn on_model_event(
self,
f: impl Fn(FileExplorerModelEvent<T>) -> A + 'static,
) -> Self
pub fn on_model_event( self, f: impl Fn(FileExplorerModelEvent<T>) -> A + 'static, ) -> Self
Maps identity-aware select/open/toggle/edit events into application actions.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::{FileExplorerModelEvent, RetainedFileExplorer};
enum Action { Model(FileExplorerModelEvent<u64>) }
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, Action>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_model_event(Action::Model);
let _ = explorer;Sourcepub fn on_model_event_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerModelEvent<T>) + 'static,
) -> Self
pub fn on_model_event_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerModelEvent<T>) + 'static, ) -> Self
Handles identity-aware events with direct event-context access.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeModelHandle};
use ailloli_ui_widgets::files::RetainedFileExplorer;
let model = TreeModelHandle::new(TreeModel::<u64>::new());
let explorer = RetainedFileExplorer::<u64, ()>::new(model, |_| None, |_| None, |_, _| Some(1), |_| {}).on_model_event_ctx(|_ctx, _event| {});
let _ = explorer;Trait Implementations§
Source§impl<T, A> IntoView<A> for RetainedFileExplorer<T, A>
Converts the retained adapter into a virtualized tree and context-menu view.
impl<T, A> IntoView<A> for RetainedFileExplorer<T, A>
Converts the retained adapter into a virtualized tree and context-menu view.
Source§impl<T, A> LayoutExt for RetainedFileExplorer<T, A>
Exposes standard layout mutation to generated extension/builders.
impl<T, A> LayoutExt for RetainedFileExplorer<T, A>
Exposes standard layout mutation to generated extension/builders.