Skip to main content

Frame

Struct Frame 

Source
pub struct Frame(/* private fields */);
Expand description

Where a view lives: it holds the view, the controllers that fit it, their actions and a unit of work. A handle, so controllers and actions can keep one.

Changing the view tells whoever watches, turns off the controllers that were on, changes the view, turns on those that fit the new one, and tells again.

Implementations§

Source§

impl Frame

Source

pub fn new( context: FrameContext, space: Rc<RefCell<dyn ObjectSpace>>, model: Option<Rc<ModelNode>>, view_controllers: Vec<Box<dyn ViewController>>, window_controllers: Vec<Box<dyn WindowController>>, ) -> Self

A frame with no view, with these controllers. Window controllers turn on now, if the context fits them, and stay on.

Source

pub fn set_messenger(&self, messenger: impl Fn(Message) + 'static)

Gives messages to this, which shows them.

Source

pub fn show_message(&self, message: Message)

Tells people something, as long as someone showing the application listens.

Source

pub fn context(&self) -> FrameContext

Where it is.

Source

pub fn space(&self) -> Rc<RefCell<dyn ObjectSpace>>

The unit of work of its view.

Source

pub fn set_entities(&self, entities: Rc<Vec<EntityInfo>>)

The entities whose appearance rules turn actions on and off.

Source

pub fn set_security(&self, security: Rc<SecurityContext>)

Turns actions off by what this person can do. What protects records is the secured space; this is what keeps people from reaching for what would be refused.

Source

pub fn security(&self) -> Option<Rc<SecurityContext>>

What this person can do, when the application has permissions.

Source

pub fn set_extension<T: 'static>(&self, value: Rc<T>)

Keeps something for whoever holds the frame to find by its type, as what shows it does for its controllers and actions.

Source

pub fn extension<T: 'static>(&self) -> Option<Rc<T>>

What was kept of this type.

Source

pub fn model(&self) -> Option<Rc<ModelNode>>

The application model, when it was given one.

Source

pub fn view(&self) -> Option<ViewInfo>

The view it holds.

Source

pub fn selected(&self) -> Vec<Object>

The records selected in the view.

Source

pub fn open_popup(&self) -> Option<(String, String)>

The popup open, as its action’s id and its view’s id.

Source

pub fn on_event(&self, watcher: impl Fn(&FrameEvent) + 'static)

Calls this as the view changes.

Source

pub fn set_validator( &self, validator: impl Fn(&[String], &ActionContext) -> Result<(), String> + 'static, )

What passes actions’ validation contexts before they run.

Source

pub fn show_view(&self, id: &str) -> Result<(), ModelError>

Shows the view with this id in the model.

Source

pub fn set_view(&self, view: Option<ViewInfo>)

Changes the view. Asked while a change is under way, as from a controller turning on, it happens after that one ends.

Source

pub fn set_view_in( &self, view: Option<ViewInfo>, space: Rc<RefCell<dyn ObjectSpace>>, )

Changes the view and takes on a new unit of work with it, as each view has its own. The controllers that turn on already see it.

Source

pub fn view_controls_created(&self)

Tells the controllers that are on that the view’s controls exist now.

Source

pub fn set_controller_active(&self, id: &str, reason: &str, on: bool)

Gives a reason for a controller being on or off. Off, it turns off all its actions.

Source

pub fn is_controller_active(&self, id: &str) -> bool

Whether a controller is on.

Source

pub fn set_selected(&self, selected: Vec<Object>)

Sets what is selected, which turns actions on and off.

Source

pub fn actions(&self) -> Vec<Action>

Every action of its controllers, whether on or off, in the order they came.

Source

pub fn action(&self, id: &str) -> Option<Action>

The action with this id.

Source

pub fn execute( &self, id: &str, input: ActionInput, ) -> Result<ActionResult, ActionError>

Runs an action, if it is on: asks whoever guards it, passes its validation contexts, runs it, and says what comes next. Asking the question first is up to whoever shows it.

Source

pub fn set_job_waker(&self, waker: JobWaker)

Wakes whoever shows the frame, from any thread, when background work has something to show.

Source

pub fn jobs(&self) -> Vec<Job>

The background work that runs now, in the order it started.

Source

pub fn apply_jobs(&self) -> bool

Keeps what background work handed back, tells what it asked to, and ends the work that ended: its action turns on again and says it ran. Says whether records changed, so what shows them reads again. Whoever shows the frame calls it once it is woken.

Source

pub fn open_popup_on(&self, action: &str, view: &str)

Opens a popup on this view for this action, for when the view depends on what it is run on. OK runs the action again, with what was picked.

Source

pub fn prepare_popup(&self, object: &mut Object)

Fills in the record the form of the open popup starts with.

Source

pub fn accept_popup( &self, input: ActionInput, ) -> Result<ActionResult, ActionError>

Ends the open popup with OK, which runs its action.

Source

pub fn cancel_popup(&self)

Ends the open popup with Cancel, and nothing runs but what cancels.

Source

pub fn close(&self)

Ends it: turns off its controllers, the window’s last.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Frame

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Frame

§

impl !Send for Frame

§

impl !Sync for Frame

§

impl !UnwindSafe for Frame

§

impl Freeze for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.