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