advotracker: callback: update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -12,9 +12,9 @@ use serde::Deserialize;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::{error::Error, process};
|
use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, span, Level};
|
use tracing::{debug, trace, Level};
|
||||||
|
|
||||||
use advotracker::data::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
|
use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
|
||||||
|
|
||||||
// include modules
|
// include modules
|
||||||
mod parse_args;
|
mod parse_args;
|
||||||
|
|||||||
@@ -7,10 +7,11 @@
|
|||||||
|
|
||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
//use crate::data::keys;
|
||||||
//data::structures::PolicyList,
|
// use crate::{
|
||||||
data::keys::*
|
// //data::structures::PolicyList,
|
||||||
};
|
// data::keys::*
|
||||||
|
// };
|
||||||
|
|
||||||
/// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`).
|
/// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`).
|
||||||
pub trait GlobalState {
|
pub trait GlobalState {
|
||||||
|
|||||||
@@ -7,17 +7,17 @@
|
|||||||
|
|
||||||
use chrono::{Local, DateTime};
|
use chrono::{Local, DateTime};
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use serde::Deserialize;
|
//use serde::Deserialize;
|
||||||
use std::env;
|
//use std::env;
|
||||||
use std::{error::Error, process};
|
//use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, Level};
|
use tracing::{info, trace};
|
||||||
|
|
||||||
use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
|
use crate::data::structures::{PolicyCode, PolicyDataList};
|
||||||
|
|
||||||
/// validate a given policy number
|
/// validate a given policy number
|
||||||
/// result will return true or false
|
/// result will return true or false
|
||||||
fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
pub fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
||||||
policy_numbers: &mut HashMap<usize, PolicyCode>, lang: &String)
|
policy_numbers: &mut HashMap<usize, PolicyCode>, lang: &String)
|
||||||
-> Result<bool, Box<dyn std::error::Error>> {
|
-> Result<bool, Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
|||||||
let res = t!("policy.validation.success", lang);
|
let res = t!("policy.validation.success", lang);
|
||||||
println!("policy_number: {} ({:?})",
|
println!("policy_number: {} ({:?})",
|
||||||
policy_number, policy_code);
|
policy_number, policy_code);
|
||||||
|
info!("{} => {} ({:?})", res, policy_number, policy_code);
|
||||||
result = true;
|
result = true;
|
||||||
trace!(target: "csv-test",
|
trace!(target: "csv-test",
|
||||||
policy_number = ?policy_number,
|
policy_number = ?policy_number,
|
||||||
@@ -48,7 +49,8 @@ fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
|||||||
_ => {
|
_ => {
|
||||||
let res = t!("policy.validation.failed", lang);
|
let res = t!("policy.validation.failed", lang);
|
||||||
println!("Noop! Number isn't valid!");
|
println!("Noop! Number isn't valid!");
|
||||||
trace!(target: "csv-test",
|
info!("{} => {}", res, policy_number);
|
||||||
|
trace!(target: "csv-test",
|
||||||
policy_number = ?policy_number,
|
policy_number = ?policy_number,
|
||||||
validation = ?res);
|
validation = ?res);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
* SPDX-License-Identifier: (0BSD or MIT)
|
* SPDX-License-Identifier: (0BSD or MIT)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use chrono::{Local, DateTime};
|
//use chrono::{Local, DateTime};
|
||||||
use locales::t;
|
use locales::t;
|
||||||
//use serde::{Deserialize, Serialize};
|
//use serde::{Deserialize, Serialize};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::env;
|
use std::{env, process};
|
||||||
use std::{error::Error, process};
|
//use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, span, Level};
|
use tracing::{debug, trace, Level};
|
||||||
|
|
||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
use orbtk::theme::DEFAULT_THEME_CSS;
|
use orbtk::theme::DEFAULT_THEME_CSS;
|
||||||
@@ -21,30 +21,6 @@ use orbtk::theme::DEFAULT_THEME_CSS;
|
|||||||
// The Main view
|
// The Main view
|
||||||
use advotracker::widgets::main_view;
|
use advotracker::widgets::main_view;
|
||||||
|
|
||||||
//use advotracker::services;
|
|
||||||
//use advotracker::sercices::policy_check::{import};
|
|
||||||
|
|
||||||
// helper modules
|
|
||||||
//pub mod base_state;
|
|
||||||
//pub mod keys;
|
|
||||||
|
|
||||||
// the frontend
|
|
||||||
//pub mod main_view;
|
|
||||||
|
|
||||||
// validation check of a policy data element given by its poliy code
|
|
||||||
//pub mod policycheck_view;
|
|
||||||
//ub mod policycheck_state;
|
|
||||||
//pub mod policycheck_menu;
|
|
||||||
|
|
||||||
// // manage list of policy data structures
|
|
||||||
// pub mod policylist_view;
|
|
||||||
// pub mod policylist_state;
|
|
||||||
|
|
||||||
// // manage policy data elements
|
|
||||||
// pub mod policydata_view;
|
|
||||||
// pub mod policydata_state;
|
|
||||||
// include modules
|
|
||||||
|
|
||||||
mod parse_args;
|
mod parse_args;
|
||||||
|
|
||||||
/// respect environment variables set in .env files
|
/// respect environment variables set in .env files
|
||||||
@@ -74,10 +50,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
use tracing_subscriber::fmt;
|
use tracing_subscriber::fmt;
|
||||||
use viperus::Viperus;
|
use viperus::Viperus;
|
||||||
|
|
||||||
use advotracker::services::policy_check::*;
|
//use advotracker::callbacks::policy_check::is_valid;
|
||||||
use advotracker::services::imports::allianzdirectcall::*;
|
use advotracker::services::imports::allianzdirectcall::*;
|
||||||
//use advotracker::data;
|
use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyList};
|
||||||
use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
|
|
||||||
|
|
||||||
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
|
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
|
||||||
|
|
||||||
|
|||||||
@@ -8,22 +8,7 @@
|
|||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
|
|
||||||
use crate::data::structures::PolicyCheck;
|
use crate::data::structures::PolicyCheck;
|
||||||
use crate::widgets::policycheck_view;
|
use crate::widgets::policycheck_view::PolicyCheckView;
|
||||||
//use policycheck_view::PolicyCheckView::*;
|
|
||||||
//data::{PolicyCheck, PolicyList, PolicyDataList},
|
|
||||||
// policylist_view::PolicyListView,
|
|
||||||
// policydata_view::PolicyDataView
|
|
||||||
|
|
||||||
//use advotracker::data::PolicyCheckView;
|
|
||||||
|
|
||||||
// use advotracker::{
|
|
||||||
// //data::{PolicyList, PolicyData},
|
|
||||||
// policycheck_view::*,
|
|
||||||
// //policylist_view::*,
|
|
||||||
// //PolicyListView,
|
|
||||||
// //policydata_view::*,
|
|
||||||
// //PolicyDataList
|
|
||||||
//};
|
|
||||||
|
|
||||||
widget!(MainView {
|
widget!(MainView {
|
||||||
// policy_list_count: usize,
|
// policy_list_count: usize,
|
||||||
@@ -55,7 +40,7 @@ impl Template for MainView {
|
|||||||
|
|
||||||
self.name("MainView")
|
self.name("MainView")
|
||||||
//.policy_list_count(0)
|
//.policy_list_count(0)
|
||||||
// //.policycheck_view(PolicyCheck::default())
|
//.policycheck_view(PolicyCheck::default())
|
||||||
// //.policycheck_view(0)
|
// //.policycheck_view(0)
|
||||||
// .policydata_view(policydata_view.0)
|
// .policydata_view(policydata_view.0)
|
||||||
// //.policylist_view(PolicyList::default())
|
// //.policylist_view(PolicyList::default())
|
||||||
|
|||||||
@@ -13,270 +13,270 @@ widget!(
|
|||||||
/// Dialog selecting a list of policy identifiers.
|
/// Dialog selecting a list of policy identifiers.
|
||||||
/// The lists groups a collection of policy codes.
|
/// The lists groups a collection of policy codes.
|
||||||
PolicyListView<PolicyListState> {
|
PolicyListView<PolicyListState> {
|
||||||
back_entity: u32,
|
back_entity: u32,
|
||||||
policy_list: PolicyList,
|
policy_list: PolicyList,
|
||||||
policy_list_count: usize,
|
policy_list_count: usize,
|
||||||
policydata_view: u32
|
policydata_view: u32
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
impl Template for PolicyListView {
|
impl Template for PolicyListView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
// collect the DCES elements of our 'policy lists' view
|
// collect the DCES elements of our 'policy lists' view
|
||||||
let items_widget = ItemsWidget::new()
|
let items_widget = ItemsWidget::new()
|
||||||
.id(ID_POLICY_LIST_ITEMS_WIDGET)
|
.id(ID_POLICY_LIST_ITEMS_WIDGET)
|
||||||
.v_align("start")
|
.v_align("start")
|
||||||
.items_builder(move |ctx, index| {
|
.items_builder(move |ctx, index| {
|
||||||
let mut name = "".to_string();
|
let mut name = "".to_string();
|
||||||
|
|
||||||
if let Some(policy_list) = ctx
|
if let Some(policy_list) = ctx
|
||||||
.get_widget(id)
|
.get_widget(id)
|
||||||
.get::<PolicyList>(PROP_POLICY_LIST)
|
.get::<PolicyList>(PROP_POLICY_LIST)
|
||||||
.get(index)
|
.get(index)
|
||||||
{
|
{
|
||||||
name = policy_list.name.clone();
|
name = policy_list.name.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// plus button: open new policy
|
// plus button: open new policy
|
||||||
let new_list_button = Button::new()
|
let new_list_button = Button::new()
|
||||||
.min_height(48.0)
|
.min_height(48.0)
|
||||||
.class(CLASS_ITEM_BUTTON)
|
.class(CLASS_ITEM_BUTTON)
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column_span(1))
|
.attach(Grid::column_span(1))
|
||||||
.on_click(move |ctx, _| {
|
.on_click(move |ctx, _| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::OpenPolicyList(index));
|
.action(Action::OpenPolicyList(index));
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
let text_block = TextBlock::new()
|
let text_block = TextBlock::new()
|
||||||
.foreground(new_list_button)
|
.foreground(new_list_button)
|
||||||
.margin((14.0, 0.0, 0.0, 0.0))
|
.margin((14.0, 0.0, 0.0, 0.0))
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.text(name)
|
.text(name)
|
||||||
.element("text-box")
|
.element("text-box")
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
let text_box = TextBox::new()
|
let text_box = TextBox::new()
|
||||||
.margin((8.0, 0.0, 0.0, 0.0))
|
.margin((8.0, 0.0, 0.0, 0.0))
|
||||||
.visibility("collapsed")
|
.visibility("collapsed")
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.water_mark("Insert name of a new policy collection ...")
|
.water_mark("Insert name of a new policy collection ...")
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.text(text_block)
|
.text(text_block)
|
||||||
.on_changed(move |ctx, entity| {
|
.on_changed(move |ctx, entity| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::TextChanged(entity, index));
|
.action(Action::TextChanged(entity, index));
|
||||||
})
|
})
|
||||||
.on_activate(move |ctx, entity| {
|
.on_activate(move |ctx, entity| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::RemoveFocus(entity));
|
.action(Action::RemoveFocus(entity));
|
||||||
})
|
})
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
Grid::new()
|
Grid::new()
|
||||||
.height(48.0)
|
.height(48.0)
|
||||||
.columns(
|
.columns(
|
||||||
Columns::new()
|
Columns::new()
|
||||||
.add("*")
|
.add("*")
|
||||||
.add(8.0)
|
.add(8.0)
|
||||||
.add(32.0)
|
.add(32.0)
|
||||||
.add(4.0)
|
.add(4.0)
|
||||||
.add(32.0)
|
.add(32.0)
|
||||||
.add(8.0)
|
.add(8.0)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.child(new_list_button)
|
.child(new_list_button)
|
||||||
.child(text_box)
|
.child(text_box)
|
||||||
.child(text_block)
|
.child(text_block)
|
||||||
.child(
|
.child(
|
||||||
// toggle if text_box is focused
|
// toggle if text_box is focused
|
||||||
ToggleButton::new()
|
ToggleButton::new()
|
||||||
.selected(("focused", text_box))
|
.selected(("focused", text_box))
|
||||||
.class(CLASS_ICON_ONLY)
|
.class(CLASS_ICON_ONLY)
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.min_size(32.0, 32.0)
|
.min_size(32.0, 32.0)
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::new()
|
Button::new()
|
||||||
// .selected(("focused", text_box))
|
// .selected(("focused", text_box))
|
||||||
.class(CLASS_ICON_ONLY)
|
.class(CLASS_ICON_ONLY)
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.min_size(32.0, 32.0)
|
.min_size(32.0, 32.0)
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.icon(material_icons_font_ttf::MD_ADD)
|
.icon(material_icons_font_ttf::MD_ADD)
|
||||||
//.icon(material_icons_font_ttf::MD_EDIT)
|
//.icon(material_icons_font_ttf::MD_EDIT)
|
||||||
//.icon("")
|
//.icon("")
|
||||||
.on_mouse_down(|_, _| true)
|
.on_mouse_down(|_, _| true)
|
||||||
.on_click(move |ctx, _| {
|
.on_click(move |ctx, _| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::SetEntry(text_box));
|
.action(Action::SetEntry(text_box));
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::new()
|
Button::new()
|
||||||
.class("icon_only")
|
.class("icon_only")
|
||||||
.attach(Grid::column(4))
|
.attach(Grid::column(4))
|
||||||
.min_size(32.0, 32.0)
|
.min_size(32.0, 32.0)
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.icon(material_icons_font_ttf::MD_DELETE)
|
.icon(material_icons_font_ttf::MD_DELETE)
|
||||||
//.icon("")
|
//.icon("")
|
||||||
.on_mouse_down(|_, _| true)
|
.on_mouse_down(|_, _| true)
|
||||||
.on_click(move |ctx, _| {
|
.on_click(move |ctx, _| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::RemoveEntry(index));
|
.action(Action::RemoveEntry(index));
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.count((PROP_POLICY_LIST_COUNT, id))
|
.count((PROP_POLICY_LIST_COUNT, id))
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
// create new policy list element
|
// create new policy list element
|
||||||
let policy_list_text_box = TextBox::new()
|
let policy_list_text_box = TextBox::new()
|
||||||
.id(ID_POLICY_LIST_TEXT_BOX)
|
.id(ID_POLICY_LIST_TEXT_BOX)
|
||||||
.attach(Grid::row(4))
|
.attach(Grid::row(4))
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.margin((4.0, 0.0, 0.0, 2.0))
|
.margin((4.0, 0.0, 0.0, 2.0))
|
||||||
.lost_focus_on_activation(false)
|
.lost_focus_on_activation(false)
|
||||||
.on_activate(move |ctx, entity| {
|
.on_activate(move |ctx, entity| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::NewEntry(entity));
|
.action(Action::NewEntry(entity));
|
||||||
})
|
})
|
||||||
.on_changed(move |ctx, entity| {
|
.on_changed(move |ctx, entity| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::InputTextChanged(entity));
|
.action(Action::InputTextChanged(entity));
|
||||||
})
|
})
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
let scroll_viewer = ScrollViewer::new()
|
let scroll_viewer = ScrollViewer::new()
|
||||||
.scroll_viewer_mode(("disabled", "auto"))
|
.scroll_viewer_mode(("disabled", "auto"))
|
||||||
.child(items_widget)
|
.child(items_widget)
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
// Child page: list available policy lists
|
// Child page: list available policy lists
|
||||||
self.name("PolicyListView")
|
self.name("PolicyListView")
|
||||||
.policy_list(PolicyList::default())
|
.policy_list(PolicyList::default())
|
||||||
.policy_list_count(0)
|
.policy_list_count(0)
|
||||||
.child(
|
.child(
|
||||||
Grid::new()
|
Grid::new()
|
||||||
.rows(
|
.rows(
|
||||||
Rows::new()
|
Rows::new()
|
||||||
.add(52.0)
|
.add(52.0)
|
||||||
.add(1.0)
|
.add(1.0)
|
||||||
.add("*")
|
.add("*")
|
||||||
.add(1.0)
|
.add(1.0)
|
||||||
.add(40.0)
|
.add(40.0)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.columns(
|
.columns(
|
||||||
Columns::new()
|
Columns::new()
|
||||||
.add("*")
|
.add("*")
|
||||||
.add(4.0)
|
.add(4.0)
|
||||||
.add(36.0)
|
.add(36.0)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
// Content
|
// Content
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
.attach(Grid::row(2))
|
.attach(Grid::row(2))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.child(scroll_viewer)
|
.child(scroll_viewer)
|
||||||
.child(
|
.child(
|
||||||
ScrollIndicator::new()
|
ScrollIndicator::new()
|
||||||
.padding((0.0, 4.0, 0.0, 0.0))
|
.padding((0.0, 4.0, 0.0, 0.0))
|
||||||
.content_id(items_widget.0)
|
.content_id(items_widget.0)
|
||||||
.scroll_offset(scroll_viewer)
|
.scroll_offset(scroll_viewer)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
// Top Bar
|
// Top Bar
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
.class(CLASS_TOP_BAR)
|
.class(CLASS_TOP_BAR)
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.child(
|
.child(
|
||||||
Grid::new()
|
Grid::new()
|
||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
.class(CLASS_HEADER)
|
.class(CLASS_HEADER)
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.h_align("center")
|
.h_align("center")
|
||||||
.text("Lists of policy data collections")
|
.text("Lists of policy data collections")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
.class("separator")
|
.class("separator")
|
||||||
.attach(Grid::row(1))
|
.attach(Grid::row(1))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
.class("separator")
|
.class("separator")
|
||||||
.attach(Grid::row(3))
|
.attach(Grid::row(3))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
// Bottom bar
|
// Bottom bar
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
.class(CLASS_BOTTOM_BAR)
|
.class(CLASS_BOTTOM_BAR)
|
||||||
.attach(Grid::row(4))
|
.attach(Grid::row(4))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
// workaround, todo fix scroll viewer mouse behavior in OrbTk
|
// workaround, todo fix scroll viewer mouse behavior in OrbTk
|
||||||
Button::new()
|
Button::new()
|
||||||
.attach(Grid::row(4))
|
.attach(Grid::row(4))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.on_mouse_down(|_, _| true)
|
.on_mouse_down(|_, _| true)
|
||||||
.on_mouse_up(|_, _| true)
|
.on_mouse_up(|_, _| true)
|
||||||
.on_click(|_, _| true)
|
.on_click(|_, _| true)
|
||||||
.class(CLASS_TRANSPARENT)
|
.class(CLASS_TRANSPARENT)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(policy_list_text_box)
|
.child(policy_list_text_box)
|
||||||
.child(
|
.child(
|
||||||
Button::new()
|
Button::new()
|
||||||
.id(ID_POLICY_LIST_ADD_BUTTON)
|
.id(ID_POLICY_LIST_ADD_BUTTON)
|
||||||
.class(CLASS_ICON_ONLY)
|
.class(CLASS_ICON_ONLY)
|
||||||
.attach(Grid::row(4))
|
.attach(Grid::row(4))
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.margin((0.0, 0.0, 4.0, 0.0))
|
.margin((0.0, 0.0, 4.0, 0.0))
|
||||||
.enabled(false)
|
.enabled(false)
|
||||||
.min_size(32.0, 32.0)
|
.min_size(32.0, 32.0)
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.icon(material_icons_font_ttf::MD_ADD)
|
.icon(material_icons_font_ttf::MD_ADD)
|
||||||
.on_click(move |ctx, _| {
|
.on_click(move |ctx, _| {
|
||||||
ctx.get_mut::<PolicyListState>(id)
|
ctx.get_mut::<PolicyListState>(id)
|
||||||
.action(Action::NewEntry(policy_list_text_box));
|
.action(Action::NewEntry(policy_list_text_box));
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user