[FEAT] manage a good display of the rectangle ==> next step is corecting the box

This commit is contained in:
Edouard DUPIN 2025-07-17 23:23:05 +02:00
parent 29ef90c1a3
commit 3bbe3afe23
5 changed files with 207 additions and 166 deletions

View File

@ -45,25 +45,25 @@ import org.slf4j.LoggerFactory;
public class ModelWidget extends Container { public class ModelWidget extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(ModelWidget.class); private static final Logger LOGGER = LoggerFactory.getLogger(ModelWidget.class);
private static final String LABEL_GRAVITY = "gravity: "; private static final String LABEL_GRAVITY = "gravity: ";
Widget testWidget; Widget testWidget;
Sizer sizerTestAreaHori; Sizer sizerTestAreaHori;
Sizer sizerMenuRoot; Sizer sizerMenuRoot;
Sizer sizerMenu; Sizer sizerMenu;
Gravity basicGravity = Gravity.BOTTOM_LEFT; Gravity basicGravity = Gravity.BOTTOM_LEFT;
private final List<Connection> conections = new ArrayList<>(); private final List<Connection> conections = new ArrayList<>();
public ModelWidget(final TestWidgetInterface interfaceToTest) { public ModelWidget(final TestWidgetInterface interfaceToTest) {
setPropertyExpand(Vector2b.TRUE); setPropertyExpand(Vector2b.TRUE);
setPropertyFill(Vector2b.TRUE); setPropertyFill(Vector2b.TRUE);
final var sizerMain = new Sizer(DisplayMode.HORIZONTAL); final var sizerMain = new Sizer(DisplayMode.HORIZONTAL);
sizerMain.setPropertyExpand(Vector2b.TRUE); sizerMain.setPropertyExpand(Vector2b.TRUE);
sizerMain.setPropertyFill(Vector2b.TRUE); sizerMain.setPropertyFill(Vector2b.TRUE);
setSubWidget(sizerMain); setSubWidget(sizerMain);
this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL); this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL);
this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE); this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE);
this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE); this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE);
@ -71,7 +71,7 @@ public class ModelWidget extends Container {
this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
this.sizerMenuRoot.setPropertyGravity(Gravity.TOP); this.sizerMenuRoot.setPropertyGravity(Gravity.TOP);
sizerMain.subWidgetAdd(this.sizerMenuRoot); sizerMain.subWidgetAdd(this.sizerMenuRoot);
this.sizerMenu = new Sizer(DisplayMode.VERTICAL); this.sizerMenu = new Sizer(DisplayMode.VERTICAL);
this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE); this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE);
this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE); this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE);
@ -79,12 +79,12 @@ public class ModelWidget extends Container {
this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL)); this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
this.sizerMenu.setPropertyGravity(Gravity.TOP); this.sizerMenu.setPropertyGravity(Gravity.TOP);
this.sizerMenuRoot.subWidgetAdd(this.sizerMenu); this.sizerMenuRoot.subWidgetAdd(this.sizerMenu);
final var sizerVertMain = new Sizer(DisplayMode.VERTICAL); final var sizerVertMain = new Sizer(DisplayMode.VERTICAL);
sizerVertMain.setPropertyExpand(Vector2b.TRUE); sizerVertMain.setPropertyExpand(Vector2b.TRUE);
sizerVertMain.setPropertyFill(Vector2b.TRUE); sizerVertMain.setPropertyFill(Vector2b.TRUE);
sizerMain.subWidgetAdd(sizerVertMain); sizerMain.subWidgetAdd(sizerVertMain);
{ {
final var simpleSpacer = new Spacer(); final var simpleSpacer = new Spacer();
simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL));
@ -95,13 +95,13 @@ public class ModelWidget extends Container {
simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
sizerVertMain.subWidgetAdd(simpleSpacer); sizerVertMain.subWidgetAdd(simpleSpacer);
} }
this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL); this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL);
this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE); this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE);
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE); this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE);
this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE); this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE);
sizerVertMain.subWidgetAdd(this.sizerTestAreaHori); sizerVertMain.subWidgetAdd(this.sizerTestAreaHori);
{ {
final var simpleSpacer = new Spacer(); final var simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.DARK_GREEN); simpleSpacer.setPropertyColor(Color.DARK_GREEN);
@ -114,11 +114,11 @@ public class ModelWidget extends Container {
// add the default widget to test: // add the default widget to test:
setTestWidget(interfaceToTest.getWidget()); setTestWidget(interfaceToTest.getWidget());
} }
public void addButton(final Widget widget) { public void addButton(final Widget widget) {
this.sizerMenu.subWidgetAdd(widget); this.sizerMenu.subWidgetAdd(widget);
} }
public void addMenuBoolean(final Widget widget, final IntrospectionProperty pojo) { public void addMenuBoolean(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -145,7 +145,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -160,7 +160,7 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -184,7 +184,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -199,14 +199,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -232,14 +232,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -262,7 +262,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuDimension3f(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDimension3f(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -277,14 +277,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -310,14 +310,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -343,14 +343,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Z"); final var simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -373,7 +373,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuDouble(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDouble(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -400,7 +400,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuFloat(final Widget widget, final IntrospectionProperty pojo) { public void addMenuFloat(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -427,7 +427,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuGravity(final Widget widget, final IntrospectionProperty pojo) { public void addMenuGravity(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -445,7 +445,7 @@ public class ModelWidget extends Container {
this.sizerMenu.subWidgetAdd(buttonGravity); this.sizerMenu.subWidgetAdd(buttonGravity);
final var gravLabel = (Label) buttonGravity.getSubWidget(); final var gravLabel = (Label) buttonGravity.getSubWidget();
gravLabel.setPropertyValue(LABEL_GRAVITY + Gravity.BOTTOM_LEFT); gravLabel.setPropertyValue(LABEL_GRAVITY + Gravity.BOTTOM_LEFT);
final var con = buttonGravity.signalClick.connect(() -> { final var con = buttonGravity.signalClick.connect(() -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -458,14 +458,14 @@ public class ModelWidget extends Container {
state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.BOTTOM, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.BOTTOM, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.BOTTOM) { } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.BOTTOM) {
state = new Gravity(GravityHorizontal.LEFT, GravityVertical.CENTER, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.LEFT, GravityVertical.CENTER, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.CENTER) { } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.CENTER) {
state = new Gravity(GravityHorizontal.CENTER, GravityVertical.CENTER, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.CENTER, GravityVertical.CENTER, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.CENTER) { } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.CENTER) {
state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.CENTER, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.RIGHT, GravityVertical.CENTER, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.CENTER) { } else if (state.x() == GravityHorizontal.RIGHT && state.y() == GravityVertical.CENTER) {
state = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.TOP) { } else if (state.x() == GravityHorizontal.LEFT && state.y() == GravityVertical.TOP) {
state = new Gravity(GravityHorizontal.CENTER, GravityVertical.TOP, GravityDepth.CENTER); state = new Gravity(GravityHorizontal.CENTER, GravityVertical.TOP, GravityDepth.CENTER);
} else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.TOP) { } else if (state.x() == GravityHorizontal.CENTER && state.y() == GravityVertical.TOP) {
@ -485,7 +485,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuInt(final Widget widget, final IntrospectionProperty pojo) { public void addMenuInt(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -504,7 +504,7 @@ public class ModelWidget extends Container {
try { try {
LOGGER.warn("Set new value: {}", valueButton); LOGGER.warn("Set new value: {}", valueButton);
pojo.setExistingValue(widget, (int) (long) valueButton); pojo.setExistingValue(widget, (int) (long) valueButton);
} catch (final AknotException e) { } catch (final AknotException e) {
e.printStackTrace(); e.printStackTrace();
return; return;
@ -513,7 +513,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuLong(final Widget widget, final IntrospectionProperty pojo) { public void addMenuLong(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -540,7 +540,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuString(final Widget widget, final IntrospectionProperty pojo) { public void addMenuString(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -567,7 +567,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuURI(final Widget widget, final IntrospectionProperty pojo) { public void addMenuURI(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -594,7 +594,7 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
public void addMenuVector2b(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector2b(final Widget widget, final IntrospectionProperty pojo) {
final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); final var lineSizer = new Sizer(DisplayMode.HORIZONTAL);
Object valueRaw = null; Object valueRaw = null;
@ -648,9 +648,9 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
} }
public void addMenuVector2f(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector2f(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -665,14 +665,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -697,14 +697,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -726,7 +726,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuVector2i(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector2i(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -741,14 +741,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -773,14 +773,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -802,7 +802,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuVector3b(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector3b(final Widget widget, final IntrospectionProperty pojo) {
final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); final var lineSizer = new Sizer(DisplayMode.HORIZONTAL);
Object valueRaw = null; Object valueRaw = null;
@ -875,9 +875,9 @@ public class ModelWidget extends Container {
this.conections.add(con); this.conections.add(con);
} }
} }
} }
public void addMenuVector3f(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector3f(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -892,14 +892,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -924,14 +924,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -956,14 +956,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Z"); final var simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -985,7 +985,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuVector3i(final Widget widget, final IntrospectionProperty pojo) { public void addMenuVector3i(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -1000,14 +1000,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("X"); final var simpleLabel = new Label("X");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -1032,14 +1032,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Y"); final var simpleLabel = new Label("Y");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -1064,14 +1064,14 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("Z"); final var simpleLabel = new Label("Z");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
@ -1093,7 +1093,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception { public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception {
LOGGER.warn("Connect all signal(s) on '{}'", widget.getName()); LOGGER.warn("Connect all signal(s) on '{}'", widget.getName());
final var signals = modelPojo.getSignals(); final var signals = modelPojo.getSignals();
@ -1102,10 +1102,10 @@ public class ModelWidget extends Container {
LOGGER.warn(" ==> description='{}'", pojo.getDescription()); LOGGER.warn(" ==> description='{}'", pojo.getDescription());
LOGGER.warn(" ==> type='{}'", pojo.getType()); LOGGER.warn(" ==> type='{}'", pojo.getType());
LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType()); LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType());
final var eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0] final var eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0]
: pojo.getBeanName(); : pojo.getBeanName();
if (pojo.getSubType() != null && pojo.getType() == Signal.class) { if (pojo.getSubType() != null && pojo.getType() == Signal.class) {
LOGGER.warn(" ** Signal<{}>", pojo.getSubType()); LOGGER.warn(" ** Signal<{}>", pojo.getSubType());
final var signalObject = pojo.getValue(widget); final var signalObject = pojo.getValue(widget);
@ -1132,11 +1132,11 @@ public class ModelWidget extends Container {
LOGGER.info("Get event from '{}'", valueNameOfSignal); LOGGER.info("Get event from '{}'", valueNameOfSignal);
}); });
} }
} }
} }
} }
public void addMenuDimensionBorderRadius(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDimensionBorderRadius(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -1151,19 +1151,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("bottom-left"); final var simpleLabel = new Label("bottom-left");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().bottomLeft()); spin.setPropertyValue((int) value.size().bottomLeft());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1184,19 +1187,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("bottom-right"); final var simpleLabel = new Label("bottom-right");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().bottomRight()); spin.setPropertyValue((int) value.size().bottomRight());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1217,19 +1223,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("top-right"); final var simpleLabel = new Label("top-right");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().topRight()); spin.setPropertyValue((int) value.size().topRight());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1250,19 +1259,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("top-left"); final var simpleLabel = new Label("top-left");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().topLeft()); spin.setPropertyValue((int) value.size().topLeft());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1280,7 +1292,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void addMenuDimensionInsets(final Widget widget, final IntrospectionProperty pojo) { public void addMenuDimensionInsets(final Widget widget, final IntrospectionProperty pojo) {
Object valueRaw = null; Object valueRaw = null;
try { try {
@ -1295,19 +1307,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("left"); final var simpleLabel = new Label("left");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().left()); spin.setPropertyValue((int) value.size().left());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1328,19 +1343,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("bottom"); final var simpleLabel = new Label("bottom");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().bottom()); spin.setPropertyValue((int) value.size().bottom());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1361,19 +1379,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("right"); final var simpleLabel = new Label("right");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().right()); spin.setPropertyValue((int) value.size().right());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1394,19 +1415,22 @@ public class ModelWidget extends Container {
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
lineSizer.setPropertyFill(Vector2b.TRUE); lineSizer.setPropertyFill(Vector2b.TRUE);
this.sizerMenu.subWidgetAdd(lineSizer); this.sizerMenu.subWidgetAdd(lineSizer);
final var simpleLabel = new Label("top"); final var simpleLabel = new Label("top");
simpleLabel.setPropertyExpand(Vector2b.FALSE); simpleLabel.setPropertyExpand(Vector2b.FALSE);
simpleLabel.setPropertyFill(Vector2b.TRUE); simpleLabel.setPropertyFill(Vector2b.TRUE);
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); simpleLabel.setPropertyMinSize(new Dimension2f(new Vector2f(100, 0), Distance.PIXEL));
simpleLabel.setPropertyGravity(Gravity.LEFT); simpleLabel.setPropertyGravity(Gravity.LEFT);
lineSizer.subWidgetAdd(simpleLabel); lineSizer.subWidgetAdd(simpleLabel);
final var spin = new Spin(); final var spin = new Spin();
spin.setPropertyExpand(Vector2b.TRUE_FALSE); spin.setPropertyExpand(Vector2b.TRUE_FALSE);
spin.setPropertyFill(Vector2b.TRUE); spin.setPropertyFill(Vector2b.TRUE);
spin.setPropertyValue((int) value.size().top()); spin.setPropertyValue((int) value.size().top());
lineSizer.subWidgetAdd(spin); lineSizer.subWidgetAdd(spin);
final var spacer = new Spacer();
spacer.setPropertyMinSize(new Dimension2f(new Vector2f(5, 0), Distance.PIXEL));
lineSizer.subWidgetAdd(spacer);
final var con = spin.signalValue.connect(newValue -> { final var con = spin.signalValue.connect(newValue -> {
try { try {
final var oldValue = pojo.getValue(widget); final var oldValue = pojo.getValue(widget);
@ -1424,7 +1448,7 @@ public class ModelWidget extends Container {
} }
} }
} }
public void displayAllPropertyWithType(final Widget widget, final IntrospectionModel modelPojo) throws Exception { public void displayAllPropertyWithType(final Widget widget, final IntrospectionModel modelPojo) throws Exception {
LOGGER.warn("Connect all property(ies) on '{}'", widget.getName()); LOGGER.warn("Connect all property(ies) on '{}'", widget.getName());
final var atributes = modelPojo.getAttributes(); final var atributes = modelPojo.getAttributes();
@ -1488,12 +1512,12 @@ public class ModelWidget extends Container {
} }
} }
} }
public void setTestWidget(final Widget widget) { public void setTestWidget(final Widget widget) {
this.sizerMenu.subWidgetRemoveAll(); this.sizerMenu.subWidgetRemoveAll();
try { try {
final var modelPojo = new IntrospectionModelComplex(widget.getClass()); final var modelPojo = new IntrospectionModelComplex(widget.getClass());
connectAllSignals(widget, modelPojo); connectAllSignals(widget, modelPojo);
displayAllPropertyWithType(widget, modelPojo); displayAllPropertyWithType(widget, modelPojo);
} catch (final Exception e) { } catch (final Exception e) {
@ -1527,10 +1551,10 @@ public class ModelWidget extends Container {
// final Vector3b stateFill = this.testWidget.getPropertyFill(); // final Vector3b stateFill = this.testWidget.getPropertyFill();
// this.buttonFillX.setPropertyValue(stateFill.x()); // this.buttonFillX.setPropertyValue(stateFill.x());
// this.buttonFillY.setPropertyValue(stateFill.y()); // this.buttonFillY.setPropertyValue(stateFill.y());
// final Gravity gravity = this.testWidget.getPropertyGravity(); // final Gravity gravity = this.testWidget.getPropertyGravity();
// final Label gravLabel = (Label) (this.buttonGravity.getSubWidgets()[0]); // final Label gravLabel = (Label) (this.buttonGravity.getSubWidgets()[0]);
// gravLabel.setPropertyValue(LABEL_GRAVITY + gravity.toString()); // gravLabel.setPropertyValue(LABEL_GRAVITY + gravity.toString());
} }
} }

View File

@ -104,18 +104,32 @@ public abstract class CompositingDrawing extends CompositingDraw {
public void circleBorderRaw( public void circleBorderRaw(
final Vector3f centerPos, final Vector3f centerPos,
final float radius, final float radius,
final float thicknessStart, float thicknessStart,
final float thicknessStop, float thicknessStop,
final float angleStart, final float angleStart,
final float angleStop) { final float angleStop) {
resetCount(); resetCount();
if (thicknessStart < 0.001 && thicknessStop < 0.001) {
return;
}
if (radius < 0.001) {
return;
}
if (thicknessStart > radius) {
thicknessStart = radius;
}
if (thicknessStop > radius) {
thicknessStop = radius;
}
int nbOcurence = (int) radius; int nbOcurence = (int) radius;
if (nbOcurence < 10) { if (nbOcurence < 10) {
nbOcurence = 10; nbOcurence = 10;
} }
for (int iii = 0; iii < nbOcurence; iii++) { for (int iii = 0; iii < nbOcurence; iii++) {
final float thickness = thicknessStart + ((thicknessStop - thicknessStart) * iii / nbOcurence); final float ratio = (float) iii / (float) nbOcurence;
final float angleOne = angleStart + (angleStop * iii / nbOcurence); final float thickness = thicknessStart + ((thicknessStop - thicknessStart) * ratio);
//final float thickness = thicknessStart * FMath.cos(ratio * FMath.PI * 0.5f) + thicknessStop * FMath.sin(ratio * FMath.PI * 0.5f);
final float angleOne = angleStart + (angleStop * ratio);
final float offsetExty = FMath.sin(angleOne) * (radius); final float offsetExty = FMath.sin(angleOne) * (radius);
final float offsetExtx = FMath.cos(angleOne) * (radius); final float offsetExtx = FMath.cos(angleOne) * (radius);
final float offsetInty = FMath.sin(angleOne) * (radius - thickness); final float offsetInty = FMath.sin(angleOne) * (radius - thickness);
@ -144,6 +158,9 @@ public abstract class CompositingDrawing extends CompositingDraw {
final float radiusStop, final float radiusStop,
final float angleStart, final float angleStart,
final float angleStop) { final float angleStop) {
if (radiusStart < 0.001 && radiusStop < 0.001) {
return;
}
resetCount(); resetCount();
int nbOcurence = (int) FMath.max(radiusStart, radiusStop); int nbOcurence = (int) FMath.max(radiusStart, radiusStop);
if (nbOcurence < 10) { if (nbOcurence < 10) {
@ -596,7 +613,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
public void rectangleRadius(final Vector3f dest, final float radius) { public void rectangleRadius(final Vector3f dest, final float radius) {
internalSetColor(this.color); internalSetColor(this.color);
final boolean showConstruct = true; final boolean showConstruct = false;
rectangleRaw(this.position.add(new Vector3f(radius, 0, 0)), dest.less(new Vector3f(radius, 0, 0))); rectangleRaw(this.position.add(new Vector3f(radius, 0, 0)), dest.less(new Vector3f(radius, 0, 0)));
if (showConstruct) { if (showConstruct) {
@ -630,7 +647,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
public void rectangleRadius(final Vector2f dest, final Insets thickness, final BorderRadius radius) { public void rectangleRadius(final Vector2f dest, final Insets thickness, final BorderRadius radius) {
internalSetColor(this.color); internalSetColor(this.color);
final boolean showConstruct = true; final boolean showConstruct = false;
if (showConstruct) { if (showConstruct) {
internalSetColor(Color.DARK_KHAKI); internalSetColor(Color.DARK_KHAKI);
@ -705,7 +722,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
final Insets thickness, final Insets thickness,
final BorderRadius radius) { final BorderRadius radius) {
internalSetColor(this.colorBg); internalSetColor(this.colorBg);
final boolean showConstruct = true; final boolean showConstruct = false;
if (showConstruct) { if (showConstruct) {
internalSetColor(Color.KHAKI); internalSetColor(Color.KHAKI);
@ -735,7 +752,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
// top-left // top-left
final Vector3f centerTopLeft = new Vector3f(this.position.x() + radius.topLeft(), dest.y() - radius.topLeft(), final Vector3f centerTopLeft = new Vector3f(this.position.x() + radius.topLeft(), dest.y() - radius.topLeft(),
0); 0);
circleBorderRaw(centerTopLeft, radius.topLeft(), thickness.left(), thickness.top(), FMath.PI * 0.5f, circleBorderRaw(centerTopLeft, radius.topLeft(), thickness.top(), thickness.left(), FMath.PI * 0.5f,
FMath.PI * 0.5f); FMath.PI * 0.5f);
// buttom area: // buttom area:

View File

@ -66,15 +66,10 @@ public class CompositingGC extends CompositingDrawing {
final Vector2f size, final Vector2f size,
final Insets thickness, final Insets thickness,
final BorderRadius radius) { final BorderRadius radius) {
if (radius == null || radius.isZero()) { setPos(position);
//addRectangle(position, size); rectangleRadius(position.add(size), thickness, radius);
//throw new RuntimeException("Not implemented ..."); if (!thickness.isZero()) {
} else { rectangleBorderRadius(position.add(size), thickness, radius);
setPos(position);
rectangleRadius(position.add(size), thickness, radius);
if (!thickness.isZero()) {
rectangleBorderRadius(position.add(size), thickness, radius);
}
} }
} }

View File

@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
public class Box extends Container { public class Box extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Box.class); private static final Logger LOGGER = LoggerFactory.getLogger(Box.class);
protected CompositingGC vectorialDraw = new CompositingGC(); protected CompositingGC vectorialDraw = new CompositingGC();
public static class BoxParameter { public static class BoxParameter {
public Float margin; public Float margin;
public Float padding; public Float padding;
@ -28,7 +28,7 @@ public class Box extends Container {
public String borderColor; public String borderColor;
public String color; public String color;
} }
/** /**
* Periodic call to update grapgic display * Periodic call to update grapgic display
* @param event Time generic event * @param event Time generic event
@ -37,31 +37,31 @@ public class Box extends Container {
LOGGER.trace("Periodic call on Entry(" + event + ")"); LOGGER.trace("Periodic call on Entry(" + event + ")");
self.markToRedraw(); self.markToRedraw();
} }
Vector2i startPosition = Vector2i.ZERO; Vector2i startPosition = Vector2i.ZERO;
Vector2i endPosition = Vector2i.ZERO; Vector2i endPosition = Vector2i.ZERO;
public boolean isInside(final Vector2f value) { public boolean isInside(final Vector2f value) {
return value.x() > this.startPosition.x() // return value.x() > this.startPosition.x() //
&& value.y() > this.startPosition.y() // && value.y() > this.startPosition.y() //
&& value.x() < this.endPosition.x() // && value.x() < this.endPosition.x() //
&& value.y() < this.endPosition.y(); && value.y() < this.endPosition.y();
} }
/** /**
* Constructor * Constructor
*/ */
public Box() {} public Box() {}
/** /**
* Constructor with his subWidget * Constructor with his subWidget
*/ */
public Box(final Widget subWidget) { public Box(final Widget subWidget) {
super(subWidget); super(subWidget);
} }
protected DimensionInsets propertyBorderWidth = DimensionInsets.ZERO;
protected DimensionInsets propertyBorderWidth = DimensionInsets.ZERO;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "border-width") @AknotName(value = "border-width")
@ -69,7 +69,7 @@ public class Box extends Container {
public DimensionInsets getPropertyBorderWidth() { public DimensionInsets getPropertyBorderWidth() {
return this.propertyBorderWidth; return this.propertyBorderWidth;
} }
public void setPropertyBorderWidth(final DimensionInsets propertyBorder) { public void setPropertyBorderWidth(final DimensionInsets propertyBorder) {
if (this.propertyBorderWidth.equals(propertyBorder)) { if (this.propertyBorderWidth.equals(propertyBorder)) {
return; return;
@ -78,9 +78,9 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
protected DimensionBorderRadius propertyBorderRadius = DimensionBorderRadius.ZERO; protected DimensionBorderRadius propertyBorderRadius = DimensionBorderRadius.ZERO;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "border-radius") @AknotName(value = "border-radius")
@ -88,7 +88,7 @@ public class Box extends Container {
public DimensionBorderRadius getPropertyBorderRadius() { public DimensionBorderRadius getPropertyBorderRadius() {
return this.propertyBorderRadius; return this.propertyBorderRadius;
} }
public void setPropertyBorderRadius(final DimensionBorderRadius propertyBorderRadius) { public void setPropertyBorderRadius(final DimensionBorderRadius propertyBorderRadius) {
if (this.propertyBorderRadius.equals(propertyBorderRadius)) { if (this.propertyBorderRadius.equals(propertyBorderRadius)) {
return; return;
@ -97,9 +97,9 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
protected Color propertyBorderColor = Color.NONE;
protected Color propertyBorderColor = Color.NONE;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "border-color") @AknotName(value = "border-color")
@ -107,7 +107,7 @@ public class Box extends Container {
public Color getPropertyBorderColor() { public Color getPropertyBorderColor() {
return this.propertyBorderColor; return this.propertyBorderColor;
} }
public void setPropertyBorderColor(final Color propertyBorderColor) { public void setPropertyBorderColor(final Color propertyBorderColor) {
if (this.propertyBorderColor.equals(propertyBorderColor)) { if (this.propertyBorderColor.equals(propertyBorderColor)) {
return; return;
@ -116,9 +116,9 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
protected Color propertyColor = Color.NONE; protected Color propertyColor = Color.NONE;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "color") @AknotName(value = "color")
@ -126,7 +126,7 @@ public class Box extends Container {
public Color getPropertyColor() { public Color getPropertyColor() {
return this.propertyColor; return this.propertyColor;
} }
public void setPropertyColor(final Color propertyColor) { public void setPropertyColor(final Color propertyColor) {
if (this.propertyColor.equals(propertyColor)) { if (this.propertyColor.equals(propertyColor)) {
return; return;
@ -135,9 +135,9 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
protected Dimension2f propertyMargin = Dimension2f.ZERO;
protected Dimension2f propertyMargin = Dimension2f.ZERO;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "margin") @AknotName(value = "margin")
@ -145,7 +145,7 @@ public class Box extends Container {
public Dimension2f getPropertyMargin() { public Dimension2f getPropertyMargin() {
return this.propertyMargin; return this.propertyMargin;
} }
public void setPropertyMargin(final Dimension2f propertyMargin) { public void setPropertyMargin(final Dimension2f propertyMargin) {
if (this.propertyMargin.equals(propertyMargin)) { if (this.propertyMargin.equals(propertyMargin)) {
return; return;
@ -154,9 +154,9 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
protected Dimension2f propertyPadding = Dimension2f.ZERO;
protected Dimension2f propertyPadding = Dimension2f.ZERO;
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "padding") @AknotName(value = "padding")
@ -164,7 +164,7 @@ public class Box extends Container {
public Dimension2f getPropertyPadding() { public Dimension2f getPropertyPadding() {
return this.propertyPadding; return this.propertyPadding;
} }
public void setPropertyPadding(final Dimension2f propertyPadding) { public void setPropertyPadding(final Dimension2f propertyPadding) {
if (this.propertyPadding.equals(propertyPadding)) { if (this.propertyPadding.equals(propertyPadding)) {
return; return;
@ -173,25 +173,25 @@ public class Box extends Container {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
super.calculateMinMaxSize(); super.calculateMinMaxSize();
final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y()); final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth); LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth);
final Insets borderSize = this.propertyBorderWidth.getPixel(); final Insets borderSize = this.propertyBorderWidth.getPixel();
final Vector2f padding = this.propertyPadding.size().multiply(2); final Vector2f padding = this.propertyPadding.getPixel().multiply(2);
final Vector2f margin = this.propertyMargin.size().multiply(2); final Vector2f margin = this.propertyMargin.getPixel().multiply(2);
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize.toVector2f()); final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize.toVector2f());
this.minSize = calculatedBoxMinSize; this.minSize = calculatedBoxMinSize;
this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size()); this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.getPixel());
markToRedraw(); markToRedraw();
} }
@Override @Override
public void onChangeSize() { public void onChangeSize() {
markToRedraw(); markToRedraw();
@ -201,11 +201,11 @@ public class Box extends Container {
if (this.subWidget == null) { if (this.subWidget == null) {
return; return;
} }
final Vector2f localPadding = this.propertyPadding.size(); final Vector2f localPadding = this.propertyPadding.getPixel();
final Vector2f localMargin = this.propertyMargin.size(); final Vector2f localMargin = this.propertyMargin.getPixel();
final Insets localBorderSize = this.propertyBorderWidth.getPixel(); final Insets localBorderSize = this.propertyBorderWidth.getPixel();
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize.toVector2f()); final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize.toVector2f());
Vector2f subWidgetSize = this.subWidget.getCalculateMinSize(); Vector2f subWidgetSize = this.subWidget.getCalculateMinSize();
if (this.subWidget.canExpand().x() && this.propertyFill.x()) { if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
subWidgetSize = subWidgetSize.withX(this.size.x()); subWidgetSize = subWidgetSize.withX(this.size.x());
@ -219,7 +219,8 @@ public class Box extends Container {
} }
subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2)); subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2));
subWidgetSize = subWidgetSize.clipInteger(); subWidgetSize = subWidgetSize.clipInteger();
on a un pb ici car on double les margin, ce qui est normal, mai on redouble les border size
final Vector2f freeSizeWithoutWidget = this.size.less(offsetSubWidget.multiply(2)).less(subWidgetSize); final Vector2f freeSizeWithoutWidget = this.size.less(offsetSubWidget.multiply(2)).less(subWidgetSize);
Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget)); Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget); subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget);
@ -228,11 +229,11 @@ public class Box extends Container {
this.subWidget.setSize(subWidgetSize); this.subWidget.setSize(subWidgetSize);
this.subWidget.onChangeSize(); this.subWidget.onChangeSize();
} }
private Vector2f calculateOriginRendering(final Vector2f renderSize) { private Vector2f calculateOriginRendering(final Vector2f renderSize) {
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize)); return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
} }
private Vector2f calculateSizeRendering() { private Vector2f calculateSizeRendering() {
Vector2f tmpRenderSize = this.minSize; Vector2f tmpRenderSize = this.minSize;
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
@ -243,7 +244,7 @@ public class Box extends Container {
} }
return tmpRenderSize; return tmpRenderSize;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
super.onRegenerateDisplay(); super.onRegenerateDisplay();
@ -251,23 +252,22 @@ public class Box extends Container {
//return; //return;
} }
final Vector2f localMargin = this.propertyMargin.size(); final Vector2f localMargin = this.propertyMargin.size();
Vector2f renderSize = calculateSizeRendering(); Vector2f renderSize = calculateSizeRendering();
Vector2f renderOrigin = calculateOriginRendering(renderSize); Vector2f renderOrigin = calculateOriginRendering(renderSize);
renderOrigin = renderOrigin.add(localMargin); renderOrigin = renderOrigin.add(localMargin);
renderSize = renderSize.less(localMargin.multiply(2)); renderSize = renderSize.less(localMargin.multiply(2));
// not sure this is needed... // not sure this is needed...
renderSize = renderSize.clipInteger(); renderSize = renderSize.clipInteger();
renderOrigin = renderOrigin.clipInteger(); renderOrigin = renderOrigin.clipInteger();
renderOrigin = renderOrigin.clipInteger(); renderOrigin = renderOrigin.clipInteger();
renderSize = renderSize.clipInteger(); renderSize = renderSize.clipInteger();
this.startPosition = renderOrigin.toVector2i(); this.startPosition = renderOrigin.toVector2i();
this.endPosition = renderSize.toVector2i(); this.endPosition = renderSize.toVector2i();
//System.out.println("renderSize: " + this.renderSize); // remove data of the previous composition:
// remove data of the previous composition :
this.vectorialDraw.clear(); this.vectorialDraw.clear();
this.vectorialDraw.setPaintFillColor(this.propertyColor); this.vectorialDraw.setPaintFillColor(this.propertyColor);
this.vectorialDraw.setPaintStrokeColor(this.propertyBorderColor); this.vectorialDraw.setPaintStrokeColor(this.propertyBorderColor);
@ -276,7 +276,7 @@ public class Box extends Container {
this.propertyBorderRadius.getPixel()); this.propertyBorderRadius.getPixel());
this.vectorialDraw.flush(); this.vectorialDraw.flush();
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
if (this.vectorialDraw != null) { if (this.vectorialDraw != null) {
@ -284,5 +284,5 @@ public class Box extends Container {
} }
super.onDraw(); super.onDraw();
} }
} }

View File

@ -4,6 +4,8 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.DimensionBorderRadius;
import org.atriasoft.etk.DimensionInsets;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
@ -121,6 +123,7 @@ public class SpinBase extends Sizer {
} }
if (this.widgetButtonDown == null) { if (this.widgetButtonDown == null) {
this.widgetButtonDown = new Button(); this.widgetButtonDown = new Button();
this.widgetButtonDown.setPropertyBorderWidth(new DimensionInsets(2f, 1f, 2f, 1f));
if (this.config != null) { if (this.config != null) {
final String shaper = this.config.getString(this.confIdDownShaper); final String shaper = this.config.getString(this.confIdDownShaper);
LOGGER.trace("shaper button DOWN : " + shaper); LOGGER.trace("shaper button DOWN : " + shaper);
@ -137,6 +140,8 @@ public class SpinBase extends Sizer {
} }
if (this.widgetButtonUp == null) { if (this.widgetButtonUp == null) {
this.widgetButtonUp = new Button(); this.widgetButtonUp = new Button();
this.widgetButtonUp.setPropertyBorderWidth(new DimensionInsets(2, 2, 2, 1));
this.widgetButtonUp.setPropertyBorderRadius(new DimensionBorderRadius(0, 8, 8, 0));
if (this.config != null) { if (this.config != null) {
final String shaper = this.config.getString(this.confIdUpShaper); final String shaper = this.config.getString(this.confIdUpShaper);
LOGGER.trace("shaper button UP : " + shaper); LOGGER.trace("shaper button UP : " + shaper);