widgets: policycheck_view: global "lang" and styling
* use ron styling * language variable in struct Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -18,28 +18,27 @@ widget!(
|
|||||||
/// Dialog to enter a policy identifier/number.
|
/// Dialog to enter a policy identifier/number.
|
||||||
/// This identifier is checked agains a map of valid policy codes.
|
/// This identifier is checked agains a map of valid policy codes.
|
||||||
PolicyCheckView<PolicyCheckState> {
|
PolicyCheckView<PolicyCheckState> {
|
||||||
|
lang: String,
|
||||||
policy_check: PolicyCheck,
|
policy_check: PolicyCheck,
|
||||||
policy_check_title: String16,
|
policy_check_title: String16,
|
||||||
policy_data_count: u32
|
policy_data_count: u32
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// The template implementation for our View
|
/// The template implementation of the policy check view
|
||||||
|
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
|
||||||
impl Template for PolicyCheckView {
|
impl Template for PolicyCheckView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||||
let policy_check_bottom_bar = Container::new()
|
let policy_check_bottom_bar = Container::new()
|
||||||
.class(CLASS_BOTTOM_BAR)
|
//.style(STYLE_BOTTOM_BAR)
|
||||||
.attach(Grid::row(4))
|
.attach(Grid::row(4))
|
||||||
.attach(Grid::column(1))
|
.attach(Grid::column(1))
|
||||||
.attach(Grid::column_span(2))
|
.attach(Grid::column_span(2))
|
||||||
.v_align("end")
|
.v_align("end")
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
//.padding(18.)
|
|
||||||
.child( Container::new()
|
.child( Container::new()
|
||||||
//.size(220., 64.)
|
.margin((0, 16, 16, 0))
|
||||||
.element("logo_customer")
|
|
||||||
.margin((0., 16., 16., 0.))
|
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.child(
|
.child(
|
||||||
ImageWidget::new()
|
ImageWidget::new()
|
||||||
@@ -53,15 +52,12 @@ impl Template for PolicyCheckView {
|
|||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Container::new()
|
Container::new()
|
||||||
//Grid::new()
|
|
||||||
.element("copyright_vendor")
|
|
||||||
.attach(Grid::column(1))
|
.attach(Grid::column(1))
|
||||||
.background("#1f1f1f")
|
|
||||||
.h_align("end")
|
.h_align("end")
|
||||||
.v_align("end")
|
.v_align("end")
|
||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
.margin((0., 9., 16., 0.))
|
.margin((0, 9, 16, 0))
|
||||||
.text("©Networkx GmbH")
|
.text("©Networkx GmbH")
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
)
|
)
|
||||||
@@ -71,7 +67,7 @@ impl Template for PolicyCheckView {
|
|||||||
|
|
||||||
let policy_check_label_menu = TextBlock::new()
|
let policy_check_label_menu = TextBlock::new()
|
||||||
.id(ID_POLICY_CHECK_LABEL_MENU)
|
.id(ID_POLICY_CHECK_LABEL_MENU)
|
||||||
.foreground("#3b434a")
|
.style("menu")
|
||||||
.text("Help Menu")
|
.text("Help Menu")
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.h_align("center")
|
.h_align("center")
|
||||||
@@ -79,19 +75,13 @@ impl Template for PolicyCheckView {
|
|||||||
|
|
||||||
let policy_check_button_menu = Button::new()
|
let policy_check_button_menu = Button::new()
|
||||||
.id(ID_POLICY_CHECK_BUTTON_MENU)
|
.id(ID_POLICY_CHECK_BUTTON_MENU)
|
||||||
|
.style("button_single_content")
|
||||||
.icon(material_icons_font::MD_MENU)
|
.icon(material_icons_font::MD_MENU)
|
||||||
.class("menu_button")
|
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
//.margin((0., 0., 0., 0.))
|
//.min_size(16, 16)
|
||||||
//.text("Menu Button")
|
|
||||||
//.min_size(8.0, 8.0)
|
|
||||||
.min_size(16.0, 16.0)
|
|
||||||
.h_align("end")
|
.h_align("end")
|
||||||
//.v_align("center")
|
|
||||||
//.enabled(true)
|
|
||||||
.on_mouse_down(|_, _| true)
|
|
||||||
.on_click(move |ctx, _| {
|
.on_click(move |ctx, _| {
|
||||||
ctx.get_mut::<PolicyCheckState>(id)
|
ctx.get_mut::<PolicyCheckState>(policycheck_view)
|
||||||
.action(Action::OpenMenu(policy_check_label_menu));
|
.action(Action::OpenMenu(policy_check_label_menu));
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
@@ -99,7 +89,7 @@ impl Template for PolicyCheckView {
|
|||||||
|
|
||||||
let policy_check_button_result = Button::new()
|
let policy_check_button_result = Button::new()
|
||||||
.id(ID_POLICY_CHECK_BUTTON_RESULT)
|
.id(ID_POLICY_CHECK_BUTTON_RESULT)
|
||||||
.class("single_content")
|
.style("button_single_content")
|
||||||
.h_align("start")
|
.h_align("start")
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.visibility(Visibility::Collapsed)
|
.visibility(Visibility::Collapsed)
|
||||||
@@ -107,8 +97,7 @@ impl Template for PolicyCheckView {
|
|||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
let policy_check_header_bar = Container::new()
|
let policy_check_header_bar = Container::new()
|
||||||
//.border_color("transparent")
|
.style(STYLE_HEADER_BAR)
|
||||||
.class(CLASS_HEADER_BAR)
|
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(1))
|
.attach(Grid::column(1))
|
||||||
.attach(Grid::column_span(2))
|
.attach(Grid::column_span(2))
|
||||||
@@ -116,15 +105,10 @@ impl Template for PolicyCheckView {
|
|||||||
Grid::new()
|
Grid::new()
|
||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
//.class(CLASS_HEADER)
|
.style("header")
|
||||||
.class("h1")
|
|
||||||
//.class(".myheader")
|
|
||||||
.id(ID_POLICY_CHECK_HEADER)
|
.id(ID_POLICY_CHECK_HEADER)
|
||||||
//.font_size(24)
|
|
||||||
//.font("Roboto Medium")
|
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.h_align("left")
|
.h_align("left")
|
||||||
//.margin((32.0, 32.0, 32.0, 32.0))
|
|
||||||
.text("Validierung Versicherungsnummer")
|
.text("Validierung Versicherungsnummer")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
@@ -142,15 +126,12 @@ impl Template for PolicyCheckView {
|
|||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
|
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
|
||||||
//.class(CLASS_TEXT_BLOCK)
|
.style("body")
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.margin((0., 0., 16., 0.))
|
.margin((0, 0, 16, 0))
|
||||||
.h_align("end")
|
.h_align("end")
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
//.min_width(250.)
|
|
||||||
//.min_height(45.)
|
|
||||||
//.size(250., 45.)
|
|
||||||
.text("Versicherungsnummer:")
|
.text("Versicherungsnummer:")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
@@ -160,13 +141,11 @@ impl Template for PolicyCheckView {
|
|||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
||||||
.h_align("start")
|
.h_align("start")
|
||||||
//.width(105.0)
|
|
||||||
//.min_width(100.0)
|
|
||||||
.lost_focus_on_activation(false)
|
.lost_focus_on_activation(false)
|
||||||
.water_mark("10-stellig")
|
.water_mark("10-stellig")
|
||||||
.on_activate(move |ctx, entity| {
|
.on_activate(move |ctx, entity| {
|
||||||
// Entity is entered/activated via Mouse/Keyboard
|
// Entity is entered/activated via Mouse/Keyboard
|
||||||
ctx.get_mut::<PolicyCheckState>(id)
|
ctx.get_mut::<PolicyCheckState>(policycheck_view)
|
||||||
.action(Action::ParseEntry(entity));
|
.action(Action::ParseEntry(entity));
|
||||||
})
|
})
|
||||||
//.on_changed(move |ctx, entity| {
|
//.on_changed(move |ctx, entity| {
|
||||||
@@ -205,21 +184,21 @@ impl Template for PolicyCheckView {
|
|||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
.id(ID_POLICY_CHECK_LABEL_RESULT)
|
.id(ID_POLICY_CHECK_LABEL_RESULT)
|
||||||
.class(CLASS_TEXT_BLOCK)
|
.style("body")
|
||||||
.attach(Grid::row(1))
|
.attach(Grid::row(1))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.margin((0., 0., 16., 0.))
|
.margin((0, 0, 16, 0))
|
||||||
.h_align("end")
|
.h_align("end")
|
||||||
.v_align("center")
|
.v_align("center")
|
||||||
.width(250.0)
|
.width(250)
|
||||||
.min_width(250.0)
|
.min_width(250)
|
||||||
.text("Ergebnis:")
|
|
||||||
.visibility(Visibility::Visible)
|
.visibility(Visibility::Visible)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBlock::new()
|
TextBlock::new()
|
||||||
.id(ID_POLICY_CHECK_RESULT)
|
.id(ID_POLICY_CHECK_RESULT)
|
||||||
|
.style("body")
|
||||||
.attach(Grid::row(1))
|
.attach(Grid::row(1))
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.h_align("start")
|
.h_align("start")
|
||||||
@@ -229,30 +208,24 @@ impl Template for PolicyCheckView {
|
|||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
let policy_check_form = Container::new()
|
let policy_check_form = Container::new()
|
||||||
//.class(CLASS_POLICY_CHECK_FORM)
|
|
||||||
.attach(Grid::row(2))
|
.attach(Grid::row(2))
|
||||||
.attach(Grid::column(1))
|
.attach(Grid::column(1))
|
||||||
.v_align("top")
|
.style("container_form")
|
||||||
.padding(14.0)
|
|
||||||
.background("transparent")
|
|
||||||
.border_radius(3.)
|
|
||||||
.border_width(1.)
|
|
||||||
.border_brush("#fafafa")
|
|
||||||
.child(
|
.child(
|
||||||
Grid::new()
|
Grid::new()
|
||||||
.id(ID_POLICY_CHECK_FORM)
|
.id(ID_POLICY_CHECK_FORM)
|
||||||
.columns(
|
.columns(
|
||||||
Columns::new()
|
Columns::new()
|
||||||
// Labels
|
// Labels
|
||||||
.add("250.")
|
.add("250")
|
||||||
// Seperator
|
// Seperator
|
||||||
.add("16.")
|
.add("16")
|
||||||
// Values
|
// Values
|
||||||
.add("100.")
|
.add("100")
|
||||||
// Seperator
|
// Seperator
|
||||||
.add("16.")
|
.add("16")
|
||||||
// Result-Button
|
// Result-Button
|
||||||
.add("32.")
|
.add("32")
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.rows(
|
.rows(
|
||||||
@@ -270,12 +243,12 @@ impl Template for PolicyCheckView {
|
|||||||
let _policy_check_numeric_box = NumericBox::new()
|
let _policy_check_numeric_box = NumericBox::new()
|
||||||
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
||||||
.h_align("start")
|
.h_align("start")
|
||||||
.width(100.0)
|
.width(100)
|
||||||
//.min(<usize>1000000000)
|
//.min(<usize>1000000000)
|
||||||
//.max(<usize>9999999999)
|
//.max(<usize>9999999999)
|
||||||
.val(0)
|
.val(0)
|
||||||
.min_width(95.0)
|
.min_width(95)
|
||||||
.margin((0.0, 0.0, 0.0, 16.0))
|
.margin((0, 0, 0, 16))
|
||||||
// WIP code @kivimango
|
// WIP code @kivimango
|
||||||
// .on_activate(move |ctx, entity| {
|
// .on_activate(move |ctx, entity| {
|
||||||
// ctx.get_mut::<PolicyCheckState>(id)
|
// ctx.get_mut::<PolicyCheckState>(id)
|
||||||
@@ -289,10 +262,9 @@ impl Template for PolicyCheckView {
|
|||||||
|
|
||||||
let policy_data_count_block = TextBlock::new()
|
let policy_data_count_block = TextBlock::new()
|
||||||
.id(ID_POLICY_DATA_COUNT_BLOCK)
|
.id(ID_POLICY_DATA_COUNT_BLOCK)
|
||||||
//.class(CLASS_TEXT_BLOCK)
|
|
||||||
.attach(Grid::row(3))
|
.attach(Grid::row(3))
|
||||||
.attach(Grid::column(1))
|
.attach(Grid::column(1))
|
||||||
.margin((0., 4., 0., 0.))
|
.margin((0, 4, 0, 0))
|
||||||
.h_align("end")
|
.h_align("end")
|
||||||
.v_align("top")
|
.v_align("top")
|
||||||
.enabled(true)
|
.enabled(true)
|
||||||
@@ -305,18 +277,17 @@ impl Template for PolicyCheckView {
|
|||||||
.child(
|
.child(
|
||||||
Grid::new()
|
Grid::new()
|
||||||
.id(ID_POLICY_CHECK_WIDGET)
|
.id(ID_POLICY_CHECK_WIDGET)
|
||||||
//.background("#fafafa")
|
|
||||||
.columns(
|
.columns(
|
||||||
Columns::new()
|
Columns::new()
|
||||||
.add(50.)
|
.add(50)
|
||||||
.add("*")
|
.add("*")
|
||||||
.add(50.)
|
.add(50)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.rows(
|
.rows(
|
||||||
Rows::new()
|
Rows::new()
|
||||||
.add("auto")
|
.add("auto")
|
||||||
.add(28.)
|
.add(28)
|
||||||
.add("*")
|
.add("*")
|
||||||
.add("auto")
|
.add("auto")
|
||||||
.add("auto")
|
.add("auto")
|
||||||
|
|||||||
Reference in New Issue
Block a user