diff --git a/fx/pom.xml b/fx/pom.xml index b853f93..edb1ba9 100644 --- a/fx/pom.xml +++ b/fx/pom.xml @@ -1,23 +1,28 @@ - - - 4.0.0 - - io.github.m-m-m - mmm-ui-demo - ${revision} - - - mmm-ui-demo-fx - jar - - - - ${project.groupId} - mmm-ui-demo-shared - - - ${project.groupId} - mmm-ui-fx-all - - - + + + 4.0.0 + + io.github.m-m-m + mmm-ui-demo + ${revision} + + + mmm-ui-demo-fx + jar + + + + ${project.groupId} + mmm-ui-demo-shared + + + ${project.groupId} + mmm-ui-fx-all + + + ch.qos.logback + logback-classic + ${logback.version} + + + diff --git a/fx/src/main/resources/css/site.css b/fx/src/main/resources/css/site.css index dfe40dd..1fe5c93 100644 --- a/fx/src/main/resources/css/site.css +++ b/fx/src/main/resources/css/site.css @@ -1,79 +1,82 @@ -* { - -ui-border-radius: 5px; -} -.root { - -fx-font-family: "Arial"; -} -.text { - -fx-font-smoothing-type: gray; -} -*:invalid { - -fx-border-color: red; -} -.ui-validation-failure { - -fx-shape: "M 25 17 L 0 17 L 0 0 L 4 0 L 7 -5 L 11 0 L 25 0 L 25 17 Z"; - -fx-border-color: red; - -fx-background-color: #FF2020A0; - -fx-wrap-text: true; -} -.label.mandatory { - -fx-font-weight: bold; -} -.ui-buttons { - -fx-alignment: center; - -fx-padding: 0.5em; - -fx-spacing: 1em; -} -.ui-button { - -fx-min-width: 10em; -} -.ui-inputcontainer { - -fx-padding: 0 0 0.5em 0; -} -.ui-form > .ui-inputcontainer { - -fx-padding: 0.25em 1em 0.25em 1em; -} -.ui-inputcontainer .slider { - -fx-padding: 0 1em 0 1em; -} -.ui-suffix { - -fx-background-color: #dddddd; - -fx-border-color: grey; - -fx-padding: 4; - -fx-border-radius: 0 5 5 0; - -fx-background-radius: 0 5 5 0; -} -.ui-prefix { - -fx-background-color: #dddddd; - -fx-border-color: grey; - -fx-padding: 4; - -fx-border-radius: 5 0 0 5; - -fx-background-radius: 5 0 0 5; -} -.with-prefix { - -fx-border-radius: 0 5 5 0; - -fx-background-radius: 0 5 5 0; -} -.with-suffix { - -fx-border-radius: 5 0 0 5; - -fx-background-radius: 5 0 0 5; -} -.with-prefix.with-suffix { - -fx-border-radius: 0; - -fx-background-radius: 0; -} -.ui-media-controls { - -fx-spacing: 0.5em; - -fx-padding: 0.5em 0.5em 0.5em 0.25em; -} -.grid-borders { - -fx-background-color: black, white; - -fx-padding: 10; - -fx-vgap: 1; - -fx-hgap: 1; -} -.grid-borders > * { - -fx-background-color: black, white; - -fx-border-color: dimgray; - -fx-background-insets: 0, 1; -} +* { + -ui-border-radius: 5px; +} +.root { + -fx-font-family: "Arial"; +} +.text { + -fx-font-smoothing-type: gray; +} +*:invalid { + -fx-border-color: red; +} +.ui-validation-failure { + -fx-shape: "M 25 17 L 0 17 L 0 0 L 4 0 L 7 -5 L 11 0 L 25 0 L 25 17 Z"; + -fx-border-color: red; + -fx-background-color: #FF2020A0; + -fx-wrap-text: true; +} +.label.mandatory { + -fx-font-weight: bold; +} +.ui-buttons { + -fx-alignment: center; + -fx-padding: 0.5em; + -fx-spacing: 1em; +} +.ui-button { + -fx-min-width: 10em; +} +.ui-inputcontainer { + -fx-padding: 0 0 0.5em 0; +} +.ui-form > .ui-inputcontainer { + -fx-padding: 0.25em 1em 0.25em 1em; +} +.ui-inputcontainer .slider { + -fx-padding: 0 1em 0 1em; +} +.ui-suffix { + -fx-background-color: #dddddd; + -fx-border-color: grey; + -fx-padding: 4; + -fx-border-radius: 0 5 5 0; + -fx-background-radius: 0 5 5 0; +} +.ui-prefix { + -fx-background-color: #dddddd; + -fx-border-color: grey; + -fx-padding: 4; + -fx-border-radius: 5 0 0 5; + -fx-background-radius: 5 0 0 5; +} +.spinner.ui-input .text-field { + -fx-padding: 5; +} +.with-prefix { + -fx-border-radius: 0 5 5 0; + -fx-background-radius: 0 5 5 0; +} +.with-suffix { + -fx-border-radius: 5 0 0 5; + -fx-background-radius: 5 0 0 5; +} +.with-prefix.with-suffix { + -fx-border-radius: 0; + -fx-background-radius: 0; +} +.ui-media-controls { + -fx-spacing: 0.5em; + -fx-padding: 0.5em 0.5em 0.5em 0.25em; +} +.grid-borders { + -fx-background-color: black, white; + -fx-padding: 10; + -fx-vgap: 1; + -fx-hgap: 1; +} +.grid-borders > * { + -fx-background-color: black, white; + -fx-border-color: dimgray; + -fx-background-insets: 0, 1; +} diff --git a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/BindingEditorView.java b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/BindingEditorView.java index 8b29717..8b25154 100644 --- a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/BindingEditorView.java +++ b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/BindingEditorView.java @@ -1,38 +1,38 @@ -/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 - * http://www.apache.org/licenses/LICENSE-2.0 */ -package io.github.mmm.ui.demo.shared.place.content.binding.editor; - -import io.github.mmm.ui.api.widget.panel.UiCustomVerticalPanel; - -/** - * View of {@link BindingEditorController}. - */ -public class BindingEditorView extends UiCustomVerticalPanel { - - private final JsonEditor jsonEditor; - - private final PersonEditor personEditor; - - /** - * The constructor. - */ - public BindingEditorView() { - - super(); - this.jsonEditor = new JsonEditor(this::updatePerson); - addChild(this.jsonEditor); - this.personEditor = new PersonEditor(this::updateJson); - addChild(this.personEditor); - } - - private void updateJson(Person person) { - - this.jsonEditor.setValue(person); - } - - private void updatePerson(Person person) { - - this.personEditor.setValue(person); - } - -} +/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 +* http://www.apache.org/licenses/LICENSE-2.0 */ +package io.github.mmm.ui.demo.shared.place.content.binding.editor; + +import io.github.mmm.ui.api.widget.panel.UiCustomVerticalPanel; + +/** + * View of {@link BindingEditorController}. + */ +public class BindingEditorView extends UiCustomVerticalPanel { + + private final JsonEditor jsonEditor; + + private final PersonEditor personEditor; + + /** + * The constructor. + */ + public BindingEditorView() { + + super(); + this.jsonEditor = new JsonEditor(this::updatePerson); + addChild(this.jsonEditor); + this.personEditor = new PersonEditor(this::updateJson); + addChild(this.personEditor); + } + + private void updateJson(Person person) { + + this.jsonEditor.setValue(person); + } + + private void updatePerson(Person person) { + + this.personEditor.setValue(person); + } + +} diff --git a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/JsonEditor.java b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/JsonEditor.java index 8297e48..4c67f41 100644 --- a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/JsonEditor.java +++ b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/JsonEditor.java @@ -1,72 +1,73 @@ -/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 - * http://www.apache.org/licenses/LICENSE-2.0 */ -package io.github.mmm.ui.demo.shared.place.content.binding.editor; - -import java.util.function.Consumer; - -import io.github.mmm.marshall.StandardFormat; -import io.github.mmm.marshall.StructuredTextFormat; -import io.github.mmm.ui.api.attribute.AttributeWriteValue; -import io.github.mmm.ui.api.event.action.UiActionReset; -import io.github.mmm.ui.api.widget.button.UiButton; -import io.github.mmm.ui.api.widget.form.UiFormPanel; -import io.github.mmm.ui.api.widget.input.UiTextArea; -import io.github.mmm.ui.api.widget.panel.UiButtonPanel; -import io.github.mmm.ui.api.widget.panel.UiCustomVerticalPanel; - -/** - * - */ -public class JsonEditor extends UiCustomVerticalPanel implements AttributeWriteValue { - - private static final String JSON_DEFAULT = "{\n" // - + " \"FirstName\": \"John\",\n" // - + " \"LastName\": \"Doe\",\n" // - + " \"Age\": 42,\n" // - + " \"City\": \"New York\",\n" // - + " \"Country\": \"USA\"\n" // - + "}"; - - private final StructuredTextFormat jsonFormat; - - private final UiTextArea jsonTextArea; - - /** - * The constructor. - * - * @param consumer the {@link Consumer} of the {@link Person} to update the editor. - */ - public JsonEditor(Consumer consumer) { - - super(); - this.jsonFormat = StandardFormat.json(); - UiFormPanel form = UiFormPanel.of(); - this.jsonTextArea = UiTextArea.of("JSON"); - this.jsonTextArea.setValue(JSON_DEFAULT); - form.addChild(this.jsonTextArea); - addChild(form); - UiButton updateEditorButton = UiButton.of("Update Editor", e -> { - consumer.accept(getValue()); - }); - UiActionReset reset = e -> this.jsonTextArea.setValue(JSON_DEFAULT); - UiButton resetButton = UiButton.of(reset); - UiButtonPanel buttonPanel = UiButtonPanel.of(resetButton, updateEditorButton); - addChild(buttonPanel); - } - - @Override - public Person getValue() { - - Person person = new Person(); - this.jsonFormat.read(this.jsonTextArea.getValue(), person); - return person; - } - - @Override - public void setValue(Person person) { - - String json = this.jsonFormat.write(person); - this.jsonTextArea.setValue(json); - } - -} +/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 */ +package io.github.mmm.ui.demo.shared.place.content.binding.editor; + +import java.util.function.Consumer; + +import io.github.mmm.marshall.StandardFormat; +import io.github.mmm.marshall.StructuredTextFormat; +import io.github.mmm.ui.api.attribute.AttributeWriteValue; +import io.github.mmm.ui.api.event.action.UiActionReset; +import io.github.mmm.ui.api.widget.button.UiButton; +import io.github.mmm.ui.api.widget.form.UiFormPanel; +import io.github.mmm.ui.api.widget.input.UiTextArea; +import io.github.mmm.ui.api.widget.panel.UiButtonPanel; +import io.github.mmm.ui.api.widget.panel.UiCustomVerticalPanel; + +/** + * + */ +public class JsonEditor extends UiCustomVerticalPanel implements AttributeWriteValue { + + private static final String JSON_DEFAULT = "{\n" // + + " \"FirstName\": \"John\",\n" // + + " \"LastName\": \"Doe\",\n" // + + " \"Age\": 42,\n" // + + " \"Married\": false,\n" // + + " \"City\": \"New York\",\n" // + + " \"Country\": \"USA\"\n" // + + "}"; + + private final StructuredTextFormat jsonFormat; + + private final UiTextArea jsonTextArea; + + /** + * The constructor. + * + * @param consumer the {@link Consumer} of the {@link Person} to update the editor. + */ + public JsonEditor(Consumer consumer) { + + super(); + this.jsonFormat = StandardFormat.json(); + UiFormPanel form = UiFormPanel.of(); + this.jsonTextArea = UiTextArea.of("JSON"); + this.jsonTextArea.setValue(JSON_DEFAULT); + form.addChild(this.jsonTextArea); + addChild(form); + UiButton updateEditorButton = UiButton.of("Update Editor", e -> { + consumer.accept(getValue()); + }); + UiActionReset reset = e -> this.jsonTextArea.setValue(JSON_DEFAULT); + UiButton resetButton = UiButton.of(reset); + UiButtonPanel buttonPanel = UiButtonPanel.of(resetButton, updateEditorButton); + addChild(buttonPanel); + } + + @Override + public Person getValue() { + + Person person = new Person(); + this.jsonFormat.read(this.jsonTextArea.getValue(), person); + return person; + } + + @Override + public void setValue(Person person) { + + String json = this.jsonFormat.write(person); + this.jsonTextArea.setValue(json); + } + +} diff --git a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/Person.java b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/Person.java index 97b1ade..987b80e 100644 --- a/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/Person.java +++ b/shared/src/main/java/io/github/mmm/ui/demo/shared/place/content/binding/editor/Person.java @@ -1,44 +1,39 @@ -/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 - * http://www.apache.org/licenses/LICENSE-2.0 */ -package io.github.mmm.ui.demo.shared.place.content.binding.editor; - -import io.github.mmm.bean.AbstractBean; -import io.github.mmm.bean.Bean; -import io.github.mmm.bean.DynamicBean; -import io.github.mmm.bean.BeanName; -import io.github.mmm.property.number.integers.IntegerProperty; -import io.github.mmm.property.string.StringProperty; - -/** - * A {@link Bean} for testing. - */ -@BeanName("mmm.Person") -public class Person extends DynamicBean { - - /** Full name of person. */ - public final StringProperty FirstName; - - /** Full name of person. */ - public final StringProperty LastName; - - /** Age of person. */ - public final IntegerProperty Age; - - /** - * The constructor. - */ - public Person() { - - super(); - this.FirstName = add().newString().withValidator().mandatory().and().build("FirstName"); - this.LastName = add().newString().withValidator().mandatory().and().build("LastName"); - this.Age = add().newInteger("Age"); - } - - @Override - protected AbstractBean create() { - - return new Person(); - } - -} +/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 */ +package io.github.mmm.ui.demo.shared.place.content.binding.editor; + +import io.github.mmm.bean.AbstractBean; +import io.github.mmm.bean.Bean; +import io.github.mmm.bean.BeanName; +import io.github.mmm.bean.DynamicBean; +import io.github.mmm.property.string.StringProperty; + +/** + * A {@link Bean} for testing. + */ +@BeanName("mmm.Person") +public class Person extends DynamicBean { + + /** Full name of person. */ + public final StringProperty FirstName; + + /** Full name of person. */ + public final StringProperty LastName; + + /** + * The constructor. + */ + public Person() { + + super(); + this.FirstName = add().newString().withValidator().mandatory().and().build("FirstName"); + this.LastName = add().newString().withValidator().mandatory().and().build("LastName"); + } + + @Override + protected AbstractBean create() { + + return new Person(); + } + +}