diff --git a/samples/src/main/sample/atriasoft/ewol/ModelWidget.java b/samples/src/main/sample/atriasoft/ewol/ModelWidget.java index 56eac32..1ca0467 100644 --- a/samples/src/main/sample/atriasoft/ewol/ModelWidget.java +++ b/samples/src/main/sample/atriasoft/ewol/ModelWidget.java @@ -15,6 +15,8 @@ import org.atriasoft.etk.Color; import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; import org.atriasoft.etk.Dimension3f; +import org.atriasoft.etk.DimensionBorderRadius; +import org.atriasoft.etk.DimensionInsets; import org.atriasoft.etk.Distance; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2b; @@ -1135,6 +1137,294 @@ public class ModelWidget extends Container { } } + public void addMenuDimensionBorderRadius(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final DimensionBorderRadius value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("bottom-left"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().bottomLeft()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionBorderRadius castedValue) { + castedValue = castedValue.withSize(castedValue.size().withBottomLeft(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("bottom-right"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().bottomRight()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionBorderRadius castedValue) { + castedValue = castedValue.withSize(castedValue.size().withBottomRight(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("top-right"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().topRight()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionBorderRadius castedValue) { + castedValue = castedValue.withSize(castedValue.size().withTopRight(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("top-left"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().topLeft()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionBorderRadius castedValue) { + castedValue = castedValue.withSize(castedValue.size().withTopLeft(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + + public void addMenuDimensionInsets(final Widget widget, final IntrospectionProperty pojo) { + Object valueRaw = null; + try { + valueRaw = pojo.getValue(widget); + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + if (valueRaw instanceof final DimensionInsets value) { + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("left"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().left()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionInsets castedValue) { + castedValue = castedValue.withSize(castedValue.size().withLeft(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("bottom"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().bottom()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionInsets castedValue) { + castedValue = castedValue.withSize(castedValue.size().withBottom(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("right"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().right()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionInsets castedValue) { + castedValue = castedValue.withSize(castedValue.size().withRight(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + { + final var lineSizer = new Sizer(DisplayMode.HORIZONTAL); + lineSizer.setPropertyExpand(Vector2b.TRUE_FALSE); + lineSizer.setPropertyFill(Vector2b.TRUE); + this.sizerMenu.subWidgetAdd(lineSizer); + + final var simpleLabel = new Label("top"); + simpleLabel.setPropertyExpand(Vector2b.FALSE); + simpleLabel.setPropertyFill(Vector2b.TRUE); + simpleLabel.setPropertyMinSize(new Dimension2f(Vector2f.VALUE_16, Distance.PIXEL)); + simpleLabel.setPropertyGravity(Gravity.LEFT); + lineSizer.subWidgetAdd(simpleLabel); + + final var spin = new Spin(); + spin.setPropertyExpand(Vector2b.TRUE_FALSE); + spin.setPropertyFill(Vector2b.TRUE); + spin.setPropertyValue((int) value.size().top()); + lineSizer.subWidgetAdd(spin); + final var con = spin.signalValue.connect(newValue -> { + try { + final var oldValue = pojo.getValue(widget); + if (oldValue instanceof DimensionInsets castedValue) { + castedValue = castedValue.withSize(castedValue.size().withTop(newValue)); + LOGGER.warn("Set new value: {}", castedValue); + pojo.setExistingValue(widget, castedValue); + } + } catch (final AknotException e) { + e.printStackTrace(); + return; + } + }); + this.conections.add(con); + } + } + } + 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(); @@ -1175,6 +1465,10 @@ public class ModelWidget extends Container { addMenuDimension2f(widget, pojo); } else if (pojo.getType() == Dimension1f.class) { addMenuDimension1f(widget, pojo); + } else if (pojo.getType() == DimensionBorderRadius.class) { + addMenuDimensionBorderRadius(widget, pojo); + } else if (pojo.getType() == DimensionInsets.class) { + addMenuDimensionInsets(widget, pojo); } else if (pojo.getType() == DisplayMode.class) { LOGGER.error(" ==> plop"); } else if (pojo.getType() == Uri.class) { diff --git a/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java b/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java index dc07104..485f87b 100644 --- a/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java +++ b/samples/src/main/sample/atriasoft/ewol/TestWidgetBox.java @@ -1,8 +1,9 @@ package sample.atriasoft.ewol; import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.DimensionBorderRadius; +import org.atriasoft.etk.DimensionInsets; import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.ewol.widget.Box; @@ -22,8 +23,8 @@ public class TestWidgetBox implements TestWidgetInterface { final var testWidget = new Box(innerWidget); testWidget.setPropertyExpand(Vector2b.FALSE); testWidget.setPropertyFill(Vector2b.FALSE); - testWidget.setPropertyBorderWidth(new Dimension1f(10)); - testWidget.setPropertyBorderRadius(new Dimension1f(25)); + testWidget.setPropertyBorderWidth(new DimensionInsets(10)); + testWidget.setPropertyBorderRadius(new DimensionBorderRadius(25)); testWidget.setPropertyBorderColor(Color.BLACK); testWidget.setPropertyColor(Color.GREEN_YELLOW); testWidget.setPropertyPadding(new Dimension2f(new Vector2f(15, 15))); diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingDrawInterface.java b/src/main/org/atriasoft/ewol/compositing/CompositingDrawInterface.java index 5af5930..68c9614 100644 --- a/src/main/org/atriasoft/ewol/compositing/CompositingDrawInterface.java +++ b/src/main/org/atriasoft/ewol/compositing/CompositingDrawInterface.java @@ -5,7 +5,9 @@ */ package org.atriasoft.ewol.compositing; +import org.atriasoft.etk.BorderRadius; import org.atriasoft.etk.Color; +import org.atriasoft.etk.Insets; import org.atriasoft.etk.math.Vector2f; public interface CompositingDrawInterface { @@ -28,5 +30,7 @@ public interface CompositingDrawInterface { void addCircle(final Vector2f position, final float radius); void addEllipse(final Vector2f center, final Vector2f radius); + + void addRectangle(Vector2f position, Vector2f size, Insets thickness, BorderRadius radius); } diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingDrawing.java b/src/main/org/atriasoft/ewol/compositing/CompositingDrawing.java index bd636e7..80efdc6 100644 --- a/src/main/org/atriasoft/ewol/compositing/CompositingDrawing.java +++ b/src/main/org/atriasoft/ewol/compositing/CompositingDrawing.java @@ -8,7 +8,9 @@ package org.atriasoft.ewol.compositing; import java.util.ArrayList; import java.util.List; +import org.atriasoft.etk.BorderRadius; import org.atriasoft.etk.Color; +import org.atriasoft.etk.Insets; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Matrix4f; @@ -22,7 +24,7 @@ import org.slf4j.LoggerFactory; public abstract class CompositingDrawing extends CompositingDraw { private static final Logger LOGGER = LoggerFactory.getLogger(CompositingDrawing.class); - + protected static int vboIdColor = 1; protected static int vboIdCoord = 0; private boolean clippingEnable = false; // !< true if the clipping must be activated @@ -38,19 +40,19 @@ public abstract class CompositingDrawing extends CompositingDraw { private ResourceProgram oGLprogram; // !< pointer on the opengl display program private final List outColors = new ArrayList<>(); private final List outTriangles = new ArrayList<>(); - + private Vector3f position = new Vector3f(0, 0, 0); // !< The current position to draw - + private float thickness = 0; // !< when drawing line and other things - + private final Vector3f[] triangle = new Vector3f[3]; // !< Register every system with a combinaison of tiangle - + private final Color[] tricolor = new Color[3]; // !< Register every the associated color foreground - + private int triElement = 0; // !< special counter of the single dot generated //protected ResourceVirtualBufferObject vbo; protected ResourceVirtualArrayObject vbo; - + // internal API for the generation abstraction of triangles /** * Basic ructor @@ -66,7 +68,7 @@ public abstract class CompositingDrawing extends CompositingDraw { // TO facilitate some debugs we add a name of the VBO: this.vbo.setName("[VBO] of ewol::compositing::Area"); } - + /** * add a point reference at the current position (this is a vertex * reference at the current position @@ -75,7 +77,7 @@ public abstract class CompositingDrawing extends CompositingDraw { internalSetColor(this.color); setPoint(this.position); } - + /** * draw a 2D circle with the specify rafdius parameter. * @param radius Distence to the dorder @@ -85,15 +87,25 @@ public abstract class CompositingDrawing extends CompositingDraw { public void circle(final float radius) { circle(radius, 0); } - + public void circle(final float radius, final float angleStart) { circle(radius, angleStart, 2.0f * FMath.PI); } + + public void circleBorderRaw( + final Vector3f centerPos, + final float radius, + final float thickness, + final float angleStart, + final float angleStop) { + circleBorderRaw(centerPos, radius, thickness, thickness, angleStart, angleStop); + } public void circleBorderRaw( final Vector3f centerPos, final float radius, - final float thickness, + final float thicknessStart, + final float thicknessStop, final float angleStart, final float angleStop) { resetCount(); @@ -102,6 +114,7 @@ public abstract class CompositingDrawing extends CompositingDraw { nbOcurence = 10; } for (int iii = 0; iii < nbOcurence; iii++) { + final float thickness = thicknessStart + ((thicknessStart - thicknessStop) * iii / nbOcurence); final float angleOne = angleStart + (angleStop * iii / nbOcurence); final float offsetExty = FMath.sin(angleOne) * (radius + thickness / 2); final float offsetExtx = FMath.cos(angleOne) * (radius + thickness / 2); @@ -119,46 +132,56 @@ public abstract class CompositingDrawing extends CompositingDraw { setPoint(new Vector3f(centerPos.x() + offsetInt2x, centerPos.y() + offsetInt2y, 0)); setPoint(new Vector3f(centerPos.x() + offsetIntx, centerPos.y() + offsetInty, 0)); } - } public void circleRaw(final Vector3f centerPos, final float radius, final float angleStart, final float angleStop) { + circleRaw(centerPos, radius, radius, angleStart, angleStop); + } + + public void circleRaw( + final Vector3f centerPos, + final float radiusStart, + final float radiusStop, + final float angleStart, + final float angleStop) { resetCount(); - int nbOcurence = (int) radius; + int nbOcurence = (int) FMath.max(radiusStart, radiusStop); if (nbOcurence < 10) { nbOcurence = 10; } + final float invertOccurence = 1.0f / nbOcurence; for (int iii = 0; iii < nbOcurence; iii++) { + final float radius = radiusStart + ((radiusStart - radiusStop) * iii * invertOccurence); setPoint(new Vector3f(centerPos.x(), centerPos.y(), 0)); - - final float angleOne = angleStart + (angleStop * iii / nbOcurence); + + final float angleOne = angleStart + (angleStop * iii * invertOccurence); float offsety = FMath.sin(angleOne) * radius; float offsetx = FMath.cos(angleOne) * radius; - + setPoint(new Vector3f(centerPos.x() + offsetx, centerPos.y() + offsety, 0)); - - final float angleTwo = angleStart + (angleStop * (iii + 1) / nbOcurence); + + final float angleTwo = angleStart + (angleStop * (iii + 1) * invertOccurence); offsety = FMath.sin(angleTwo) * radius; offsetx = FMath.cos(angleTwo) * radius; - + setPoint(new Vector3f(centerPos.x() + offsetx, centerPos.y() + offsety, 0)); } } - + public void circle(float radius, final float angleStart, float angleStop) { resetCount(); - + if (radius < 0) { radius *= -1; } angleStop = angleStop - angleStart; - + // display background : if (this.colorBg.a() != 0) { internalSetColor(this.colorBg); circleRaw(this.position, radius, angleStart, angleStop); } - + // show if we have a border : if (this.thickness == 0 || this.color.a() == 0) { return; @@ -166,7 +189,7 @@ public abstract class CompositingDrawing extends CompositingDraw { internalSetColor(this.color); circleBorderRaw(this.position, radius, this.thickness, angleStart, angleStop); } - + /** * clear all the registered element in the current element */ @@ -178,23 +201,23 @@ public abstract class CompositingDrawing extends CompositingDraw { this.vbo.clear(); this.outTriangles.clear(); this.outColors.clear(); - + // reset temporal variables : this.position = Vector3f.ZERO; - + this.clippingPosStart = Vector3f.ZERO; this.clippingPosStop = Vector3f.ZERO; this.clippingEnable = false; - + this.color = Color.BLACK; this.colorBg = Color.NONE; - + for (int iii = 0; iii < 3; iii++) { this.triangle[iii] = this.position; this.tricolor[iii] = this.color; } } - + /** * draw All the refistered text in the current element on openGL */ @@ -217,7 +240,7 @@ public abstract class CompositingDrawing extends CompositingDraw { this.vbo.unBindForRendering(); this.oGLprogram.unUse(); } - + @Override public void flush() { // push data on the VBO @@ -225,7 +248,7 @@ public abstract class CompositingDrawing extends CompositingDraw { this.vbo.setColors(this.outColors.toArray(Color[]::new)); this.vbo.setVertexCount(this.outTriangles.size()); } - + /** * Lunch the generation of triangle */ @@ -238,7 +261,7 @@ public abstract class CompositingDrawing extends CompositingDraw { this.outColors.add(this.tricolor[1]); this.outColors.add(this.tricolor[2]); } - + /** * Get the foreground color of the font. * @return Foreground color. @@ -246,7 +269,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public Color getColor() { return this.color; } - + /** * Get the background color of the font. * @return Background color. @@ -254,7 +277,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public Color getColorBg() { return this.colorBg; } - + /** * get the current display position (sometime needed in the gui control) * @return the current position. @@ -262,7 +285,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public Vector3f getPos() { return this.position; } - + /** * set the Color of the current triangle drawing * @param color Color to current dots generated @@ -278,7 +301,7 @@ public abstract class CompositingDrawing extends CompositingDraw { this.tricolor[2] = color; } } - + /** * Relative drawing a line (special vector) * @param vect Vector of the current line. @@ -286,31 +309,31 @@ public abstract class CompositingDrawing extends CompositingDraw { public void lineRel(final float xxx, final float yyy) { lineTo(this.position.add(new Vector3f(xxx, yyy, 0))); } - + public void lineRel(final float xxx, final float yyy, final float zzz) { lineTo(this.position.add(new Vector3f(xxx, yyy, zzz))); } - + public void lineRel(final Vector2f vect) { lineRel(new Vector3f(vect.x(), vect.y(), 0)); } - + public void lineRel(final Vector3f vect) { lineTo(this.position.add(vect)); } - + public void lineTo(final float xxx, final float yyy) { lineTo(new Vector3f(xxx, yyy, 0)); } - + public void lineTo(final float xxx, final float yyy, final float zzz) { lineTo(new Vector3f(xxx, yyy, zzz)); } - + public void lineTo(final Vector2f dest) { lineTo(new Vector3f(dest.x(), dest.y(), 0)); } - + /** * draw a line to a specific position * @param dest Position of the end of the line. @@ -341,14 +364,14 @@ public abstract class CompositingDrawing extends CompositingDraw { setPoint(new Vector3f(this.position.x() - offsetx, this.position.y() - offsety, this.position.z())); setPoint(new Vector3f(this.position.x() + offsetx, this.position.y() + offsety, this.position.z())); setPoint(new Vector3f(dest.x() + offsetx, dest.y() + offsety, this.position.z())); - + setPoint(new Vector3f(dest.x() + offsetx, dest.y() + offsety, dest.z())); setPoint(new Vector3f(dest.x() - offsetx, dest.y() - offsety, dest.z())); setPoint(new Vector3f(this.position.x() - offsetx, this.position.y() - offsety, dest.z())); // update the system position : this.position = dest; } - + /** * load the openGL program and get all the ID needed */ @@ -367,19 +390,19 @@ public abstract class CompositingDrawing extends CompositingDraw { this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView"); } } - + public void rectangle(final float xxx, final float yyy) { rectangle(new Vector3f(xxx, yyy, 0)); } - + public void rectangle(final float xxx, final float yyy, final float zzz) { rectangle(new Vector3f(xxx, yyy, zzz)); } - + public void rectangle(final Vector2f dest) { rectangle(dest.toVector3f()); } - + /** * draw a 2D rectangle to the position requested. * @param dest Position the the end of the rectangle @@ -388,7 +411,7 @@ public abstract class CompositingDrawing extends CompositingDraw { internalSetColor(this.color); rectangleRaw(this.position, dest); } - + public void rectangleRaw(final Vector3f startPos, final Vector3f endPos) { resetCount(); /* @@ -434,16 +457,16 @@ public abstract class CompositingDrawing extends CompositingDraw { setPoint(new Vector3f(dxA, dyD, 0)); setPoint(new Vector3f(dxA, dyC, 0)); setPoint(new Vector3f(dxB, dyC, 0)); - + setPoint(new Vector3f(dxB, dyC, 0)); setPoint(new Vector3f(dxB, dyD, 0)); setPoint(new Vector3f(dxA, dyD, 0)); } - + public void rectangleBorder(final Vector2f dest, final float borderWidth) { rectangleBorder(dest.toVector3f(), borderWidth); } - + public void rectangleBorder(final Vector3f dest, final float borderWidth) { /* * Bitmap position xA xB @@ -519,39 +542,39 @@ public abstract class CompositingDrawing extends CompositingDraw { setPoint(new Vector3f(dxA, dyC, 0)); setPoint(new Vector3f(dxB, dyC, 0)); setPoint(new Vector3f(dxpA, dypC, 0)); - + setPoint(new Vector3f(dxB, dyC, 0)); setPoint(new Vector3f(dxpA, dypC, 0)); setPoint(new Vector3f(dxpB, dypC, 0)); - + // Right border: setPoint(new Vector3f(dxpB, dypC, 0)); setPoint(new Vector3f(dxB, dyC, 0)); setPoint(new Vector3f(dxB, dyD, 0)); - + setPoint(new Vector3f(dxpB, dypC, 0)); setPoint(new Vector3f(dxB, dyD, 0)); setPoint(new Vector3f(dxpB, dypD, 0)); - + // Top border: setPoint(new Vector3f(dxpB, dypD, 0)); setPoint(new Vector3f(dxB, dyD, 0)); setPoint(new Vector3f(dxA, dyD, 0)); - + setPoint(new Vector3f(dxpB, dypD, 0)); setPoint(new Vector3f(dxA, dyD, 0)); setPoint(new Vector3f(dxpA, dypD, 0)); - + // Left border: setPoint(new Vector3f(dxpA, dypD, 0)); setPoint(new Vector3f(dxA, dyD, 0)); setPoint(new Vector3f(dxpA, dypC, 0)); - + setPoint(new Vector3f(dxA, dyD, 0)); setPoint(new Vector3f(dxpA, dypC, 0)); setPoint(new Vector3f(dxA, dyC, 0)); } - + /** * draw a 2D rectangle to the position requested. * @param dest Position the the end of the rectangle @@ -559,11 +582,11 @@ public abstract class CompositingDrawing extends CompositingDraw { public void rectangleRadius(final Vector2f dest, final float radius) { rectangleRadius(dest.toVector3f(), radius); } - + public void rectangleRadius(final Vector3f dest, final float radius) { internalSetColor(this.color); - final boolean showConstruct = false; - + final boolean showConstruct = true; + rectangleRaw(this.position.add(new Vector3f(radius, 0, 0)), dest.less(new Vector3f(radius, 0, 0))); if (showConstruct) { internalSetColor(Color.ORANGE); @@ -575,7 +598,7 @@ public abstract class CompositingDrawing extends CompositingDraw { } rectangleRaw(new Vector3f(dest.x() - radius, this.position.y() + radius, 0), new Vector3f(dest.x(), dest.y() - radius, 0)); - + if (showConstruct) { internalSetColor(Color.AQUA_MARINE); } @@ -585,7 +608,7 @@ public abstract class CompositingDrawing extends CompositingDraw { FMath.PI * 0.5f); circleRaw(new Vector3f(this.position.x() + radius, dest.y() - radius, 0), radius, FMath.PI * 0.5f, FMath.PI * 0.5f); - + if (showConstruct) { internalSetColor(Color.BLACK); rectangleRaw(this.position, this.position.add(10)); @@ -593,14 +616,56 @@ public abstract class CompositingDrawing extends CompositingDraw { rectangleRaw(dest.less(10), dest); } } - + + public void rectangleRadius(final Vector2f dest, final Insets thickness, final BorderRadius radius) { + internalSetColor(this.color); + final boolean showConstruct = true; + + // center rectangle + rectangleRaw(this.position.add(new Vector3f(thickness.top(), thickness.top(), 0)), + dest.toVector3f().less(new Vector3f(thickness.top(), thickness.top(), 0))); + // top & bottom rectangle ==> refacto .. + // rectangleRaw(this.position.add(new Vector3f(thickness.top(), 0, 0)), + // dest.toVector3f().less(new Vector3f(radius.topLeft(), 0, 0))); + // if (showConstruct) { + // internalSetColor(Color.ORANGE); + // } + // // left rectangle + // rectangleRaw(this.position.add(new Vector3f(0, radius.topLeft(), 0)), + // new Vector3f(this.position.x() + radius.topLeft(), dest.y() - radius.topLeft(), 0)); + // if (showConstruct) { + // internalSetColor(Color.GRAY); + // } + // // right rectangle + // rectangleRaw(new Vector3f(dest.x() - radius.topLeft(), this.position.y() + radius.topLeft(), 0), + // new Vector3f(dest.x(), dest.y() - radius.topLeft(), 0)); + + if (showConstruct) { + internalSetColor(Color.AQUA_MARINE); + } + circleRaw(this.position.add(radius.topLeft(), radius.topLeft(), 0), radius.topLeft(), FMath.PI, + FMath.PI * 0.5f); + circleRaw(dest.toVector3f().less(radius.topLeft(), radius.topLeft(), 0), radius.topLeft(), 0, FMath.PI * 0.5f); + circleRaw(new Vector3f(dest.x() - radius.topLeft(), this.position.y() + radius.topLeft(), 0), radius.topLeft(), + FMath.PI * 1.5f, FMath.PI * 0.5f); + circleRaw(new Vector3f(this.position.x() + radius.topLeft(), dest.y() - radius.topLeft(), 0), radius.topLeft(), + FMath.PI * 0.5f, FMath.PI * 0.5f); + + if (showConstruct) { + internalSetColor(Color.BLACK); + rectangleRaw(this.position, this.position.add(10)); + internalSetColor(Color.RED); + rectangleRaw(dest.toVector3f().less(10), dest.toVector3f()); + } + } + public void rectangleBorderRadius(final Vector2f dest, final float thickness, final float radius) { rectangleBorderRadius(dest.toVector3f(), thickness, radius); } - + public void rectangleBorderRadius(final Vector3f dest, final float thickness, final float radius) { - internalSetColor(this.color); - final boolean showConstruct = true; + internalSetColor(this.colorBg); + final boolean showConstruct = false; if (showConstruct) { internalSetColor(Color.ANTIQUE_WHITE); } @@ -616,7 +681,7 @@ public abstract class CompositingDrawing extends CompositingDraw { // right rectangleRaw(new Vector3f(dest.x() - thickness * 0.5f, this.position.y() + radius, 0), new Vector3f(dest.x() + thickness * 0.5f, dest.y() - radius, 0)); - + if (showConstruct) { internalSetColor(Color.DARK_RED); } @@ -626,7 +691,7 @@ public abstract class CompositingDrawing extends CompositingDraw { FMath.PI * 1.5f, FMath.PI * 0.5f); circleBorderRaw(new Vector3f(this.position.x() + radius, dest.y() - radius, 0), radius, thickness, FMath.PI * 0.5f, FMath.PI * 0.5f); - + if (showConstruct) { internalSetColor(Color.BLACK); rectangleRaw(this.position, this.position.add(10)); @@ -635,18 +700,59 @@ public abstract class CompositingDrawing extends CompositingDraw { } } + public void rectangleBorderRadius( + //final Vector2f pos, + final Vector2f dest, + final Insets thickness, + final BorderRadius radius) { + internalSetColor(this.color); + final boolean showConstruct = true; + if (showConstruct) { + internalSetColor(Color.ANTIQUE_WHITE); + } + // // Bottom + // rectangleRaw(new Vector3f(this.position.x() + radius, this.position.y() - thickness * 0.5f, 0), + // new Vector3f(dest.x() - radius, this.position.y() + thickness * 0.5f, 0)); + // // top + // rectangleRaw(new Vector3f(this.position.x() + radius, dest.y() - thickness * 0.5f, 0), + // new Vector3f(dest.x() - radius, dest.y() + thickness * 0.5f, 0)); + // // left + // rectangleRaw(new Vector3f(this.position.x() - thickness * 0.5f, this.position.y() + radius, 0), + // new Vector3f(this.position.x() + thickness * 0.5f, dest.y() - radius, 0)); + // // right + // rectangleRaw(new Vector3f(dest.x() - thickness * 0.5f, this.position.y() + radius, 0), + // new Vector3f(dest.x() + thickness * 0.5f, dest.y() - radius, 0)); + // + // if (showConstruct) { + // internalSetColor(Color.DARK_RED); + // } + // circleBorderRaw(this.position.add(radius, radius, 0), radius, thickness, FMath.PI, FMath.PI * 0.5f); + // circleBorderRaw(dest.less(radius, radius, 0), radius, thickness, 0, FMath.PI * 0.5f); + // circleBorderRaw(new Vector3f(dest.x() - radius, this.position.y() + radius, 0), radius, thickness, + // FMath.PI * 1.5f, FMath.PI * 0.5f); + // circleBorderRaw(new Vector3f(this.position.x() + radius, dest.y() - radius, 0), radius, thickness, + // FMath.PI * 0.5f, FMath.PI * 0.5f); + // + // if (showConstruct) { + // internalSetColor(Color.BLACK); + // rectangleRaw(this.position, this.position.add(10)); + // internalSetColor(Color.RED); + // rectangleRaw(dest.less(10), dest); + // } + } + public void rectangleWidth(final float xxx, final float yyy) { rectangleWidth(new Vector3f(xxx, yyy, 0)); } - + public void rectangleWidth(final float xxx, final float yyy, final float zzz) { rectangleWidth(new Vector3f(xxx, yyy, zzz)); } - + public void rectangleWidth(final Vector2f size) { rectangleWidth(new Vector3f(size.x(), size.y(), 0)); } - + /** * draw a 2D rectangle to the requested size. * @param size size of the rectangle @@ -654,18 +760,18 @@ public abstract class CompositingDrawing extends CompositingDraw { public void rectangleWidth(final Vector3f size) { rectangle(this.position.add(size)); } - + /** * in case of some error the count can be reset */ private void resetCount() { this.triElement = 0; } - + public void setClipping(final Vector2f pos, final Vector2f posEnd) { setClipping(new Vector3f(pos.x(), pos.y(), -1), new Vector3f(posEnd.x(), posEnd.y(), 1)); } - + /** * Request a clipping area for the text (next draw only) * @param pos Start position of the clipping @@ -678,7 +784,7 @@ public abstract class CompositingDrawing extends CompositingDraw { this.clippingPosStart = Vector3f.min(pos, posEnd); this.clippingEnable = true; } - + /** * enable/Disable the clipping (without lose the current clipping * position) @@ -687,11 +793,11 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setClippingMode(final boolean newMode) { this.clippingEnable = newMode; } - + public void setClippingWidth(final Vector2f pos, final Vector2f width) { setClippingWidth(new Vector3f(pos.x(), pos.y(), -1), new Vector3f(width.x(), width.y(), 2)); } - + /** * Request a clipping area for the text (next draw only) * @param pos Start position of the clipping @@ -700,7 +806,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setClippingWidth(final Vector3f pos, final Vector3f width) { setClipping(pos, pos.add(width)); } - + /** * set the Color of the current foreground font * @param color Color to set on foreground (for next print) @@ -708,7 +814,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setColor(final Color color) { this.color = color; } - + /** * set the background color of the font (for selected Text (not the * global BG)) @@ -717,7 +823,7 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setColorBg(final Color color) { this.colorBg = color; } - + /** * internal add of the specific point * @param point The requeste dpoint to add @@ -730,19 +836,19 @@ public abstract class CompositingDrawing extends CompositingDraw { } this.vbo.flush(); } - + public void setPos(final float xxx, final float yyy) { setPos(new Vector3f(xxx, yyy, 0)); } - + public void setPos(final float xxx, final float yyy, final float zzz) { setPos(new Vector3f(xxx, yyy, zzz)); } - + public void setPos(final Vector2f pos) { setPos(new Vector3f(pos.x(), pos.y(), 0)); } - + /** * set position for the next text written * @param pos Position of the text (in 3D) @@ -750,11 +856,11 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setPos(final Vector3f pos) { this.position = pos; } - + public void setRelPos(final float xxx, final float yyy) { this.position = this.position.add(xxx, yyy, 0); } - + /** * set relative position for the next text writen * @param pos ofset apply of the text (in 3D) @@ -762,15 +868,15 @@ public abstract class CompositingDrawing extends CompositingDraw { public void setRelPos(final float xxx, final float yyy, final float zzz) { this.position = this.position.add(xxx, yyy, zzz); } - + public void setRelPos(final Vector2f pos) { setRelPos(new Vector3f(pos.x(), pos.y(), 0)); } - + public void setRelPos(final Vector3f pos) { this.position = this.position.add(pos); } - + /** * Specify the line thickness for the next elements * @param thickness The thickness desired for the next print @@ -782,12 +888,12 @@ public abstract class CompositingDrawing extends CompositingDraw { this.thickness *= -1; } } - + /** * Un-Load the openGL program and get all the ID needed */ private void unLoadProgram() { this.oGLprogram = null; } - + } \ No newline at end of file diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingGC.java b/src/main/org/atriasoft/ewol/compositing/CompositingGC.java index b90d29c..668a0cf 100644 --- a/src/main/org/atriasoft/ewol/compositing/CompositingGC.java +++ b/src/main/org/atriasoft/ewol/compositing/CompositingGC.java @@ -5,7 +5,9 @@ */ package org.atriasoft.ewol.compositing; +import org.atriasoft.etk.BorderRadius; import org.atriasoft.etk.Color; +import org.atriasoft.etk.Insets; import org.atriasoft.etk.math.Vector2f; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +60,24 @@ public class CompositingGC extends CompositingDrawing { } } + @Override + public void addRectangle( + final Vector2f position, + 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 (this.strokeSize > 0) { + rectangleBorderRadius(position.add(size), thickness, radius); + } + } + } + @Override public void addCircle(final Vector2f position, final float radius) { setPos(position); diff --git a/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java index 68dfc0b..21f8f9d 100644 --- a/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java +++ b/src/main/org/atriasoft/ewol/compositing/CompositingSVG.java @@ -16,7 +16,9 @@ import org.atriasoft.esvg.JoinMode; import org.atriasoft.esvg.Line; import org.atriasoft.esvg.PaintState; import org.atriasoft.esvg.Rectangle; +import org.atriasoft.etk.BorderRadius; import org.atriasoft.etk.Color; +import org.atriasoft.etk.Insets; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Vector2f; @@ -49,20 +51,20 @@ public class CompositingSVG extends CompositingDraw { private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program private Vector3f position = Vector3f.ZERO; //!< The current position to draw private Vector2i requestSize = new Vector2i(2, 2); - + private ResourceTexture2 resource = null; //!< texture resources private ResourceVirtualArrayObject vbo = null; - + private Color[] vboDataColors = null; private Vector3f[] vboDataCoords = null; private Vector2f[] vboDataCoordsTex = null; - + public CompositingSVG() { this(""" """, CompositingSVG.SIZE_AUTO); } - + public CompositingSVG(final String data, final int size) { this.svgData = data; // Create the VBO: @@ -76,7 +78,7 @@ public class CompositingSVG extends CompositingDraw { setSource(this.svgData, size); loadProgram(); } - + /** * clear alll tre registered element in the current element */ @@ -91,7 +93,7 @@ public class CompositingSVG extends CompositingDraw { this.color = Color.WHITE; this.angle = 0; } - + /** * draw All the registered text in the current element on openGL * @param disableDepthTest disable the Depth test for display @@ -131,7 +133,7 @@ public class CompositingSVG extends CompositingDraw { this.vbo.unBindForRendering(); this.oGLprogram.unUse(); } - + @Override public void flush() { generate(); @@ -143,7 +145,7 @@ public class CompositingSVG extends CompositingDraw { this.vbo.flush(); } } - + /** * get the current display position (sometime needed in the gui control) * @return the current position. @@ -151,7 +153,7 @@ public class CompositingSVG extends CompositingDraw { public Vector3f getPos() { return this.position; } - + /** * get the source image registered size in the file (<0 when multiple size image) * @return tre image registered size @@ -162,7 +164,7 @@ public class CompositingSVG extends CompositingDraw { } return this.resource.getUsableSize(); } - + /** * Sometimes the user declare an image but not allocate the resources all the time, this is to know it .. * @return the validity of the resources. @@ -170,7 +172,7 @@ public class CompositingSVG extends CompositingDraw { public boolean hasSources() { return this.resource != null; } - + /** * load the openGL program and get all the ID needed */ @@ -184,11 +186,11 @@ public class CompositingSVG extends CompositingDraw { this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView"); } } - + public void print(final Vector2f size) { printPart(size, Vector2f.ZERO, Vector2f.ONE); } - + /** * add a compleate of the image to display with the requested size * @param size size of the output image @@ -196,7 +198,7 @@ public class CompositingSVG extends CompositingDraw { public void print(final Vector2i size) { print(new Vector2f(size.x(), size.y())); } - + /** * add a part of the image to display with the requested size * @param size size of the output image @@ -214,73 +216,73 @@ public class CompositingSVG extends CompositingDraw { final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio); LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart + " stop=" + sourcePosStop); - + this.vboDataColors = new Color[6]; this.vboDataCoords = new Vector3f[6]; this.vboDataCoordsTex = new Vector2f[6]; - + if (this.angle == 0.0f) { Vector3f point = this.position; int indexElem = 0; - + Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); point = new Vector3f(this.position.x() + size.x(), this.position.y(), 0); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); point = new Vector3f(this.position.x() + size.x(), this.position.y() + size.y(), 0); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); point = new Vector3f(this.position.x(), this.position.y() + size.y(), 0); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); point = new Vector3f(this.position.x(), this.position.y(), 0); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; - + return; } - + final Vector3f center = this.position.add(new Vector3f(size.x(), size.y(), 0)).divide(2.0f); - + final Vector3f limitedSize = new Vector3f(size.x() * 0.5f, size.y() * 0.5f, 0.0f); - + Vector3f point = Vector3f.ZERO; - + Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); - + int indexElem = 0; - + point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); point = new Vector3f(limitedSize.x(), -limitedSize.y(), 0); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); @@ -288,7 +290,7 @@ public class CompositingSVG extends CompositingDraw { this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); point = new Vector3f(limitedSize.x(), limitedSize.y(), 0); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); @@ -296,12 +298,12 @@ public class CompositingSVG extends CompositingDraw { this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); point = new Vector3f(-limitedSize.x(), limitedSize.y(), 0); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); @@ -309,16 +311,16 @@ public class CompositingSVG extends CompositingDraw { this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; indexElem++; - + tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); this.vboDataCoords[indexElem] = point; this.vboDataCoordsTex[indexElem] = tex; this.vboDataColors[indexElem] = this.color; - + } - + /** * set a unique rotation of this element (not set in the rotate Generic system) * @param angleRad Angle to set in radiant. @@ -326,7 +328,7 @@ public class CompositingSVG extends CompositingDraw { public void setAngle(final float angleRad) { this.angle = angleRad; } - + /** * set the Color of the current foreground font * @param color Color to set on foreground (for next print) @@ -334,15 +336,15 @@ public class CompositingSVG extends CompositingDraw { public void setColor(final Color color) { this.color = color; } - + public void setPos(final Vector2f pos) { setPos(new Vector3f(pos.x(), pos.y(), 0)); } - + public void setPos(final Vector2i pos) { setPos(new Vector3f(pos.x(), pos.y(), 0)); } - + /** * set position for the next text written * @param pos Position of the text (in 3D) @@ -350,11 +352,11 @@ public class CompositingSVG extends CompositingDraw { public void setPos(final Vector3f pos) { this.position = pos; } - + public void setRelPos(final Vector2f pos) { setRelPos(new Vector3f(pos.x(), pos.y(), 0)); } - + /** * set relative position for the next text written * @param pos offset apply of the text (in 3D) @@ -362,7 +364,7 @@ public class CompositingSVG extends CompositingDraw { public void setRelPos(final Vector3f pos) { this.position = this.position.add(pos); } - + public void setSource(final ImageByteRGBA image) { clear(); this.svgData = null; @@ -370,20 +372,20 @@ public class CompositingSVG extends CompositingDraw { this.resource = new ResourceTexture2(); this.resource.set(image); } - + public void setSource(final String data) { setSource(data, 32); } - + public void setSource(final String data, final int size) { setSource(data, new Vector2i(size, size)); } - + // public void setSource(final Uri data, final Vector2i size) { // data // setSource // } - + public void setSource(final String data, final Vector2i size) { if (data == null) { LOGGER.error("try to set NULL data in svg"); @@ -411,7 +413,7 @@ public class CompositingSVG extends CompositingDraw { this.svgData = data; this.requestSize = size; } - + public void setSource(final EsvgDocument data, final Vector2i size) { if (this.svgData == null && this.svgDoc.equals(data) && this.requestSize.x() == size.x() && this.requestSize.y() == size.y()) { @@ -423,7 +425,7 @@ public class CompositingSVG extends CompositingDraw { this.requestSize = size; generate(); } - + protected void generate() { final Vector2i size = this.requestSize; if (this.svgDoc != null) { @@ -438,13 +440,13 @@ public class CompositingSVG extends CompositingDraw { this.resource.set(tmp); } } - - PaintState paint = new PaintState(); + PaintState paint = new PaintState(); + public void clearPaint() { this.paint.clear(); } - + public void createSize(final Vector2i size) { clear(); this.paint.clear(); @@ -453,38 +455,38 @@ public class CompositingSVG extends CompositingDraw { } this.requestSize = size; } - + @Override public void setPaintFillColor(final Color color) { this.paint.fill = new Pair<>(color, ""); } - + @Override public void setPaintStrokeColor(final Color color) { this.paint.stroke = new Pair<>(color, ""); } - + @Override public void setPaintStrokeWidth(final float width) { this.paint.strokeWidth = width; } - + public void setPaintLineJoin(final JoinMode lineJoin) { this.paint.lineJoin = lineJoin; } - + public void setPaintLineCap(final CapMode lineCap) { this.paint.lineCap = lineCap; } - + public void setPaintMiterLimit(final float miterLimit) { this.paint.miterLimit = miterLimit; } - + public void setPaintOpacity(final float opacity) { this.paint.opacity = opacity; } - + @Override public void addLine(final Vector2f startPos, final Vector2f stopPos) { if (this.svgDoc == null) { @@ -492,7 +494,7 @@ public class CompositingSVG extends CompositingDraw { } this.svgDoc.addElement(new Line(startPos, stopPos, this.paint)); } - + @Override public void addRectangle(final Vector2f position, final Vector2f size) { if (this.svgDoc == null) { @@ -500,7 +502,7 @@ public class CompositingSVG extends CompositingDraw { } this.svgDoc.addElement(new Rectangle(position, size, this.paint)); } - + @Override public void addRectangle(final Vector2f position, final Vector2f size, final Vector2f roundedCorner) { if (this.svgDoc == null) { @@ -508,7 +510,7 @@ public class CompositingSVG extends CompositingDraw { } this.svgDoc.addElement(new Rectangle(position, size, roundedCorner, this.paint)); } - + @Override public void addCircle(final Vector2f position, final float radius) { if (this.svgDoc == null) { @@ -516,7 +518,7 @@ public class CompositingSVG extends CompositingDraw { } this.svgDoc.addElement(new Circle(position, radius, this.paint)); } - + @Override public void addEllipse(final Vector2f center, final Vector2f radius) { if (this.svgDoc == null) { @@ -524,14 +526,14 @@ public class CompositingSVG extends CompositingDraw { } this.svgDoc.addElement(new Ellipse(center, radius, this.paint)); } - + public void setRectangleAsSource(final int sizeX, final int sizeY, final Color color) { createSize(new Vector2i(sizeX, sizeY)); // specific for SVG setPaintFillColor(color); addRectangle(Vector2f.ZERO, new Vector2f(sizeX, sizeY)); flush(); } - + public void setRectangleBorderAsSource( final int sizeX, final int sizeY, @@ -539,7 +541,7 @@ public class CompositingSVG extends CompositingDraw { final int borderSize, final int borderRadius, final Color borderColor) { - + final int paddingCompensateBorder = Math.round(borderSize * 0.5f); createSize(new Vector2i(sizeX, sizeY)); // specific for SVG setPaintFillColor(color); @@ -550,4 +552,14 @@ public class CompositingSVG extends CompositingDraw { new Vector2f(borderRadius, borderRadius)); flush(); } + + @Override + public void addRectangle( + final Vector2f position, + final Vector2f size, + final Insets thickness, + final BorderRadius radius) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/org/atriasoft/ewol/widget/Box.java b/src/main/org/atriasoft/ewol/widget/Box.java index 2546214..736d835 100644 --- a/src/main/org/atriasoft/ewol/widget/Box.java +++ b/src/main/org/atriasoft/ewol/widget/Box.java @@ -5,8 +5,10 @@ import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.DimensionBorderRadius; +import org.atriasoft.etk.DimensionInsets; +import org.atriasoft.etk.Insets; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2i; import org.atriasoft.ewol.compositing.CompositingGC; @@ -17,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; @@ -26,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 @@ -35,40 +37,40 @@ 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 Dimension1f propertyBorderWidth = Dimension1f.ZERO; + protected DimensionInsets propertyBorderWidth = DimensionInsets.ZERO; + @AknotManaged @AknotAttribute @AknotName(value = "border-width") @AknotDescription(value = "Border of the box") - public Dimension1f getPropertyBorderWidth() { + public DimensionInsets getPropertyBorderWidth() { return this.propertyBorderWidth; } - - public void setPropertyBorderWidth(final Dimension1f propertyBorder) { + + public void setPropertyBorderWidth(final DimensionInsets propertyBorder) { if (this.propertyBorderWidth.equals(propertyBorder)) { return; } @@ -76,18 +78,18 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - - protected Dimension1f propertyBorderRadius = new Dimension1f(0); - + + protected DimensionBorderRadius propertyBorderRadius = DimensionBorderRadius.ZERO; + @AknotManaged @AknotAttribute @AknotName(value = "border-radius") @AknotDescription(value = "Border radius of the box") - public Dimension1f getPropertyBorderRadius() { + public DimensionBorderRadius getPropertyBorderRadius() { return this.propertyBorderRadius; } - - public void setPropertyBorderRadius(final Dimension1f propertyBorderRadius) { + + public void setPropertyBorderRadius(final DimensionBorderRadius propertyBorderRadius) { if (this.propertyBorderRadius.equals(propertyBorderRadius)) { return; } @@ -95,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") @@ -105,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; @@ -114,9 +116,9 @@ public class Box extends Container { markToRedraw(); requestUpdateSize(); } - + protected Color propertyColor = Color.NONE; - + @AknotManaged @AknotAttribute @AknotName(value = "color") @@ -124,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; @@ -133,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") @@ -143,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; @@ -152,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") @@ -162,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; @@ -171,24 +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 Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f, - this.propertyBorderWidth.size() * 2.0f); + final Insets borderSize = this.propertyBorderWidth.getPixel(); + final Vector2f padding = this.propertyPadding.size().multiply(2); final Vector2f margin = this.propertyMargin.size().multiply(2); - final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize); - + + final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize.toVector2f()); + this.minSize = calculatedBoxMinSize; this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size()); markToRedraw(); } - + @Override public void onChangeSize() { markToRedraw(); @@ -200,9 +203,9 @@ public class Box extends Container { } final Vector2f localPadding = this.propertyPadding.size(); final Vector2f localMargin = this.propertyMargin.size(); - final float localBorderSize = this.propertyBorderWidth.size(); - final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize); - + 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()); @@ -216,7 +219,7 @@ public class Box extends Container { } subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2)); subWidgetSize = subWidgetSize.clipInteger(); - + final Vector2f freeSizeWithoutWidget = this.size.less(offsetSubWidget.multiply(2)).less(subWidgetSize); Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget)); subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget); @@ -225,11 +228,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()) { @@ -240,7 +243,7 @@ public class Box extends Container { } return tmpRenderSize; } - + @Override public void onRegenerateDisplay() { super.onRegenerateDisplay(); @@ -248,33 +251,32 @@ 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 : this.vectorialDraw.clear(); - final int borderSize = (int) this.propertyBorderWidth.size(); this.vectorialDraw.setPaintFillColor(this.propertyColor); this.vectorialDraw.setPaintStrokeColor(this.propertyBorderColor); - this.vectorialDraw.setPaintStrokeWidth(borderSize); - this.vectorialDraw.addRectangle(renderOrigin, renderSize, - new Vector2f(this.propertyBorderRadius.size(), this.propertyBorderRadius.size())); + //this.vectorialDraw.setPaintStrokeWidth(borderSize); + this.vectorialDraw.addRectangle(renderOrigin, renderSize, this.propertyBorderWidth.getPixel(), + this.propertyBorderRadius.getPixel()); this.vectorialDraw.flush(); } - + @Override protected void onDraw() { if (this.vectorialDraw != null) { @@ -282,5 +284,5 @@ public class Box extends Container { } super.onDraw(); } - + } diff --git a/src/main/org/atriasoft/ewol/widget/Button.java b/src/main/org/atriasoft/ewol/widget/Button.java index 1c33d8c..84ff3dd 100644 --- a/src/main/org/atriasoft/ewol/widget/Button.java +++ b/src/main/org/atriasoft/ewol/widget/Button.java @@ -8,8 +8,8 @@ import org.atriasoft.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.DimensionInsets; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2f; @@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory; */ public class Button extends Box { private static final Logger LOGGER = LoggerFactory.getLogger(Button.class); - + public static Button createLabelButton(final String label) { final Button out = new Button(); final Label labelWidget = new Label(); @@ -46,7 +46,7 @@ public class Button extends Box { out.setSubWidget(labelWidget); return out; } - + /** * Periodic call to update graphic display * @param event Time generic event @@ -58,12 +58,12 @@ public class Button extends Box { // } self.markToRedraw(); } - + /// Periodic call handle to remove it when needed protected Connection periodicConnectionHanble = new Connection(); - + private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol"); - + @AknotSignal @AknotName(value = "down") @AknotDescription("Button is Down") @@ -84,10 +84,10 @@ public class Button extends Box { @AknotName(value = "leave") @AknotDescription("The cursor leave the button") public SignalEmpty signalLeave = new SignalEmpty(); - + private boolean buttonPressed = false; private final boolean mouseHover = false; - + /** * Constructor */ @@ -98,15 +98,15 @@ public class Button extends Box { setMouseLimit(1); setPropertyExpand(Vector2b.TRUE); setPropertyFill(Vector2b.TRUE); - setPropertyBorderWidth(new Dimension1f(4)); + setPropertyBorderWidth(new DimensionInsets(4)); //setPropertyBorderRadius(new Dimension1f(15)); setPropertyBorderColor(Color.BLACK); setPropertyColor(Color.WHITE); setPropertyPadding(new Dimension2f(new Vector2f(3, 3))); setPropertyMargin(new Dimension2f(new Vector2f(0, 0))); - + } - + @AknotManaged @AknotAttribute @AknotName(value = "config") @@ -114,7 +114,7 @@ public class Button extends Box { public Uri getPropertyConfig() { return this.propertyConfig; } - + @Override protected boolean onEventEntry(final EventEntry event) { //LOGGER.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); @@ -124,7 +124,7 @@ public class Button extends Box { } return super.onEventEntry(event); } - + @Override public boolean onEventInput(final EventInput event) { final Vector2f relPos = relativePosition(event.pos()); @@ -184,14 +184,14 @@ public class Button extends Box { } return false; } - + @Override protected void onLostFocus() { this.buttonPressed = false; LOGGER.trace(this.name + " : Remove Focus ..."); //checkStatus(); } - + public void setPropertyConfig(final Uri propertyConfig) { if (this.propertyConfig.equals(propertyConfig)) { return; diff --git a/src/main/org/atriasoft/ewol/widget/Tick.java b/src/main/org/atriasoft/ewol/widget/Tick.java index 90b3fe0..0e70d84 100644 --- a/src/main/org/atriasoft/ewol/widget/Tick.java +++ b/src/main/org/atriasoft/ewol/widget/Tick.java @@ -9,8 +9,8 @@ import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Color; -import org.atriasoft.etk.Dimension1f; import org.atriasoft.etk.Dimension2f; +import org.atriasoft.etk.DimensionInsets; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2f; @@ -45,19 +45,19 @@ public Uri> propertyShape; //!< shape of the widget public class Tick extends Box { private static final Logger LOGGER = LoggerFactory.getLogger(Tick.class); protected CompositingSVG compositingTick = new CompositingSVG(); - + /// color property of the text foreground private int colorIdTextFg; /// text display this.text //private final CompositingGraphicContext gc = new CompositingGraphicContext(); /// Periodic call handle to remove it when needed protected Connection periodicConnectionHanble = new Connection(); - + private final Uri propertyConfig = new Uri("THEME", "shape/Tick.json", "ewol"); private final Uri uriCheckGreen = new Uri("THEME", "CheckBoxCrossRed.svg", "ewol"); - - private Boolean propertyValue = false; //!< string that must be displayed + private Boolean propertyValue = false; //!< string that must be displayed + @AknotSignal @AknotName("down") @AknotDescription("Tick is Down") @@ -77,9 +77,9 @@ public class Tick extends Box { // element over: Vector2f overPositionStart = Vector2f.ZERO; Vector2f overPositionStop = Vector2f.ZERO; - + private boolean isDown; - + /** * Constuctor */ @@ -91,15 +91,15 @@ public class Tick extends Box { setPropertyExpand(Vector2b.FALSE); setPropertyFill(Vector2b.TRUE); setPropertyMinSize(new Dimension2f(new Vector2f(32f, 32f))); - setPropertyBorderWidth(new Dimension1f(4)); + setPropertyBorderWidth(new DimensionInsets(4)); //setPropertyBorderRadius(new Dimension1f(15)); setPropertyBorderColor(Color.BLACK); setPropertyColor(Color.WHITE); setPropertyPadding(new Dimension2f(new Vector2f(3, 3))); setPropertyMargin(new Dimension2f(new Vector2f(0, 0))); - - } + } + @Override public void calculateMinMaxSize() { // call main class @@ -107,7 +107,7 @@ public class Tick extends Box { // get generic padding final Padding padding = Padding.ZERO; final Vector2i minHeight = Vector2i.VALUE_16; - + Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y()); // add padding : minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y()); @@ -116,7 +116,7 @@ public class Tick extends Box { checkMinSize(); LOGGER.error("min size = " + this.minSize); } - + protected void changeStatusIn(final GuiShapeMode newStatusId) { // if (this.shape.changeStatusIn(newStatusId)) { // if (!this.periodicConnectionHanble.isConnected()) { @@ -127,12 +127,12 @@ public class Tick extends Box { // markToRedraw(); // } } - + private boolean checkIfOver(final Vector2f relPos) { return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y(); } - + @AknotManaged @AknotAttribute @AknotName("value") @@ -140,16 +140,16 @@ public class Tick extends Box { public Boolean getPropertyValue() { return this.propertyValue; } - + protected void onChangePropertyTextWhenNothing() { markToRedraw(); } - + protected void onChangePropertyValue() { //Boolean newData = this.propertyValue; markToRedraw(); } - + @Override protected void onDraw() { super.onDraw(); @@ -162,7 +162,7 @@ public class Tick extends Box { // this.shape.draw(true, this.propertyValue ? 0 : 1); // } } - + @Override public boolean onEventInput(final EventInput event) { final Vector2f positionAbsolute = new Vector2f(event.pos().x(), event.pos().y()); @@ -224,7 +224,7 @@ public class Tick extends Box { } return false; } - + @Override public void onRegenerateDisplay() { super.onRegenerateDisplay(); @@ -236,7 +236,7 @@ public class Tick extends Box { this.compositingTick.print(this.startPosition.less(4).toVector2f()); this.compositingTick.flush(); } - + /** * internal check the value with RegExp checking * @param newData The new string to display @@ -245,7 +245,7 @@ public class Tick extends Box { this.propertyValue = newData; markToRedraw(); } - + public void setPropertyValue(final Boolean propertyValue) { if (this.propertyValue.equals(propertyValue)) { return; @@ -254,5 +254,5 @@ public class Tick extends Box { this.signalValue.emit(this.propertyValue); onChangePropertyValue(); } - + }