From 0fe0fa662998670dafe051d053b5c2273a8e9dd1 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 10 Jul 2025 23:40:56 +0200 Subject: [PATCH] [FEAT] refacto the samples --- .../ewol/{validationWidget => }/Appl.java | 26 +- .../sample/atriasoft/ewol/BasicWindows.java | 1304 ++--------------- .../ewol/MainApplicaitionStarter.java | 15 + .../sample/atriasoft/ewol/ModelWidget.java | 1242 ++++++++++++++++ .../sample/atriasoft/ewol/TestWidgetBox.java | 39 + .../atriasoft/ewol/TestWidgetButton.java | 17 + .../ewol/TestWidgetButtonToggle.java | 22 + .../atriasoft/ewol/TestWidgetCheckBox.java | 22 + .../atriasoft/ewol/TestWidgetEntry.java | 21 + .../MainWindows.java => TestWidgetImage.java} | 67 +- .../atriasoft/ewol/TestWidgetInterface.java | 9 + .../atriasoft/ewol/TestWidgetLabel.java | 24 + .../atriasoft/ewol/TestWidgetSlider.java | 21 + .../ewol/simpleWindowsLabel/Appl.java | 83 -- .../ewol/simpleWindowsLabel/MainWindows.java | 31 - .../SimpleWindowsLabelMain.java | 15 - .../ewol/simpleWindowsWithBox/Appl.java | 83 -- .../simpleWindowsWithBox/MainWindows.java | 39 - .../SimpleWindowsWithBoxMain.java | 15 - .../ewol/simpleWindowsWithButton/Appl.java | 83 -- .../simpleWindowsWithButton/MainWindows.java | 27 - .../SimpleWindowsWithButtonMain.java | 15 - .../ewol/simpleWindowsWithCheckBox/Appl.java | 83 -- .../ewol/simpleWindowsWithCheckBox/Main.java | 15 - .../MainWindows.java | 29 - .../ewol/simpleWindowsWithImage/Appl.java | 83 -- .../SimpleWindowsWithImageMain.java | 15 - .../ewol/validationWidget/MainWindows.java | 69 - .../ewol/validationWidget/ValidatorMain.java | 15 - 29 files changed, 1559 insertions(+), 1970 deletions(-) rename samples/src/main/sample/atriasoft/ewol/{validationWidget => }/Appl.java (76%) create mode 100644 samples/src/main/sample/atriasoft/ewol/MainApplicaitionStarter.java create mode 100644 samples/src/main/sample/atriasoft/ewol/ModelWidget.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetButton.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetButtonToggle.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetCheckBox.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetEntry.java rename samples/src/main/sample/atriasoft/ewol/{simpleWindowsWithImage/MainWindows.java => TestWidgetImage.java} (50%) create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetInterface.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetLabel.java create mode 100644 samples/src/main/sample/atriasoft/ewol/TestWidgetSlider.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/Appl.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/SimpleWindowsWithBoxMain.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/Appl.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/MainWindows.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/SimpleWindowsWithButtonMain.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Main.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java delete mode 100644 samples/src/main/sample/atriasoft/ewol/validationWidget/ValidatorMain.java diff --git a/samples/src/main/sample/atriasoft/ewol/validationWidget/Appl.java b/samples/src/main/sample/atriasoft/ewol/Appl.java similarity index 76% rename from samples/src/main/sample/atriasoft/ewol/validationWidget/Appl.java rename to samples/src/main/sample/atriasoft/ewol/Appl.java index 3027a8b..d9f12ab 100644 --- a/samples/src/main/sample/atriasoft/ewol/validationWidget/Appl.java +++ b/samples/src/main/sample/atriasoft/ewol/Appl.java @@ -1,4 +1,4 @@ -package sample.atriasoft.ewol.validationWidget; +package sample.atriasoft.ewol; import org.atriasoft.etk.Configs; import org.atriasoft.etk.math.Vector2f; @@ -10,32 +10,32 @@ import org.slf4j.LoggerFactory; public class Appl implements EwolApplication { private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - //! [ewol_sample_HW_main_application] + // ! [ewol_sample_HW_main_application] private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] + // ! [ewol_sample_HW_main_parse_arguments] // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); + for (var iii = 0; iii < context.getCmd().size(); iii++) { + final var tmpppp = context.getCmd().get(iii); if (tmpppp == "-h" || tmpppp == "--help") { LOGGER.info(" -h/--help display this help"); System.exit(0); } } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] + // ! [ewol_sample_HW_main_parse_arguments] + // ! [ewol_sample_HW_main_set_windows_size] // TODO : Remove this: Move if in the windows properties context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] + // ! [ewol_sample_HW_main_set_windows_size] + // ! [ewol_sample_HW_main_set_font_property] // select font preference of der with a basic application size Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] + // ! [ewol_sample_HW_main_set_font_property] + // ! [ewol_sample_HW_main_set_windows] // Create the windows - final MainWindows basicWindows = new MainWindows(); + final var basicWindows = new BasicWindows(); // configure the ewol context to use the new windows context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] + // ! [ewol_sample_HW_main_set_windows] } @Override diff --git a/samples/src/main/sample/atriasoft/ewol/BasicWindows.java b/samples/src/main/sample/atriasoft/ewol/BasicWindows.java index 8c088bc..1990a21 100644 --- a/samples/src/main/sample/atriasoft/ewol/BasicWindows.java +++ b/samples/src/main/sample/atriasoft/ewol/BasicWindows.java @@ -1,1252 +1,112 @@ package sample.atriasoft.ewol; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import org.atriasoft.aknot.exception.AknotException; -import org.atriasoft.aknot.model.IntrospectionModel; -import org.atriasoft.aknot.pojo.IntrospectionModelComplex; -import org.atriasoft.aknot.pojo.IntrospectionProperty; -import org.atriasoft.esignal.Connection; -import org.atriasoft.esignal.Signal; -import org.atriasoft.esignal.SignalEmpty; -import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; -import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Distance; -import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.etk.math.Vector2i; -import org.atriasoft.etk.math.Vector3b; -import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.etk.math.Vector3i; -import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.GravityDepth; -import org.atriasoft.ewol.GravityHorizontal; -import org.atriasoft.ewol.GravityVertical; import org.atriasoft.ewol.widget.Button; -import org.atriasoft.ewol.widget.CheckBox; -import org.atriasoft.ewol.widget.Entry; +import org.atriasoft.ewol.widget.Container; import org.atriasoft.ewol.widget.Label; import org.atriasoft.ewol.widget.Sizer; import org.atriasoft.ewol.widget.Sizer.DisplayMode; -import org.atriasoft.ewol.widget.Spacer; -import org.atriasoft.ewol.widget.Spin; -import org.atriasoft.ewol.widget.Widget; import org.atriasoft.ewol.widget.Windows; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class BasicWindows extends Windows { private static final Logger LOGGER = LoggerFactory.getLogger(BasicWindows.class); - private static final String LABEL_GRAVITY = "gravity: "; - + + private int index = -1; + private final List testedElement = new ArrayList<>(); + private Container container = null; + private Label title = null; + public static void staticRequestNext(final BasicWindows self) { self.requestNext(); } - - Widget testWidget; - Sizer sizerTestAreaHori; - Sizer sizerMenuRoot; - Sizer sizerMenu; - - Gravity basicGravity = Gravity.BOTTOM_LEFT; - - private final List conections = new ArrayList<>(); - + + public static void staticRequestPrevious(final BasicWindows self) { + self.requestPrevious(); + } + + public void requestNext() { + LOGGER.info("Request Next"); + this.index++; + if (this.index >= this.testedElement.size()) { + this.index = 0; + } + updateDisplay(); + } + + public void requestPrevious() { + LOGGER.info("Request Previous"); + this.index--; + if (this.index < 0) { + this.index = this.testedElement.size() - 1; + } + updateDisplay(); + } + + public void updateDisplay() { + final var test = this.testedElement.get(this.index); + final var titlegenerated = "[" + (this.index + 1) + "/" + this.testedElement.size() + "] " + test.getTitle() + + ""; + this.title.setPropertyValue(titlegenerated); + setPropertyTitle(titlegenerated); + this.container.setSubWidget(new ModelWidget(test)); + } + public BasicWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("No title set !!! for this test"); - - final Sizer sizerMain = new Sizer(DisplayMode.HORIZONTAL); + + final var sizerMain = new Sizer(DisplayMode.VERTICAL); sizerMain.setPropertyExpand(Vector2b.TRUE); sizerMain.setPropertyFill(Vector2b.TRUE); setSubWidget(sizerMain); - - this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL); - this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE); - this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE); - this.sizerMenuRoot.setPropertyFill(Vector2b.TRUE); - this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); - this.sizerMenuRoot.setPropertyGravity(Gravity.TOP); - sizerMain.subWidgetAdd(this.sizerMenuRoot); - - final Button next = Button.createLabelButton("Next ..."); - this.sizerMenuRoot.subWidgetAdd(next); + + final var menu = new Sizer(DisplayMode.HORIZONTAL); + menu.setPropertyExpand(Vector2b.TRUE_FALSE); + menu.setPropertyExpandIfFree(Vector2b.TRUE_FALSE); + menu.setPropertyFill(Vector2b.TRUE); + menu.setPropertyLockExpand(Vector2b.TRUE); + menu.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 3), Distance.CENTIMETER)); + sizerMain.subWidgetAdd(menu); + + this.container = new Container(); + this.container.setPropertyExpand(Vector2b.TRUE); + this.container.setPropertyFill(Vector2b.TRUE); + sizerMain.subWidgetAdd(this.container); + + final var next = Button.createLabelButton("<< Previous"); + next.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER)); + menu.subWidgetAdd(next); next.signalClick.connectAuto(this, BasicWindows::staticRequestNext); - - this.sizerMenu = new Sizer(DisplayMode.VERTICAL); - this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE); - this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE); - this.sizerMenu.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); - this.sizerMenu.setPropertyGravity(Gravity.TOP); - this.sizerMenuRoot.subWidgetAdd(this.sizerMenu); - - final Sizer sizerVertMain = new Sizer(DisplayMode.VERTICAL); - sizerVertMain.setPropertyExpand(Vector2b.TRUE); - sizerVertMain.setPropertyFill(Vector2b.TRUE); - sizerMain.subWidgetAdd(sizerVertMain); - - { - final Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL)); - simpleSpacer.setPropertyColor(Color.ALICE_BLUE); - simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE); - simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); - simpleSpacer.setPropertyFill(Vector2b.TRUE); - simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - sizerVertMain.subWidgetAdd(simpleSpacer); - } - - this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL); - this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE); - this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE); - this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE); - sizerVertMain.subWidgetAdd(this.sizerTestAreaHori); - - { - final Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyColor(Color.DARK_GREEN); - simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE); - simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); - simpleSpacer.setPropertyFill(Vector2b.TRUE); - simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - sizerVertMain.subWidgetAdd(simpleSpacer); - } - } - - public void addButton(final Widget widget) { - this.sizerMenu.subWidgetAdd(widget); - } - - public void addMenuBoolean(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Boolean value) { - final CheckBox checkBox = new CheckBox("Y"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value); - this.sizerMenu.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - pojo.setExistingValue(widget, valueButton); - } catch (final AknotException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Dimension1f value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - LOGGER.warn("Receved event for button ..."); - try { - final Object oldValue = pojo.getValue(widget); - LOGGER.warn("Receved event for button ... {}", oldValue); - if (oldValue instanceof final Dimension1f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withSize(valueButton)); - pojo.setExistingValue(widget, new Dimension1f(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } + this.title = new Label("unknown"); + this.title.setPropertyFill(Vector2b.FALSE); + this.title.setPropertyExpand(Vector2b.TRUE); + menu.subWidgetAdd(this.title); + + final var previous = Button.createLabelButton("Next >>"); + previous.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER)); + menu.subWidgetAdd(previous); + previous.signalClick.connectAuto(this, BasicWindows::staticRequestPrevious); + + this.container.setPropertyExpand(Vector2b.TRUE); + this.container.setPropertyFill(Vector2b.TRUE); + this.container.setPropertyExpandIfFree(Vector2b.TRUE); + + this.testedElement.add(new TestWidgetSlider()); + this.testedElement.add(new TestWidgetEntry()); + this.testedElement.add(new TestWidgetBox()); + this.testedElement.add(new TestWidgetButton()); + this.testedElement.add(new TestWidgetButtonToggle()); + this.testedElement.add(new TestWidgetCheckBox()); + this.testedElement.add(new TestWidgetImage()); + this.testedElement.add(new TestWidgetLabel()); + requestNext(); - public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Dimension2f value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size().x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Dimension2f castedValue) { - LOGGER.warn("Set new value: {}", - castedValue.withSize(castedValue.size().withX(valueButton))); - pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton))); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size().y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Dimension2f castedValue) { - LOGGER.warn("Set new value: {}", - castedValue.withSize(castedValue.size().withY(valueButton))); - pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton))); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } } - - public void addMenuDimension3f(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Dimension3f value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size().x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Dimension3f castedValue) { - LOGGER.warn("Set new value: {}", - castedValue.withSize(castedValue.size().withX(valueButton))); - pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton))); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size().y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Dimension3f castedValue) { - LOGGER.warn("Set new value: {}", - castedValue.withSize(castedValue.size().withY(valueButton))); - pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton))); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Z"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.size().z()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Dimension3f castedValue) { - LOGGER.warn("Set new value: {}", - castedValue.withSize(castedValue.size().withZ(valueButton))); - pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withZ(valueButton))); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } - - public void addMenuDouble(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Double value) { - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) (double) value); - this.sizerMenu.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, (double) valueButton); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuFloat(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Float value) { - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) (float) value); - this.sizerMenu.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, (float) valueButton); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuGravity(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Gravity value) { - final Button buttonGravity = Button.createLabelButton("Gravity"); - buttonGravity.setPropertyExpand(Vector2b.TRUE_FALSE); - buttonGravity.setPropertyFill(Vector2b.TRUE); - buttonGravity.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - buttonGravity.setPropertyGravity(Gravity.CENTER); - this.sizerMenu.subWidgetAdd(buttonGravity); - final Label gravLabel = (Label) (buttonGravity.getSubWidget()); - gravLabel.setPropertyValue(LABEL_GRAVITY + Gravity.BOTTOM_LEFT); - - final Connection con = buttonGravity.signalClick.connect(() -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Gravity castedValue) { - Gravity state = castedValue; - // TODO: I change the gravity model to integrate the 3rd rank... - if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.BOTTOM) { - state = new Gravity(GravityHorizontal.CENTER, GravityVertical.BOTTOM, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.BOTTOM) { - state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.BOTTOM, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.BOTTOM) { - state = new Gravity(GravityHorizontal.LEFT, GravityVertical.CENTER, GravityDepth.CENTER); - - } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.CENTER) { - state = new Gravity(GravityHorizontal.CENTER, GravityVertical.CENTER, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.CENTER) { - state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.CENTER, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.CENTER) { - state = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); - - } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.TOP) { - state = new Gravity(GravityHorizontal.CENTER, GravityVertical.TOP, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.TOP) { - state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.TOP, GravityDepth.CENTER); - } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.TOP) { - state = new Gravity(GravityHorizontal.LEFT, GravityVertical.BOTTOM, GravityDepth.CENTER); - } - gravLabel.setPropertyValue(LABEL_GRAVITY + state.toString()); - LOGGER.warn("Set new value: {}", state); - pojo.setExistingValue(widget, state); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuInt(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Integer value) { - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value); - this.sizerMenu.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, (int) (long) valueButton); - - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuLong(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Long value) { - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value); - this.sizerMenu.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, valueButton); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuString(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final String value) { - final Entry element = new Entry(); - element.setPropertyExpand(Vector2b.TRUE_FALSE); - element.setPropertyFill(Vector2b.TRUE); - element.setPropertyValue(value); - this.sizerMenu.subWidgetAdd(element); - final Connection con = element.signalModify.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, valueButton); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuURI(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Uri value) { - final Entry element = new Entry(); - element.setPropertyExpand(Vector2b.TRUE_FALSE); - element.setPropertyFill(Vector2b.TRUE); - element.setPropertyValue(value.toString()); - this.sizerMenu.subWidgetAdd(element); - final Connection con = element.signalModify.connect(valueButton -> { - try { - LOGGER.warn("Set new value: {}", valueButton); - pojo.setExistingValue(widget, Uri.valueOf(valueButton)); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - public void addMenuVector2b(final Widget widget, final IntrospectionProperty pojo) { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector3b value) { - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - { - final CheckBox checkBox = new CheckBox("X"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value.x()); - lineSizer.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2b castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); - pojo.setExistingValue(widget, castedValue.withX(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final CheckBox checkBox = new CheckBox("Y"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value.y()); - lineSizer.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2b castedValue) { - pojo.setExistingValue(widget, castedValue.withY(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - } - - public void addMenuVector2f(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector2f value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); - pojo.setExistingValue(widget, castedValue.withX(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withY(valueButton)); - pojo.setExistingValue(widget, castedValue.withY(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } - - public void addMenuVector2i(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector2i value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value.x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2i castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton)); - pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value.y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector2i castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton)); - pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } - - public void addMenuVector3b(final Widget widget, final IntrospectionProperty pojo) { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector3b value) { - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - { - final CheckBox checkBox = new CheckBox("X"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value.x()); - lineSizer.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3b castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); - pojo.setExistingValue(widget, castedValue.withX(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final CheckBox checkBox = new CheckBox("Y"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value.y()); - lineSizer.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3b castedValue) { - pojo.setExistingValue(widget, castedValue.withY(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final CheckBox checkBox = new CheckBox("Z"); - checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); - checkBox.setPropertyFill(Vector2b.TRUE); - checkBox.setPropertyValue(value.z()); - lineSizer.subWidgetAdd(checkBox); - final Connection con = checkBox.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3b castedValue) { - pojo.setExistingValue(widget, castedValue.withZ(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - - } - - public void addMenuVector3f(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector3f value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); - pojo.setExistingValue(widget, castedValue.withX(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withY(valueButton)); - pojo.setExistingValue(widget, castedValue.withY(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Z"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue((int) value.z()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3f castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withZ(valueButton)); - pojo.setExistingValue(widget, castedValue.withZ(valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } - - public void addMenuVector3i(final Widget widget, final IntrospectionProperty pojo) { - Object valueRaw = null; - try { - valueRaw = pojo.getValue(widget); - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - if (valueRaw instanceof final Vector3i value) { - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("X"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value.x()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3i castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton)); - pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Y"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value.y()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3i castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton)); - pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - { - final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL); - lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); - lineSizer.setPropertyFill(Vector2b.TRUE); - this.sizerMenu.subWidgetAdd(lineSizer); - - final Label simpleLabel = new Label("Z"); - simpleLabel.setPropertyExpand(Vector2b.FALSE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - lineSizer.subWidgetAdd(simpleLabel); - - final Spin spin = new Spin(); - spin.setPropertyExpand(Vector2b.TRUE_FALSE); - spin.setPropertyFill(Vector2b.TRUE); - spin.setPropertyValue(value.z()); - lineSizer.subWidgetAdd(spin); - final Connection con = spin.signalValue.connect(valueButton -> { - try { - final Object oldValue = pojo.getValue(widget); - if (oldValue instanceof final Vector3i castedValue) { - LOGGER.warn("Set new value: {}", castedValue.withZ((int) (long) valueButton)); - pojo.setExistingValue(widget, castedValue.withZ((int) (long) valueButton)); - } - } catch (final AknotException e) { - e.printStackTrace(); - return; - } - }); - this.conections.add(con); - } - } - } - - public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception { - LOGGER.warn("Connect all signal(s) on '{}'", widget.getName()); - final List signals = modelPojo.getSignals(); - for (final IntrospectionProperty pojo : signals) { - LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames())); - LOGGER.warn(" ==> description='{}'", pojo.getDescription()); - LOGGER.warn(" ==> type='{}'", pojo.getType()); - LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType()); - - final String eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] - : pojo.getBeanName(); - - if (pojo.getSubType() != null && pojo.getType() == Signal.class) { - LOGGER.warn(" ** Signal<{}>", pojo.getSubType()); - final Object signalObject = pojo.getValue(widget); - if (signalObject == null) { - LOGGER.error("Signal is not accessible !!!!!!! "); - } else { - final String valueNameOfSignal = eventName; - @SuppressWarnings("unchecked") - final Signal tmp = (Signal) signalObject; - tmp.connect(object -> { - LOGGER.info("Get event from '{}' value='{}'", valueNameOfSignal, object); - }); - } - } - if (pojo.getSubType() == null && pojo.getType() == SignalEmpty.class) { - LOGGER.warn(" ** SignalEmpty"); - final Object signalObject = pojo.getValue(widget); - if (signalObject == null) { - LOGGER.error("Signal is not accessible !!!!!!! "); - } else { - final String valueNameOfSignal = eventName; - final SignalEmpty tmp = (SignalEmpty) signalObject; - tmp.connect(() -> { - LOGGER.info("Get event from '{}'", valueNameOfSignal); - }); - } - - } - } - } - - public void displayAllPropertyWithType(final Widget widget, final IntrospectionModel modelPojo) throws Exception { - LOGGER.warn("Connect all property(ies) on '{}'", widget.getName()); - final List atributes = modelPojo.getAttributes(); - for (final IntrospectionProperty pojo : atributes) { - LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames())); - LOGGER.warn(" ==> description='{}'", pojo.getDescription()); - LOGGER.warn(" ==> type='{}'", pojo.getType()); - LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType()); - final String propertyName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] - : pojo.getBeanName(); - if (pojo.getType() == int.class || pojo.getType() == Integer.class) { - addMenuInt(widget, pojo); - } else if (pojo.getType() == long.class || pojo.getType() == Long.class) { - addMenuLong(widget, pojo); - } else if (pojo.getType() == boolean.class || pojo.getType() == Boolean.class) { - addMenuBoolean(widget, pojo); - } else if (pojo.getType() == float.class || pojo.getType() == Float.class) { - addMenuFloat(widget, pojo); - } else if (pojo.getType() == double.class || pojo.getType() == Double.class) { - addMenuDouble(widget, pojo); - } else if (pojo.getType() == String.class) { - addMenuString(widget, pojo); - } else if (pojo.getType() == Vector3f.class) { - addMenuVector3f(widget, pojo); - } else if (pojo.getType() == Vector2f.class) { - addMenuVector2f(widget, pojo); - } else if (pojo.getType() == Vector3b.class) { - addMenuVector3b(widget, pojo); - } else if (pojo.getType() == Vector2b.class) { - addMenuVector2b(widget, pojo); - } else if (pojo.getType() == Vector3i.class) { - addMenuVector3i(widget, pojo); - } else if (pojo.getType() == Vector2i.class) { - addMenuVector2i(widget, pojo); - } else if (pojo.getType() == Dimension3f.class) { - addMenuDimension3f(widget, pojo); - } else if (pojo.getType() == Dimension2f.class) { - addMenuDimension2f(widget, pojo); - } else if (pojo.getType() == Dimension1f.class) { - addMenuDimension1f(widget, pojo); - } else if (pojo.getType() == DisplayMode.class) { - LOGGER.error(" ==> plop"); - } else if (pojo.getType() == Uri.class) { - addMenuURI(widget, pojo); - } else if (pojo.getType() == Gravity.class) { - addMenuGravity(widget, pojo); - } else { - LOGGER.error(" ==> property type unknown='{}'", pojo.getType()); - } - { - final Label simpleLabel = new Label("" + propertyName + ":"); - simpleLabel.setPropertyExpand(Vector2b.TRUE_FALSE); - simpleLabel.setPropertyFill(Vector2b.FALSE); - simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - simpleLabel.setPropertyGravity(Gravity.LEFT); - this.sizerMenu.subWidgetAdd(simpleLabel); - } - } - } - - public void requestNext() { - // nothing to do ... - } - - public void setTestWidget(final Widget widget) { - this.sizerMenu.subWidgetRemoveAll(); - try { - final IntrospectionModelComplex modelPojo = new IntrospectionModelComplex(widget.getClass()); - - connectAllSignals(widget, modelPojo); - displayAllPropertyWithType(widget, modelPojo); - } catch (final Exception e) { - e.printStackTrace(); - } - this.sizerTestAreaHori.subWidgetRemoveAll(); - { - final Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyColor(Color.CHOCOLATE); - simpleSpacer.setPropertyExpand(Vector2b.FALSE); - simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); - simpleSpacer.setPropertyFill(Vector2b.TRUE); - simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); - } - this.testWidget = widget; - this.sizerTestAreaHori.subWidgetAdd(this.testWidget); - { - final Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyColor(Color.GREEN_YELLOW); - simpleSpacer.setPropertyExpand(Vector2b.FALSE); - simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); - simpleSpacer.setPropertyFill(Vector2b.TRUE); - simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); - } - // update properties... - //final Vector3b stateExpand = this.testWidget.getPropertyExpand(); - //this.buttonExpandX.setPropertyValue(stateExpand.x()); - //this.buttonExpandY.setPropertyValue(stateExpand.y()); - //final Vector3b stateFill = this.testWidget.getPropertyFill(); - //this.buttonFillX.setPropertyValue(stateFill.x()); - //this.buttonFillY.setPropertyValue(stateFill.y()); - - //final Gravity gravity = this.testWidget.getPropertyGravity(); - //final Label gravLabel = (Label) (this.buttonGravity.getSubWidgets()[0]); - //gravLabel.setPropertyValue(LABEL_GRAVITY + gravity.toString()); - } - -} \ No newline at end of file +} diff --git a/samples/src/main/sample/atriasoft/ewol/MainApplicaitionStarter.java b/samples/src/main/sample/atriasoft/ewol/MainApplicaitionStarter.java new file mode 100644 index 0000000..afded41 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/MainApplicaitionStarter.java @@ -0,0 +1,15 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.Uri; +import org.atriasoft.ewol.Ewol; + +public class MainApplicaitionStarter { + public static void main(final String[] args) { + Ewol.init(); + Uri.setApplication(MainApplicaitionStarter.class, "test-ewol/"); + Ewol.run(new Appl(), args); + } + + private MainApplicaitionStarter() { + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/ModelWidget.java b/samples/src/main/sample/atriasoft/ewol/ModelWidget.java new file mode 100644 index 0000000..56eac32 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/ModelWidget.java @@ -0,0 +1,1242 @@ +package sample.atriasoft.ewol; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.atriasoft.aknot.exception.AknotException; +import org.atriasoft.aknot.model.IntrospectionModel; +import org.atriasoft.aknot.pojo.IntrospectionModelComplex; +import org.atriasoft.aknot.pojo.IntrospectionProperty; +import org.atriasoft.esignal.Connection; +import org.atriasoft.esignal.Signal; +import org.atriasoft.esignal.SignalEmpty; +import org.atriasoft.etk.Color; +import org.atriasoft.etk.Dimension1f; +import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.Dimension3f; +import org.atriasoft.etk.Distance; +import org.atriasoft.etk.Uri; +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.etk.math.Vector2i; +import org.atriasoft.etk.math.Vector3b; +import org.atriasoft.etk.math.Vector3f; +import org.atriasoft.etk.math.Vector3i; +import org.atriasoft.ewol.Gravity; +import org.atriasoft.ewol.GravityDepth; +import org.atriasoft.ewol.GravityHorizontal; +import org.atriasoft.ewol.GravityVertical; +import org.atriasoft.ewol.widget.Button; +import org.atriasoft.ewol.widget.CheckBox; +import org.atriasoft.ewol.widget.Container; +import org.atriasoft.ewol.widget.Entry; +import org.atriasoft.ewol.widget.Label; +import org.atriasoft.ewol.widget.Sizer; +import org.atriasoft.ewol.widget.Sizer.DisplayMode; +import org.atriasoft.ewol.widget.Spacer; +import org.atriasoft.ewol.widget.Spin; +import org.atriasoft.ewol.widget.Widget; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ModelWidget extends Container { + private static final Logger LOGGER = LoggerFactory.getLogger(ModelWidget.class); + private static final String LABEL_GRAVITY = "gravity: "; + + Widget testWidget; + Sizer sizerTestAreaHori; + Sizer sizerMenuRoot; + Sizer sizerMenu; + + Gravity basicGravity = Gravity.BOTTOM_LEFT; + + private final List conections = new ArrayList<>(); + + public ModelWidget(final TestWidgetInterface interfaceToTest) { + + setPropertyExpand(Vector2b.TRUE); + setPropertyFill(Vector2b.TRUE); + final var sizerMain = new Sizer(DisplayMode.HORIZONTAL); + sizerMain.setPropertyExpand(Vector2b.TRUE); + sizerMain.setPropertyFill(Vector2b.TRUE); + setSubWidget(sizerMain); + + this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL); + this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE); + this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE); + this.sizerMenuRoot.setPropertyFill(Vector2b.TRUE); + this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); + this.sizerMenuRoot.setPropertyGravity(Gravity.TOP); + sizerMain.subWidgetAdd(this.sizerMenuRoot); + + this.sizerMenu = new Sizer(DisplayMode.VERTICAL); + this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE); + this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE); + this.sizerMenu.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); + this.sizerMenu.setPropertyGravity(Gravity.TOP); + this.sizerMenuRoot.subWidgetAdd(this.sizerMenu); + + final var sizerVertMain = new Sizer(DisplayMode.VERTICAL); + sizerVertMain.setPropertyExpand(Vector2b.TRUE); + sizerVertMain.setPropertyFill(Vector2b.TRUE); + sizerMain.subWidgetAdd(sizerVertMain); + + { + final var simpleSpacer = new Spacer(); + simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL)); + simpleSpacer.setPropertyColor(Color.ALICE_BLUE); + simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); + simpleSpacer.setPropertyFill(Vector2b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + sizerVertMain.subWidgetAdd(simpleSpacer); + } + + this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL); + this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE); + this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE); + this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE); + sizerVertMain.subWidgetAdd(this.sizerTestAreaHori); + + { + final var simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.DARK_GREEN); + simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); + simpleSpacer.setPropertyFill(Vector2b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + sizerVertMain.subWidgetAdd(simpleSpacer); + } + // add the default widget to test: + setTestWidget(interfaceToTest.getWidget()); + } + + public void addButton(final Widget widget) { + this.sizerMenu.subWidgetAdd(widget); + } + + public void addMenuBoolean(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Boolean value) { + final var checkBox = new CheckBox("Y"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value); + this.sizerMenu.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + pojo.setExistingValue(widget, valueButton); + } catch (final AknotException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Dimension1f value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + LOGGER.warn("Receved event for button ..."); + try { + final var oldValue = pojo.getValue(widget); + LOGGER.warn("Receved event for button ... {}", oldValue); + if (oldValue instanceof final Dimension1f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withSize(valueButton)); + pojo.setExistingValue(widget, new Dimension1f(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Dimension2f value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Dimension2f castedValue) { + LOGGER.warn("Set new value: {}", + castedValue.withSize(castedValue.size().withX(valueButton))); + pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton))); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Dimension2f castedValue) { + LOGGER.warn("Set new value: {}", + castedValue.withSize(castedValue.size().withY(valueButton))); + pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton))); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuDimension3f(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Dimension3f value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Dimension3f castedValue) { + LOGGER.warn("Set new value: {}", + castedValue.withSize(castedValue.size().withX(valueButton))); + pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withX(valueButton))); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Dimension3f castedValue) { + LOGGER.warn("Set new value: {}", + castedValue.withSize(castedValue.size().withY(valueButton))); + pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withY(valueButton))); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().z()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Dimension3f castedValue) { + LOGGER.warn("Set new value: {}", + castedValue.withSize(castedValue.size().withZ(valueButton))); + pojo.setExistingValue(widget, castedValue.withSize(castedValue.size().withZ(valueButton))); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuDouble(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Double value) { + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) (double) value); + this.sizerMenu.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, (double) valueButton); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuFloat(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Float value) { + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) (float) value); + this.sizerMenu.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, (float) valueButton); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuGravity(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Gravity value) { + final var buttonGravity = Button.createLabelButton("Gravity"); + buttonGravity.setPropertyExpand(Vector2b.TRUE_FALSE); + buttonGravity.setPropertyFill(Vector2b.TRUE); + buttonGravity.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + buttonGravity.setPropertyGravity(Gravity.CENTER); + this.sizerMenu.subWidgetAdd(buttonGravity); + final var gravLabel = (Label) buttonGravity.getSubWidget(); + gravLabel.setPropertyValue(LABEL_GRAVITY + Gravity.BOTTOM_LEFT); + + final var con = buttonGravity.signalClick.connect(() -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Gravity castedValue) { + var state = castedValue; + // TODO: I change the gravity model to integrate the 3rd rank... + if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.BOTTOM) { + state = new Gravity(GravityHorizontal.CENTER, GravityVertical.BOTTOM, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.BOTTOM) { + state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.BOTTOM, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.BOTTOM) { + state = new Gravity(GravityHorizontal.LEFT, GravityVertical.CENTER, GravityDepth.CENTER); + + } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.CENTER) { + state = new Gravity(GravityHorizontal.CENTER, GravityVertical.CENTER, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.CENTER) { + state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.CENTER, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.CENTER) { + state = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); + + } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.TOP) { + state = new Gravity(GravityHorizontal.CENTER, GravityVertical.TOP, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.TOP) { + state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.TOP, GravityDepth.CENTER); + } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.TOP) { + state = new Gravity(GravityHorizontal.LEFT, GravityVertical.BOTTOM, GravityDepth.CENTER); + } + gravLabel.setPropertyValue(LABEL_GRAVITY + state.toString()); + LOGGER.warn("Set new value: {}", state); + pojo.setExistingValue(widget, state); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuInt(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Integer value) { + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value); + this.sizerMenu.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, (int) (long) valueButton); + + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuLong(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Long value) { + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value); + this.sizerMenu.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, valueButton); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuString(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final String value) { + final var element = new Entry(); + element.setPropertyExpand(Vector2b.TRUE_FALSE); + element.setPropertyFill(Vector2b.TRUE); + element.setPropertyValue(value); + this.sizerMenu.subWidgetAdd(element); + final var con = element.signalModify.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, valueButton); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuURI(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Uri value) { + final var element = new Entry(); + element.setPropertyExpand(Vector2b.TRUE_FALSE); + element.setPropertyFill(Vector2b.TRUE); + element.setPropertyValue(value.toString()); + this.sizerMenu.subWidgetAdd(element); + final var con = element.signalModify.connect(valueButton -> { + try { + LOGGER.warn("Set new value: {}", valueButton); + pojo.setExistingValue(widget, Uri.valueOf(valueButton)); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + public void addMenuVector2b(final Widget widget, final IntrospectionProperty pojo) { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector2b value) { + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + { + final var checkBox = new CheckBox("X"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value.x()); + lineSizer.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2b castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); + pojo.setExistingValue(widget, castedValue.withX(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var checkBox = new CheckBox("Y"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value.y()); + lineSizer.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2b castedValue) { + pojo.setExistingValue(widget, castedValue.withY(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + } + + public void addMenuVector2f(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector2f value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); + pojo.setExistingValue(widget, castedValue.withX(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withY(valueButton)); + pojo.setExistingValue(widget, castedValue.withY(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuVector2i(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector2i value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value.x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2i castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton)); + pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value.y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector2i castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton)); + pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuVector3b(final Widget widget, final IntrospectionProperty pojo) { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector3b value) { + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + { + final var checkBox = new CheckBox("X"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value.x()); + lineSizer.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3b castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); + pojo.setExistingValue(widget, castedValue.withX(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var checkBox = new CheckBox("Y"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value.y()); + lineSizer.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3b castedValue) { + pojo.setExistingValue(widget, castedValue.withY(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var checkBox = new CheckBox("Z"); + checkBox.setPropertyExpand(Vector2b.TRUE_FALSE); + checkBox.setPropertyFill(Vector2b.TRUE); + checkBox.setPropertyValue(value.z()); + lineSizer.subWidgetAdd(checkBox); + final var con = checkBox.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3b castedValue) { + pojo.setExistingValue(widget, castedValue.withZ(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + + } + + public void addMenuVector3f(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector3f value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX(valueButton)); + pojo.setExistingValue(widget, castedValue.withX(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withY(valueButton)); + pojo.setExistingValue(widget, castedValue.withY(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.z()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3f castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withZ(valueButton)); + pojo.setExistingValue(widget, castedValue.withZ(valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuVector3i(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final Vector3i value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value.x()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3i castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withX((int) (long) valueButton)); + pojo.setExistingValue(widget, castedValue.withX((int) (long) valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value.y()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3i castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withY((int) (long) valueButton)); + pojo.setExistingValue(widget, castedValue.withY((int) (long) valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue(value.z()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(valueButton -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof final Vector3i castedValue) { + LOGGER.warn("Set new value: {}", castedValue.withZ((int) (long) valueButton)); + pojo.setExistingValue(widget, castedValue.withZ((int) (long) valueButton)); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception { + LOGGER.warn("Connect all signal(s) on '{}'", widget.getName()); + final var signals = modelPojo.getSignals(); + for (final IntrospectionProperty pojo : signals) { + LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames())); + LOGGER.warn(" ==> description='{}'", pojo.getDescription()); + LOGGER.warn(" ==> type='{}'", pojo.getType()); + LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType()); + + final var eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] + : pojo.getBeanName(); + + if (pojo.getSubType() != null && pojo.getType() == Signal.class) { + LOGGER.warn(" ** Signal<{}>", pojo.getSubType()); + final var signalObject = pojo.getValue(widget); + if (signalObject == null) { + LOGGER.error("Signal is not accessible !!!!!!! "); + } else { + final var valueNameOfSignal = eventName; + @SuppressWarnings("unchecked") + final var tmp = (Signal) signalObject; + tmp.connect(object -> { + LOGGER.info("Get event from '{}' value='{}'", valueNameOfSignal, object); + }); + } + } + if (pojo.getSubType() == null && pojo.getType() == SignalEmpty.class) { + LOGGER.warn(" ** SignalEmpty"); + final var signalObject = pojo.getValue(widget); + if (signalObject == null) { + LOGGER.error("Signal is not accessible !!!!!!! "); + } else { + final var valueNameOfSignal = eventName; + final var tmp = (SignalEmpty) signalObject; + tmp.connect(() -> { + LOGGER.info("Get event from '{}'", valueNameOfSignal); + }); + } + + } + } + } + + public void displayAllPropertyWithType(final Widget widget, final IntrospectionModel modelPojo) throws Exception { + LOGGER.warn("Connect all property(ies) on '{}'", widget.getName()); + final var atributes = modelPojo.getAttributes(); + for (final IntrospectionProperty pojo : atributes) { + LOGGER.warn(" - '{}' otherNames={}", pojo.getBeanName(), Arrays.toString(pojo.getNames())); + LOGGER.warn(" ==> description='{}'", pojo.getDescription()); + LOGGER.warn(" ==> type='{}'", pojo.getType()); + LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType()); + final var propertyName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] + : pojo.getBeanName(); + if (pojo.getType() == int.class || pojo.getType() == Integer.class) { + addMenuInt(widget, pojo); + } else if (pojo.getType() == long.class || pojo.getType() == Long.class) { + addMenuLong(widget, pojo); + } else if (pojo.getType() == boolean.class || pojo.getType() == Boolean.class) { + addMenuBoolean(widget, pojo); + } else if (pojo.getType() == float.class || pojo.getType() == Float.class) { + addMenuFloat(widget, pojo); + } else if (pojo.getType() == double.class || pojo.getType() == Double.class) { + addMenuDouble(widget, pojo); + } else if (pojo.getType() == String.class) { + addMenuString(widget, pojo); + } else if (pojo.getType() == Vector3f.class) { + addMenuVector3f(widget, pojo); + } else if (pojo.getType() == Vector2f.class) { + addMenuVector2f(widget, pojo); + } else if (pojo.getType() == Vector3b.class) { + addMenuVector3b(widget, pojo); + } else if (pojo.getType() == Vector2b.class) { + addMenuVector2b(widget, pojo); + } else if (pojo.getType() == Vector3i.class) { + addMenuVector3i(widget, pojo); + } else if (pojo.getType() == Vector2i.class) { + addMenuVector2i(widget, pojo); + } else if (pojo.getType() == Dimension3f.class) { + addMenuDimension3f(widget, pojo); + } else if (pojo.getType() == Dimension2f.class) { + addMenuDimension2f(widget, pojo); + } else if (pojo.getType() == Dimension1f.class) { + addMenuDimension1f(widget, pojo); + } else if (pojo.getType() == DisplayMode.class) { + LOGGER.error(" ==> plop"); + } else if (pojo.getType() == Uri.class) { + addMenuURI(widget, pojo); + } else if (pojo.getType() == Gravity.class) { + addMenuGravity(widget, pojo); + } else { + LOGGER.error(" ==> property type unknown='{}'", pojo.getType()); + } + { + final var simpleLabel = new Label("" + propertyName + ":"); + simpleLabel.setPropertyExpand(Vector2b.TRUE_FALSE); + simpleLabel.setPropertyFill(Vector2b.FALSE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + this.sizerMenu.subWidgetAdd(simpleLabel); + } + } + } + + public void setTestWidget(final Widget widget) { + this.sizerMenu.subWidgetRemoveAll(); + try { + final var modelPojo = new IntrospectionModelComplex(widget.getClass()); + + connectAllSignals(widget, modelPojo); + displayAllPropertyWithType(widget, modelPojo); + } catch (final Exception e) { + e.printStackTrace(); + } + this.sizerTestAreaHori.subWidgetRemoveAll(); + { + final var simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.CHOCOLATE); + simpleSpacer.setPropertyExpand(Vector2b.FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); + simpleSpacer.setPropertyFill(Vector2b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); + } + this.testWidget = widget; + this.sizerTestAreaHori.subWidgetAdd(this.testWidget); + { + final var simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.GREEN_YELLOW); + simpleSpacer.setPropertyExpand(Vector2b.FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE); + simpleSpacer.setPropertyFill(Vector2b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + this.sizerTestAreaHori.subWidgetAdd(simpleSpacer); + } + // update properties... + // final Vector3b stateExpand = this.testWidget.getPropertyExpand(); + // this.buttonExpandX.setPropertyValue(stateExpand.x()); + // this.buttonExpandY.setPropertyValue(stateExpand.y()); + // final Vector3b stateFill = this.testWidget.getPropertyFill(); + // this.buttonFillX.setPropertyValue(stateFill.x()); + // this.buttonFillY.setPropertyValue(stateFill.y()); + + // final Gravity gravity = this.testWidget.getPropertyGravity(); + // final Label gravLabel = (Label) (this.buttonGravity.getSubWidgets()[0]); + // gravLabel.setPropertyValue(LABEL_GRAVITY + gravity.toString()); + } + +} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java new file mode 100644 index 0000000..dc07104 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java @@ -0,0 +1,39 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.Color; +import org.atriasoft.etk.Dimension1f; +import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.ewol.widget.Box; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetBox implements TestWidgetInterface { + @Override + public Widget getWidget() { + final var innerWidget = new Box(); + // this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); + innerWidget.setPropertyExpand(Vector2b.FALSE); + innerWidget.setPropertyExpandIfFree(Vector2b.TRUE); + innerWidget.setPropertyFill(Vector2b.TRUE); + innerWidget.setPropertyColor(Color.PINK); + innerWidget.setPropertyMinSize(new Dimension2f(new Vector2f(50, 80))); + + final var testWidget = new Box(innerWidget); + testWidget.setPropertyExpand(Vector2b.FALSE); + testWidget.setPropertyFill(Vector2b.FALSE); + testWidget.setPropertyBorderWidth(new Dimension1f(10)); + testWidget.setPropertyBorderRadius(new Dimension1f(25)); + testWidget.setPropertyBorderColor(Color.BLACK); + testWidget.setPropertyColor(Color.GREEN_YELLOW); + testWidget.setPropertyPadding(new Dimension2f(new Vector2f(15, 15))); + testWidget.setPropertyMargin(new Dimension2f(new Vector2f(25, 25))); + + return testWidget; + } + + @Override + public String getTitle() { + return "Simple CheckBox"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetButton.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetButton.java new file mode 100644 index 0000000..eeab528 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetButton.java @@ -0,0 +1,17 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.ewol.widget.Button; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetButton implements TestWidgetInterface { + + @Override + public Widget getWidget() { + return Button.createLabelButton("A simple Label"); + } + + @Override + public String getTitle() { + return "Simple CheckBox"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetButtonToggle.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetButtonToggle.java new file mode 100644 index 0000000..997e16c --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetButtonToggle.java @@ -0,0 +1,22 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.ewol.widget.Composer; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetButtonToggle implements TestWidgetInterface { + + @Override + public Widget getWidget() { + return Composer.composerGenerateString(""" + + """); + } + + @Override + public String getTitle() { + return "Simple Button toggle"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetCheckBox.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetCheckBox.java new file mode 100644 index 0000000..1fb26c2 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetCheckBox.java @@ -0,0 +1,22 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.ewol.widget.CheckBox; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetCheckBox implements TestWidgetInterface { + + @Override + public Widget getWidget() { + final var testWidget = new CheckBox("Hello, how Are You?
second-life?"); + // this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); + testWidget.setPropertyExpand(Vector2b.TRUE); + testWidget.setPropertyFill(Vector2b.TRUE); + return testWidget; + } + + @Override + public String getTitle() { + return "Simple CheckBox"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetEntry.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetEntry.java new file mode 100644 index 0000000..ac49222 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetEntry.java @@ -0,0 +1,21 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.ewol.widget.Entry; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetEntry implements TestWidgetInterface { + @Override + public Widget getWidget() { + final var testWidget = new Entry(); + testWidget.setPropertyExpand(Vector2b.FALSE); + testWidget.setPropertyFill(Vector2b.FALSE); + + return testWidget; + } + + @Override + public String getTitle() { + return "Test Entry"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetImage.java similarity index 50% rename from samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java rename to samples/src/main/sample/atriasoft/ewol/TestWidgetImage.java index 27465d3..a0e17b5 100644 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetImage.java @@ -1,4 +1,4 @@ -package sample.atriasoft.ewol.simpleWindowsWithImage; +package sample.atriasoft.ewol; import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Distance; @@ -7,12 +7,36 @@ import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.ewol.widget.Button; import org.atriasoft.ewol.widget.ImageDisplay; +import org.atriasoft.ewol.widget.Widget; -import sample.atriasoft.ewol.BasicWindows; +public class TestWidgetImage implements TestWidgetInterface { -public class MainWindows extends BasicWindows { + ImageDisplay testWidget; + Button buttonAspectRatio; - public static void eventButtonChangeImage(final MainWindows self, final Boolean value) { + @Override + public Widget getWidget() { + this.testWidget = new ImageDisplay(); + this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); + this.testWidget.setPropertyExpand(Vector2b.TRUE); + this.testWidget.setPropertyFill(Vector2b.TRUE); + this.testWidget.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + + this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio"); + this.buttonAspectRatio.setPropertyExpand(Vector2b.FALSE); + this.buttonAspectRatio.setPropertyFill(Vector2b.FALSE); + this.buttonAspectRatio.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + ////////////// addButton(this.buttonAspectRatio); + this.buttonAspectRatio.signalClick.connectAuto(this, TestWidgetImage::eventButtonChangeKeepRatio); + return this.testWidget; + } + + @Override + public String getTitle() { + return "Simple Image"; + } + + public static void eventButtonChangeImage(final TestWidgetImage self, final Boolean value) { if (value) { self.testWidget.setPropertySource(new Uri("DATA", "mireC.png")); } else { @@ -20,38 +44,11 @@ public class MainWindows extends BasicWindows { } } - public static void eventButtonChangeKeepRatio(final MainWindows self) { - final boolean state = self.testWidget.isPropertyKeepRatio(); + public static void eventButtonChangeKeepRatio(final TestWidgetImage self) { + final var state = self.testWidget.isPropertyKeepRatio(); self.testWidget.setPropertyKeepRatio(!state); - //self.buttonAspectRatio.setPropertyValue(state ? "fkeep aspect ratio" : "un-keep aspect ratio"); + // self.buttonAspectRatio.setPropertyValue(state ? "fkeep aspect ratio" : + // "un-keep aspect ratio"); } - ImageDisplay testWidget; - Button buttonAspectRatio; - - public MainWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple Image"); - - this.testWidget = new ImageDisplay(); - this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); - this.testWidget.setPropertyExpand(Vector2b.TRUE); - this.testWidget.setPropertyFill(Vector2b.TRUE); - this.testWidget.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - setTestWidget(this.testWidget); - { - // final Button button = Button.createToggleLabelButton("mireA.png", "mireC.png"); - // button.setPropertyExpand(Vector2b.FALSE); - // button.setPropertyFill(Vector2b.FALSE); - // button.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - // this.addButton(button); - // button.signalValue.connectAuto(this, MainWindows::eventButtonChangeImage); - } - this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio"); - this.buttonAspectRatio.setPropertyExpand(Vector2b.FALSE); - this.buttonAspectRatio.setPropertyFill(Vector2b.FALSE); - this.buttonAspectRatio.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); - addButton(this.buttonAspectRatio); - this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio); - } } diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetInterface.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetInterface.java new file mode 100644 index 0000000..037f154 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetInterface.java @@ -0,0 +1,9 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.ewol.widget.Widget; + +public interface TestWidgetInterface { + Widget getWidget(); + + String getTitle(); +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetLabel.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetLabel.java new file mode 100644 index 0000000..56fde79 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetLabel.java @@ -0,0 +1,24 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.ewol.widget.Label; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetLabel implements TestWidgetInterface { + + @Override + public Widget getWidget() { + final var testWidget = new Label(); + testWidget.setPropertyValue( + "Hello. World

- How are You ???
- Not so Well, I break my leg.

The end
"); + testWidget.setPropertyExpand(Vector2b.TRUE); + testWidget.setPropertyFill(Vector2b.TRUE); + return testWidget; + } + + @Override + public String getTitle() { + return "Simple Label test"; + } + +} diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetSlider.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetSlider.java new file mode 100644 index 0000000..9b31e1a --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetSlider.java @@ -0,0 +1,21 @@ +package sample.atriasoft.ewol; + +import org.atriasoft.etk.math.Vector2b; +import org.atriasoft.ewol.widget.Slider; +import org.atriasoft.ewol.widget.Widget; + +public class TestWidgetSlider implements TestWidgetInterface { + @Override + public Widget getWidget() { + final var testWidget = new Slider(); + testWidget.setPropertyExpand(Vector2b.FALSE); + testWidget.setPropertyFill(Vector2b.FALSE); + + return testWidget; + } + + @Override + public String getTitle() { + return "Test Slider"; + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java deleted file mode 100644 index 5af9694..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java +++ /dev/null @@ -1,83 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsLabel; - -import org.atriasoft.etk.Configs; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.ewol.context.EwolApplication; -import org.atriasoft.ewol.context.EwolContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Appl implements EwolApplication { - private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - - //! [ewol_sample_HW_main_application] - private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] - // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); - if (tmpppp == "-h" || tmpppp == "--help") { - LOGGER.info(" -h/--help display this help"); - System.exit(0); - } - } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] - // TODO : Remove this: Move if in the windows properties - context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] - // select font preference of der with a basic application size - Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] - // Create the windows - final MainWindows basicWindows = new MainWindows(); - // configure the ewol context to use the new windows - context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] - } - - @Override - public void onCreate(final EwolContext context) { - LOGGER.info("Application onCreate: [BEGIN]"); - localCreate(context); - LOGGER.info("Application onCreate: [ END ]"); - } - - @Override - public void onDestroy(final EwolContext context) { - LOGGER.info("Application onDestroy: [BEGIN]"); - - LOGGER.info("Application onDestroy: [ END ]"); - } - - @Override - public void onPause(final EwolContext context) { - LOGGER.info("Application onPause: [BEGIN]"); - - LOGGER.info("Application onPause: [ END ]"); - } - - @Override - public void onResume(final EwolContext context) { - LOGGER.info("Application onResume: [BEGIN]"); - - LOGGER.info("Application onResume: [ END ]"); - } - - @Override - public void onStart(final EwolContext context) { - LOGGER.info("Application onStart: [BEGIN]"); - - LOGGER.info("Application onStart: [ END ]"); - } - - @Override - public void onStop(final EwolContext context) { - LOGGER.info("Application onStop: [BEGIN]"); - - LOGGER.info("Application onStop: [ END ]"); - } - -} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java deleted file mode 100644 index f161060..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java +++ /dev/null @@ -1,31 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsLabel; - -import org.atriasoft.etk.math.Vector2b; -import org.atriasoft.ewol.widget.Label; -import org.atriasoft.ewol.widget.Spacer; - -import sample.atriasoft.ewol.BasicWindows; - -public class MainWindows extends BasicWindows { - - public MainWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple sample test"); - //EwolObject.getContext().getFontDefault().setName("FreeSans"); - //! [ewol_sample_HW_windows_label] - if (true) { - //! [ewol_sample_HW_windows_title] - final Label simpleLabel = new Label(); - simpleLabel.setPropertyValue("Hello. World

- How are You ???
- Not so Well, I break my leg.

The end
"); - simpleLabel.setPropertyExpand(Vector2b.TRUE); - simpleLabel.setPropertyFill(Vector2b.TRUE); - this.setTestWidget(simpleLabel); - //! [ewol_sample_HW_windows_label] - } else { - final Spacer simpleSpacer = new Spacer(); - simpleSpacer.setPropertyExpand(Vector2b.TRUE); - simpleSpacer.setPropertyFill(Vector2b.TRUE); - this.setTestWidget(simpleSpacer); - } - } -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java deleted file mode 100644 index 6434b8a..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsLabel; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class SimpleWindowsLabelMain { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("ne", MainCollisionTest.class, "testDataLoxelEngine/"); - Uri.setApplication(SimpleWindowsLabelMain.class); - Ewol.run(new Appl(), args); - } - - private SimpleWindowsLabelMain() {} -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/Appl.java deleted file mode 100644 index 2c3a2bb..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/Appl.java +++ /dev/null @@ -1,83 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithBox; - -import org.atriasoft.etk.Configs; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.ewol.context.EwolApplication; -import org.atriasoft.ewol.context.EwolContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Appl implements EwolApplication { - private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - - //! [ewol_sample_HW_main_application] - private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] - // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); - if (tmpppp == "-h" || tmpppp == "--help") { - LOGGER.info(" -h/--help display this help"); - System.exit(0); - } - } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] - // TODO : Remove this: Move if in the windows properties - context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] - // select font preference of der with a basic application size - Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] - // Create the windows - final MainWindows basicWindows = new MainWindows(); - // configure the ewol context to use the new windows - context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] - } - - @Override - public void onCreate(final EwolContext context) { - LOGGER.info("Application onCreate: [BEGIN]"); - localCreate(context); - LOGGER.info("Application onCreate: [ END ]"); - } - - @Override - public void onDestroy(final EwolContext context) { - LOGGER.info("Application onDestroy: [BEGIN]"); - - LOGGER.info("Application onDestroy: [ END ]"); - } - - @Override - public void onPause(final EwolContext context) { - LOGGER.info("Application onPause: [BEGIN]"); - - LOGGER.info("Application onPause: [ END ]"); - } - - @Override - public void onResume(final EwolContext context) { - LOGGER.info("Application onResume: [BEGIN]"); - - LOGGER.info("Application onResume: [ END ]"); - } - - @Override - public void onStart(final EwolContext context) { - LOGGER.info("Application onStart: [BEGIN]"); - - LOGGER.info("Application onStart: [ END ]"); - } - - @Override - public void onStop(final EwolContext context) { - LOGGER.info("Application onStop: [BEGIN]"); - - LOGGER.info("Application onStop: [ END ]"); - } - -} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java deleted file mode 100644 index 17fa026..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/MainWindows.java +++ /dev/null @@ -1,39 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithBox; - -import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; -import org.atriasoft.etk.Dimension2f; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.etk.math.Vector2b; -import org.atriasoft.ewol.widget.Box; - -import sample.atriasoft.ewol.BasicWindows; - -public class MainWindows extends BasicWindows { - - Box testWidget; - - public MainWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple CheckBox"); - - final Box innerWidget = new Box(); - //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); - innerWidget.setPropertyExpand(Vector2b.FALSE); - innerWidget.setPropertyExpandIfFree(Vector2b.TRUE); - innerWidget.setPropertyFill(Vector2b.TRUE); - innerWidget.setPropertyColor(Color.PINK); - innerWidget.setPropertyMinSize(new Dimension2f(new Vector2f(50, 80))); - - this.testWidget = new Box(innerWidget); - this.testWidget.setPropertyExpand(Vector2b.FALSE); - this.testWidget.setPropertyFill(Vector2b.FALSE); - this.testWidget.setPropertyBorderWidth(new Dimension1f(10)); - this.testWidget.setPropertyBorderRadius(new Dimension1f(25)); - this.testWidget.setPropertyBorderColor(Color.BLACK); - this.testWidget.setPropertyColor(Color.GREEN_YELLOW); - this.testWidget.setPropertyPadding(new Dimension2f(new Vector2f(15, 15))); - this.testWidget.setPropertyMargin(new Dimension2f(new Vector2f(25, 25))); - setTestWidget(this.testWidget); - } -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/SimpleWindowsWithBoxMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/SimpleWindowsWithBoxMain.java deleted file mode 100644 index 8470ddf..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithBox/SimpleWindowsWithBoxMain.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithBox; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class SimpleWindowsWithBoxMain { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); - Uri.setApplication(SimpleWindowsWithBoxMain.class, "test-ewol/"); - Ewol.run(new Appl(), args); - } - - private SimpleWindowsWithBoxMain() {} -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/Appl.java deleted file mode 100644 index 43fe8a1..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/Appl.java +++ /dev/null @@ -1,83 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithButton; - -import org.atriasoft.etk.Configs; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.ewol.context.EwolApplication; -import org.atriasoft.ewol.context.EwolContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Appl implements EwolApplication { - private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - - //! [ewol_sample_HW_main_application] - private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] - // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); - if (tmpppp == "-h" || tmpppp == "--help") { - LOGGER.info(" -h/--help display this help"); - System.exit(0); - } - } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] - // TODO : Remove this: Move if in the windows properties - context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] - // select font preference of der with a basic application size - Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] - // Create the windows - final MainWindows basicWindows = new MainWindows(); - // configure the ewol context to use the new windows - context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] - } - - @Override - public void onCreate(final EwolContext context) { - LOGGER.info("Application onCreate: [BEGIN]"); - localCreate(context); - LOGGER.info("Application onCreate: [ END ]"); - } - - @Override - public void onDestroy(final EwolContext context) { - LOGGER.info("Application onDestroy: [BEGIN]"); - - LOGGER.info("Application onDestroy: [ END ]"); - } - - @Override - public void onPause(final EwolContext context) { - LOGGER.info("Application onPause: [BEGIN]"); - - LOGGER.info("Application onPause: [ END ]"); - } - - @Override - public void onResume(final EwolContext context) { - LOGGER.info("Application onResume: [BEGIN]"); - - LOGGER.info("Application onResume: [ END ]"); - } - - @Override - public void onStart(final EwolContext context) { - LOGGER.info("Application onStart: [BEGIN]"); - - LOGGER.info("Application onStart: [ END ]"); - } - - @Override - public void onStop(final EwolContext context) { - LOGGER.info("Application onStop: [BEGIN]"); - - LOGGER.info("Application onStop: [ END ]"); - } - -} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/MainWindows.java deleted file mode 100644 index b6a55de..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/MainWindows.java +++ /dev/null @@ -1,27 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithButton; - -import org.atriasoft.ewol.widget.Box; -import org.atriasoft.ewol.widget.Button; - -import sample.atriasoft.ewol.BasicWindows; - -public class MainWindows extends BasicWindows { - - Box testWidget; - - public MainWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple Button"); - this.testWidget = Button.createLabelButton("A simple Label"); - //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); - // this.testWidget.setPropertyExpand(Vector2b.TRUE); - // this.testWidget.setPropertyFill(Vector2b.TRUE); - // this.testWidget.setPropertyBorderWidth(new Dimension1f(10)); - // this.testWidget.setPropertyBorderRadius(new Dimension1f(25)); - // this.testWidget.setPropertyBorderColor(Color.BLACK); - // this.testWidget.setPropertyColor(Color.GREEN_YELLOW); - // this.testWidget.setPropertyPadding(new Dimension2f(new Vector2f(15, 15))); - // this.testWidget.setPropertyMargin(new Dimension2f(new Vector2f(25, 25))); - setTestWidget(this.testWidget); - } -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/SimpleWindowsWithButtonMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/SimpleWindowsWithButtonMain.java deleted file mode 100644 index e5a6175..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithButton/SimpleWindowsWithButtonMain.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithButton; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class SimpleWindowsWithButtonMain { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); - Uri.setApplication(SimpleWindowsWithButtonMain.class, "test-ewol/"); - Ewol.run(new Appl(), args); - } - - private SimpleWindowsWithButtonMain() {} -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java deleted file mode 100644 index 702e7fb..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java +++ /dev/null @@ -1,83 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithCheckBox; - -import org.atriasoft.etk.Configs; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.ewol.context.EwolApplication; -import org.atriasoft.ewol.context.EwolContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Appl implements EwolApplication { - private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - - //! [ewol_sample_HW_main_application] - private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] - // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); - if (tmpppp == "-h" || tmpppp == "--help") { - LOGGER.info(" -h/--help display this help"); - System.exit(0); - } - } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] - // TODO : Remove this: Move if in the windows properties - context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] - // select font preference of der with a basic application size - Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] - // Create the windows - final MainWindows basicWindows = new MainWindows(); - // configure the ewol context to use the new windows - context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] - } - - @Override - public void onCreate(final EwolContext context) { - LOGGER.info("Application onCreate: [BEGIN]"); - localCreate(context); - LOGGER.info("Application onCreate: [ END ]"); - } - - @Override - public void onDestroy(final EwolContext context) { - LOGGER.info("Application onDestroy: [BEGIN]"); - - LOGGER.info("Application onDestroy: [ END ]"); - } - - @Override - public void onPause(final EwolContext context) { - LOGGER.info("Application onPause: [BEGIN]"); - - LOGGER.info("Application onPause: [ END ]"); - } - - @Override - public void onResume(final EwolContext context) { - LOGGER.info("Application onResume: [BEGIN]"); - - LOGGER.info("Application onResume: [ END ]"); - } - - @Override - public void onStart(final EwolContext context) { - LOGGER.info("Application onStart: [BEGIN]"); - - LOGGER.info("Application onStart: [ END ]"); - } - - @Override - public void onStop(final EwolContext context) { - LOGGER.info("Application onStop: [BEGIN]"); - - LOGGER.info("Application onStop: [ END ]"); - } - -} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Main.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Main.java deleted file mode 100644 index 64dedd9..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Main.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithCheckBox; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class Main { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); - Uri.setApplication(Main.class, "test-ewol/"); - Ewol.run(new Appl(), args); - } - - private Main() {} -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java deleted file mode 100644 index 39de0c5..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java +++ /dev/null @@ -1,29 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithCheckBox; - -import org.atriasoft.etk.math.Vector2b; -import org.atriasoft.ewol.widget.CheckBox; - -import sample.atriasoft.ewol.BasicWindows; - -public class MainWindows extends BasicWindows { - - CheckBox testWidget; - - public MainWindows() { - //! [ewol_sample_HW_windows_title] - setPropertyTitle("Simple CheckBox"); - - this.testWidget = new CheckBox("Hello, how Are You?
second-life?"); - //this.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); - this.testWidget.setPropertyExpand(Vector2b.TRUE); - this.testWidget.setPropertyFill(Vector2b.TRUE); - setTestWidget(this.testWidget); - /* - Button simpleButton = new Button(); - simpleButton.setPropertyValue("Top Button"); - simpleButton.setPropertyExpand(Vector2b.TRUE); - simpleButton.setPropertyFill(Vector2b.TRUE); - this.setTestWidget(simpleButton); - */ - } -} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java deleted file mode 100644 index a2691f6..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java +++ /dev/null @@ -1,83 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithImage; - -import org.atriasoft.etk.Configs; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.ewol.context.EwolApplication; -import org.atriasoft.ewol.context.EwolContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Appl implements EwolApplication { - private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class); - - //! [ewol_sample_HW_main_application] - private void localCreate(final EwolContext context) { - //! [ewol_sample_HW_main_parse_arguments] - // parse all the argument of the application - for (int iii = 0; iii < context.getCmd().size(); iii++) { - final String tmpppp = context.getCmd().get(iii); - if (tmpppp == "-h" || tmpppp == "--help") { - LOGGER.info(" -h/--help display this help"); - System.exit(0); - } - } - //! [ewol_sample_HW_main_parse_arguments] - //! [ewol_sample_HW_main_set_windows_size] - // TODO : Remove this: Move if in the windows properties - context.setSize(new Vector2f(800, 600)); - //! [ewol_sample_HW_main_set_windows_size] - //! [ewol_sample_HW_main_set_font_property] - // select font preference of der with a basic application size - Configs.getConfigFonts().set("FreeSherif", 12); - //! [ewol_sample_HW_main_set_font_property] - //! [ewol_sample_HW_main_set_windows] - // Create the windows - final MainWindows basicWindows = new MainWindows(); - // configure the ewol context to use the new windows - context.setWindows(basicWindows); - //! [ewol_sample_HW_main_set_windows] - } - - @Override - public void onCreate(final EwolContext context) { - LOGGER.info("Application onCreate: [BEGIN]"); - localCreate(context); - LOGGER.info("Application onCreate: [ END ]"); - } - - @Override - public void onDestroy(final EwolContext context) { - LOGGER.info("Application onDestroy: [BEGIN]"); - - LOGGER.info("Application onDestroy: [ END ]"); - } - - @Override - public void onPause(final EwolContext context) { - LOGGER.info("Application onPause: [BEGIN]"); - - LOGGER.info("Application onPause: [ END ]"); - } - - @Override - public void onResume(final EwolContext context) { - LOGGER.info("Application onResume: [BEGIN]"); - - LOGGER.info("Application onResume: [ END ]"); - } - - @Override - public void onStart(final EwolContext context) { - LOGGER.info("Application onStart: [BEGIN]"); - - LOGGER.info("Application onStart: [ END ]"); - } - - @Override - public void onStop(final EwolContext context) { - LOGGER.info("Application onStop: [BEGIN]"); - - LOGGER.info("Application onStop: [ END ]"); - } - -} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java deleted file mode 100644 index 5f1261a..0000000 --- a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.simpleWindowsWithImage; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class SimpleWindowsWithImageMain { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); - Uri.setApplication(SimpleWindowsWithImageMain.class, "test-ewol/"); - Ewol.run(new Appl(), args); - } - - private SimpleWindowsWithImageMain() {} -} diff --git a/samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java deleted file mode 100644 index 557c354..0000000 --- a/samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java +++ /dev/null @@ -1,69 +0,0 @@ -package sample.atriasoft.ewol.validationWidget; - -import java.util.ArrayList; -import java.util.List; - -import org.atriasoft.ewol.widget.Composer; -import org.atriasoft.ewol.widget.Widget; - -import sample.atriasoft.ewol.BasicWindows; - -public class MainWindows extends BasicWindows { - - private int index = -1; - private final List values = new ArrayList<>(); - private final List titles = new ArrayList<>(); - - public MainWindows() { - setPropertyTitle("Test all compositing"); - - this.titles.add("test button toogle"); - this.values.add(""" - - """); - this.titles.add("test Slider"); - this.values.add(""" - - """); - this.titles.add("test Entry"); - this.values.add(""" - - """); - - this.titles.add("test button"); - this.values.add(""" - - """); - - this.titles.add("test checkBox"); - this.values.add(""" - - - """); - // set first item - requestNext(); - } - - @Override - public void requestNext() { - System.out.print("Request change !!!!"); - this.index++; - if (this.titles.size() <= this.index) { - this.index = 0; - } - setPropertyTitle(this.titles.get(this.index)); - - final String dataString = this.values.get(this.index); - final Widget data = Composer.composerGenerateString(dataString); - setTestWidget(data); - } -} diff --git a/samples/src/main/sample/atriasoft/ewol/validationWidget/ValidatorMain.java b/samples/src/main/sample/atriasoft/ewol/validationWidget/ValidatorMain.java deleted file mode 100644 index ccbecd1..0000000 --- a/samples/src/main/sample/atriasoft/ewol/validationWidget/ValidatorMain.java +++ /dev/null @@ -1,15 +0,0 @@ -package sample.atriasoft.ewol.validationWidget; - -import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.Ewol; - -public class ValidatorMain { - public static void main(final String[] args) { - Ewol.init(); - //Uri.addLibrary("ne", MainCollisionTest.class, "testDataLoxelEngine/"); - Uri.setApplication(MainWindows.class); - Ewol.run(new Appl(), args); - } - - private ValidatorMain() {} -}