diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..a8bd00a --- /dev/null +++ b/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..19b27d2 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + ewol + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/samples/.classpath b/samples/.classpath new file mode 100644 index 0000000..7b9ebcf --- /dev/null +++ b/samples/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/.project b/samples/.project new file mode 100644 index 0000000..9a65b88 --- /dev/null +++ b/samples/.project @@ -0,0 +1,23 @@ + + + ewol-sample + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/samples/.settings/org.eclipse.jdt.core.prefs b/samples/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8b94239 --- /dev/null +++ b/samples/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 +org.eclipse.jdt.core.compiler.compliance=21 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=21 diff --git a/samples/.settings/org.eclipse.m2e.core.prefs b/samples/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/samples/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/samples/src/main/module-info.java_ b/samples/src/main/module-info.java_ new file mode 100644 index 0000000..509dddc --- /dev/null +++ b/samples/src/main/module-info.java_ @@ -0,0 +1,6 @@ +module sample.atriasoft.ewol { + //exports sample.atriasoft.ewol.simpleWindowsWithImage; + requires org.atriasoft.ewol; + requires org.atriasoft.etk; + requires org.atriasoft.esignal; +} \ No newline at end of file diff --git a/samples/src/main/sample/atriasoft/ewol/BasicWindows.java b/samples/src/main/sample/atriasoft/ewol/BasicWindows.java new file mode 100644 index 0000000..603d10f --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/BasicWindows.java @@ -0,0 +1,1210 @@ +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.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.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: "; + + 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 BasicWindows() { + //! [ewol_sample_HW_windows_title] + setPropertyTitle("No title set !!! for this test"); + + final Sizer sizerMain = new Sizer(DisplayMode.HORIZONTAL); + sizerMain.setPropertyExpand(Vector3b.TRUE); + sizerMain.setPropertyFill(Vector3b.TRUE); + setSubWidget(sizerMain); + + this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL); + this.sizerMenuRoot.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE); + this.sizerMenuRoot.setPropertyLockExpand(Vector3b.TRUE); + this.sizerMenuRoot.setPropertyFill(Vector3b.TRUE); + this.sizerMenuRoot.setPropertyMinSize(new Dimension3f(new Vector3f(350, 10, 10), Distance.PIXEL)); + this.sizerMenuRoot.setPropertyGravity(Gravity.TOP); + sizerMain.subWidgetAdd(this.sizerMenuRoot); + + final Button next = Button.createLabelButton("Next ..."); + this.sizerMenuRoot.subWidgetAdd(next); + next.signalClick.connectAuto(this, BasicWindows::staticRequestNext); + + this.sizerMenu = new Sizer(DisplayMode.VERTICAL); + this.sizerMenu.setPropertyExpand(Vector3b.FALSE_TRUE_FALSE); + this.sizerMenu.setPropertyLockExpand(Vector3b.TRUE); + this.sizerMenu.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.setPropertyMinSize(new Dimension3f(new Vector3f(350, 10, 10), Distance.PIXEL)); + this.sizerMenu.setPropertyGravity(Gravity.TOP); + this.sizerMenuRoot.subWidgetAdd(this.sizerMenu); + + final Sizer sizerVertMain = new Sizer(DisplayMode.VERTICAL); + sizerVertMain.setPropertyExpand(Vector3b.TRUE); + sizerVertMain.setPropertyFill(Vector3b.TRUE); + sizerMain.subWidgetAdd(sizerVertMain); + + { + final Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_128, Distance.PIXEL)); + simpleSpacer.setPropertyColor(Color.ALICE_BLUE); + simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + sizerVertMain.subWidgetAdd(simpleSpacer); + } + + this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL); + this.sizerTestAreaHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + this.sizerTestAreaHori.setPropertyExpandIfFree(Vector3b.TRUE); + this.sizerTestAreaHori.setPropertyFill(Vector3b.TRUE_FALSE_FALSE); + sizerVertMain.subWidgetAdd(this.sizerTestAreaHori); + + { + final Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.DARK_GREEN); + simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.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(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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 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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + buttonGravity.setPropertyFill(Vector3b.TRUE); + buttonGravity.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + buttonGravity.setPropertyGravity(Gravity.CENTER); + this.sizerMenu.subWidgetAdd(buttonGravity); + final Label gravLabel = (Label) (buttonGravity.getSubWidgets()[0]); + 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(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + element.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + element.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + { + final CheckBox checkBox = new CheckBox("X"); + checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + { + final CheckBox checkBox = new CheckBox("X"); + checkBox.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + checkBox.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("X"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Y"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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(Vector3b.TRUE_FALSE_FALSE); + lineSizer.setPropertyFill(Vector3b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final Label simpleLabel = new Label("Z"); + simpleLabel.setPropertyExpand(Vector3b.FALSE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final Spin spin = new Spin(); + spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE); + spin.setPropertyFill(Vector3b.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() == 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(Vector3b.TRUE_FALSE_FALSE); + simpleLabel.setPropertyFill(Vector3b.FALSE); + simpleLabel.setPropertyMinSize(new Dimension3f(Vector3f.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(Vector3b.FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.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(Vector3b.FALSE); + simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.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/ComplexWindiows1/Appl.java b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/Appl.java new file mode 100644 index 0000000..d216faf --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/Appl.java @@ -0,0 +1,83 @@ +package sample.atriasoft.ewol.ComplexWindiows1; + +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/ComplexWindiows1/ComplexeWindows1Main.java b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/ComplexeWindows1Main.java new file mode 100644 index 0000000..e1367cd --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/ComplexeWindows1Main.java @@ -0,0 +1,15 @@ +package sample.atriasoft.ewol.ComplexWindiows1; + +import org.atriasoft.etk.Uri; +import org.atriasoft.ewol.Ewol; + +public class ComplexeWindows1Main { + public static void main(final String[] args) { + Ewol.init(); + //Uri.addLibrary("ne", MainCollisionTest.class, "testDataLoxelEngine/"); + Uri.setApplication(ComplexeWindows1Main.class); + Ewol.run(new Appl(), args); + } + + private ComplexeWindows1Main() {} +} diff --git a/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java new file mode 100644 index 0000000..8c01cf4 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java @@ -0,0 +1,71 @@ +package sample.atriasoft.ewol.ComplexWindiows1; + +import org.atriasoft.etk.Color; +import org.atriasoft.etk.Dimension3f; +import org.atriasoft.etk.Distance; +import org.atriasoft.etk.math.Vector3b; +import org.atriasoft.etk.math.Vector3f; +import org.atriasoft.ewol.widget.Sizer; +import org.atriasoft.ewol.widget.Sizer.DisplayMode; +import org.atriasoft.ewol.widget.Spacer; +import org.atriasoft.ewol.widget.Windows; + +public class MainWindows extends Windows { + + public MainWindows() { + //! [ewol_sample_HW_windows_title] + setPropertyTitle("Simple sample test"); + //EwolObject.getContext().getFontDefault().setName("FreeSans"); + Sizer sizerMain = new Sizer(DisplayMode.VERTICAL); + sizerMain.setPropertyExpand(Vector3b.TRUE); + sizerMain.setPropertyFill(Vector3b.TRUE); + setSubWidget(sizerMain); + + Sizer sizerHori1 = new Sizer(DisplayMode.HORIZONTAL); + sizerHori1.setPropertyExpand(Vector3b.TRUE); + sizerHori1.setPropertyFill(Vector3b.TRUE); + sizerMain.subWidgetAdd(sizerHori1); + + Sizer sizerHori2 = new Sizer(DisplayMode.HORIZONTAL); + sizerHori2.setPropertyExpand(Vector3b.TRUE); + sizerHori2.setPropertyFill(Vector3b.TRUE); + sizerMain.subWidgetAdd(sizerHori2); + + { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyMinSize(new Dimension3f(new Vector3f(100, 100, 100), Distance.PIXEL)); + simpleSpacer.setPropertyColor(Color.ALICE_BLUE); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + sizerHori1.subWidgetAdd(simpleSpacer); + } + { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.DARK_GREEN); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + sizerHori1.subWidgetAdd(simpleSpacer); + } + { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.CHOCOLATE); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + sizerHori1.subWidgetAdd(simpleSpacer); + } + { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.GREEN_YELLOW); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + sizerHori2.subWidgetAdd(simpleSpacer); + } + { + Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyColor(Color.PINK); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.TRUE); + sizerHori2.subWidgetAdd(simpleSpacer); + } + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java new file mode 100644 index 0000000..5af9694 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/Appl.java @@ -0,0 +1,83 @@ +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 new file mode 100644 index 0000000..02fc42e --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/MainWindows.java @@ -0,0 +1,31 @@ +package sample.atriasoft.ewol.simpleWindowsLabel; + +import org.atriasoft.etk.math.Vector3b; +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(Vector3b.TRUE); + simpleLabel.setPropertyFill(Vector3b.TRUE); + this.setTestWidget(simpleLabel); + //! [ewol_sample_HW_windows_label] + } else { + final Spacer simpleSpacer = new Spacer(); + simpleSpacer.setPropertyExpand(Vector3b.TRUE); + simpleSpacer.setPropertyFill(Vector3b.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 new file mode 100644 index 0000000..6434b8a --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsLabel/SimpleWindowsLabelMain.java @@ -0,0 +1,15 @@ +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/simpleWindowsWithCheckBox/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java new file mode 100644 index 0000000..702e7fb --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/Appl.java @@ -0,0 +1,83 @@ +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/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java new file mode 100644 index 0000000..8b0f4f5 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/MainWindows.java @@ -0,0 +1,29 @@ +package sample.atriasoft.ewol.simpleWindowsWithCheckBox; + +import org.atriasoft.etk.math.Vector3b; +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(Vector3b.TRUE); + this.testWidget.setPropertyFill(Vector3b.TRUE); + this.setTestWidget(this.testWidget); + /* + Button simpleButton = new Button(); + simpleButton.setPropertyValue("Top Button"); + simpleButton.setPropertyExpand(Vector3b.TRUE); + simpleButton.setPropertyFill(Vector3b.TRUE); + this.setTestWidget(simpleButton); + */ + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/SimpleWindowsWithCheckBoxMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/SimpleWindowsWithCheckBoxMain.java new file mode 100644 index 0000000..7733474 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithCheckBox/SimpleWindowsWithCheckBoxMain.java @@ -0,0 +1,15 @@ +package sample.atriasoft.ewol.simpleWindowsWithCheckBox; + +import org.atriasoft.etk.Uri; +import org.atriasoft.ewol.Ewol; + +public class SimpleWindowsWithCheckBoxMain { + public static void main(final String[] args) { + Ewol.init(); + //Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/"); + Uri.setApplication(SimpleWindowsWithCheckBoxMain.class, "test-ewol/"); + Ewol.run(new Appl(), args); + } + + private SimpleWindowsWithCheckBoxMain() {} +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java new file mode 100644 index 0000000..a2691f6 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java @@ -0,0 +1,83 @@ +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/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java new file mode 100644 index 0000000..4bf5a95 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java @@ -0,0 +1,57 @@ +package sample.atriasoft.ewol.simpleWindowsWithImage; + +import org.atriasoft.etk.Dimension3f; +import org.atriasoft.etk.Distance; +import org.atriasoft.etk.Uri; +import org.atriasoft.etk.math.Vector3b; +import org.atriasoft.etk.math.Vector3f; +import org.atriasoft.ewol.widget.Button; +import org.atriasoft.ewol.widget.ImageDisplay; + +import sample.atriasoft.ewol.BasicWindows; + +public class MainWindows extends BasicWindows { + + public static void eventButtonChangeImage(final MainWindows self, final Boolean value) { + if (value) { + self.testWidget.setPropertySource(new Uri("DATA", "mireC.png")); + } else { + self.testWidget.setPropertySource(new Uri("DATA", "mireA.png")); + } + } + + public static void eventButtonChangeKeepRatio(final MainWindows self) { + final boolean state = self.testWidget.isPropertyKeepRatio(); + self.testWidget.setPropertyKeepRatio(!state); + //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(Vector3b.TRUE); + this.testWidget.setPropertyFill(Vector3b.TRUE); + this.testWidget.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + this.setTestWidget(this.testWidget); + { + final Button button = Button.createToggleLabelButton("mireA.png", "mireC.png"); + button.setPropertyExpand(Vector3b.FALSE); + button.setPropertyFill(Vector3b.FALSE); + button.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + this.addButton(button); + button.signalValue.connectAuto(this, MainWindows::eventButtonChangeImage); + } + this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio"); + this.buttonAspectRatio.setPropertyExpand(Vector3b.FALSE); + this.buttonAspectRatio.setPropertyFill(Vector3b.FALSE); + this.buttonAspectRatio.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL)); + this.addButton(this.buttonAspectRatio); + this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio); + } +} diff --git a/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java new file mode 100644 index 0000000..5f1261a --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/simpleWindowsWithImage/SimpleWindowsWithImageMain.java @@ -0,0 +1,15 @@ +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/Appl.java b/samples/src/main/sample/atriasoft/ewol/validationWidget/Appl.java new file mode 100644 index 0000000..3027a8b --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/validationWidget/Appl.java @@ -0,0 +1,83 @@ +package sample.atriasoft.ewol.validationWidget; + +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/validationWidget/MainWindows.java b/samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java new file mode 100644 index 0000000..557c354 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/validationWidget/MainWindows.java @@ -0,0 +1,69 @@ +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 new file mode 100644 index 0000000..ccbecd1 --- /dev/null +++ b/samples/src/main/sample/atriasoft/ewol/validationWidget/ValidatorMain.java @@ -0,0 +1,15 @@ +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() {} +} diff --git a/samples/src/resources/logback.xml b/samples/src/resources/logback.xml new file mode 100644 index 0000000..af419ee --- /dev/null +++ b/samples/src/resources/logback.xml @@ -0,0 +1,53 @@ + + + + + + + + + + %green(%d{HH:mm:ss.SSS}) %highlight(%-5level) %-30((%file:%line\)): %msg%n + + + + + + + + + + + + + + + + + + [%thread] %level %logger - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/TestResources/logback.xml b/src/TestResources/logback.xml new file mode 100644 index 0000000..af419ee --- /dev/null +++ b/src/TestResources/logback.xml @@ -0,0 +1,53 @@ + + + + + + + + + + %green(%d{HH:mm:ss.SSS}) %highlight(%-5level) %-30((%file:%line\)): %msg%n + + + + + + + + + + + + + + + + + + [%thread] %level %logger - %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/module-info.java_ b/src/main/module-info.java_ new file mode 100644 index 0000000..e1b3cc0 --- /dev/null +++ b/src/main/module-info.java_ @@ -0,0 +1,28 @@ +/** Basic module interface. + * + * @author Edouard DUPIN */ + +open module org.atriasoft.ewol { + exports org.atriasoft.ewol; + exports org.atriasoft.ewol.compositing; + exports org.atriasoft.ewol.compositing.tools; + exports org.atriasoft.ewol.context; + exports org.atriasoft.ewol.event; + exports org.atriasoft.ewol.object; + exports org.atriasoft.ewol.resource; + exports org.atriasoft.ewol.resource.font; + //exports org.atriasoft.ewol.tools; + exports org.atriasoft.ewol.widget; + exports org.atriasoft.ewol.widget.meta; + + requires transitive org.atriasoft.esignal; + requires transitive org.atriasoft.iogami; + requires transitive org.atriasoft.gale; + requires transitive org.atriasoft.etk; + requires transitive org.atriasoft.esvg; + requires transitive org.atriasoft.exml; + requires transitive org.atriasoft.ejson; + requires org.atriasoft.loader3d; + requires org.atriasoft.egami; + requires java.base; +} diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java new file mode 100644 index 0000000..29c5657 --- /dev/null +++ b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java @@ -0,0 +1,397 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ +package org.atriasoft.ewol.compositing; + +import org.atriasoft.egami.ImageByte; +import org.atriasoft.egami.ImageByteRGBA; +import org.atriasoft.egami.ToolImage; +import org.atriasoft.esvg.EsvgDocument; +import org.atriasoft.etk.Color; +import org.atriasoft.etk.Uri; +import org.atriasoft.etk.math.Matrix4f; +import org.atriasoft.etk.math.Vector2f; +import org.atriasoft.etk.math.Vector2i; +import org.atriasoft.etk.math.Vector3f; +import org.atriasoft.gale.backend3d.OpenGL; +import org.atriasoft.gale.backend3d.OpenGL.RenderMode; +import org.atriasoft.gale.resource.ResourceProgram; +import org.atriasoft.gale.resource.ResourceTexture2; +import org.atriasoft.gale.resource.ResourceVirtualArrayObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CompositingSVG extends Compositing { + private static final Logger LOGGER = LoggerFactory.getLogger(CompositingSVG.class); + public static final int NB_VBO = 3; + public static final int SIZE_AUTO = 0; + public static final int VBO_ID_COLOR = 2; + // VBO table property: + public static final int VBO_ID_COORD = 0; + public static final int VBO_ID_COORD_TEX = 1; + private float angle = 0; //!< Angle to set at the axes + private Color color = new Color(1, 1, 1); //!< The text foreground color + private String svgData; + protected int oGLMatrixProjection = -1; //!< openGL id on the element (Projection matrix) + protected int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix) + protected int oGLMatrixView = -1; //!< openGL id on the element (view matrix) + private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program + private Vector3f position = Vector3f.ZERO; //!< The current position to draw + private Vector2i requestSize = new Vector2i(2, 2); + + private ResourceTexture2 resource = null; + private ResourceTexture2 resourceImage = null; //!< texture resources + private ResourceVirtualArrayObject vbo = null; + + private Color[] vboDataColors = null; + private Vector3f[] vboDataCoords = null; + private Vector2f[] vboDataCoordsTex = null; + + public CompositingSVG() { + this("", CompositingSVG.SIZE_AUTO); + } + + public CompositingSVG(final String data, final int size) { + this.svgData = data; + // Create the VBO: + this.vbo = ResourceVirtualArrayObject.createDynamic(); + if (this.vbo == null) { + LOGGER.error("can not instanciate VBO ..."); + return; + } + // TO facilitate some debugs we add a name of the VBO: + this.vbo.setName("[VBO] of " + this.getClass().getCanonicalName()); + setSource(data, size); + loadProgram(); + } + + /** + * clear alll tre registered element in the current element + */ + @Override + public void clear() { + // call upper class + super.clear(); + // reset Buffer : + this.vbo.clear(); + // reset temporal variables : + this.position = Vector3f.ZERO; + this.color = Color.WHITE; + this.angle = 0; + } + + /** + * draw All the registered text in the current element on openGL + * @param disableDepthTest disable the Depth test for display + */ + @Override + public void draw(final boolean disableDepthTest) { + /* + if (this.VBO.bufferSize(this.vboIdCoord) <= 0) { + //LOGGER.warn("Nothink to draw..."); + return; + } + */ + if (this.resourceImage == null) { + return; + } + if (this.oGLprogram == null) { + LOGGER.error("No shader ..."); + return; + } + //LOGGER.warn("Display image : " + this.VBO.bufferSize(this.vboIdCoord)); + if (disableDepthTest) { + OpenGL.disable(OpenGL.Flag.flag_depthTest); + } else { + OpenGL.enable(OpenGL.Flag.flag_depthTest); + } + // set Matrix : translation/positionMatrix + final Matrix4f projMatrix = OpenGL.getMatrix(); + final Matrix4f camMatrix = OpenGL.getCameraMatrix(); + this.oGLprogram.use(); + this.vbo.bindForRendering(); + this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix); + this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, this.matrixApply); + this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix); + // TextureID + this.resourceImage.bindForRendering(0); + this.vbo.renderArrays(RenderMode.TRIANGLE); + this.vbo.unBindForRendering(); + this.oGLprogram.unUse(); + } + + @Override + public void flush() { + this.vbo.setPosition(this.vboDataCoords); + this.vbo.setTextureCoordinate(this.vboDataCoordsTex); + this.vbo.setColors(this.vboDataColors); + this.vbo.setVertexCount(this.vboDataCoords.length); + this.vbo.flush(); + } + + /** + * get the current display position (sometime needed in the gui control) + * @return the current position. + */ + public Vector3f getPos() { + return this.position; + } + + /** + * get the source image registered size in the file (<0 when multiple size image) + * @return tre image registered size + */ + public Vector2i getRealSize() { + if (this.resourceImage == null) { + return Vector2i.ZERO; + } + return this.resourceImage.getUsableSize(); + } + + /** + * Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. + * @return the validity od the resources. + */ + public boolean hasSources() { + return this.resource != null; + } + + /** + * load the openGL program and get all the ID needed + */ + private void loadProgram() { + // get the shader resource: + this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"), + new Uri("DATA", "textured3D.frag", "ewol")); + if (this.oGLprogram != null) { + this.oGLMatrixTransformation = this.oGLprogram.getUniform("in_matrixTransformation"); + this.oGLMatrixProjection = this.oGLprogram.getUniform("in_matrixProjection"); + this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView"); + } + } + + public void print(final Vector2f size) { + printPart(size, Vector2f.ZERO, Vector2f.ONE); + } + + /** + * add a compleate of the image to display with the requested size + * @param size size of the output image + */ + public void print(final Vector2i size) { + print(new Vector2f(size.x(), size.y())); + } + + /** + * add a part of the image to display with the requested size + * @param size size of the output image + * @param sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image). + * @param sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image). + */ + public void printPart(final Vector2f size, final Vector2f sourcePosStartIn, final Vector2f sourcePosStopIn) { + if (this.resource == null) { + return; + } + final Vector2f openGLSize = new Vector2f(this.resource.getOpenGlSize().x(), this.resource.getOpenGlSize().y()); + final Vector2i usefullSize = this.resource.getUsableSize(); + final Vector2f ratio = new Vector2f(usefullSize.x() / openGLSize.x(), usefullSize.y() / openGLSize.y()); + final Vector2f sourcePosStart = sourcePosStartIn.multiply(ratio); + final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio); + LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart + + " stop=" + sourcePosStop); + + this.vboDataColors = new Color[6]; + this.vboDataCoords = new Vector3f[6]; + this.vboDataCoordsTex = new Vector2f[6]; + + if (this.angle == 0.0f) { + Vector3f point = this.position; + int indexElem = 0; + + Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); + point = new Vector3f(this.position.x() + size.x(), this.position.y(), 0); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); + point = new Vector3f(this.position.x() + size.x(), this.position.y() + size.y(), 0); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); + point = new Vector3f(this.position.x(), this.position.y() + size.y(), 0); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); + point = new Vector3f(this.position.x(), this.position.y(), 0); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + + return; + } + + final Vector3f center = this.position.add(new Vector3f(size.x(), size.y(), 0)).divide(2.0f); + + final Vector3f limitedSize = new Vector3f(size.x() * 0.5f, size.y() * 0.5f, 0.0f); + + Vector3f point = Vector3f.ZERO; + + Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); + + int indexElem = 0; + + point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); + point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); + point = new Vector3f(limitedSize.x(), -limitedSize.y(), 0); + point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); + point = new Vector3f(limitedSize.x(), limitedSize.y(), 0); + point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); + point = new Vector3f(-limitedSize.x(), limitedSize.y(), 0); + point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + indexElem++; + + tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); + point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); + point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); + this.vboDataCoords[indexElem] = point; + this.vboDataCoordsTex[indexElem] = tex; + this.vboDataColors[indexElem] = this.color; + + } + + /** + * set a unique rotation of this element (not set in the rotate Generic system) + * @param angleRad Angle to set in radiant. + */ + public void setAngle(final float angleRad) { + this.angle = angleRad; + } + + /** + * set the Color of the current foreground font + * @param color Color to set on foreground (for next print) + */ + public void setColor(final Color color) { + this.color = color; + } + + public void setPos(final Vector2f pos) { + setPos(new Vector3f(pos.x(), pos.y(), 0)); + } + + /** + * set position for the next text writen + * @param pos Position of the text (in 3D) + */ + public void setPos(final Vector3f pos) { + this.position = pos; + } + + public void setRelPos(final Vector2f pos) { + setRelPos(new Vector3f(pos.x(), pos.y(), 0)); + } + + /** + * set relative position for the next text writen + * @param pos ofset apply of the text (in 3D) + */ + public void setRelPos(final Vector3f pos) { + this.position = this.position.add(pos); + } + + public void setSource(final ImageByteRGBA image) { + clear(); + this.svgData = null; + this.requestSize = image.getSize(); + this.resourceImage = new ResourceTexture2(); + this.resourceImage.set(image); + } + + public void setSource(final String data) { + setSource(data, 32); + } + + public void setSource(final String data, final int size) { + setSource(data, new Vector2i(size, size)); + } + + public void setSource(final String data, final Vector2i size) { + clear(); + + final EsvgDocument doc = new EsvgDocument(); + doc.parse(data); + final ImageByte tmp = ToolImage.convertImageByte(doc.renderImageFloatRGBA(size)); + if (tmp == null) { + LOGGER.error("Can not load the Raw SVG ... "); + return; + } + this.resourceImage.set(tmp); + + if (this.svgData.equals(data) && this.requestSize.x() == size.x() && this.requestSize.y() == size.y()) { + // Nothing to do ... + return; + } + final ResourceTexture2 resource = this.resource; + final ResourceTexture2 resourceTex = this.resourceImage; + this.svgData = data; + this.requestSize = size; + this.resource = null; + this.resourceImage = null; + + final Vector2i tmpSize = new Vector2i(size.x(), size.y()); + + // link to new one + this.resource = ResourceTexture2.create(); + if (this.resource == null) { + LOGGER.error("Can not get Image resource"); + } + } + +} diff --git a/src/resources/resources/ewol/theme/shape/Slider.emf b/src/resources/resources/ewol/theme/shape/Slider.emf new file mode 100644 index 0000000..c64a160 --- /dev/null +++ b/src/resources/resources/ewol/theme/shape/Slider.emf @@ -0,0 +1,55 @@ +EMF(STRING) +# Blender v3.2.2 EMF File: 'Slider.blend' +Mesh:Background_Cube + Vertex:8 + -19.899271 0.013653 -7.090058|20.135780 -0.013816 -7.091342|-11.978650 7.060808 -0.005660|12.109317 7.009231 -0.006946|-11.988304 -7.009315 -0.006822|12.099687 -7.025841 -0.006946|-19.970213 0.015238 7.080030|20.212339 -0.013868 7.078948| + UV-mapping: + 0.074219 0.995849|0.120606 0.943115|0.121582 0.993408|0.073324 0.991157|0.112927 0.992387|0.078245 0.948093|0.102023 0.957458|0.101769 0.970961|0.080974 0.959440|0.082167 0.983774|0.113157 0.949323|0.078476 0.953015|0.074219 0.944092|0.111927 0.985005|0.174907 0.947863|0.178598 0.993618|0.131613 0.991157|0.142456 0.948632|0.178368 0.988235|0.137534 0.984544|0.171985 0.949093|0.173216 0.991157|0.136074 0.991157|0.174677 0.949093|0.135074 0.992387|0.136304 0.949093|0.178368 0.944941|0.175907 0.989926| + Normal(face):12 + -0.000484 -0.710494 0.703703|0.658059 -0.000452 -0.752966|-0.663681 0.000517 -0.748015|0.000534 0.710552 0.703645|-0.000496 -0.710521 0.703676|0.001554 0.708234 0.705976|-0.666861 0.000396 0.745182|-0.000510 -0.710438 -0.703759|0.661515 -0.000454 0.749932|0.000465 0.710438 -0.703759|-0.000491 -0.710395 -0.703803|0.001479 0.708140 -0.706070| + Face:12 + palette:gui_border_1 + 5/0/0 6/1/0 4/2/0| 5/3/1 3/4/1 7/5/1| 2/6/2 4/7/2 6/8/2| 3/9/3 6/10/3 7/11/3| 5/0/4 7/12/4 6/1/4| 3/9/5 2/13/5 6/10/5| + palette:gui_border_2 + 0/14/6 4/15/6 2/16/6| 5/17/7 0/18/7 1/19/7| 1/20/8 3/21/8 5/22/8| 0/23/9 3/24/9 1/25/9| 5/17/10 4/26/10 0/18/10| 0/23/11 2/27/11 3/24/11| +Mesh:Slider_Cube.001 + Vertex:12 + -1.392792 10.016173 4.974034|1.417824 10.013016 4.974034|-0.007534 11.437571 4.974034|1.384170 -10.026020 4.974034|0.002411 -11.410795 4.974034|-1.396495 -10.011983 4.974034|-1.392791 10.016173 -5.048842|1.417825 10.013015 -5.048842|-0.007534 11.437570 -5.048842|1.384170 -10.026021 -5.048842|0.002412 -11.410795 -5.048842|-1.396495 -10.011985 -5.048842| + UV-mapping: + 0.000000 0.000000| + Normal(face):20 + 0.707877 -0.706335 0.000000|0.706907 0.707306 -0.000000|0.000000 0.000000 -1.000000|-1.000000 0.000185 -0.000000|-0.707083 -0.707130 -0.000000|-0.716152 0.697944 -0.000000|0.999999 -0.001679 0.000000|0.000000 0.000000 1.000000|-0.707082 -0.707131 0.000000| + Face:20 + palette:gui_slider + 4/0/0 9/0/0 3/0/0| 1/0/1 8/0/1 2/0/1| 7/0/2 9/0/2 11/0/2| 6/0/3 5/0/3 0/0/3| 5/0/4 10/0/4 4/0/4| 2/0/5 6/0/5 0/0/5| 3/0/6 7/0/6 1/0/6| 5/0/7 1/0/7 0/0/7| 4/0/7 3/0/7 5/0/7| 2/0/7 0/0/7 1/0/7| 4/0/0 10/0/0 9/0/0| 1/0/1 7/0/1 8/0/1| 9/0/2 10/0/2 11/0/2| 11/0/2 6/0/2 7/0/2| 6/0/2 8/0/2 7/0/2| 6/0/3 11/0/3 5/0/3| 5/0/8 11/0/8 10/0/8| 2/0/5 8/0/5 6/0/5| 3/0/6 9/0/6 7/0/6| 5/0/7 3/0/7 1/0/7| + +# Just for information: +Palettes:gui_border_1 + Ns 225.000000 + Ka 1.000000 1.000000 1.000000 + Kd 0.000000 0.002615 0.800000 + Ks 0.500000 0.500000 0.500000 + Ke 0.000000 0.000000 0.000000 + vNi 1.450000 + d 1.000000 + illum 2 +# Just for information: +Palettes:gui_border_2 + Ns 225.000000 + Ka 1.000000 1.000000 1.000000 + Kd 0.000000 0.800000 0.170495 + Ks 0.500000 0.500000 0.500000 + Ke 0.000000 0.000000 0.000000 + vNi 1.450000 + d 1.000000 + illum 2 +# Just for information: +Palettes:gui_slider + Ns 225.000000 + Ka 1.000000 1.000000 1.000000 + Kd 0.638272 0.000000 0.447210 + Ks 0.500000 0.500000 0.500000 + Ke 0.000000 0.000000 0.000000 + vNi 1.450000 + d 1.000000 + illum 2 diff --git a/src/resources/resources/ewol/theme/shape/Slider.json b/src/resources/resources/ewol/theme/shape/Slider.json new file mode 100644 index 0000000..0a89301 --- /dev/null +++ b/src/resources/resources/ewol/theme/shape/Slider.json @@ -0,0 +1,25 @@ +{ + # padding "outside" the object in pixel ==> prevent bad display + "padding-out-left":2, + "padding-out-right":2, + "padding-out-top":2, + "padding-out-buttom":2, + + # padding "inside" the object in pixel ==> prevent bad display + "padding-in-left":0, + "padding-in-right":0, + "padding-in-top":0, + "padding-in-buttom":0, + + # render program: + "program-vert":"THEME:shape/aaRenderShapeScale.vert?lib=ewol", + "program-frag":"THEME:shape/aaRenderShape.frag?lib=ewol", + + # Object to render (with modification) + "object-file":"THEME:shape/Slider.emf?lib=ewol&filter=^Background.*$", + "object-file-2":"THEME:shape/Slider.emf?lib=ewol&filter=^Slider.*$", + + "palette":"THEME:shape/palette_gui.json?lib=ewol", + + "change-time":100 +}