[FEAT] manage a good display of the rectangle ==> next step is corecting the box
This commit is contained in:
parent
29ef90c1a3
commit
3bbe3afe23
@ -45,25 +45,25 @@ import org.slf4j.LoggerFactory;
|
||||
public class ModelWidget extends Container {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ModelWidget.class);
|
||||
private static final String LABEL_GRAVITY = "gravity: ";
|
||||
|
||||
|
||||
Widget testWidget;
|
||||
Sizer sizerTestAreaHori;
|
||||
Sizer sizerMenuRoot;
|
||||
Sizer sizerMenu;
|
||||
|
||||
|
||||
Gravity basicGravity = Gravity.BOTTOM_LEFT;
|
||||
|
||||
|
||||
private final List<Connection> conections = new ArrayList<>();
|
||||
|
||||
|
||||
public ModelWidget(final TestWidgetInterface interfaceToTest) {
|
||||
|
||||
|
||||
setPropertyExpand(Vector2b.TRUE);
|
||||
setPropertyFill(Vector2b.TRUE);
|
||||
final var sizerMain = new Sizer(DisplayMode.HORIZONTAL);
|
||||
sizerMain.setPropertyExpand(Vector2b.TRUE);
|
||||
sizerMain.setPropertyFill(Vector2b.TRUE);
|
||||
setSubWidget(sizerMain);
|
||||
|
||||
|
||||
this.sizerMenuRoot = new Sizer(DisplayMode.VERTICAL);
|
||||
this.sizerMenuRoot.setPropertyExpand(Vector2b.FALSE_TRUE);
|
||||
this.sizerMenuRoot.setPropertyLockExpand(Vector2b.TRUE);
|
||||
@ -71,7 +71,7 @@ public class ModelWidget extends Container {
|
||||
this.sizerMenuRoot.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
|
||||
this.sizerMenuRoot.setPropertyGravity(Gravity.TOP);
|
||||
sizerMain.subWidgetAdd(this.sizerMenuRoot);
|
||||
|
||||
|
||||
this.sizerMenu = new Sizer(DisplayMode.VERTICAL);
|
||||
this.sizerMenu.setPropertyExpand(Vector2b.FALSE_TRUE);
|
||||
this.sizerMenu.setPropertyLockExpand(Vector2b.TRUE);
|
||||
@ -79,12 +79,12 @@ public class ModelWidget extends Container {
|
||||
this.sizerMenu.setPropertyMinSize(new Dimension2f(new Vector2f(350, 10), Distance.PIXEL));
|
||||
this.sizerMenu.setPropertyGravity(Gravity.TOP);
|
||||
this.sizerMenuRoot.subWidgetAdd(this.sizerMenu);
|
||||
|
||||
|
||||
final var sizerVertMain = new Sizer(DisplayMode.VERTICAL);
|
||||
sizerVertMain.setPropertyExpand(Vector2b.TRUE);
|
||||
sizerVertMain.setPropertyFill(Vector2b.TRUE);
|
||||
sizerMain.subWidgetAdd(sizerVertMain);
|
||||
|
||||
|
||||
{
|
||||
final var simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_128, Distance.PIXEL));
|
||||
@ -95,13 +95,13 @@ public class ModelWidget extends Container {
|
||||
simpleSpacer.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
sizerVertMain.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
|
||||
|
||||
this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL);
|
||||
this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE);
|
||||
this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE);
|
||||
sizerVertMain.subWidgetAdd(this.sizerTestAreaHori);
|
||||
|
||||
|
||||
{
|
||||
final var simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.DARK_GREEN);
|
||||
@ -114,11 +114,11 @@ public class ModelWidget extends Container {
|
||||
// add the default widget to test:
|
||||
setTestWidget(interfaceToTest.getWidget());
|
||||
}
|
||||
|
||||
|
||||
public void addButton(final Widget widget) {
|
||||
this.sizerMenu.subWidgetAdd(widget);
|
||||
}
|
||||
|
||||
|
||||
public void addMenuBoolean(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -145,7 +145,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -160,7 +160,7 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -184,7 +184,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -199,14 +199,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -232,14 +232,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -262,7 +262,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDimension3f(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -277,14 +277,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -310,14 +310,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -343,14 +343,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Z");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -373,7 +373,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDouble(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -400,7 +400,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuFloat(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -427,7 +427,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuGravity(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -445,7 +445,7 @@ public class ModelWidget extends Container {
|
||||
this.sizerMenu.subWidgetAdd(buttonGravity);
|
||||
final var gravLabel = (Label) buttonGravity.getSubWidget();
|
||||
gravLabel.setPropertyValue(LABEL_GRAVITY + Gravity.BOTTOM_LEFT);
|
||||
|
||||
|
||||
final var con = buttonGravity.signalClick.connect(() -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -458,14 +458,14 @@ public class ModelWidget extends Container {
|
||||
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) {
|
||||
@ -485,7 +485,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuInt(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -504,7 +504,7 @@ public class ModelWidget extends Container {
|
||||
try {
|
||||
LOGGER.warn("Set new value: {}", valueButton);
|
||||
pojo.setExistingValue(widget, (int) (long) valueButton);
|
||||
|
||||
|
||||
} catch (final AknotException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
@ -513,7 +513,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuLong(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -540,7 +540,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuString(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -567,7 +567,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuURI(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -594,7 +594,7 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector2b(final Widget widget, final IntrospectionProperty pojo) {
|
||||
final var lineSizer = new Sizer(DisplayMode.HORIZONTAL);
|
||||
Object valueRaw = null;
|
||||
@ -648,9 +648,9 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector2f(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -665,14 +665,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -697,14 +697,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -726,7 +726,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector2i(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -741,14 +741,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -773,14 +773,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -802,7 +802,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector3b(final Widget widget, final IntrospectionProperty pojo) {
|
||||
final var lineSizer = new Sizer(DisplayMode.HORIZONTAL);
|
||||
Object valueRaw = null;
|
||||
@ -875,9 +875,9 @@ public class ModelWidget extends Container {
|
||||
this.conections.add(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector3f(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -892,14 +892,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -924,14 +924,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -956,14 +956,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Z");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -985,7 +985,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuVector3i(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -1000,14 +1000,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("X");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -1032,14 +1032,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Y");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -1064,14 +1064,14 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("Z");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE);
|
||||
simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
simpleLabel.setPropertyGravity(Gravity.LEFT);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
@ -1093,7 +1093,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void connectAllSignals(final Widget widget, final IntrospectionModelComplex modelPojo) throws Exception {
|
||||
LOGGER.warn("Connect all signal(s) on '{}'", widget.getName());
|
||||
final var signals = modelPojo.getSignals();
|
||||
@ -1102,10 +1102,10 @@ public class ModelWidget extends Container {
|
||||
LOGGER.warn(" ==> description='{}'", pojo.getDescription());
|
||||
LOGGER.warn(" ==> type='{}'", pojo.getType());
|
||||
LOGGER.warn(" ==> sub-type='{}'", pojo.getSubType());
|
||||
|
||||
|
||||
final var eventName = pojo.getNames() != null && pojo.getNames().length != 0 ? pojo.getNames()[0]
|
||||
: pojo.getBeanName();
|
||||
|
||||
|
||||
if (pojo.getSubType() != null && pojo.getType() == Signal.class) {
|
||||
LOGGER.warn(" ** Signal<{}>", pojo.getSubType());
|
||||
final var signalObject = pojo.getValue(widget);
|
||||
@ -1132,11 +1132,11 @@ public class ModelWidget extends Container {
|
||||
LOGGER.info("Get event from '{}'", valueNameOfSignal);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDimensionBorderRadius(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -1151,19 +1151,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("bottom-left");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().bottomLeft());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1184,19 +1187,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("bottom-right");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().bottomRight());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1217,19 +1223,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("top-right");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().topRight());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1250,19 +1259,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("top-left");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().topLeft());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1280,7 +1292,7 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMenuDimensionInsets(final Widget widget, final IntrospectionProperty pojo) {
|
||||
Object valueRaw = null;
|
||||
try {
|
||||
@ -1295,19 +1307,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("left");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().left());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1328,19 +1343,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("bottom");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().bottom());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1361,19 +1379,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("right");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().right());
|
||||
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 -> {
|
||||
try {
|
||||
final var oldValue = pojo.getValue(widget);
|
||||
@ -1394,19 +1415,22 @@ public class ModelWidget extends Container {
|
||||
lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
lineSizer.setPropertyFill(Vector2b.TRUE);
|
||||
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||
|
||||
|
||||
final var simpleLabel = new Label("top");
|
||||
simpleLabel.setPropertyExpand(Vector2b.FALSE);
|
||||
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);
|
||||
lineSizer.subWidgetAdd(simpleLabel);
|
||||
|
||||
|
||||
final var spin = new Spin();
|
||||
spin.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
spin.setPropertyFill(Vector2b.TRUE);
|
||||
spin.setPropertyValue((int) value.size().top());
|
||||
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 -> {
|
||||
try {
|
||||
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 {
|
||||
LOGGER.warn("Connect all property(ies) on '{}'", widget.getName());
|
||||
final var atributes = modelPojo.getAttributes();
|
||||
@ -1488,12 +1512,12 @@ public class ModelWidget extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setTestWidget(final Widget widget) {
|
||||
this.sizerMenu.subWidgetRemoveAll();
|
||||
try {
|
||||
final var modelPojo = new IntrospectionModelComplex(widget.getClass());
|
||||
|
||||
|
||||
connectAllSignals(widget, modelPojo);
|
||||
displayAllPropertyWithType(widget, modelPojo);
|
||||
} catch (final Exception e) {
|
||||
@ -1527,10 +1551,10 @@ public class ModelWidget extends Container {
|
||||
// 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());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -104,18 +104,32 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
public void circleBorderRaw(
|
||||
final Vector3f centerPos,
|
||||
final float radius,
|
||||
final float thicknessStart,
|
||||
final float thicknessStop,
|
||||
float thicknessStart,
|
||||
float thicknessStop,
|
||||
final float angleStart,
|
||||
final float angleStop) {
|
||||
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;
|
||||
if (nbOcurence < 10) {
|
||||
nbOcurence = 10;
|
||||
}
|
||||
for (int iii = 0; iii < nbOcurence; iii++) {
|
||||
final float thickness = thicknessStart + ((thicknessStop - thicknessStart) * iii / nbOcurence);
|
||||
final float angleOne = angleStart + (angleStop * iii / nbOcurence);
|
||||
final float ratio = (float) iii / (float) 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 offsetExtx = FMath.cos(angleOne) * (radius);
|
||||
final float offsetInty = FMath.sin(angleOne) * (radius - thickness);
|
||||
@ -144,6 +158,9 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
final float radiusStop,
|
||||
final float angleStart,
|
||||
final float angleStop) {
|
||||
if (radiusStart < 0.001 && radiusStop < 0.001) {
|
||||
return;
|
||||
}
|
||||
resetCount();
|
||||
int nbOcurence = (int) FMath.max(radiusStart, radiusStop);
|
||||
if (nbOcurence < 10) {
|
||||
@ -596,7 +613,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
|
||||
public void rectangleRadius(final Vector3f dest, final float radius) {
|
||||
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)));
|
||||
if (showConstruct) {
|
||||
@ -630,7 +647,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
|
||||
public void rectangleRadius(final Vector2f dest, final Insets thickness, final BorderRadius radius) {
|
||||
internalSetColor(this.color);
|
||||
final boolean showConstruct = true;
|
||||
final boolean showConstruct = false;
|
||||
|
||||
if (showConstruct) {
|
||||
internalSetColor(Color.DARK_KHAKI);
|
||||
@ -705,7 +722,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
final Insets thickness,
|
||||
final BorderRadius radius) {
|
||||
internalSetColor(this.colorBg);
|
||||
final boolean showConstruct = true;
|
||||
final boolean showConstruct = false;
|
||||
|
||||
if (showConstruct) {
|
||||
internalSetColor(Color.KHAKI);
|
||||
@ -735,7 +752,7 @@ public abstract class CompositingDrawing extends CompositingDraw {
|
||||
// top-left
|
||||
final Vector3f centerTopLeft = new Vector3f(this.position.x() + radius.topLeft(), dest.y() - radius.topLeft(),
|
||||
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);
|
||||
|
||||
// buttom area:
|
||||
|
@ -66,15 +66,10 @@ public class CompositingGC extends CompositingDrawing {
|
||||
final Vector2f size,
|
||||
final Insets thickness,
|
||||
final BorderRadius radius) {
|
||||
if (radius == null || radius.isZero()) {
|
||||
//addRectangle(position, size);
|
||||
//throw new RuntimeException("Not implemented ...");
|
||||
} else {
|
||||
setPos(position);
|
||||
rectangleRadius(position.add(size), thickness, radius);
|
||||
if (!thickness.isZero()) {
|
||||
rectangleBorderRadius(position.add(size), thickness, radius);
|
||||
}
|
||||
setPos(position);
|
||||
rectangleRadius(position.add(size), thickness, radius);
|
||||
if (!thickness.isZero()) {
|
||||
rectangleBorderRadius(position.add(size), thickness, radius);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class Box extends Container {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Box.class);
|
||||
protected CompositingGC vectorialDraw = new CompositingGC();
|
||||
|
||||
|
||||
public static class BoxParameter {
|
||||
public Float margin;
|
||||
public Float padding;
|
||||
@ -28,7 +28,7 @@ public class Box extends Container {
|
||||
public String borderColor;
|
||||
public String color;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Periodic call to update grapgic display
|
||||
* @param event Time generic event
|
||||
@ -37,31 +37,31 @@ public class Box extends Container {
|
||||
LOGGER.trace("Periodic call on Entry(" + event + ")");
|
||||
self.markToRedraw();
|
||||
}
|
||||
|
||||
|
||||
Vector2i startPosition = Vector2i.ZERO;
|
||||
Vector2i endPosition = Vector2i.ZERO;
|
||||
|
||||
|
||||
public boolean isInside(final Vector2f value) {
|
||||
return value.x() > this.startPosition.x() //
|
||||
&& value.y() > this.startPosition.y() //
|
||||
&& value.x() < this.endPosition.x() //
|
||||
&& value.y() < this.endPosition.y();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Box() {}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor with his subWidget
|
||||
*/
|
||||
public Box(final Widget subWidget) {
|
||||
super(subWidget);
|
||||
}
|
||||
|
||||
protected DimensionInsets propertyBorderWidth = DimensionInsets.ZERO;
|
||||
|
||||
protected DimensionInsets propertyBorderWidth = DimensionInsets.ZERO;
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "border-width")
|
||||
@ -69,7 +69,7 @@ public class Box extends Container {
|
||||
public DimensionInsets getPropertyBorderWidth() {
|
||||
return this.propertyBorderWidth;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyBorderWidth(final DimensionInsets propertyBorder) {
|
||||
if (this.propertyBorderWidth.equals(propertyBorder)) {
|
||||
return;
|
||||
@ -78,9 +78,9 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
protected DimensionBorderRadius propertyBorderRadius = DimensionBorderRadius.ZERO;
|
||||
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "border-radius")
|
||||
@ -88,7 +88,7 @@ public class Box extends Container {
|
||||
public DimensionBorderRadius getPropertyBorderRadius() {
|
||||
return this.propertyBorderRadius;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyBorderRadius(final DimensionBorderRadius propertyBorderRadius) {
|
||||
if (this.propertyBorderRadius.equals(propertyBorderRadius)) {
|
||||
return;
|
||||
@ -97,9 +97,9 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
protected Color propertyBorderColor = Color.NONE;
|
||||
|
||||
protected Color propertyBorderColor = Color.NONE;
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "border-color")
|
||||
@ -107,7 +107,7 @@ public class Box extends Container {
|
||||
public Color getPropertyBorderColor() {
|
||||
return this.propertyBorderColor;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyBorderColor(final Color propertyBorderColor) {
|
||||
if (this.propertyBorderColor.equals(propertyBorderColor)) {
|
||||
return;
|
||||
@ -116,9 +116,9 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
protected Color propertyColor = Color.NONE;
|
||||
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "color")
|
||||
@ -126,7 +126,7 @@ public class Box extends Container {
|
||||
public Color getPropertyColor() {
|
||||
return this.propertyColor;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyColor(final Color propertyColor) {
|
||||
if (this.propertyColor.equals(propertyColor)) {
|
||||
return;
|
||||
@ -135,9 +135,9 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
protected Dimension2f propertyMargin = Dimension2f.ZERO;
|
||||
|
||||
protected Dimension2f propertyMargin = Dimension2f.ZERO;
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "margin")
|
||||
@ -145,7 +145,7 @@ public class Box extends Container {
|
||||
public Dimension2f getPropertyMargin() {
|
||||
return this.propertyMargin;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyMargin(final Dimension2f propertyMargin) {
|
||||
if (this.propertyMargin.equals(propertyMargin)) {
|
||||
return;
|
||||
@ -154,9 +154,9 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
protected Dimension2f propertyPadding = Dimension2f.ZERO;
|
||||
|
||||
protected Dimension2f propertyPadding = Dimension2f.ZERO;
|
||||
|
||||
@AknotManaged
|
||||
@AknotAttribute
|
||||
@AknotName(value = "padding")
|
||||
@ -164,7 +164,7 @@ public class Box extends Container {
|
||||
public Dimension2f getPropertyPadding() {
|
||||
return this.propertyPadding;
|
||||
}
|
||||
|
||||
|
||||
public void setPropertyPadding(final Dimension2f propertyPadding) {
|
||||
if (this.propertyPadding.equals(propertyPadding)) {
|
||||
return;
|
||||
@ -173,25 +173,25 @@ public class Box extends Container {
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void calculateMinMaxSize() {
|
||||
super.calculateMinMaxSize();
|
||||
final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
|
||||
|
||||
|
||||
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth);
|
||||
final Insets borderSize = this.propertyBorderWidth.getPixel();
|
||||
|
||||
final Vector2f padding = this.propertyPadding.size().multiply(2);
|
||||
final Vector2f margin = this.propertyMargin.size().multiply(2);
|
||||
|
||||
|
||||
final Vector2f padding = this.propertyPadding.getPixel().multiply(2);
|
||||
final Vector2f margin = this.propertyMargin.getPixel().multiply(2);
|
||||
|
||||
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize.toVector2f());
|
||||
|
||||
|
||||
this.minSize = calculatedBoxMinSize;
|
||||
this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size());
|
||||
this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.getPixel());
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onChangeSize() {
|
||||
markToRedraw();
|
||||
@ -201,11 +201,11 @@ public class Box extends Container {
|
||||
if (this.subWidget == null) {
|
||||
return;
|
||||
}
|
||||
final Vector2f localPadding = this.propertyPadding.size();
|
||||
final Vector2f localMargin = this.propertyMargin.size();
|
||||
final Vector2f localPadding = this.propertyPadding.getPixel();
|
||||
final Vector2f localMargin = this.propertyMargin.getPixel();
|
||||
final Insets localBorderSize = this.propertyBorderWidth.getPixel();
|
||||
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize.toVector2f());
|
||||
|
||||
|
||||
Vector2f subWidgetSize = this.subWidget.getCalculateMinSize();
|
||||
if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
|
||||
subWidgetSize = subWidgetSize.withX(this.size.x());
|
||||
@ -219,7 +219,8 @@ public class Box extends Container {
|
||||
}
|
||||
subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2));
|
||||
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);
|
||||
Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
|
||||
subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget);
|
||||
@ -228,11 +229,11 @@ public class Box extends Container {
|
||||
this.subWidget.setSize(subWidgetSize);
|
||||
this.subWidget.onChangeSize();
|
||||
}
|
||||
|
||||
|
||||
private Vector2f calculateOriginRendering(final Vector2f renderSize) {
|
||||
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
|
||||
}
|
||||
|
||||
|
||||
private Vector2f calculateSizeRendering() {
|
||||
Vector2f tmpRenderSize = this.minSize;
|
||||
if (this.propertyFill.x()) {
|
||||
@ -243,7 +244,7 @@ public class Box extends Container {
|
||||
}
|
||||
return tmpRenderSize;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRegenerateDisplay() {
|
||||
super.onRegenerateDisplay();
|
||||
@ -251,23 +252,22 @@ public class Box extends Container {
|
||||
//return;
|
||||
}
|
||||
final Vector2f localMargin = this.propertyMargin.size();
|
||||
|
||||
|
||||
Vector2f renderSize = calculateSizeRendering();
|
||||
Vector2f renderOrigin = calculateOriginRendering(renderSize);
|
||||
|
||||
|
||||
renderOrigin = renderOrigin.add(localMargin);
|
||||
renderSize = renderSize.less(localMargin.multiply(2));
|
||||
// not sure this is needed...
|
||||
renderSize = renderSize.clipInteger();
|
||||
renderOrigin = renderOrigin.clipInteger();
|
||||
|
||||
|
||||
renderOrigin = renderOrigin.clipInteger();
|
||||
renderSize = renderSize.clipInteger();
|
||||
this.startPosition = renderOrigin.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.setPaintFillColor(this.propertyColor);
|
||||
this.vectorialDraw.setPaintStrokeColor(this.propertyBorderColor);
|
||||
@ -276,7 +276,7 @@ public class Box extends Container {
|
||||
this.propertyBorderRadius.getPixel());
|
||||
this.vectorialDraw.flush();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw() {
|
||||
if (this.vectorialDraw != null) {
|
||||
@ -284,5 +284,5 @@ public class Box extends Container {
|
||||
}
|
||||
super.onDraw();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
|
||||
import org.atriasoft.aknot.annotation.AknotDescription;
|
||||
import org.atriasoft.aknot.annotation.AknotManaged;
|
||||
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.math.Vector2b;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
@ -121,6 +123,7 @@ public class SpinBase extends Sizer {
|
||||
}
|
||||
if (this.widgetButtonDown == null) {
|
||||
this.widgetButtonDown = new Button();
|
||||
this.widgetButtonDown.setPropertyBorderWidth(new DimensionInsets(2f, 1f, 2f, 1f));
|
||||
if (this.config != null) {
|
||||
final String shaper = this.config.getString(this.confIdDownShaper);
|
||||
LOGGER.trace("shaper button DOWN : " + shaper);
|
||||
@ -137,6 +140,8 @@ public class SpinBase extends Sizer {
|
||||
}
|
||||
if (this.widgetButtonUp == null) {
|
||||
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) {
|
||||
final String shaper = this.config.getString(this.confIdUpShaper);
|
||||
LOGGER.trace("shaper button UP : " + shaper);
|
||||
|
Loading…
x
Reference in New Issue
Block a user