From 599db5aefa4ba5ae4ea59130559500032a70ebaf Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 3 May 2022 15:06:29 +0200 Subject: [PATCH] [DEV] update new aknot --- old_widget/Gird.java | 420 ------------------ old_widget/meta/ColorChooser.java | 6 +- samples/src/module-info.java | 1 + .../sample/atriasoft/ewol/BasicWindows.java | 101 +++++ src/module-info.java | 3 +- .../ewol/annotation/EwolAnnotation.java | 20 - .../ewol/annotation/EwolDescription.java | 13 - .../ewol/annotation/EwolObjectProperty.java | 13 - .../atriasoft/ewol/annotation/EwolSignal.java | 7 - src/org/atriasoft/ewol/object/EwolObject.java | 32 +- src/org/atriasoft/ewol/widget/Button.java | 74 +-- src/org/atriasoft/ewol/widget/CheckBox.java | 44 +- src/org/atriasoft/ewol/widget/Composer.java | 30 +- src/org/atriasoft/ewol/widget/Container.java | 16 +- src/org/atriasoft/ewol/widget/ContainerN.java | 24 +- .../ewol/widget/ContainerToggle.java | 14 +- .../ewol/widget/ContainerWithShape.java | 16 +- src/org/atriasoft/ewol/widget/Entry.java | 72 +-- src/org/atriasoft/ewol/widget/Gird.java | 420 ++++++++++++++++++ .../atriasoft/ewol/widget/ImageDisplay.java | 107 ++--- src/org/atriasoft/ewol/widget/Label.java | 41 +- src/org/atriasoft/ewol/widget/LabelOnSVG.java | 59 +-- .../atriasoft/ewol/widget/ListFileSystem.java | 78 ++-- src/org/atriasoft/ewol/widget/PopUp.java | 16 +- .../atriasoft/ewol/widget/ProgressBar.java | 50 +-- src/org/atriasoft/ewol/widget/Scroll.java | 40 +- src/org/atriasoft/ewol/widget/Sizer.java | 31 +- src/org/atriasoft/ewol/widget/Spacer.java | 17 +- src/org/atriasoft/ewol/widget/Spin.java | 58 +-- src/org/atriasoft/ewol/widget/Tick.java | 42 +- src/org/atriasoft/ewol/widget/Widget.java | 77 ++-- .../atriasoft/ewol/widget/WidgetScrolled.java | 24 +- .../ewol/widget/WidgetXmlFactory.java | 6 +- src/org/atriasoft/ewol/widget/Windows.java | 44 +- .../ewol/widget/meta/FileChooser.java | 58 +-- .../atriasoft/ewol/widget/meta/SpinBase.java | 24 +- 36 files changed, 1096 insertions(+), 1002 deletions(-) delete mode 100644 old_widget/Gird.java delete mode 100644 src/org/atriasoft/ewol/annotation/EwolAnnotation.java delete mode 100644 src/org/atriasoft/ewol/annotation/EwolDescription.java delete mode 100644 src/org/atriasoft/ewol/annotation/EwolObjectProperty.java delete mode 100644 src/org/atriasoft/ewol/annotation/EwolSignal.java create mode 100644 src/org/atriasoft/ewol/widget/Gird.java diff --git a/old_widget/Gird.java b/old_widget/Gird.java deleted file mode 100644 index b258a62..0000000 --- a/old_widget/Gird.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * @author Edouard DUPIN - * @copyright 2011, Edouard DUPIN, all right reserved - * @license MPL v2.0 (see license file) - */ -package org.atriasoft.ewol.widget; - -import java.io.File; -import java.io.IOException; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.atriasoft.esignal.Signal; -import org.atriasoft.etk.Color; -import org.atriasoft.etk.Uri; -import org.atriasoft.etk.math.Vector2f; -import org.atriasoft.etk.math.Vector2i; -import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.etk.math.Vector3i; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; -import org.atriasoft.ewol.event.EventInput; -import org.atriasoft.ewol.internal.Log; -import org.atriasoft.ewol.resource.ResourceColorFile; -import org.atriasoft.ewol.widget.model.ListRole; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.gale.key.KeyStatus; - -/** - * @ingroup ewolWidgetGroup - */ -class Gird extends Widget { - protected class GirdProperties { - public Widget widget; - public int row; - public int col; - }; - protected int sizeRow = 0; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ... - protected int uniformSizeRow = 0; - protected List sizeCol = new ArrayList<>(); //!< size of all colomn (if set (otherwise 0)) - protected List subWidget = new ArrayList<>(); //!< all sub widget are contained in this element - protected Widget tmpWidget = null; //!< use when replace a widget ... - protected boolean gavityButtom = true; - /** - * Constructor - */ - public Gird() { - this.borderSize = _newBorderSize; - if (this.borderSize.x() < 0) { - Log.error("Try to set a border size <0 on x : " + this.borderSize.x() + " == > restore to 0"); - this.borderSize.setX(0); - } - if (this.borderSize.y() < 0) { - Log.error("Try to set a border size <0 on y : " + this.borderSize.y() + " == > restore to 0"); - this.borderSize.setY(0); - } - markToRedraw(); - requestUpdateSize(); - } - /** - * set the number of colomn - * @param colNumber Nuber of colomn - */ - public void setColNumber(int _colNumber) { - if ((long)this.sizeCol.size() > _colNumber) { - int errorControl = this.subWidget.size(); - // remove subWidget : - for (long iii=this.subWidget.size(); iii >= 0; iii--) { - if (this.subWidget[iii].col > (_colNumber-1)) { - // out of bounds : must remove it ... - if (this.subWidget[iii].widget != null) { - this.subWidget[iii].widget.reset(); - // no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ... - if (errorControl == this.subWidget.size()) { - Log.critical("[" + getId() + "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); - } - } else { - Log.warning("[" + getId() + "] Must not have null pointer on the subWidget list ..."); - this.subWidget.erase(this.subWidget.begin()+iii); - } - errorControl = this.subWidget.size(); - } - } - // just add the col size: - this.sizeCol.erase(this.sizeCol.end()); - } else { - // just add the col size: - for (int iii=this.sizeCol.size()-1; iii<_colNumber-1 ; iii++) { - this.sizeCol.pushBack(0); - } - } - } - /** - * change a size view of a colomn. - * @param colId Id of the colomn [0..x]. - * @param size size of the colomn. - */ - public void setColSize(int _colId, int _size) { - if ((long)this.sizeCol.size() > _colId) { - this.sizeCol[_colId] = _size; - } else { - Log.error("Can not set the Colomn size : " + _colId+1 - + " at " + _size + "px we have " - + this.sizeCol.size() + " colomn"); - } - } - - /** - * change a size view of a line. - * @param size size of the line. - */ - public void setRowSize(int _size){ - this.sizeRow = _size; - } - /** - * get the size view of a colomn. - * @param colId Id of the colomn [0..x]. - * @return The size of the colomn. - */ - public int getColSize(int _colId) { - if ((long)this.sizeCol.size() > _colId) { - if (this.sizeCol[_colId] <= 0) { - return 0; - } - return this.sizeCol[_colId]; - } - Log.error("Can not get the Colomn size : " + _colId+1 + " we have "+ this.sizeCol.size() + " colomn"); - return 0; - } - /** - * get the size view of the lines. - * @return The size of the lines. - */ - public int getRowSize(){ - return this.sizeRow; - } - /** - * set the gravity of the widget on the Button (index 0 is on buttom) - */ - public void setGravityButtom() { - this.gavityButtom = true; - markToRedraw(); - } - /** - * set the gravity of the widget on the Top (index 0 is on top) - */ - public void setGravityTop() { - this.gavityButtom = false; - markToRedraw(); - } - /** - * remove all sub element from the widget. - */ - public void subWidgetRemoveAll() { - int errorControl = this.subWidget.size(); - this.subWidget.clear(); - } - /** - * add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right) - * @param _colId Id of the colomn [0..x]. - * @param _rowId Id of the row [0..y]. - * @param _newWidget the element pointer - */ - public void subWidgetAdd(int _colId, int _rowId, Widget _newWidget){ - if (_newWidget == null) { - return; - } - GirdProperties prop; - prop.row = _rowId; - prop.col = _colId; - prop.widget = _newWidget; - - // need to find the correct position : - for (int iii=0; iii prop.row) { - // find a new position; - this.subWidget.insert(this.subWidget.begin()+iii, prop); - return; - } else { - if (this.subWidget[iii].col < prop.col) { - continue; - } else if (this.subWidget[iii].col > prop.col) { - // find a new position; - this.subWidget.insert(this.subWidget.begin()+iii, prop); - return; - } else { - // The element already exist == > replace it ... - this.tmpWidget = this.subWidget[iii].widget; - this.subWidget[iii].widget = _newWidget; - if (this.tmpWidget != null) { - this.tmpWidget.reset(); - if (this.tmpWidget != null) { - Log.critical("[" + getId() + "] Error while replacing a widget ... == > never call when free"); - this.tmpWidget = null; - } - } - } - } - } - // not find == > just adding it ... - this.subWidget.pushBack(prop); - } - /** - * remove definitly a widget from the system and this Gird. - * @param _newWidget the element pointer. - */ - public void subWidgetRemove(Widget _newWidget){ - for (int iii=0; iii= _pos.x()) - && (tmpOrigin.y() <= _pos.y() && tmpOrigin.y() + tmpSize.y() >= _pos.y()) ) { - Widget tmpWidget = it.widget.getWidgetAtPos(_pos); - if (tmpWidget != null) { - return tmpWidget; - } - // stop searching - break; - } - } - return null; - } - public void onChangeSize() { - //Log.debug("Update size"); - this.size -= this.borderSize*2; - - for (int iii=0; iii lastLineID) { - // change of line : - lastLineID = this.subWidget[iii].row; - } - if (this.subWidget[iii].widget != null) { - this.subWidget[iii].widget.calculateMinMaxSize(); - Vector2f tmpSize = this.subWidget[iii].widget.getCalculateMinSize(); - Log.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize); - // for all we get the max size : - this.uniformSizeRow = etk::max((int)tmpSize.y(), this.uniformSizeRow); - // for the colomn size : We set the autamatic value in negative : - if (this.sizeCol[this.subWidget[iii].col] <= 0) { - this.sizeCol[this.subWidget[iii].col] = etk::min(this.sizeCol[this.subWidget[iii].col], (int)-tmpSize.x() ); - } - } - } - - if (this.sizeRow > 0) { - this.uniformSizeRow = this.sizeRow; - } - int tmpSizeWidth = 0; - for (int iii=0; iii classType = widget.getClass(); + final Field[] fields = classType.getFields(); + Log.verbose(" Fields: (" + fields.length + ")"); + for (final Field elem : fields) { + // we does not manage static field + if (Modifier.isStatic(elem.getModifiers())) { + continue; + } + // we does not manage private field + // NOTE: if the field is private I do not check the elements ==> the user want a private API !!! (maybe change ...) + if (!Modifier.isPublic(elem.getModifiers())) { + continue; + } + final Boolean isSignal = ReflectTools.getIsSignal(elem, false); + if (!isSignal) { + continue; + } + final String[] names = ReflectTools.getNames(elem, null); + String eventName = elem.toGenericString(); + Log.error(" - name={} otherNames={}", eventName, Arrays.toString(names)); + if (names.length != 0 && names[0] != null) { + eventName = names[0]; + } + final String description = ReflectTools.getDescription(elem); + if (description != null) { + Log.error(" ==> '{}'", description); + } + final Class[] types = ReflectTools.getTypeField(elem); + Log.error(" typeSignal '{}'", Arrays.toString(types)); + if (types.length == 2 && types[0] == Signal.class) { + Log.error(" ** Signal<{}>", types[1].getCanonicalName()); + final Object signalObject = elem.get(widget); + if (signalObject == null) { + Log.error("Signal is not accessible !!!!!!! "); + } else { + final String valueNameOfSignal = eventName; + @SuppressWarnings("unchecked") + final Signal tmp = (Signal) signalObject; + tmp.connect((object) -> { + Log.print("Get event from '{}' value='{}'", valueNameOfSignal, object); + }); + } + } + if (types.length == 1 && types[0] == SignalEmpty.class) { + Log.error(" ** SignalEmpty"); + + } + + } + + } + + public void displayAllPropertyWithType(final Widget widget) throws Exception { + Log.warning("Connect all property(ies) on '{}'", widget.getName()); + final Class classType = widget.getClass(); + final List methods = ReflectClass.getFilterGenericFucntion(classType, null, true, true, true); + // Separate the methods and filer as: + // - XXX GetXxx(); & XXX != boolean + // - void setXxx(XXX elem); + // - [bB]oolean isXxx(); + // for records: + // - xxx(); + final boolean isRecord = Record.class.isAssignableFrom(classType); + final List methodsGet = ReflectClass.extractGetMethod(classType, methods, null); + for (final Method elem : methodsGet) { + final String name = Tools.decapitalizeFirst(isRecord ? elem.getName() : elem.getName().substring(3)); + final Boolean isAttribute = ReflectTools.getIsAttribute(elem, false); + if (!isAttribute) { + continue; + } + final String[] otherNames = ReflectTools.getNames(elem, null); + Log.error(" - '{}' otherNames={}", name, Arrays.toString(otherNames)); + final String description = ReflectTools.getDescription(elem); + if (description != null) { + Log.error(" ==> '{}'", description); + } + } + + } + public void setTestWidget(final Widget widget) { + try { + connectAllSignals(widget); + displayAllPropertyWithType(widget); + } catch (final Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.sizerTestAreaHori.subWidgetRemoveAll(); { final Spacer simpleSpacer = new Spacer(); @@ -220,4 +320,5 @@ public class BasicWindows extends Windows { final Label gravLabel = (Label) (this.buttonGravity.getSubWidgets()[0]); gravLabel.setPropertyValue(LABEL_GRAVITY + gravity.toString()); } + } \ No newline at end of file diff --git a/src/module-info.java b/src/module-info.java index df373e5..b940efd 100644 --- a/src/module-info.java +++ b/src/module-info.java @@ -4,7 +4,6 @@ open module org.atriasoft.ewol { exports org.atriasoft.ewol; - exports org.atriasoft.ewol.annotation; exports org.atriasoft.ewol.compositing; exports org.atriasoft.ewol.compositing.tools; exports org.atriasoft.ewol.context; @@ -14,7 +13,7 @@ open module org.atriasoft.ewol { exports org.atriasoft.ewol.resource.font; //exports org.atriasoft.ewol.tools; exports org.atriasoft.ewol.widget; - //exports org.atriasoft.ewol.widget.meta; + exports org.atriasoft.ewol.widget.meta; requires transitive org.atriasoft.esignal; requires transitive org.atriasoft.iogami; diff --git a/src/org/atriasoft/ewol/annotation/EwolAnnotation.java b/src/org/atriasoft/ewol/annotation/EwolAnnotation.java deleted file mode 100644 index dfabd80..0000000 --- a/src/org/atriasoft/ewol/annotation/EwolAnnotation.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.atriasoft.ewol.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Meta-annotation (annotations used on other annotations) - * used for marking all annotations that are - * part of Exml package. Can be used for recognizing all - * Exml annotations generically, and in future also for - * passing other generic annotation configuration. - */ -@Target(ElementType.ANNOTATION_TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface EwolAnnotation { - // for now, a pure tag annotation, no parameters - -} diff --git a/src/org/atriasoft/ewol/annotation/EwolDescription.java b/src/org/atriasoft/ewol/annotation/EwolDescription.java deleted file mode 100644 index e09b124..0000000 --- a/src/org/atriasoft/ewol/annotation/EwolDescription.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.atriasoft.ewol.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.FIELD, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@EwolAnnotation -public @interface EwolDescription { - String[] value(); -} diff --git a/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java b/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java deleted file mode 100644 index 1b405f0..0000000 --- a/src/org/atriasoft/ewol/annotation/EwolObjectProperty.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.atriasoft.ewol.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.FIELD, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@EwolAnnotation -public @interface EwolObjectProperty { - -} diff --git a/src/org/atriasoft/ewol/annotation/EwolSignal.java b/src/org/atriasoft/ewol/annotation/EwolSignal.java deleted file mode 100644 index 88fea5d..0000000 --- a/src/org/atriasoft/ewol/annotation/EwolSignal.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.atriasoft.ewol.annotation; - -public @interface EwolSignal { - String description() default ""; - - String[] name(); -} diff --git a/src/org/atriasoft/ewol/object/EwolObject.java b/src/org/atriasoft/ewol/object/EwolObject.java index c04639b..3cbb5f8 100644 --- a/src/org/atriasoft/ewol/object/EwolObject.java +++ b/src/org/atriasoft/ewol/object/EwolObject.java @@ -2,17 +2,17 @@ package org.atriasoft.ewol.object; import java.lang.ref.WeakReference; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotDefaultAttribute; +import org.atriasoft.aknot.annotation.AknotDefaultManaged; +import org.atriasoft.aknot.annotation.AknotDefaultOptional; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotIgnoreUnknown; +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.ewol.Ewol; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.context.EwolContext; import org.atriasoft.ewol.internal.Log; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlDefaultAttibute; -import org.atriasoft.exml.annotation.XmlDefaultManaged; -import org.atriasoft.exml.annotation.XmlDefaultOptional; -import org.atriasoft.exml.annotation.XmlIgnoreUnknow; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** @file * @author Edouard DUPIN @@ -24,10 +24,10 @@ import org.atriasoft.exml.annotation.XmlName; * Basic message classes for ewol system * this class permit at every Object to communicate between them. */ -@XmlDefaultManaged(value = false) -@XmlDefaultOptional -@XmlDefaultAttibute -@XmlIgnoreUnknow +@AknotDefaultManaged(value = false) +@AknotDefaultOptional +@AknotDefaultAttribute +@AknotIgnoreUnknown public class EwolObject { private static Integer valUID = 0; //!< Static used for the unique ID definition @@ -114,10 +114,10 @@ public class EwolObject { return this.uniqueId; } - @XmlManaged - @XmlAttribute - @XmlName(value = "name") - @EwolDescription(value = "Name of the object.") + @AknotManaged + @AknotAttribute + @AknotName(value = "name") + @AknotDescription(value = "Name of the object.") public String getName() { return this.name; } diff --git a/src/org/atriasoft/ewol/widget/Button.java b/src/org/atriasoft/ewol/widget/Button.java index 43de832..6bab9b3 100644 --- a/src/org/atriasoft/ewol/widget/Button.java +++ b/src/org/atriasoft/ewol/widget/Button.java @@ -1,5 +1,10 @@ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; @@ -8,8 +13,6 @@ import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.compositing.GuiShapeMode; import org.atriasoft.ewol.compositing.ShapeBox; @@ -18,9 +21,6 @@ import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyKeyboard; import org.atriasoft.gale.key.KeyStatus; @@ -100,17 +100,29 @@ public class Button extends ContainerToggle { protected ShapeBox shapeProperty = ShapeBox.ZERO; private GuiShape shape; - @EwolSignal(name = "down", description = "Button is Down") + @AknotSignal + @AknotName(value = "down") + @AknotDescription("Button is Down") public SignalEmpty signalDown = new SignalEmpty(); - @EwolSignal(name = "up", description = "Button is Up") + @AknotSignal + @AknotName(value = "up") + @AknotDescription("Button is Up") public SignalEmpty signalUp = new SignalEmpty(); - @EwolSignal(name = "click", description = "Button is Clicked") + @AknotSignal + @AknotName(value = "click") + @AknotDescription("Button is Clicked") public SignalEmpty signalClick = new SignalEmpty(); - @EwolSignal(name = "enter", description = "The cursor enter inside the button") + @AknotSignal + @AknotName(value = "enter") + @AknotDescription("The cursor enter inside the button") public SignalEmpty signalEnter = new SignalEmpty(); - @EwolSignal(name = "leave", description = "The cursor leave the button") + @AknotSignal + @AknotName(value = "leave") + @AknotDescription("The cursor leave the button") public SignalEmpty signalLeave = new SignalEmpty(); - @EwolSignal(name = "value", description = "The button value change") + @AknotSignal + @AknotName(value = "value") + @AknotDescription("The button value change") public Signal signalValue = new Signal<>(); private boolean buttonPressed = false; @@ -165,42 +177,42 @@ public class Button extends ContainerToggle { changeStatusIn(GuiShapeMode.NONE); } - @XmlManaged - @XmlAttribute - @XmlName(value = "config") - @EwolDescription(value = "configuration of the widget") + @AknotManaged + @AknotAttribute + @AknotName(value = "config") + @AknotDescription(value = "configuration of the widget") public Uri getPropertyConfig() { return this.propertyConfig; } - @XmlManaged - @XmlAttribute - @XmlName(value = "lock") - @EwolDescription(value = "Lock the button in a special state to permit changing state only by the coder") + @AknotManaged + @AknotAttribute + @AknotName(value = "lock") + @AknotDescription(value = "Lock the button in a special state to permit changing state only by the coder") public ButtonLock getPropertyLock() { return this.propertyLock; } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "Value display in the entry (decorated text)") + @AknotManaged + @AknotAttribute + @AknotName(value = "value") + @AknotDescription(value = "Value display in the entry (decorated text)") public boolean getPropertyValue() { return this.propertyValue; } - @XmlManaged - @XmlAttribute - @XmlName(value = "enable-single") - @EwolDescription(value = "If one element set in the Button ==> display only set") + @AknotManaged + @AknotAttribute + @AknotName(value = "enable-single") + @AknotDescription(value = "If one element set in the Button ==> display only set") public boolean isPropertyEnableSingle() { return this.propertyEnableSingle; } - @XmlManaged - @XmlAttribute - @XmlName(value = "toggle") - @EwolDescription(value = "The button can toggle") + @AknotManaged + @AknotAttribute + @AknotName(value = "toggle") + @AknotDescription(value = "The button can toggle") public boolean isPropertyToggleMode() { return this.propertyToggleMode; } diff --git a/src/org/atriasoft/ewol/widget/CheckBox.java b/src/org/atriasoft/ewol/widget/CheckBox.java index 4c025bd..695b958 100644 --- a/src/org/atriasoft/ewol/widget/CheckBox.java +++ b/src/org/atriasoft/ewol/widget/CheckBox.java @@ -1,16 +1,16 @@ package org.atriasoft.ewol.widget; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; +import org.atriasoft.aknot.annotation.AknotSignal; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotText; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.widget.Sizer.DisplayMode; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlText; public class CheckBox extends Container { @@ -35,13 +35,21 @@ public class CheckBox extends Container { self.signalValue.emit(value); } - @EwolSignal(name = "down", description = "CheckBox is Down") + @AknotSignal + @AknotName("down") + @AknotDescription("CheckBox is Down") public SignalEmpty signalDown = new SignalEmpty(); - @EwolSignal(name = "up", description = "CheckBox is Up") + @AknotSignal + @AknotName("up") + @AknotDescription("CheckBox is Up") public SignalEmpty signalUp = new SignalEmpty(); - @EwolSignal(name = "click", description = "CheckBox is Clicked") + @AknotSignal + @AknotName("click") + @AknotDescription("CheckBox is Clicked") public SignalEmpty signalClick = new SignalEmpty(); - @EwolSignal(name = "value", description = "CheckBox value change") + @AknotSignal + @AknotName("value") + @AknotDescription("CheckBox value change") public Signal signalValue = new Signal<>(); final Tick tick; final Label label; @@ -74,18 +82,18 @@ public class CheckBox extends Container { this.label.signalPressed.connectAuto(this, CheckBox::eventLabelClick); } - @XmlManaged - @XmlText - @XmlName(value = "label") - @EwolDescription(value = "value of the label") + @AknotManaged + @AknotText + @AknotName(value = "label") + @AknotDescription(value = "value of the label") public String getPropertyLabel() { return this.label.getPropertyValue(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "State of the checkbox") + @AknotManaged + @AknotAttribute + @AknotName(value = "value") + @AknotDescription(value = "State of the checkbox") public Boolean getPropertyValue() { return this.tick.getPropertyValue(); } diff --git a/src/org/atriasoft/ewol/widget/Composer.java b/src/org/atriasoft/ewol/widget/Composer.java index 6d42af2..ac23084 100644 --- a/src/org/atriasoft/ewol/widget/Composer.java +++ b/src/org/atriasoft/ewol/widget/Composer.java @@ -1,23 +1,23 @@ -/* +package org.atriasoft.ewol.widget; + +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotDescription; +/** * @author Edouard DUPIN * @copyright 2011, Edouard DUPIN, all right reserved * @license MPL v2.0 (see license file) */ -package org.atriasoft.ewol.widget; - +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.exml.Exml; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.exml.exception.ExmlException; import org.atriasoft.gale.context.ClipboardList; import org.atriasoft.gale.context.Cursor; @@ -301,10 +301,10 @@ public class Composer extends Container { return super.getPropertyMinSize(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "sub-file") - @EwolDescription(value = "compose with a subXML file") + @AknotManaged + @AknotAttribute + @AknotName(value = "sub-file") + @AknotDescription(value = "compose with a subXML file") public Uri getPropertySubFile() { return this.propertySubFile; } @@ -351,10 +351,10 @@ public class Composer extends Container { return super.isFocused(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "remove-if-under-remove") - @EwolDescription(value = "Demand the remove iof the widget if the subObject demand a remove") + @AknotManaged + @AknotAttribute + @AknotName(value = "remove-if-under-remove") + @AknotDescription(value = "Demand the remove iof the widget if the subObject demand a remove") public boolean isPropertyRemoveIfUnderRemove() { return this.propertyRemoveIfUnderRemove; } diff --git a/src/org/atriasoft/ewol/widget/Container.java b/src/org/atriasoft/ewol/widget/Container.java index 1577ea3..7a6ebb4 100644 --- a/src/org/atriasoft/ewol/widget/Container.java +++ b/src/org/atriasoft/ewol/widget/Container.java @@ -5,15 +5,15 @@ */ package org.atriasoft.ewol.widget; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotFactory; +import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlFactory; -import org.atriasoft.exml.annotation.XmlManaged; /* * @ingroup ewolWidgetGroup @@ -65,10 +65,10 @@ public class Container extends Widget { * get the main node widget * @return the requested pointer on the node */ - @XmlManaged - @XmlAttribute(false) - @XmlFactory(WidgetXmlFactory.class) - @EwolDescription(value = "Sub-node with multiple names...") + @AknotManaged + @AknotAttribute(false) + @AknotFactory(WidgetXmlFactory.class) + @AknotDescription(value = "Sub-node with multiple names...") public Widget getSubWidget() { return this.subWidget; } diff --git a/src/org/atriasoft/ewol/widget/ContainerN.java b/src/org/atriasoft/ewol/widget/ContainerN.java index 1876837..eeaab3a 100644 --- a/src/org/atriasoft/ewol/widget/ContainerN.java +++ b/src/org/atriasoft/ewol/widget/ContainerN.java @@ -10,16 +10,16 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotFactory; +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlFactory; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** * @ingroup ewolWidgetGroup @@ -88,10 +88,10 @@ public class ContainerN extends Widget { } } - @XmlManaged - @XmlAttribute - @XmlName(value = "lock") - @EwolDescription(value = "Lock the subwidget expand") + @AknotManaged + @AknotAttribute + @AknotName(value = "lock") + @AknotDescription(value = "Lock the subwidget expand") public Vector3b getPropertyLockExpand() { return this.propertyLockExpand; } @@ -113,9 +113,9 @@ public class ContainerN extends Widget { return null; } - @XmlManaged - @XmlFactory(value = WidgetXmlFactory.class) - @EwolDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)") + @AknotManaged + @AknotFactory(value = WidgetXmlFactory.class) + @AknotDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)") public List getSubWidgets() { return this.subWidget; } diff --git a/src/org/atriasoft/ewol/widget/ContainerToggle.java b/src/org/atriasoft/ewol/widget/ContainerToggle.java index 5e82a1f..a862e46 100644 --- a/src/org/atriasoft/ewol/widget/ContainerToggle.java +++ b/src/org/atriasoft/ewol/widget/ContainerToggle.java @@ -5,14 +5,14 @@ */ package org.atriasoft.ewol.widget; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotFactory; +import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlFactory; -import org.atriasoft.exml.annotation.XmlManaged; /* * @ingroup ewolWidgetGroup @@ -79,9 +79,9 @@ public class ContainerToggle extends Widget { return null; } - @XmlManaged - @XmlFactory(value = WidgetXmlFactory.class) - @EwolDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)") + @AknotManaged + @AknotFactory(value = WidgetXmlFactory.class) + @AknotDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)") public Widget[] getSubWidgets() { return this.subWidget; } @@ -157,7 +157,7 @@ public class ContainerToggle extends Widget { onChangeSize(); } - @XmlManaged(value = false) + @AknotManaged(value = false) public void setSubWidget(final Widget newWidget) { setSubWidget(newWidget, 0); } diff --git a/src/org/atriasoft/ewol/widget/ContainerWithShape.java b/src/org/atriasoft/ewol/widget/ContainerWithShape.java index 9fe2b64..86b6ac3 100644 --- a/src/org/atriasoft/ewol/widget/ContainerWithShape.java +++ b/src/org/atriasoft/ewol/widget/ContainerWithShape.java @@ -5,17 +5,17 @@ */ package org.atriasoft.ewol.widget; +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.Uri; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.compositing.ShapeBox; import org.atriasoft.ewol.internal.Log; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** * Simple Container that have a Shape (not directly instantiate!!!!) @@ -50,10 +50,10 @@ public class ContainerWithShape extends Container { Log.warning("[{}] Result min size : {}", getId(), this.minSize); } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape") - @EwolDescription(value = "The uri one the shape for the Pop-up") + @AknotManaged + @AknotAttribute + @AknotName(value = "shape") + @AknotDescription(value = "The uri one the shape for the Pop-up") public Uri getPropertyShape() { return this.propertyShape; } diff --git a/src/org/atriasoft/ewol/widget/Entry.java b/src/org/atriasoft/ewol/widget/Entry.java index fc0b941..5e7646d 100644 --- a/src/org/atriasoft/ewol/widget/Entry.java +++ b/src/org/atriasoft/ewol/widget/Entry.java @@ -3,6 +3,11 @@ package org.atriasoft.ewol.widget; import java.util.Arrays; import java.util.regex.Pattern; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; @@ -10,8 +15,6 @@ import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.compositing.GuiShapeMode; @@ -20,9 +23,6 @@ import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.context.ClipBoard; import org.atriasoft.gale.context.ClipboardList; import org.atriasoft.gale.key.KeyKeyboard; @@ -84,12 +84,18 @@ public class Entry extends Widget { private Pattern regex = null; //!< regular expression to check content private GuiShape shape; //.create() - @EwolSignal(name = "click", description = "the user Click on the Entry box") + @AknotSignal + @AknotName(value = "click") + @AknotDescription("the user Click on the Entry box") public SignalEmpty signalClick = new SignalEmpty(); //!< bang on click the entry box - @EwolSignal(name = "enter", description = "The cursor enter inside the button") + @AknotSignal + @AknotName(value = "enter") + @AknotDescription("The cursor enter inside the button") public Signal signalEnter = new Signal<>(); //!< Enter key is pressed - @EwolSignal(name = "modify", description = "Entry box value change") + @AknotSignal + @AknotName(value = "modify") + @AknotDescription("Entry box value change") public Signal signalModify = new Signal<>(); //!< data change // element over: Vector3f overPositionStart = Vector3f.ZERO; @@ -97,7 +103,7 @@ public class Entry extends Widget { Vector3f overPositionStop = Vector3f.ZERO; /** - * Contuctor + * Constructor * @param _newData The USting that might be set in the Entry box (no event generation!!) */ public Entry() { @@ -651,10 +657,10 @@ public class Entry extends Widget { markToRedraw(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "config") - @EwolDescription(value = "configuration of the widget") + @AknotManaged + @AknotAttribute + @AknotName(value = "config") + @AknotDescription(value = "configuration of the widget") public void setPropertyConfig(final Uri propertyConfig) { if (this.propertyConfig.equals(propertyConfig)) { return; @@ -663,10 +669,10 @@ public class Entry extends Widget { onChangePropertyShaper(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "max") - @EwolDescription(value = "Maximum char that can be set on the Entry") + @AknotManaged + @AknotAttribute + @AknotName(value = "max") + @AknotDescription(value = "Maximum char that can be set on the Entry") public void setPropertyMaxCharacter(final int propertyMaxCharacter) { if (this.propertyMaxCharacter == propertyMaxCharacter) { return; @@ -675,10 +681,10 @@ public class Entry extends Widget { onChangePropertyMaxCharacter(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "password") - @EwolDescription(value = "Not display content in password mode") + @AknotManaged + @AknotAttribute + @AknotName(value = "password") + @AknotDescription(value = "Not display content in password mode") public void setPropertyPassword(final boolean propertyPassword) { if (this.propertyPassword == propertyPassword) { return; @@ -687,10 +693,10 @@ public class Entry extends Widget { onChangePropertyPassword(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "regex") - @EwolDescription(value = "Control what it is write with a regular expression") + @AknotManaged + @AknotAttribute + @AknotName(value = "regex") + @AknotDescription(value = "Control what it is write with a regular expression") public void setPropertyRegex(final String propertyRegex) { if (this.propertyRegex.equals(propertyRegex)) { return; @@ -699,10 +705,10 @@ public class Entry extends Widget { onChangePropertyRegex(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "empty-text") - @EwolDescription(value = "Text when nothing is written") + @AknotManaged + @AknotAttribute + @AknotName(value = "empty-text") + @AknotDescription(value = "Text when nothing is written") public void setPropertyTextWhenNothing(final String propertyTextWhenNothing) { if (this.propertyTextWhenNothing.equals(propertyTextWhenNothing)) { return; @@ -711,10 +717,10 @@ public class Entry extends Widget { onChangePropertyTextWhenNothing(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "Value display in the entry (decorated text)") + @AknotManaged + @AknotAttribute + @AknotName(value = "value") + @AknotDescription(value = "Value display in the entry (decorated text)") public void setPropertyValue(final String propertyValue) { if (this.propertyValue.equals(propertyValue)) { return; diff --git a/src/org/atriasoft/ewol/widget/Gird.java b/src/org/atriasoft/ewol/widget/Gird.java new file mode 100644 index 0000000..8e68f7d --- /dev/null +++ b/src/org/atriasoft/ewol/widget/Gird.java @@ -0,0 +1,420 @@ +/* + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ +package org.atriasoft.ewol.widget; + +import java.util.ArrayList; +import java.util.List; + +import org.atriasoft.etk.math.Vector3f; +import org.atriasoft.ewol.DrawProperty; +import org.atriasoft.ewol.internal.Log; + +/** + * @ingroup ewolWidgetGroup + */ +class Gird extends Widget { + protected class GirdProperties { + public Widget widget; + public int row; + public int col; + } + + protected int sizeRow = 0; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ... + protected int uniformSizeRow = 0; + protected List sizeCol = new ArrayList<>(); //!< size of all colomn (if set (otherwise 0)) + protected List subWidget = new ArrayList<>(); //!< all sub widget are contained in this element + protected Widget tmpWidget = null; //!< use when replace a widget ... + protected boolean gavityButtom = true; + + protected Vector3f propertyBorderSize = Vector3f.ZERO; //!< Border size needed for all the display + + /** + * Constructor + */ + public Gird() { + + } + + @Override + public void calculateMinMaxSize() { + for (int iii = 0; iii < this.sizeCol.size(); iii++) { + if (this.sizeCol.get(iii) <= 0) { + this.sizeCol.set(iii, 0); + } + } + //Log.debug("Update minimum size"); + this.minSize = this.propertyMinSize.getPixel(); + this.maxSize = this.propertyMaxSize.getPixel(); + this.uniformSizeRow = 0; + this.minSize = this.minSize.add(this.propertyBorderSize.multiply(2)); + int lastLineID = 0; + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (this.subWidget.get(iii).row > lastLineID) { + // change of line : + lastLineID = this.subWidget.get(iii).row; + } + if (this.subWidget.get(iii).widget != null) { + this.subWidget.get(iii).widget.calculateMinMaxSize(); + final Vector3f tmpSize = this.subWidget.get(iii).widget.getCalculateMinSize(); + Log.debug(" [" + iii + "] subWidgetMinSize=" + tmpSize); + // for all we get the max size : + this.uniformSizeRow = Math.max((int) tmpSize.y(), this.uniformSizeRow); + // for the colomn size : We set the autamatic value in negative : + if (this.sizeCol.get(this.subWidget.get(iii).col) <= 0) { + this.sizeCol.set(this.subWidget.get(iii).col, Math.min(this.sizeCol.get(this.subWidget.get(iii).col), (int) -tmpSize.x())); + } + } + } + + if (this.sizeRow > 0) { + this.uniformSizeRow = this.sizeRow; + } + int tmpSizeWidth = 0; + for (int iii = 0; iii < this.sizeCol.size(); iii++) { + tmpSizeWidth += Math.abs(this.sizeCol.get(iii)); + } + Log.debug(" tmpSizeWidth=" + tmpSizeWidth); + Log.debug(" this.uniformSizeRow=" + this.uniformSizeRow); + this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow, 0); + + Log.debug("Calculate min size : " + this.minSize); + + //Log.debug("Vert Result : expand="+ this.userExpand + " minSize="+ this.minSize); + } + + /** + * get the current border size of the current element: + * @return the border size (0 if not used) + */ + public Vector3f getBorderSize() { + return this.propertyBorderSize; + } + + /** + * get the size view of a colomn. + * @param colId Id of the colomn [0..x]. + * @return The size of the colomn. + */ + public int getColSize(final int colId) { + if ((long) this.sizeCol.size() > colId) { + if (this.sizeCol.get(colId) <= 0) { + return 0; + } + return this.sizeCol.get(colId); + } + Log.error("Can not get the Colomn size : " + colId + 1 + " we have " + this.sizeCol.size() + " colomn"); + return 0; + } + + public Vector3f getPropertyBorderSize() { + return this.propertyBorderSize; + } + + /** + * get the size view of the lines. + * @return The size of the lines. + */ + public int getRowSize() { + return this.sizeRow; + } + + @Override + public Widget getWidgetAtPos(final Vector3f pos) { + if (this.propertyHide) { + return null; + } + // for all element in the sizer ... + for (final GirdProperties it : this.subWidget) { + if (it.widget == null) { + continue; + } + final Vector3f tmpSize = it.widget.getSize(); + final Vector3f tmpOrigin = it.widget.getOrigin(); + if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) { + final Widget tmpWidget = it.widget.getWidgetAtPos(pos); + if (tmpWidget != null) { + return tmpWidget; + } + // stop searching + break; + } + } + return null; + } + + @Override + public void onChangeSize() { + //Log.debug("Update size"); + this.size = this.size.less(this.propertyBorderSize.x() * 2, this.propertyBorderSize.y() * 2, this.propertyBorderSize.y() * 2); + + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (this.subWidget.get(iii).widget != null) { + //calculate the origin : + Vector3f tmpOrigin = this.origin.add(this.propertyBorderSize); + if (!this.gavityButtom) { + tmpOrigin = tmpOrigin.add(0, this.size.y() - this.propertyBorderSize.y(), 0); + } + + int tmpSizeWidth = 0; + for (int jjj = 0; jjj < this.subWidget.get(iii).col; jjj++) { + tmpSizeWidth += Math.abs(this.sizeCol.get(jjj)); + } + // adding Y origin : + int addingPos = 0; + if (this.gavityButtom) { + addingPos = (this.subWidget.get(iii).row) * this.uniformSizeRow; + } else { + addingPos = -(this.subWidget.get(iii).row + 1) * this.uniformSizeRow; + } + tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos, 0); + + Log.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin, new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0)); + // set the origin : + this.subWidget.get(iii).widget.setOrigin(tmpOrigin.clipInteger()); + // all time set all the space . + this.subWidget.get(iii).widget.setSize((new Vector3f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow, 0)).clipInteger()); + this.subWidget.get(iii).widget.onChangeSize(); + } + } + this.size = this.size.add(this.propertyBorderSize.multiply(0.5f)); + Log.debug("Calculate size : " + this.size); + markToRedraw(); + } + + @Override + public void onRegenerateDisplay() { + for (final GirdProperties it : this.subWidget) { + if (it.widget != null) { + it.widget.onRegenerateDisplay(); + } + } + } + + /** + * set the current border size of the current element: + * @param newBorderSize The border size to set (0 if not used) + */ + public void setBorderSize(final Vector3f newBorderSize) { + this.propertyBorderSize = newBorderSize; + } + + /** + * set the number of colomn + * @param colNumber Nuber of colomn + */ + public void setColNumber(final int colNumber) { + if ((long) this.sizeCol.size() > colNumber) { + int errorControl = this.subWidget.size(); + // remove subWidget : + for (int iii = this.subWidget.size(); iii >= 0; iii--) { + if (this.subWidget.get(iii).col > (colNumber - 1)) { + // out of bounds : must remove it ... + if (this.subWidget.get(iii).widget != null) { + this.subWidget.get(iii).widget = null; + // no remove, this element is removed with the function onObjectRemove == > it does not exist anymore ... + if (errorControl == this.subWidget.size()) { + Log.critical( + "[" + getId() + "] The number of element might have been reduced ... == > it is not the case ==> the herited class must call the \"OnObjectRemove\" function..."); + } + } else { + Log.warning("[" + getId() + "] Must not have null pointer on the subWidget list ..."); + this.subWidget.remove(iii); + } + errorControl = this.subWidget.size(); + } + } + // just add the col size: + this.sizeCol.remove(this.sizeCol.size() - 1); + } else { + // just add the col size: + for (int iii = this.sizeCol.size() - 1; iii < colNumber - 1; iii++) { + this.sizeCol.add(0); + } + } + } + + /** + * change a size view of a colomn. + * @param colId Id of the colomn [0..x]. + * @param size size of the colomn. + */ + public void setColSize(final int colId, final int size) { + if ((long) this.sizeCol.size() > colId) { + this.sizeCol.set(colId, size); + } else { + Log.error("Can not set the Colomn size : " + colId + 1 + " at " + size + "px we have " + this.sizeCol.size() + " colomn"); + } + } + + /** + * set the gravity of the widget on the Button (index 0 is on buttom) + */ + public void setGravityButtom() { + this.gavityButtom = true; + markToRedraw(); + } + + /** + * set the gravity of the widget on the Top (index 0 is on top) + */ + public void setGravityTop() { + this.gavityButtom = false; + markToRedraw(); + } + + public void setPropertyBorderSize(final Vector3f propertyBorderSize) { + this.propertyBorderSize = propertyBorderSize; + if (this.propertyBorderSize.x() < 0) { + Log.error("Try to set a border size <0 on x : " + this.propertyBorderSize.x() + " == > restore to 0"); + this.propertyBorderSize = this.propertyBorderSize.withX(0); + } + if (this.propertyBorderSize.y() < 0) { + Log.error("Try to set a border size <0 on y : " + this.propertyBorderSize.y() + " == > restore to 0"); + this.propertyBorderSize = this.propertyBorderSize.withY(0); + } + markToRedraw(); + requestUpdateSize(); + } + + /** + * change a size view of a line. + * @param size size of the line. + */ + public void setRowSize(final int size) { + this.sizeRow = size; + } + + /** + * add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right) + * @param colId Id of the colomn [0..x]. + * @param rowId Id of the row [0..y]. + * @param newWidget the element pointer + */ + public void subWidgetAdd(final int colId, final int rowId, final Widget newWidget) { + if (newWidget == null) { + return; + } + final GirdProperties prop = new GirdProperties(); + prop.row = rowId; + prop.col = colId; + prop.widget = newWidget; + + // need to find the correct position : + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (this.subWidget.get(iii).row < prop.row) { + continue; + } else if (this.subWidget.get(iii).row > prop.row) { + // find a new position; + this.subWidget.add(iii, prop); + return; + } else { + if (this.subWidget.get(iii).col < prop.col) { + continue; + } else if (this.subWidget.get(iii).col > prop.col) { + // find a new position; + this.subWidget.add(iii, prop); + return; + } else { + // The element already exist == > replace it ... + this.tmpWidget = this.subWidget.get(iii).widget; + this.subWidget.get(iii).widget = newWidget; + this.tmpWidget = null; + } + } + } + // not find == > just adding it ... + this.subWidget.add(prop); + } + + /** + * remove definitly a widget from the system and this Gird. + * @param colId Id of the colomn [0..x]. + * @param rowId Id of the row [0..y]. + */ + public void subWidgetRemove(final int colId, final int rowId) { + if (colId < 0 || rowId < 0) { + Log.warning("[" + getId() + "] try to remove widget with id < 0 col=" + colId + " row=" + rowId); + return; + } + final int errorControl = this.subWidget.size(); + // try to find it ... + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (this.subWidget.get(iii).row == rowId && this.subWidget.get(iii).col == colId) { + this.subWidget.remove(iii); + return; + } + } + Log.warning("[" + getId() + "] Can not remove unExistant widget"); + } + + /** + * remove definitly a widget from the system and this Gird. + * @param newWidget the element pointer. + */ + public void subWidgetRemove(final Widget newWidget) { + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (newWidget == this.subWidget.get(iii).widget) { + this.subWidget.remove(iii); + return; + } + } + Log.warning("[" + getId() + "] Can not remove unExistant widget"); + } + + /** + * remove all sub element from the widget. + */ + public void subWidgetRemoveAll() { + final int errorControl = this.subWidget.size(); + this.subWidget.clear(); + } + + /** + * Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). + * @param colId Id of the colomn [0..x]. + * @param rowId Id of the row [0..y]. + */ + public void subWidgetUnLink(final int colId, final int rowId) { + if (colId < 0 || rowId < 0) { + Log.warning("[" + getId() + "] try to Unlink widget with id < 0 col=" + colId + " row=" + rowId); + return; + } + // try to find it ... + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (this.subWidget.get(iii).row == rowId && this.subWidget.get(iii).col == colId) { + this.subWidget.remove(iii); + return; + } + } + Log.warning("[" + getId() + "] Can not unLink unExistant widget"); + } + + /** + * Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). + * @param newWidget the element pointer. + */ + public void subWidgetUnLink(final Widget newWidget) { + if (newWidget == null) { + return; + } + for (int iii = 0; iii < this.subWidget.size(); iii++) { + if (newWidget == this.subWidget.get(iii).widget) { + this.subWidget.remove(iii); + return; + } + } + } + + @Override + public void systemDraw(final DrawProperty displayProp) { + super.systemDraw(displayProp); + for (final GirdProperties it : this.subWidget) { + if (it.widget != null) { + it.widget.systemDraw(displayProp); + } + } + } +} diff --git a/src/org/atriasoft/ewol/widget/ImageDisplay.java b/src/org/atriasoft/ewol/widget/ImageDisplay.java index 78e29ce..6b91617 100644 --- a/src/org/atriasoft/ewol/widget/ImageDisplay.java +++ b/src/org/atriasoft/ewol/widget/ImageDisplay.java @@ -5,6 +5,11 @@ */ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; import org.atriasoft.egami.ImageByteRGBA; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Dimension2f; @@ -12,15 +17,10 @@ import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.CompositingImage; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; public class ImageDisplay extends Widget { @@ -38,30 +38,31 @@ public class ImageDisplay extends Widget { protected boolean propertySmooth = true; //!< display is done in the pixel approximation if false protected Uri propertySource = null; //!< file name of the image. protected boolean propertyUseThemeColor = false; //!< Use the themo color management ("THEMECOLOR:///Image.json?lib=ewol") default false - @EwolSignal(name = "pressed") - @EwolDescription(value = "Image is pressed") + @AknotSignal + @AknotName("pressed") + @AknotDescription(value = "Image is pressed") public final SignalEmpty signalPressed = new SignalEmpty(); /** - * + * */ public ImageDisplay() {} @Override public void calculateMinMaxSize() { Log.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize + " min-size=" + this.propertyMinSize); - Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f); - Vector2f imageSize = this.propertyImageSize.getPixel(); - Vector3f size = this.propertyMinSize.getPixel(); + final Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f); + final Vector2f imageSize = this.propertyImageSize.getPixel(); + final Vector3f size = this.propertyMinSize.getPixel(); Log.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size); if (!imageSize.isZero()) { - Vector2f tmp = imageBoder.add(imageSize); + final Vector2f tmp = imageBoder.add(imageSize); this.minSize = new Vector3f(tmp.x(), tmp.y(), 0); this.maxSize = this.minSize; } else { - Vector2i imageSizeReal = this.getPropertyMinSize().getPixeli();//.compositing.getRealSize(); + final Vector2i imageSizeReal = this.getPropertyMinSize().getPixeli();//.compositing.getRealSize(); Log.verbose(" Real Size = " + imageSizeReal); - Vector3f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0); + final Vector3f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0); this.minSize = new Vector3f(imageBoder.x() + imageSizeReal.x(), imageBoder.y() + imageSizeReal.y(), 0); Log.verbose(" set max : " + this.minSize + " min1=" + min1); this.minSize = Vector3f.max(this.minSize, min1); @@ -76,66 +77,66 @@ public class ImageDisplay extends Widget { markToRedraw(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "border") - @EwolDescription(value = "Border of the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "border") + @AknotDescription(value = "Border of the image") public Dimension2f getPropertyBorder() { return this.propertyBorder; } - @XmlManaged - @XmlAttribute - @XmlName(value = "size") - @EwolDescription(value = "Basic display size of the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "size") + @AknotDescription(value = "Basic display size of the image") public Dimension2f getPropertyImageSize() { return this.propertyImageSize; } - @XmlManaged - @XmlAttribute - @XmlName(value = "part-start") - @EwolDescription(value = "Start display position in the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "part-start") + @AknotDescription(value = "Start display position in the image") public Vector2f getPropertyPosStart() { return this.propertyPosStart; } - @XmlManaged - @XmlAttribute - @XmlName(value = "part-stop") - @EwolDescription(value = "Start display position in the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "part-stop") + @AknotDescription(value = "Start display position in the image") public Vector2f getPropertyPosStop() { return this.propertyPosStop; } - @XmlManaged - @XmlAttribute - @XmlName(value = "src") - @EwolDescription(value = "Image source path") + @AknotManaged + @AknotAttribute + @AknotName(value = "src") + @AknotDescription(value = "Image source path") public Uri getPropertySource() { return this.propertySource; } - @XmlManaged - @XmlAttribute - @XmlName(value = "ratio") - @EwolDescription(value = "Keep ratio of the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "ratio") + @AknotDescription(value = "Keep ratio of the image") public boolean isPropertyKeepRatio() { return this.propertyKeepRatio; } - @XmlManaged - @XmlAttribute - @XmlName(value = "smooth") - @EwolDescription(value = "Smooth display of the image") + @AknotManaged + @AknotAttribute + @AknotName(value = "smooth") + @AknotDescription(value = "Smooth display of the image") public boolean isPropertySmooth() { return this.propertySmooth; } - @XmlManaged - @XmlAttribute - @XmlName(value = "use-theme-color") - @EwolDescription(value = "Use the theme color to display images") + @AknotManaged + @AknotAttribute + @AknotName(value = "use-theme-color") + @AknotDescription(value = "Use the theme color to display images") public boolean isPropertyUseThemeColor() { return this.propertyUseThemeColor; } @@ -172,9 +173,9 @@ public class ImageDisplay extends Widget { Vector3f origin = new Vector3f(imageBoder.x(), imageBoder.y(), 0); imageBoder = imageBoder.multiply(2.0f); Vector2f imageRealSize = this.imageRenderSize.less(imageBoder); - Vector3f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y(), 0); + final Vector3f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y(), 0); - Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart); + final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart); //imageRealSizeMax *= ratioSizeDisplayRequested; Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y(), 0)); @@ -189,19 +190,19 @@ public class ImageDisplay extends Widget { origin = origin.add(delta); if (this.propertyKeepRatio) { - Vector2i tmpSize = this.compositing.getRealSize(); + final Vector2i tmpSize = this.compositing.getRealSize(); //float ratio = tmpSize.x() / tmpSize.y(); - float ratio = (tmpSize.x() * ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y()); + final float ratio = (tmpSize.x() * ratioSizeDisplayRequested.x()) / (tmpSize.y() * ratioSizeDisplayRequested.y()); //float ratioCurrent = (imageRealSize.x()*ratioSizeDisplayRequested.x()) / (imageRealSize.y() * ratioSizeDisplayRequested.y()); - float ratioCurrent = imageRealSize.x() / imageRealSize.y(); + final float ratioCurrent = imageRealSize.x() / imageRealSize.y(); if (ratio == ratioCurrent) { // nothing to do ... } else if (ratio < ratioCurrent) { - float oldX = imageRealSize.x(); + final float oldX = imageRealSize.x(); imageRealSize = imageRealSize.withX(imageRealSize.y() * ratio); origin = origin.add((oldX - imageRealSize.x()) * 0.5f, 0, 0); } else { - float oldY = imageRealSize.y(); + final float oldY = imageRealSize.y(); imageRealSize = imageRealSize.withY(imageRealSize.x() / ratio); origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f, 0); } diff --git a/src/org/atriasoft/ewol/widget/Label.java b/src/org/atriasoft/ewol/widget/Label.java index 4505f68..54e18b1 100644 --- a/src/org/atriasoft/ewol/widget/Label.java +++ b/src/org/atriasoft/ewol/widget/Label.java @@ -5,28 +5,29 @@ */ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; +import org.atriasoft.aknot.annotation.AknotText; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etranslate.ETranslate; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.AlignMode; import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; -import org.atriasoft.exml.annotation.XmlText; import org.atriasoft.gale.key.KeyStatus; public class Label extends Widget { - @EwolSignal(name = "pressed") - @EwolDescription(value = "Label is pressed") + @AknotSignal + @AknotName("pressed") + @AknotDescription("Label is pressed") public SignalEmpty signalPressed = new SignalEmpty(); private String propertyValue = ""; //!< decorated text to display. private int propertyFontSize = 0; //!< default size of the font. @@ -179,10 +180,10 @@ public class Label extends Widget { this.textCompose.flush(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "auto-translate") - @EwolDescription(value = "Translate the String with the marker {T:xxxxxx}") + @AknotManaged + @AknotAttribute + @AknotName(value = "auto-translate") + @AknotDescription(value = "Translate the String with the marker {T:xxxxxx}") public void setPropertyAutoTranslate(final boolean propertyAutoTranslate) { if (this.propertyAutoTranslate == propertyAutoTranslate) { return; @@ -197,10 +198,10 @@ public class Label extends Widget { requestUpdateSize(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "font-size") - @EwolDescription(value = "Default font size (0=> system default)") + @AknotManaged + @AknotAttribute + @AknotName(value = "font-size") + @AknotDescription(value = "Default font size (0=> system default)") public void setPropertyFontSize(final int propertyFontSize) { if (this.propertyFontSize == propertyFontSize) { return; @@ -210,10 +211,10 @@ public class Label extends Widget { requestUpdateSize(); } - @XmlManaged - @XmlText - @XmlName(value = "value") - @EwolDescription(value = "Displayed value string") + @AknotManaged + @AknotText + @AknotName(value = "value") + @AknotDescription(value = "Displayed value string") public void setPropertyValue(final String propertyValue) { if (this.propertyValue.equals(propertyValue)) { return; diff --git a/src/org/atriasoft/ewol/widget/LabelOnSVG.java b/src/org/atriasoft/ewol/widget/LabelOnSVG.java index 2cb4122..d7550cd 100644 --- a/src/org/atriasoft/ewol/widget/LabelOnSVG.java +++ b/src/org/atriasoft/ewol/widget/LabelOnSVG.java @@ -5,22 +5,22 @@ */ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etranslate.ETranslate; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.AlignMode; import org.atriasoft.ewol.compositing.CompositingText; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; public class LabelOnSVG extends Widget { @@ -31,8 +31,9 @@ public class LabelOnSVG extends Widget { protected int propertyFontSize = 0; //!< default size of the font. protected String propertyValue = ""; //!< decorated text to display. - @EwolSignal(name = "pressed") - @EwolDescription(value = "Label is pressed") + @AknotSignal + @AknotName("pressed") + @AknotDescription("Label is pressed") public SignalEmpty signalPressed = new SignalEmpty(); protected CompositingText text = new CompositingText(); //!< Compositing text element. protected String value = ""; @@ -64,14 +65,14 @@ public class LabelOnSVG extends Widget { @Override public void calculateMinMaxSize() { - Vector3f tmpMax = this.propertyMaxSize.getPixel(); - Vector3f tmpMin = this.propertyMinSize.getPixel(); + final Vector3f tmpMax = this.propertyMaxSize.getPixel(); + final Vector3f tmpMin = this.propertyMinSize.getPixel(); Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax); if (tmpMax.x() <= 999999) { this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT); Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement "); } - Vector3f minSize = this.text.calculateSizeDecorated(this.value); + final Vector3f minSize = this.text.calculateSizeDecorated(this.value); Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize); this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z())); @@ -114,18 +115,18 @@ public class LabelOnSVG extends Widget { //return; } this.text.clear(); - int paddingSize = 2; + final int paddingSize = 2; - Vector3f tmpMax = this.propertyMaxSize.getPixel(); + final Vector3f tmpMax = this.propertyMaxSize.getPixel(); // to know the size of one line : - Vector3f minSize = this.text.calculateSize('A'); + final Vector3f minSize = this.text.calculateSize('A'); //minSize.setX(etk::max(minSize.x(), this.minSize.x())); //minSize.setY(etk::max(minSize.y(), this.minSize.y())); if (tmpMax.x() <= 999999) { this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT); } - Vector3f currentTextSize = this.text.calculateSizeDecorated(this.value); + final Vector3f currentTextSize = this.text.calculateSizeDecorated(this.value); Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y()); @@ -145,10 +146,10 @@ public class LabelOnSVG extends Widget { tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y()); - Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0); + final Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0); - Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f); - Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1); + final Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f); + final Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1); // clean the element this.text.reset(); @@ -168,10 +169,10 @@ public class LabelOnSVG extends Widget { this.text.flush(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "auto-translate") - @EwolDescription(value = "Translate the String with the marker {T:xxxxxx}") + @AknotManaged + @AknotAttribute + @AknotName("auto-translate") + @AknotDescription("Translate the String with the marker {T:xxxxxx}") public void setPropertyAutoTranslate(final boolean propertyAutoTranslate) { if (this.propertyAutoTranslate == propertyAutoTranslate) { return; @@ -186,10 +187,10 @@ public class LabelOnSVG extends Widget { requestUpdateSize(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "font-size") - @EwolDescription(value = "Default font size (0=> system default)") + @AknotManaged + @AknotAttribute + @AknotName("font-size") + @AknotDescription("Default font size (0=> system default)") public void setPropertyFontSize(final int propertyFontSize) { if (this.propertyFontSize == propertyFontSize) { return; @@ -199,10 +200,10 @@ public class LabelOnSVG extends Widget { requestUpdateSize(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "Displayed value string") + @AknotManaged + @AknotAttribute + @AknotName("value") + @AknotDescription("Displayed value string") public void setPropertyValue(final String propertyValue) { if (this.propertyValue.equals(propertyValue)) { return; diff --git a/src/org/atriasoft/ewol/widget/ListFileSystem.java b/src/org/atriasoft/ewol/widget/ListFileSystem.java index 3799fd4..47cec2d 100644 --- a/src/org/atriasoft/ewol/widget/ListFileSystem.java +++ b/src/org/atriasoft/ewol/widget/ListFileSystem.java @@ -16,6 +16,11 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Signal; import org.atriasoft.etk.Color; import org.atriasoft.etk.Uri; @@ -23,35 +28,34 @@ import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3i; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceColorFile; import org.atriasoft.ewol.widget.model.ListRole; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; /** * Generic display folder class. This widget display the content of a single folder : */ public class ListFileSystem extends WidgetList { - @EwolSignal(name = "file-select") - @EwolDescription(value = "A file has been selected in the List") + @AknotSignal + @AknotName(value = "file-select") + @AknotDescription(value = "A file has been selected in the List") public Signal signalFileSelect = new Signal<>(); //!< @event "file-select" Generated when a file is selected. - @EwolSignal(name = "file-validate") - @EwolDescription(value = "A file has been validated on the list (double clicked or return pressed)") + @AknotSignal + @AknotName(value = "file-validate") + @AknotDescription(value = "A file has been validated on the list (double clicked or return pressed)") public Signal signalFileValidate = new Signal<>(); //!< @event "file-validate" Generate when the user validate (return) or double click on the element - @EwolSignal(name = "folder-select") - @EwolDescription(value = "A folder has been selected in the List") + @AknotSignal + @AknotName(value = "folder-select") + @AknotDescription(value = "A folder has been selected in the List") public Signal signalFolderSelect = new Signal<>(); - @EwolSignal(name = "folder-validate") - @EwolDescription(value = "A folder has been validated on the list (double clicked or return pressed)") + @AknotSignal + @AknotName(value = "folder-validate") + @AknotDescription(value = "A folder has been validated on the list (double clicked or return pressed)") public Signal signalFolderValidate = new Signal<>(); protected String propertyPath = "/"; //!< Current folder that display point on. protected File propertyFile = null; //!< current selected file @@ -144,26 +148,26 @@ public class ListFileSystem extends WidgetList { return new Vector2i(1, this.list.size() + offset); } - @XmlManaged - @XmlAttribute - @XmlName(value = "select") - @EwolDescription(value = "selection af a specific file") + @AknotManaged + @AknotAttribute + @AknotName(value = "select") + @AknotDescription(value = "selection af a specific file") public File getPropertyFile() { return this.propertyFile; } - @XmlManaged - @XmlAttribute - @XmlName(value = "filter") - @EwolDescription(value = "regex to filter files ...") + @AknotManaged + @AknotAttribute + @AknotName(value = "filter") + @AknotDescription(value = "regex to filter files ...") public String getPropertyFilter() { return this.propertyFilter; } - @XmlManaged - @XmlAttribute - @XmlName(value = "Path") - @EwolDescription(value = "Path to display") + @AknotManaged + @AknotAttribute + @AknotName(value = "Path") + @AknotDescription(value = "Path to display") public String getPropertyPath() { return this.propertyPath; } @@ -179,26 +183,26 @@ public class ListFileSystem extends WidgetList { return null; } - @XmlManaged - @XmlAttribute - @XmlName(value = "show-file") - @EwolDescription(value = "Display files") + @AknotManaged + @AknotAttribute + @AknotName(value = "show-file") + @AknotDescription(value = "Display files") public boolean isPropertyShowFile() { return this.propertyShowFile; } - @XmlManaged - @XmlAttribute - @XmlName(value = "show-folder") - @EwolDescription(value = "display folders") + @AknotManaged + @AknotAttribute + @AknotName(value = "show-folder") + @AknotDescription(value = "display folders") public boolean isPropertyShowFolder() { return this.propertyShowFolder; } - @XmlManaged - @XmlAttribute - @XmlName(value = "show-hidden") - @EwolDescription(value = "Show the hidden element (file, folder, ...)") + @AknotManaged + @AknotAttribute + @AknotName(value = "show-hidden") + @AknotDescription(value = "Show the hidden element (file, folder, ...)") public boolean isPropertyShowHidden() { return this.propertyShowHidden; } diff --git a/src/org/atriasoft/ewol/widget/PopUp.java b/src/org/atriasoft/ewol/widget/PopUp.java index 712dcc5..83883d2 100644 --- a/src/org/atriasoft/ewol/widget/PopUp.java +++ b/src/org/atriasoft/ewol/widget/PopUp.java @@ -5,16 +5,16 @@ */ package org.atriasoft.ewol.widget; +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.Dimension3f; import org.atriasoft.etk.Distance; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.event.EventInput; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; /** @@ -33,10 +33,10 @@ public class PopUp extends ContainerWithShape { this.propertyExpand = Vector3b.FALSE; } - @XmlManaged - @XmlAttribute - @XmlName(value = "out-click-remove") - @EwolDescription(value = "Remove the widget if the use click outside") + @AknotManaged + @AknotAttribute + @AknotName(value = "out-click-remove") + @AknotDescription(value = "Remove the widget if the use click outside") public boolean isPropertyCloseOutEvent() { return this.propertyCloseOutEvent; } diff --git a/src/org/atriasoft/ewol/widget/ProgressBar.java b/src/org/atriasoft/ewol/widget/ProgressBar.java index 3c7cc5e..8fdd436 100644 --- a/src/org/atriasoft/ewol/widget/ProgressBar.java +++ b/src/org/atriasoft/ewol/widget/ProgressBar.java @@ -5,13 +5,13 @@ */ package org.atriasoft.ewol.widget; +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.Color; import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.CompositingDrawing; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; class ProgressBar extends Widget { private static final int DOT_RADIUS = 6; @@ -28,39 +28,39 @@ class ProgressBar extends Widget { @Override public void calculateMinMaxSize() { - Vector3f tmpMin = this.propertyMinSize.getPixel(); + final Vector3f tmpMin = this.propertyMinSize.getPixel(); this.minSize = new Vector3f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f), 10); markToRedraw(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "color-off") - @EwolDescription(value = "Color of the false value") + @AknotManaged + @AknotAttribute + @AknotName(value = "color-off") + @AknotDescription(value = "Color of the false value") public Color getPropertyTextColorBgOff() { return this.propertyTextColorBgOff; } - @XmlManaged - @XmlAttribute - @XmlName(value = "color-on") - @EwolDescription(value = "Color of the true value") + @AknotManaged + @AknotAttribute + @AknotName(value = "color-on") + @AknotDescription(value = "Color of the true value") public Color getPropertyTextColorBgOn() { return this.propertyTextColorBgOn; } - @XmlManaged - @XmlAttribute - @XmlName(value = "color-bg") - @EwolDescription(value = "ackground color") + @AknotManaged + @AknotAttribute + @AknotName(value = "color-bg") + @AknotDescription(value = "ackground color") public Color getPropertyTextColorFg() { return this.propertyTextColorFg; } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "Value of the progress bar [0..1]") + @AknotManaged + @AknotAttribute + @AknotName(value = "value") + @AknotDescription(value = "Value of the progress bar [0..1]") public float getPropertyValue() { return this.propertyValue; } @@ -80,10 +80,10 @@ class ProgressBar extends Widget { this.draw.setColor(this.propertyTextColorFg); - int tmpSizeX = (int) (this.size.x() - 10); - int tmpSizeY = (int) (this.size.y() - 10); - int tmpOriginX = 5; - int tmpOriginY = 5; + final int tmpSizeX = (int) (this.size.x() - 10); + final int tmpSizeY = (int) (this.size.y() - 10); + final int tmpOriginX = 5; + final int tmpOriginY = 5; this.draw.setColor(this.propertyTextColorBgOn); this.draw.setPos(new Vector3f(tmpOriginX, tmpOriginY, 0)); this.draw.rectangleWidth(new Vector3f(tmpSizeX * this.propertyValue, tmpSizeY, 0)); diff --git a/src/org/atriasoft/ewol/widget/Scroll.java b/src/org/atriasoft/ewol/widget/Scroll.java index f2d96c7..7027b48 100644 --- a/src/org/atriasoft/ewol/widget/Scroll.java +++ b/src/org/atriasoft/ewol/widget/Scroll.java @@ -5,6 +5,10 @@ */ package org.atriasoft.ewol.widget; +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.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Vector2f; @@ -14,13 +18,9 @@ import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.GravityVertical; import org.atriasoft.ewol.HighSpeedMode; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; import org.atriasoft.gale.key.KeyType; @@ -70,26 +70,26 @@ class Scroll extends Container { } } - @XmlManaged - @XmlAttribute - @XmlName(value = "limit") - @EwolDescription(value = "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end") + @AknotManaged + @AknotAttribute + @AknotName(value = "limit") + @AknotDescription(value = "Limit the scroll maximum position [0..1]% represent the free space in the scoll when arrive at the end") public Vector3f getPropertyLimit() { return this.propertyLimit; } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape-hori") - @EwolDescription(value = "shape for the horizontal display") + @AknotManaged + @AknotAttribute + @AknotName(value = "shape-hori") + @AknotDescription(value = "shape for the horizontal display") public Uri getPropertyShapeHori() { return this.propertyShapeHori; } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape-vert") - @EwolDescription(value = "shape for the vertical display") + @AknotManaged + @AknotAttribute + @AknotName(value = "shape-vert") + @AknotDescription(value = "shape for the vertical display") public Uri getPropertyShapeVert() { return this.propertyShapeVert; } @@ -103,10 +103,10 @@ class Scroll extends Container { return this; } - @XmlManaged - @XmlAttribute - @XmlName(value = "hover") - @EwolDescription(value = "The display bar are hover the subWidget") + @AknotManaged + @AknotAttribute + @AknotName(value = "hover") + @AknotDescription(value = "The display bar are hover the subWidget") public boolean isPropertyHover() { return this.propertyHover; } diff --git a/src/org/atriasoft/ewol/widget/Sizer.java b/src/org/atriasoft/ewol/widget/Sizer.java index a99a494..32c92d0 100644 --- a/src/org/atriasoft/ewol/widget/Sizer.java +++ b/src/org/atriasoft/ewol/widget/Sizer.java @@ -5,21 +5,20 @@ */ package org.atriasoft.ewol.widget; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotCaseSensitive; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.etk.Dimension3f; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3i; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolObjectProperty; import org.atriasoft.ewol.internal.Log; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlCaseSensitive; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; public class Sizer extends ContainerN { - @XmlCaseSensitive(value = false) + @AknotCaseSensitive(value = false) public enum DisplayMode { HORIZONTAL, //!< Horizontal mode VERTICAL; //!< Vertical mode @@ -80,20 +79,18 @@ public class Sizer extends ContainerN { Log.verbose("[{}] Result min size : {}", getId(), this.minSize); } - @XmlManaged - @XmlAttribute - @XmlName("border") - @EwolObjectProperty - @EwolDescription("The sizer border size") + @AknotManaged + @AknotAttribute + @AknotName("border") + @AknotDescription("The sizer border size") public Dimension3f getPropertyBorderSize() { return this.propertyBorderSize; } - @XmlManaged - @XmlAttribute - @XmlName("mode") - @EwolObjectProperty - @EwolDescription("The display mode") + @AknotManaged + @AknotAttribute + @AknotName("mode") + @AknotDescription("The display mode") public DisplayMode getPropertyMode() { return this.propertyMode; } diff --git a/src/org/atriasoft/ewol/widget/Spacer.java b/src/org/atriasoft/ewol/widget/Spacer.java index 6d3fcf8..6dbd08a 100644 --- a/src/org/atriasoft/ewol/widget/Spacer.java +++ b/src/org/atriasoft/ewol/widget/Spacer.java @@ -1,5 +1,10 @@ package org.atriasoft.ewol.widget; +import org.atriasoft.aknot.annotation.AknotAttribute; +import org.atriasoft.aknot.annotation.AknotDescription; +import org.atriasoft.aknot.annotation.AknotManaged; +import org.atriasoft.aknot.annotation.AknotName; + /** @file * @author Edouard DUPIN * @copyright 2011, Edouard DUPIN, all right reserved @@ -8,18 +13,14 @@ package org.atriasoft.ewol.widget; import org.atriasoft.etk.Color; import org.atriasoft.etk.math.Vector3f; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.CompositingDrawing; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; public class Spacer extends Widget { private final CompositingDrawing draw = new CompositingDrawing(); //!< Compositing drawing element - @XmlManaged - @XmlAttribute - @XmlName(value = "color") - @EwolDescription(value = "background of the spacer") + @AknotManaged + @AknotAttribute + @AknotName("color") + @AknotDescription("background of the spacer") protected Color propertyColor = Color.NONE; //!< Background color /** diff --git a/src/org/atriasoft/ewol/widget/Spin.java b/src/org/atriasoft/ewol/widget/Spin.java index 924a392..38f0ee7 100644 --- a/src/org/atriasoft/ewol/widget/Spin.java +++ b/src/org/atriasoft/ewol/widget/Spin.java @@ -1,16 +1,16 @@ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.Signal; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.FMath; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.widget.meta.SpinBase; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** * a composed Spin is a Spin with an inside composed with the specify XML element @@ -18,9 +18,13 @@ import org.atriasoft.exml.annotation.XmlName; */ public class Spin extends SpinBase { // Event list of properties - @EwolSignal(name = "value", description = "Spin updated value (depend of the mantis)") + @AknotSignal + @AknotName("value") + @AknotDescription("Spin updated value (depend of the mantis)") public Signal signalValue = new Signal<>(); - @EwolSignal(name = "valueDouble", description = "Spin value change value in 'double' (application of the mantis)") + @AknotSignal + @AknotName("valueDouble") + @AknotDescription("Spin value change value in 'double' (application of the mantis)") public Signal signalValueDouble = new Signal<>(); protected long propertyValue = 0; //!< Current value of the Spin. protected long propertyMin = Long.MIN_VALUE; //!< Minimum value @@ -68,42 +72,42 @@ public class Spin extends SpinBase { Log.warning("updateGui [STOP]"); } - @XmlManaged - @XmlAttribute - @XmlName(value = "increment") - @EwolDescription(value = "Increment value at each button event or keybord event") + @AknotManaged + @AknotAttribute + @AknotName("increment") + @AknotDescription("Increment value at each button event or keybord event") public long getPropertyIncrement() { return this.propertyIncrement; } - @XmlManaged - @XmlAttribute - @XmlName(value = "mantis") - @EwolDescription(value = "fix-point mantis element (number of digit under the .)") + @AknotManaged + @AknotAttribute + @AknotName("mantis") + @AknotDescription("fix-point mantis element (number of digit under the .)") public int getPropertyMantis() { return this.propertyMantis; } - @XmlManaged - @XmlAttribute - @XmlName(value = "max") - @EwolDescription(value = "Maximum value of the spin (depend on mantis)") + @AknotManaged + @AknotAttribute + @AknotName(value = "max") + @AknotDescription(value = "Maximum value of the spin (depend on mantis)") public long getPropertyMax() { return this.propertyMax; } - @XmlManaged - @XmlAttribute - @XmlName(value = "min") - @EwolDescription(value = "Minimum value of the spin (depend on mantis)") + @AknotManaged + @AknotAttribute + @AknotName("min") + @AknotDescription("Minimum value of the spin (depend on mantis)") public long getPropertyMin() { return this.propertyMin; } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "Value of the Spin") + @AknotManaged + @AknotAttribute + @AknotName("value") + @AknotDescription("Value of the Spin") public long getPropertyValue() { return this.propertyValue; } diff --git a/src/org/atriasoft/ewol/widget/Tick.java b/src/org/atriasoft/ewol/widget/Tick.java index 2123308..fd84c18 100644 --- a/src/org/atriasoft/ewol/widget/Tick.java +++ b/src/org/atriasoft/ewol/widget/Tick.java @@ -1,5 +1,10 @@ package org.atriasoft.ewol.widget; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Connection; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; @@ -7,17 +12,12 @@ import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3i; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.compositing.GuiShapeMode; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventTime; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.key.KeyStatus; /** @@ -64,13 +64,21 @@ public class Tick extends Widget { private Boolean propertyValue = false; //!< string that must be displayed private GuiShape shape; - @EwolSignal(name = "down", description = "Tick is Down") + @AknotSignal + @AknotName("down") + @AknotDescription("Tick is Down") public SignalEmpty signalDown = new SignalEmpty(); - @EwolSignal(name = "up", description = "Tick is Up") + @AknotSignal + @AknotName("up") + @AknotDescription("Tick is Up") public SignalEmpty signalUp = new SignalEmpty(); - @EwolSignal(name = "click", description = "Tick is Clicked") + @AknotSignal + @AknotName("click") + @AknotDescription("Tick is Clicked") public SignalEmpty signalClick = new SignalEmpty(); - @EwolSignal(name = "value", description = "Tick value change") + @AknotSignal + @AknotName("value") + @AknotDescription("Tick value change") public Signal signalValue = new Signal<>(); // element over: Vector3f overPositionStart = Vector3f.ZERO; @@ -124,18 +132,18 @@ public class Tick extends Widget { return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "config") - @EwolDescription(value = "configuration of the widget") + @AknotManaged + @AknotAttribute + @AknotName("config") + @AknotDescription("configuration of the widget") public Uri getPropertyConfig() { return this.propertyConfig; } - @XmlManaged - @XmlAttribute - @XmlName(value = "value") - @EwolDescription(value = "State of the Tick") + @AknotManaged + @AknotAttribute + @AknotName("value") + @AknotDescription("State of the Tick") public Boolean getPropertyValue() { return this.propertyValue; } diff --git a/src/org/atriasoft/ewol/widget/Widget.java b/src/org/atriasoft/ewol/widget/Widget.java index 2b1a77a..6169bce 100644 --- a/src/org/atriasoft/ewol/widget/Widget.java +++ b/src/org/atriasoft/ewol/widget/Widget.java @@ -9,6 +9,11 @@ package org.atriasoft.ewol.widget; import java.util.ArrayList; import java.util.List; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Signal; import org.atriasoft.etk.Color; import org.atriasoft.etk.Dimension3f; @@ -20,8 +25,6 @@ import org.atriasoft.etk.math.Vector3b; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.event.EntrySystem; import org.atriasoft.ewol.event.EventEntry; @@ -30,9 +33,6 @@ import org.atriasoft.ewol.event.EventShortCut; import org.atriasoft.ewol.event.InputSystem; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.backend3d.OpenGL; import org.atriasoft.gale.context.ClipboardList; import org.atriasoft.gale.context.Cursor; @@ -93,7 +93,8 @@ public class Widget extends EwolObject { // ---------------------------------------------------------------------------------------------------------------- // -- Shortcut : management of the shortcut // ---------------------------------------------------------------------------------------------------------------- - @EwolSignal(name = "shortcut") + @AknotSignal + @AknotName("shortcut") public Signal signalShortcut; //!< signal handle of the message // ---------------------------------------------------------------------------------------------------------------- @@ -270,66 +271,66 @@ public class Widget extends EwolObject { return this.origin; } - @XmlManaged - @XmlAttribute - @XmlName(value = "focus") - @EwolDescription(value = "enable the widget to have the focus capacity") + @AknotManaged + @AknotAttribute + @AknotName("focus") + @AknotDescription("enable the widget to have the focus capacity") public boolean getPropertyCanFocus() { return this.propertyCanFocus; } - @XmlManaged - @XmlAttribute - @XmlName(value = "expand") - @EwolDescription(value = "Request the widget Expand size while space is available") + @AknotManaged + @AknotAttribute + @AknotName("expand") + @AknotDescription("Request the widget Expand size while space is available") public Vector3b getPropertyExpand() { return this.propertyExpand; } - @XmlManaged - @XmlAttribute - @XmlName(value = "expand-free") - @EwolDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper wideget)") + @AknotManaged + @AknotAttribute + @AknotName("expand-free") + @AknotDescription("Request the widget Expand size while free space is detected (does not generate expand in upper wideget)") public Vector3b getPropertyExpandIfFree() { return this.propertyExpandIfFree; } - @XmlManaged - @XmlAttribute - @XmlName(value = "fill") - @EwolDescription(value = "Fill the widget available size") + @AknotManaged + @AknotAttribute + @AknotName("fill") + @AknotDescription("Fill the widget available size") public Vector3b getPropertyFill() { return this.propertyFill; } - @XmlManaged - @XmlAttribute - @XmlName(value = "gravity") - @EwolDescription(value = "Gravity orientation") + @AknotManaged + @AknotAttribute + @AknotName("gravity") + @AknotDescription("Gravity orientation") public Gravity getPropertyGravity() { return this.propertyGravity; } - @XmlManaged - @XmlAttribute - @XmlName(value = "hide") - @EwolDescription(value = "The widget start hided") + @AknotManaged + @AknotAttribute + @AknotName("hide") + @AknotDescription("The widget start hided") public boolean getPropertyHide() { return this.propertyHide; } - @XmlManaged - @XmlAttribute - @XmlName(value = "max-size") - @EwolDescription(value = "User maximum size") + @AknotManaged + @AknotAttribute + @AknotName("max-size") + @AknotDescription("User maximum size") public Dimension3f getPropertyMaxSize() { return this.propertyMaxSize; } - @XmlManaged - @XmlAttribute - @XmlName(value = "min-size") - @EwolDescription(value = "User minimum size") + @AknotManaged + @AknotAttribute + @AknotName("min-size") + @AknotDescription("User minimum size") public Dimension3f getPropertyMinSize() { return this.propertyMinSize; } diff --git a/src/org/atriasoft/ewol/widget/WidgetScrolled.java b/src/org/atriasoft/ewol/widget/WidgetScrolled.java index cc402bd..8c58c5c 100644 --- a/src/org/atriasoft/ewol/widget/WidgetScrolled.java +++ b/src/org/atriasoft/ewol/widget/WidgetScrolled.java @@ -1,5 +1,9 @@ package org.atriasoft.ewol.widget; +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.Uri; import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.Matrix4f; @@ -8,13 +12,9 @@ import org.atriasoft.etk.math.Vector3f; import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.HighSpeedMode; import org.atriasoft.ewol.Padding; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.GuiShape; import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.internal.Log; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.backend3d.OpenGL; import org.atriasoft.gale.key.KeyStatus; import org.atriasoft.gale.key.KeyType; @@ -59,18 +59,18 @@ class WidgetScrolled extends Widget { onChangePropertyShapeHori(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape-hori") - @EwolDescription(value = "shape for the horizontal display") + @AknotManaged + @AknotAttribute + @AknotName("shape-hori") + @AknotDescription("shape for the horizontal display") public Uri getPropertyShapeHori() { return this.propertyShapeHori; } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape-vert") - @EwolDescription(value = "shape for the vertical display") + @AknotManaged + @AknotAttribute + @AknotName("shape-vert") + @AknotDescription("shape for the vertical display") public Uri getPropertyShapeVert() { return this.propertyShapeVert; } diff --git a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java index 0bddffa..5b69682 100644 --- a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java +++ b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java @@ -3,10 +3,10 @@ package org.atriasoft.ewol.widget; import java.util.HashMap; import java.util.Map; +import org.atriasoft.aknot.model.InterfaceFactoryAccess; import org.atriasoft.ewol.widget.meta.FileChooser; -import org.atriasoft.exml.annotation.XmlFactory.InterfaceXmlFactoryAccess; -public class WidgetXmlFactory implements InterfaceXmlFactoryAccess { +public class WidgetXmlFactory implements InterfaceFactoryAccess { private static Map> listWidgetAvaillable = new HashMap<>(); static { listWidgetAvaillable.put("Sizer", Sizer.class); @@ -24,7 +24,7 @@ public class WidgetXmlFactory implements InterfaceXmlFactoryAccess { } @Override - public Class findClass(final String name) { + public Class findClass(final String name, final boolean caseSensitive) { return listWidgetAvaillable.get(name); } diff --git a/src/org/atriasoft/ewol/widget/Windows.java b/src/org/atriasoft/ewol/widget/Windows.java index d25526c..28b862e 100644 --- a/src/org/atriasoft/ewol/widget/Windows.java +++ b/src/org/atriasoft/ewol/widget/Windows.java @@ -9,21 +9,21 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +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.Color; import org.atriasoft.etk.Uri; import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3i; import org.atriasoft.ewol.DrawProperty; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.compositing.CompositingDrawing; import org.atriasoft.ewol.context.EwolContext; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.object.EwolObject; import org.atriasoft.ewol.resource.ResourceColorFile; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; import org.atriasoft.gale.backend3d.OpenGL; /** @@ -35,15 +35,15 @@ public class Windows extends Widget { protected List popUpWidgetList = new ArrayList<>(); - @XmlManaged - @XmlAttribute - @XmlName(value = "file-color") - @EwolDescription(value = "File color of the Windows") + @AknotManaged + @AknotAttribute + @AknotName("file-color") + @AknotDescription("File color of the Windows") public Uri propertyColorConfiguration = new Uri("THEME", "color/Windows.json", "ewol"); //!< Configuration file of the windows theme - @XmlManaged - @XmlAttribute - @XmlName(value = "title") - @EwolDescription(value = "Title of the windows") + @AknotManaged + @AknotAttribute + @AknotName("title") + @AknotDescription("Title of the windows") public String propertyTitle = "No title"; //!< Current title of the windows protected ResourceColorFile resourceColor = null; //!< theme color property (name of file in @ref propertyColorConfiguration) @@ -67,7 +67,7 @@ public class Windows extends Widget { if (this.subWidget != null) { this.subWidget.drawWidgetTree(level); } - for (Widget it : this.popUpWidgetList) { + for (final Widget it : this.popUpWidgetList) { if (it != null) { it.drawWidgetTree(level); } @@ -96,7 +96,7 @@ public class Windows extends Widget { } } // get all subwidget "pop-up" - for (Widget it : this.popUpWidgetList) { + for (final Widget it : this.popUpWidgetList) { if (it != null) { tmpObject = it.getSubObjectNamed(objectName); if (tmpObject != null) { @@ -112,7 +112,7 @@ public class Windows extends Widget { public Widget getWidgetAtPos(final Vector3f pos) { Log.verbose("Get widget at pos : " + pos); // calculate relative position - Vector3f relativePos = relativePosition(pos); + final Vector3f relativePos = relativePosition(pos); // event go directly on the pop-up if (this.popUpWidgetList.size() != 0) { return this.popUpWidgetList.get(this.popUpWidgetList.size() - 1).getWidgetAtPos(pos); @@ -144,7 +144,7 @@ public class Windows extends Widget { this.subWidget.setOrigin(Vector3f.ZERO); this.subWidget.onChangeSize(); } - for (Widget it : this.popUpWidgetList) { + for (final Widget it : this.popUpWidgetList) { if (it != null) { it.calculateMinMaxSize(); it.setSize(this.size); @@ -159,7 +159,7 @@ public class Windows extends Widget { if (this.subWidget != null) { this.subWidget.systemRegenerateDisplay(); } - for (Widget it : this.popUpWidgetList) { + for (final Widget it : this.popUpWidgetList) { if (it != null) { it.systemRegenerateDisplay(); } @@ -210,7 +210,7 @@ public class Windows extends Widget { Log.verbose("A child has been removed"); ListIterator it = this.popUpWidgetList.listIterator(); while (it.hasNext()) { - Widget elem = it.next(); + final Widget elem = it.next(); if (elem == child) { Log.verbose(" Find it ..."); if (elem != null) { @@ -245,7 +245,7 @@ public class Windows extends Widget { return; } this.propertyTitle = propertyTitle; - EwolContext context = EwolObject.getContext(); + final EwolContext context = EwolObject.getContext(); if (context.getWindows() == this) { context.setTitle(propertyTitle); } else { @@ -290,8 +290,8 @@ public class Windows extends Widget { // clear the matrix system : OpenGL.setBasicMatrix(Matrix4f.IDENTITY); - Vector3i tmpSize = new Vector3i((int) this.size.x(), (int) this.size.y(), (int) this.size.z()); - DrawProperty displayProp = new DrawProperty(tmpSize, Vector3i.ZERO, tmpSize); + final Vector3i tmpSize = new Vector3i((int) this.size.x(), (int) this.size.y(), (int) this.size.z()); + final DrawProperty displayProp = new DrawProperty(tmpSize, Vector3i.ZERO, tmpSize); systemDraw(displayProp); OpenGL.disable(OpenGL.Flag.flag_blend); } @@ -317,7 +317,7 @@ public class Windows extends Widget { } // second display the pop-up - for (Widget it : this.popUpWidgetList) { + for (final Widget it : this.popUpWidgetList) { if (it != null) { it.systemDraw(displayProp); //Log.debug("Draw Pop-up"); diff --git a/src/org/atriasoft/ewol/widget/meta/FileChooser.java b/src/org/atriasoft/ewol/widget/meta/FileChooser.java index 81f961a..cc7b889 100644 --- a/src/org/atriasoft/ewol/widget/meta/FileChooser.java +++ b/src/org/atriasoft/ewol/widget/meta/FileChooser.java @@ -7,11 +7,14 @@ package org.atriasoft.ewol.widget.meta; import java.io.File; +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.aknot.annotation.AknotSignal; import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.SignalEmpty; import org.atriasoft.etk.Uri; -import org.atriasoft.ewol.annotation.EwolDescription; -import org.atriasoft.ewol.annotation.EwolSignal; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.widget.Button; import org.atriasoft.ewol.widget.CheckBox; @@ -20,9 +23,6 @@ import org.atriasoft.ewol.widget.Entry; import org.atriasoft.ewol.widget.ImageDisplay; import org.atriasoft.ewol.widget.Label; import org.atriasoft.ewol.widget.ListFileSystem; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** * File Chooser is a simple selector of file for opening, saving, and what you want ... @@ -158,12 +158,14 @@ public class FileChooser extends Composer { self.autoDestroy(); } - @EwolSignal(name = "cancel") - @EwolDescription(value = "Cancel button is pressed") + @AknotSignal + @AknotName(value = "cancel") + @AknotDescription(value = "Cancel button is pressed") public SignalEmpty signalCancel; //!< abort the display of the pop-up or press cancel button - @EwolSignal(name = "validate") - @EwolDescription(value = "Validate button is pressed") + @AknotSignal + @AknotName(value = "validate") + @AknotDescription(value = "Validate button is pressed") public Signal signalValidate; //!< select file(s) // properties public String propertyPath = System.getProperty("user.home"); //!< Current path to explore @@ -271,9 +273,9 @@ public class FileChooser extends Composer { } } - @XmlManaged - @XmlAttribute - @XmlName(value = "file") + @AknotManaged + @AknotAttribute + @AknotName(value = "file") public void setPropertyFile(final String propertyFile) { if (this.propertyFile.equals(propertyFile)) { return; @@ -282,10 +284,10 @@ public class FileChooser extends Composer { onChangePropertyFile(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "label-cancel") - @EwolDescription(value = "Label for cancel button") + @AknotManaged + @AknotAttribute + @AknotName(value = "label-cancel") + @AknotDescription(value = "Label for cancel button") public void setPropertyLabelCancel(final String propertyLabelCancel) { if (this.propertyLabelCancel.equals(propertyLabelCancel)) { return; @@ -294,10 +296,10 @@ public class FileChooser extends Composer { onChangePropertyLabelCancel(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "title") - @EwolDescription(value = "Titile of the Pop-up") + @AknotManaged + @AknotAttribute + @AknotName(value = "title") + @AknotDescription(value = "Titile of the Pop-up") public void setPropertyLabelTitle(final String propertyLabelTitle) { if (this.propertyLabelTitle.equals(propertyLabelTitle)) { return; @@ -306,10 +308,10 @@ public class FileChooser extends Composer { onChangePropertyLabelTitle(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "label-validate") - @EwolDescription(value = "Label for validate button") + @AknotManaged + @AknotAttribute + @AknotName(value = "label-validate") + @AknotDescription(value = "Label for validate button") public void setPropertyLabelValidate(final String propertyLabelValidate) { if (this.propertyLabelValidate.equals(propertyLabelValidate)) { return; @@ -318,10 +320,10 @@ public class FileChooser extends Composer { onChangePropertyLabelValidate(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "path") - @EwolDescription(value = "Path of the File chooser") + @AknotManaged + @AknotAttribute + @AknotName(value = "path") + @AknotDescription(value = "Path of the File chooser") public void setPropertyPath(final String propertyPath) { if (this.propertyPath.equals(propertyPath)) { return; diff --git a/src/org/atriasoft/ewol/widget/meta/SpinBase.java b/src/org/atriasoft/ewol/widget/meta/SpinBase.java index 995bd4f..269981c 100644 --- a/src/org/atriasoft/ewol/widget/meta/SpinBase.java +++ b/src/org/atriasoft/ewol/widget/meta/SpinBase.java @@ -1,9 +1,12 @@ package org.atriasoft.ewol.widget.meta; +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.Uri; import org.atriasoft.etk.math.Vector3b; import org.atriasoft.ewol.Gravity; -import org.atriasoft.ewol.annotation.EwolDescription; import org.atriasoft.ewol.internal.Log; import org.atriasoft.ewol.resource.ResourceConfigFile; import org.atriasoft.ewol.widget.Button; @@ -12,9 +15,6 @@ import org.atriasoft.ewol.widget.Entry; import org.atriasoft.ewol.widget.Sizer; import org.atriasoft.ewol.widget.Widget; import org.atriasoft.ewol.widget.model.SpinPosition; -import org.atriasoft.exml.annotation.XmlAttribute; -import org.atriasoft.exml.annotation.XmlManaged; -import org.atriasoft.exml.annotation.XmlName; /** * @ingroup ewolWidgetGroup @@ -53,18 +53,18 @@ public class SpinBase extends Sizer { updateGui(); } - @XmlManaged - @XmlAttribute - @XmlName(value = "shape") - @EwolDescription(value = "shape for the display") + @AknotManaged + @AknotAttribute + @AknotName(value = "shape") + @AknotDescription(value = "shape for the display") public Uri getPropertyShape() { return this.propertyShape; } - @XmlManaged - @XmlAttribute - @XmlName(value = "spin-mode") - @EwolDescription(value = "The display spin mode") + @AknotManaged + @AknotAttribute + @AknotName(value = "spin-mode") + @AknotDescription(value = "The display spin mode") public SpinPosition getPropertySpinMode() { return this.propertySpinMode; }