use crate::{
command::WebDynproCommand,
element::{action::ButtonDef, parser::ElementParser},
error::WebDynproError,
event::Event,
};
pub struct ButtonPressEventCommand {
element_def: ButtonDef,
}
impl ButtonPressEventCommand {
pub fn new(element_def: ButtonDef) -> Self {
Self { element_def }
}
}
impl WebDynproCommand for ButtonPressEventCommand {
type Result = Event;
fn dispatch(&self, parser: &ElementParser) -> Result<Self::Result, WebDynproError> {
parser.element_from_def(&self.element_def)?.press()
}
}