forked from mbk-lab/rui_orig
replace interface{} -> any
This commit is contained in:
parent
38dafc42c6
commit
fdbb6cb00b
54
README-ru.md
54
README-ru.md
|
@ -358,8 +358,8 @@ View имеет ряд свойств, таких как высота, шири
|
||||||
(View реализует данный интерфейс):
|
(View реализует данный интерфейс):
|
||||||
|
|
||||||
type Properties interface {
|
type Properties interface {
|
||||||
Get(tag string) interface{}
|
Get(tag string) any
|
||||||
Set(tag string, value interface{}) bool
|
Set(tag string, value any) bool
|
||||||
Remove(tag string)
|
Remove(tag string)
|
||||||
Clear()
|
Clear()
|
||||||
AllTags() []string
|
AllTags() []string
|
||||||
|
@ -374,8 +374,8 @@ View имеет ряд свойств, таких как высота, шири
|
||||||
|
|
||||||
Для упрощения установки/чтения свойств имеются также две глобальные функции Get и Set:
|
Для упрощения установки/чтения свойств имеются также две глобальные функции Get и Set:
|
||||||
|
|
||||||
func Get(rootView View, viewID, tag string) interface{}
|
func Get(rootView View, viewID, tag string) any
|
||||||
func Set(rootView View, viewID, tag string, value interface{}) bool
|
func Set(rootView View, viewID, tag string, value any) bool
|
||||||
|
|
||||||
Данные функции возвращают/устанавливают значение дочернего View
|
Данные функции возвращают/устанавливают значение дочернего View
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ View имеет ряд свойств, таких как высота, шири
|
||||||
* функция func([<параметры>])
|
* функция func([<параметры>])
|
||||||
* массив функций []func(< View >[, <параметры>])
|
* массив функций []func(< View >[, <параметры>])
|
||||||
* массив функций []func([<параметры>])
|
* массив функций []func([<параметры>])
|
||||||
* []interface{} содержащий только func(< View >[, <параметры>]) и func([<параметры>])
|
* []any содержащий только func(< View >[, <параметры>]) и func([<параметры>])
|
||||||
|
|
||||||
После присваивания свойству все эти типы преобразуются в массив функций []func(<View>, [<параметры>]).
|
После присваивания свойству все эти типы преобразуются в массив функций []func(<View>, [<параметры>]).
|
||||||
Соответственно функция Get всегда возвращает массив функций []func(<View>, [<параметры>]).
|
Соответственно функция Get всегда возвращает массив функций []func(<View>, [<параметры>]).
|
||||||
|
@ -451,7 +451,7 @@ View имеет ряд свойств, таких как высота, шири
|
||||||
* func(newText string)
|
* func(newText string)
|
||||||
* []func(editor EditView, newText string)
|
* []func(editor EditView, newText string)
|
||||||
* []func(newText string)
|
* []func(newText string)
|
||||||
* []interface{} содержащий только func(editor EditView, newText string) и func(newText string)
|
* []any содержащий только func(editor EditView, newText string) и func(newText string)
|
||||||
|
|
||||||
А свойство "edit-text-changed" всегда хранит и возвращает []func(EditView, string).
|
А свойство "edit-text-changed" всегда хранит и возвращает []func(EditView, string).
|
||||||
|
|
||||||
|
@ -1037,7 +1037,7 @@ RadiusProperty, а не структура BoxRadius. Получить стру
|
||||||
Pos определяет положение точки относительно начала линии градиента. Массив должен иметь не менее 2 точек.
|
Pos определяет положение точки относительно начала линии градиента. Массив должен иметь не менее 2 точек.
|
||||||
В качестве значения градиента можно также передать массив Color. В этом случае точки равномерно
|
В качестве значения градиента можно также передать массив Color. В этом случае точки равномерно
|
||||||
распределяются вдоль линии градиента.
|
распределяются вдоль линии градиента.
|
||||||
Также в качестве массива ключевых точек можно использовать массив типа []interface{}.
|
Также в качестве массива ключевых точек можно использовать массив типа []any.
|
||||||
Элементами этого массива могут быть BackgroundGradientPoint, Color, текстовое представление BackgroundGradientPoint
|
Элементами этого массива могут быть BackgroundGradientPoint, Color, текстовое представление BackgroundGradientPoint
|
||||||
или Color и имя константы
|
или Color и имя константы
|
||||||
|
|
||||||
|
@ -1105,8 +1105,8 @@ Pos определяет положение точки относительно
|
||||||
описывается структурой BackgroundGradientAngle:
|
описывается структурой BackgroundGradientAngle:
|
||||||
|
|
||||||
type BackgroundGradientAngle struct {
|
type BackgroundGradientAngle struct {
|
||||||
Color interface{}
|
Color any
|
||||||
Angle interface{}
|
Angle any
|
||||||
}
|
}
|
||||||
|
|
||||||
где Color задает цвет ключевого угла и может принимать значение типа Color или string (цветовая константа
|
где Color задает цвет ключевого угла и может принимать значение типа Color или string (цветовая константа
|
||||||
|
@ -1216,7 +1216,7 @@ radius необходимо передать nil
|
||||||
|
|
||||||
Многоугольная область обрезки. Создается с помощью функций:
|
Многоугольная область обрезки. Создается с помощью функций:
|
||||||
|
|
||||||
func PolygonClip(points []interface{}) ClipShape
|
func PolygonClip(points []any) ClipShape
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape
|
func PolygonPointsClip(points []SizeUnit) ClipShape
|
||||||
|
|
||||||
в качестве аргумента передается массив угловых точек многоугольника в следующем порядке: x1, y1, x2, y2, …
|
в качестве аргумента передается массив угловых точек многоугольника в следующем порядке: x1, y1, x2, y2, …
|
||||||
|
@ -2114,7 +2114,7 @@ radius необходимо передать nil
|
||||||
|
|
||||||
* []string - каждый элемент массива преобразуется во View как описано в предыдущем пункте;
|
* []string - каждый элемент массива преобразуется во View как описано в предыдущем пункте;
|
||||||
|
|
||||||
* []interface{} - данный массив должен содержать только View и string. Каждый string-элемент
|
* []any - данный массив должен содержать только View и string. Каждый string-элемент
|
||||||
преобразуется во View, как описано выше. Если массив будет содержать недопустимае значения,
|
преобразуется во View, как описано выше. Если массив будет содержать недопустимае значения,
|
||||||
то свойство "content" не будет установлено, а функция Set вернет false и в лог запишется сообщение об ошибке.
|
то свойство "content" не будет установлено, а функция Set вернет false и в лог запишется сообщение об ошибке.
|
||||||
|
|
||||||
|
@ -2285,7 +2285,7 @@ Cвойство "grid-auto-flow" может принимать следующи
|
||||||
|
|
||||||
* []string. Каждый элемент должен быть текстовым представлением SizeUnit (или SizeUnit константой)
|
* []string. Каждый элемент должен быть текстовым представлением SizeUnit (или SizeUnit константой)
|
||||||
|
|
||||||
* []interface{}. Каждый элемент должен или иметь тип SizeUnit или быть текстовым
|
* []any. Каждый элемент должен или иметь тип SizeUnit или быть текстовым
|
||||||
представлением SizeUnit (или SizeUnit константой)
|
представлением SizeUnit (или SizeUnit константой)
|
||||||
|
|
||||||
Если количество элементов в свойствах "cell-width" и "cell-height" меньше, чем используемое число
|
Если количество элементов в свойствах "cell-width" и "cell-height" меньше, чем используемое число
|
||||||
|
@ -3141,7 +3141,7 @@ FileInfo содержит только информацию о файле, но
|
||||||
|
|
||||||
* []string
|
* []string
|
||||||
* []fmt.Stringer
|
* []fmt.Stringer
|
||||||
* []interface{} содержащий в качестве элементов только: string, fmt.Stringer, bool, rune,
|
* []any содержащий в качестве элементов только: string, fmt.Stringer, bool, rune,
|
||||||
float32, float64, int, int8…int64, uint, uint8…uint64.
|
float32, float64, int, int8…int64, uint, uint8…uint64.
|
||||||
|
|
||||||
Все эти типы данных преопразуются в []string и присваиваются свойству "items".
|
Все эти типы данных преопразуются в []string и присваиваются свойству "items".
|
||||||
|
@ -3157,9 +3157,9 @@ float32, float64, int, int8…int64, uint, uint8…uint64.
|
||||||
* int
|
* int
|
||||||
* []string
|
* []string
|
||||||
* string может содержать несколько индексов разделенных запятыми
|
* string может содержать несколько индексов разделенных запятыми
|
||||||
* []interface{} содержащий в качестве элементов только: string, int, int8…int64, uint, uint8…uint64.
|
* []any содержащий в качестве элементов только: string, int, int8…int64, uint, uint8…uint64.
|
||||||
|
|
||||||
Все эти типы данных преопразуются в []interface{} и присваиваются свойству "disabled-items".
|
Все эти типы данных преопразуются в []any и присваиваются свойству "disabled-items".
|
||||||
Прочитать значение свойства "disabled-items" можно с помощью функции
|
Прочитать значение свойства "disabled-items" можно с помощью функции
|
||||||
|
|
||||||
func GetDropDownDisabledItems(view View, subviewID string) []int
|
func GetDropDownDisabledItems(view View, subviewID string) []int
|
||||||
|
@ -3248,7 +3248,7 @@ Cвойствy "items" могут быть присвоены следующие
|
||||||
* ListAdapter;
|
* ListAdapter;
|
||||||
* []View при присваиваниии преобразуется в ListAdapter с помощью функции NewViewListAdapter;
|
* []View при присваиваниии преобразуется в ListAdapter с помощью функции NewViewListAdapter;
|
||||||
* []string при присваиваниии преобразуется в ListAdapter с помощью функции NewTextListAdapter;
|
* []string при присваиваниии преобразуется в ListAdapter с помощью функции NewTextListAdapter;
|
||||||
* []interface{} который может содержать элементы типа View, string, fmt.Stringer, bool, rune,
|
* []any который может содержать элементы типа View, string, fmt.Stringer, bool, rune,
|
||||||
float32, float64, int, int8…int64, uint, uint8…uint64. При присваиваниии все типы кроме
|
float32, float64, int, int8…int64, uint, uint8…uint64. При присваиваниии все типы кроме
|
||||||
View и string преобразуется в string, далее все string в TextView и из получившегося массива View
|
View и string преобразуется в string, далее все string в TextView и из получившегося массива View
|
||||||
с помощью функции NewViewListAdapter получается ListAdapter.
|
с помощью функции NewViewListAdapter получается ListAdapter.
|
||||||
|
@ -3454,7 +3454,7 @@ CheckboxHorizontalAlign и CheckboxVerticalAlign)
|
||||||
type TableAdapter interface {
|
type TableAdapter interface {
|
||||||
RowCount() int
|
RowCount() int
|
||||||
ColumnCount() int
|
ColumnCount() int
|
||||||
Cell(row, column int) interface{}
|
Cell(row, column int) any
|
||||||
}
|
}
|
||||||
|
|
||||||
где функции RowCount() и ColumnCount() должны возврацать количество строк и столбцов в таблице;
|
где функции RowCount() и ColumnCount() должны возврацать количество строк и столбцов в таблице;
|
||||||
|
@ -3474,10 +3474,10 @@ Cell(row, column int) возвращает содержимое ячейки т
|
||||||
Свойству "content" можно также присваивать следующие типы данных
|
Свойству "content" можно также присваивать следующие типы данных
|
||||||
|
|
||||||
* TableAdapter
|
* TableAdapter
|
||||||
* [][]interface{}
|
* [][]any
|
||||||
* [][]string
|
* [][]string
|
||||||
|
|
||||||
[][]interface{} и [][]string при присвоении преобразуются к TableAdapter.
|
[][]any и [][]string при присвоении преобразуются к TableAdapter.
|
||||||
|
|
||||||
### Свойство "cell-style"
|
### Свойство "cell-style"
|
||||||
|
|
||||||
|
@ -3530,7 +3530,7 @@ Cell(row, column int) возвращает содержимое ячейки т
|
||||||
| | | |
|
| | | |
|
||||||
|------|-------|--------|
|
|------|-------|--------|
|
||||||
|
|
||||||
Если в качестве значения свойства "content" используется [][]interface{}, то для объединения
|
Если в качестве значения свойства "content" используется [][]any, то для объединения
|
||||||
ячеек используются пустые структуры
|
ячеек используются пустые структуры
|
||||||
|
|
||||||
type VerticalTableJoin struct {
|
type VerticalTableJoin struct {
|
||||||
|
@ -3541,7 +3541,7 @@ Cell(row, column int) возвращает содержимое ячейки т
|
||||||
Данные структуры присоединяют ячейку, соответсвенно, к верхней/левой. Описание приведенной выше таблицы будет
|
Данные структуры присоединяют ячейку, соответсвенно, к верхней/левой. Описание приведенной выше таблицы будет
|
||||||
иметь следующий вид
|
иметь следующий вид
|
||||||
|
|
||||||
content := [][]interface{} {
|
content := [][]any {
|
||||||
{"", "", rui.HorizontalTableJoin{}},
|
{"", "", rui.HorizontalTableJoin{}},
|
||||||
{rui.VerticalTableJoin{}, "", ""},
|
{rui.VerticalTableJoin{}, "", ""},
|
||||||
}
|
}
|
||||||
|
@ -4552,7 +4552,7 @@ x1 и x2 должны быть в диапазоне [0, 1]. Вы можете
|
||||||
Однократная анимация запускается с помощью функции SetAnimated интерфейса View. Данная функция имеет следующее
|
Однократная анимация запускается с помощью функции SetAnimated интерфейса View. Данная функция имеет следующее
|
||||||
описание:
|
описание:
|
||||||
|
|
||||||
SetAnimated(tag string, value interface{}, animation Animation) bool
|
SetAnimated(tag string, value any, animation Animation) bool
|
||||||
|
|
||||||
Она присваивает свойству новое значение, при этом изменение происходит с использованием заданной анимации.
|
Она присваивает свойству новое значение, при этом изменение происходит с использованием заданной анимации.
|
||||||
Например,
|
Например,
|
||||||
|
@ -4564,7 +4564,7 @@ x1 и x2 должны быть в диапазоне [0, 1]. Вы можете
|
||||||
|
|
||||||
Есть также глобальная функция для анимированного однократного изменения значения свойства дочернего View
|
Есть также глобальная функция для анимированного однократного изменения значения свойства дочернего View
|
||||||
|
|
||||||
func SetAnimated(rootView View, viewID, tag string, value interface{}, animation Animation) bool
|
func SetAnimated(rootView View, viewID, tag string, value any, animation Animation) bool
|
||||||
|
|
||||||
Постоянная анимация запускается каждый раз когда изменяется значение свойства. Для задания постоянной
|
Постоянная анимация запускается каждый раз когда изменяется значение свойства. Для задания постоянной
|
||||||
анимации перехода используется свойство "transition" (константа Transition). В качества значения данному
|
анимации перехода используется свойство "transition" (константа Transition). В качества значения данному
|
||||||
|
@ -4641,8 +4641,8 @@ Cценарий анимации описывает более сложную а
|
||||||
|
|
||||||
type AnimatedProperty struct {
|
type AnimatedProperty struct {
|
||||||
Tag string
|
Tag string
|
||||||
From, To interface{}
|
From, To any
|
||||||
KeyFrames map[int]interface{}
|
KeyFrames map[int]any
|
||||||
}
|
}
|
||||||
|
|
||||||
где Tag - имя свойства, From - начальное значение свойства, To - конечное значение свойства,
|
где Tag - имя свойства, From - начальное значение свойства, To - конечное значение свойства,
|
||||||
|
@ -4834,11 +4834,11 @@ Safari и Firefox.
|
||||||
|
|
||||||
* SetTitleColor(color Color) устанавливает цвет панели навигации браузера. Поддерживается только в Safari и Chrome для Android.
|
* SetTitleColor(color Color) устанавливает цвет панели навигации браузера. Поддерживается только в Safari и Chrome для Android.
|
||||||
|
|
||||||
* Get(viewID, tag string) interface{} - возвращает значение свойства View с именем tag. Эквивалентно
|
* Get(viewID, tag string) any - возвращает значение свойства View с именем tag. Эквивалентно
|
||||||
|
|
||||||
rui.Get(session.RootView(), viewID, tag)
|
rui.Get(session.RootView(), viewID, tag)
|
||||||
|
|
||||||
* Set(viewID, tag string, value interface{}) bool - устанавливает значение свойства View с именем tag.
|
* Set(viewID, tag string, value any) bool - устанавливает значение свойства View с именем tag.
|
||||||
|
|
||||||
rui.Set(session.RootView(), viewID, tag, value)
|
rui.Set(session.RootView(), viewID, tag, value)
|
||||||
|
|
||||||
|
|
48
README.md
48
README.md
|
@ -362,8 +362,8 @@ View has a number of properties like height, width, color, text parameters, etc.
|
||||||
The Properties interface is used to read and write the property value (View implements this interface):
|
The Properties interface is used to read and write the property value (View implements this interface):
|
||||||
|
|
||||||
type Properties interface {
|
type Properties interface {
|
||||||
Get(tag string) interface{}
|
Get(tag string) any
|
||||||
Set(tag string, value interface{}) bool
|
Set(tag string, value any) bool
|
||||||
Remove(tag string)
|
Remove(tag string)
|
||||||
Clear()
|
Clear()
|
||||||
AllTags() []string
|
AllTags() []string
|
||||||
|
@ -378,8 +378,8 @@ The Remove function removes property value, equivalent to Set(nil)
|
||||||
|
|
||||||
To simplify setting / reading properties, there are also two global functions Get and Set:
|
To simplify setting / reading properties, there are also two global functions Get and Set:
|
||||||
|
|
||||||
func Get(rootView View, viewID, tag string) interface{}
|
func Get(rootView View, viewID, tag string) any
|
||||||
func Set(rootView View, viewID, tag string, value interface{}) bool
|
func Set(rootView View, viewID, tag string, value any) bool
|
||||||
|
|
||||||
These functions get/set the value of the child View
|
These functions get/set the value of the child View
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ Each event can have multiple listeners. In this regard, five data types can be u
|
||||||
* func([< parameters>])
|
* func([< parameters>])
|
||||||
* []func(< View >[, < parameters >])
|
* []func(< View >[, < parameters >])
|
||||||
* []func([< parameters >])
|
* []func([< parameters >])
|
||||||
* []interface{} which only contains func(< View >[, < parameters >]) and func([< parameters >])
|
* []any which only contains func(< View >[, < parameters >]) and func([< parameters >])
|
||||||
|
|
||||||
After being assigned to a property, all these types are converted to an array of []func(< View >, [< parameters >]).
|
After being assigned to a property, all these types are converted to an array of []func(< View >, [< parameters >]).
|
||||||
Accordingly, the Get function always returns an array of []func(< View >, [< parameters >]).
|
Accordingly, the Get function always returns an array of []func(< View >, [< parameters >]).
|
||||||
|
@ -453,7 +453,7 @@ For the "edit-text-changed" event, this
|
||||||
* func(newText string)
|
* func(newText string)
|
||||||
* []func(editor EditView, newText string)
|
* []func(editor EditView, newText string)
|
||||||
* []func(newText string)
|
* []func(newText string)
|
||||||
* []interface{} содержащий только func(editor EditView, newText string) и func(newText string)
|
* []any содержащий только func(editor EditView, newText string) и func(newText string)
|
||||||
|
|
||||||
And the "edit-text-changed" property always stores and returns []func(EditView, string).
|
And the "edit-text-changed" property always stores and returns []func(EditView, string).
|
||||||
|
|
||||||
|
@ -1016,7 +1016,7 @@ Optional parameter. The default direction is from bottom to top. It can be eithe
|
||||||
Each point is described by a BackgroundGradientPoint structure, which has two fields: Pos of type SizeUnit and Color.
|
Each point is described by a BackgroundGradientPoint structure, which has two fields: Pos of type SizeUnit and Color.
|
||||||
Pos defines the position of the point relative to the start of the gradient line. The array must have at least 2 points.
|
Pos defines the position of the point relative to the start of the gradient line. The array must have at least 2 points.
|
||||||
You can also pass a Color array as the gradient value. In this case, the points are evenly distributed along the gradient line.
|
You can also pass a Color array as the gradient value. In this case, the points are evenly distributed along the gradient line.
|
||||||
You can also use an array of []interface{} as an array of cue points.
|
You can also use an array of []any as an array of cue points.
|
||||||
The elements of this array can be BackgroundGradientPoint, Color, BackgroundGradientPoint or Color text representation, and the name of the constant
|
The elements of this array can be BackgroundGradientPoint, Color, BackgroundGradientPoint or Color text representation, and the name of the constant
|
||||||
|
|
||||||
* Repeating ("repeating") - a boolean value that determines whether the gradient will repeat after the last key point.
|
* Repeating ("repeating") - a boolean value that determines whether the gradient will repeat after the last key point.
|
||||||
|
@ -1081,8 +1081,8 @@ The radial gradient has the following options:
|
||||||
Each key angle is described by a BackgroundGradientAngle structure:
|
Each key angle is described by a BackgroundGradientAngle structure:
|
||||||
|
|
||||||
type BackgroundGradientAngle struct {
|
type BackgroundGradientAngle struct {
|
||||||
Color interface{}
|
Color any
|
||||||
Angle interface{}
|
Angle any
|
||||||
}
|
}
|
||||||
|
|
||||||
where Color specifies the color of the key corner and can take a value of Color type or
|
where Color specifies the color of the key corner and can take a value of Color type or
|
||||||
|
@ -1194,7 +1194,7 @@ The textual description of the elliptical clipping region is in the following fo
|
||||||
|
|
||||||
Polygonal cropping area. Created using functions:
|
Polygonal cropping area. Created using functions:
|
||||||
|
|
||||||
func PolygonClip(points []interface{}) ClipShape
|
func PolygonClip(points []any) ClipShape
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape
|
func PolygonPointsClip(points []SizeUnit) ClipShape
|
||||||
|
|
||||||
an array of corner points of the polygon is passed as an argument in the following order: x1, y1, x2, y2, …
|
an array of corner points of the polygon is passed as an argument in the following order: x1, y1, x2, y2, …
|
||||||
|
@ -2091,7 +2091,7 @@ Next, a []View is created containing the resulting View;
|
||||||
|
|
||||||
* []string - each element of the array is converted to View as described in the previous paragraph;
|
* []string - each element of the array is converted to View as described in the previous paragraph;
|
||||||
|
|
||||||
* []interface{} - this array must contain only View and string. Each string element is converted to
|
* []any - this array must contain only View and string. Each string element is converted to
|
||||||
a View as described above. If the array contains invalid values, the "content" property will not be set,
|
a View as described above. If the array contains invalid values, the "content" property will not be set,
|
||||||
and the Set function will return false and an error message will be written to the log.
|
and the Set function will return false and an error message will be written to the log.
|
||||||
|
|
||||||
|
@ -3112,7 +3112,7 @@ The following data types can be passed as a value to the "items" property
|
||||||
|
|
||||||
* []string
|
* []string
|
||||||
* []fmt.Stringer
|
* []fmt.Stringer
|
||||||
* []interface{} containing as elements only: string, fmt.Stringer, bool, rune,
|
* []any containing as elements only: string, fmt.Stringer, bool, rune,
|
||||||
float32, float64, int, int8 … int64, uint, uint8 … uint64.
|
float32, float64, int, int8 … int64, uint, uint8 … uint64.
|
||||||
|
|
||||||
All of these data types are converted to []string and assigned to the "items" property.
|
All of these data types are converted to []string and assigned to the "items" property.
|
||||||
|
@ -3127,9 +3127,9 @@ This property is assigned an array of disabled item indices. The index can be sp
|
||||||
* int
|
* int
|
||||||
* []string
|
* []string
|
||||||
* string - can contain multiple indexes separated by commas
|
* string - can contain multiple indexes separated by commas
|
||||||
* []interface{} - containing as elements only: string, int, int8…int64, uint, uint8…uint64.
|
* []any - containing as elements only: string, int, int8…int64, uint, uint8…uint64.
|
||||||
|
|
||||||
All of these data types are converted to []interface{} and assigned to the "disabled-items" property.
|
All of these data types are converted to []any and assigned to the "disabled-items" property.
|
||||||
You can read the value of the "disabled-items" property using the function
|
You can read the value of the "disabled-items" property using the function
|
||||||
|
|
||||||
func GetDropDownDisabledItems(view View, subviewID string) []int
|
func GetDropDownDisabledItems(view View, subviewID string) []int
|
||||||
|
@ -3422,7 +3422,7 @@ To describe the content, you need to implement the TableAdapter interface declar
|
||||||
type TableAdapter interface {
|
type TableAdapter interface {
|
||||||
RowCount() int
|
RowCount() int
|
||||||
ColumnCount() int
|
ColumnCount() int
|
||||||
Cell(row, column int) interface{}
|
Cell(row, column int) any
|
||||||
}
|
}
|
||||||
|
|
||||||
where RowCount() and ColumnCount() functions must return the number of rows and columns in the table;
|
where RowCount() and ColumnCount() functions must return the number of rows and columns in the table;
|
||||||
|
@ -3441,10 +3441,10 @@ Cell(row, column int) returns the contents of a table cell. The Cell() function
|
||||||
The "content" property can also be assigned the following data types
|
The "content" property can also be assigned the following data types
|
||||||
|
|
||||||
* TableAdapter
|
* TableAdapter
|
||||||
* [][]interface{}
|
* [][]any
|
||||||
* [][]string
|
* [][]string
|
||||||
|
|
||||||
[][]interface{} and [][]string are converted to a TableAdapter when assigned.
|
[][]any and [][]string are converted to a TableAdapter when assigned.
|
||||||
|
|
||||||
### "cell-style" property
|
### "cell-style" property
|
||||||
|
|
||||||
|
@ -3496,7 +3496,7 @@ In this case, the table will look like this
|
||||||
| | | |
|
| | | |
|
||||||
|------+-------+--------|
|
|------+-------+--------|
|
||||||
|
|
||||||
If [][]interface{} is used as the value of the "content" property, then empty structures are used to merge cells
|
If [][]any is used as the value of the "content" property, then empty structures are used to merge cells
|
||||||
|
|
||||||
type VerticalTableJoin struct {
|
type VerticalTableJoin struct {
|
||||||
}
|
}
|
||||||
|
@ -3506,7 +3506,7 @@ If [][]interface{} is used as the value of the "content" property, then empty st
|
||||||
|
|
||||||
These structures attach the cell to the top/left, respectively. The description of the above table will be as follows
|
These structures attach the cell to the top/left, respectively. The description of the above table will be as follows
|
||||||
|
|
||||||
content := [][]interface{} {
|
content := [][]any {
|
||||||
{"", "", rui.HorizontalTableJoin{}},
|
{"", "", rui.HorizontalTableJoin{}},
|
||||||
{rui.VerticalTableJoin{}, "", ""},
|
{rui.VerticalTableJoin{}, "", ""},
|
||||||
}
|
}
|
||||||
|
@ -4513,7 +4513,7 @@ There are two types of transition animations:
|
||||||
A one-time animation is triggered using the SetAnimated function of the View interface.
|
A one-time animation is triggered using the SetAnimated function of the View interface.
|
||||||
This function has the following description:
|
This function has the following description:
|
||||||
|
|
||||||
SetAnimated(tag string, value interface{}, animation Animation) bool
|
SetAnimated(tag string, value any, animation Animation) bool
|
||||||
|
|
||||||
It assigns a new value to the property, and the change occurs using the specified animation.
|
It assigns a new value to the property, and the change occurs using the specified animation.
|
||||||
For example,
|
For example,
|
||||||
|
@ -4525,7 +4525,7 @@ For example,
|
||||||
|
|
||||||
There is also a global function for animated one-time change of the property value of the child View
|
There is also a global function for animated one-time change of the property value of the child View
|
||||||
|
|
||||||
func SetAnimated(rootView View, viewID, tag string, value interface{}, animation Animation) bool
|
func SetAnimated(rootView View, viewID, tag string, value any, animation Animation) bool
|
||||||
|
|
||||||
A persistent animation runs every time the property value changes.
|
A persistent animation runs every time the property value changes.
|
||||||
To set the constant animation of the transition, use the "transition" property (the Transition constant).
|
To set the constant animation of the transition, use the "transition" property (the Transition constant).
|
||||||
|
@ -4603,8 +4603,8 @@ the change script of one property. She is described as
|
||||||
|
|
||||||
type AnimatedProperty struct {
|
type AnimatedProperty struct {
|
||||||
Tag string
|
Tag string
|
||||||
From, To interface{}
|
From, To any
|
||||||
KeyFrames map[int]interface{}
|
KeyFrames map[int]any
|
||||||
}
|
}
|
||||||
|
|
||||||
where Tag is the name of the property, From is the initial value of the property,
|
where Tag is the name of the property, From is the initial value of the property,
|
||||||
|
@ -4791,7 +4791,7 @@ Returns false if no topic with this name was found. Themes named "" are the defa
|
||||||
|
|
||||||
* SetTitleColor(color Color) sets the color of the browser navigation bar. Supported only in Safari and Chrome for android
|
* SetTitleColor(color Color) sets the color of the browser navigation bar. Supported only in Safari and Chrome for android
|
||||||
|
|
||||||
* Get(viewID, tag string) interface{} returns the value of the View property named tag. Equivalent to
|
* Get(viewID, tag string) any returns the value of the View property named tag. Equivalent to
|
||||||
|
|
||||||
rui.Get(session.RootView(), viewID, tag)
|
rui.Get(session.RootView(), viewID, tag)
|
||||||
|
|
||||||
|
|
16
animation.go
16
animation.go
|
@ -107,11 +107,11 @@ type AnimatedProperty struct {
|
||||||
// Tag is the name of the property
|
// Tag is the name of the property
|
||||||
Tag string
|
Tag string
|
||||||
// From is the initial value of the property
|
// From is the initial value of the property
|
||||||
From interface{}
|
From any
|
||||||
// To is the final value of the property
|
// To is the final value of the property
|
||||||
To interface{}
|
To any
|
||||||
// KeyFrames is intermediate property values
|
// KeyFrames is intermediate property values
|
||||||
KeyFrames map[int]interface{}
|
KeyFrames map[int]any
|
||||||
}
|
}
|
||||||
|
|
||||||
type animationData struct {
|
type animationData struct {
|
||||||
|
@ -184,7 +184,7 @@ func (animation *animationData) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (animation *animationData) Set(tag string, value interface{}) bool {
|
func (animation *animationData) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
animation.Remove(tag)
|
animation.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -285,7 +285,7 @@ func (animation *animationData) Set(tag string, value interface{}) bool {
|
||||||
ErrorLogF(`key-frame "%d" is out of range`, n)
|
ErrorLogF(`key-frame "%d" is out of range`, n)
|
||||||
} else {
|
} else {
|
||||||
if result.KeyFrames == nil {
|
if result.KeyFrames == nil {
|
||||||
result.KeyFrames = map[int]interface{}{n: node.Text()}
|
result.KeyFrames = map[int]any{n: node.Text()}
|
||||||
} else {
|
} else {
|
||||||
result.KeyFrames[n] = node.Text()
|
result.KeyFrames[n] = node.Text()
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ func (animation *animationData) Remove(tag string) {
|
||||||
delete(animation.properties, animation.normalizeTag(tag))
|
delete(animation.properties, animation.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (animation *animationData) Get(tag string) interface{} {
|
func (animation *animationData) Get(tag string) any {
|
||||||
return animation.getRaw(animation.normalizeTag(tag))
|
return animation.getRaw(animation.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ func (session *sessionData) registerAnimation(props []AnimatedProperty) string {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) SetAnimated(tag string, value interface{}, animation Animation) bool {
|
func (view *viewData) SetAnimated(tag string, value any, animation Animation) bool {
|
||||||
if animation == nil {
|
if animation == nil {
|
||||||
return view.Set(tag, value)
|
return view.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ func (view *viewData) getTransitions() Params {
|
||||||
// SetAnimated sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result:
|
// SetAnimated sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result:
|
||||||
// true - success,
|
// true - success,
|
||||||
// false - error (incompatible type or invalid format of a string value, see AppLog).
|
// false - error (incompatible type or invalid format of a string value, see AppLog).
|
||||||
func SetAnimated(rootView View, viewID, tag string, value interface{}, animation Animation) bool {
|
func SetAnimated(rootView View, viewID, tag string, value any, animation Animation) bool {
|
||||||
if view := ViewByID(rootView, viewID); view != nil {
|
if view := ViewByID(rootView, viewID); view != nil {
|
||||||
return view.SetAnimated(tag, value, animation)
|
return view.SetAnimated(tag, value, animation)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ const (
|
||||||
AnimationIterationEvent = "animation-iteration-event"
|
AnimationIterationEvent = "animation-iteration-event"
|
||||||
)
|
)
|
||||||
|
|
||||||
func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
|
func valueToAnimationListeners(value any) ([]func(View, string), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ func valueToAnimationListeners(value interface{}) ([]func(View, string), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -183,7 +183,7 @@ var transitionEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
TransitionCancelEvent: {jsEvent: "ontransitioncancel", jsFunc: "transitionCancelEvent"},
|
TransitionCancelEvent: {jsEvent: "ontransitioncancel", jsFunc: "transitionCancelEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setTransitionListener(tag string, value interface{}) bool {
|
func (view *viewData) setTransitionListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToAnimationListeners(value)
|
listeners, ok := valueToAnimationListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
@ -263,7 +263,7 @@ var animationEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
AnimationCancelEvent: {jsEvent: "onanimationcancel", jsFunc: "animationCancelEvent"},
|
AnimationCancelEvent: {jsEvent: "onanimationcancel", jsFunc: "animationCancelEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setAnimationListener(tag string, value interface{}) bool {
|
func (view *viewData) setAnimationListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToAnimationListeners(value)
|
listeners, ok := valueToAnimationListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
|
@ -39,7 +39,7 @@ func DebugLog(text string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugLogF print the text to the debug log
|
// DebugLogF print the text to the debug log
|
||||||
func DebugLogF(format string, a ...interface{}) {
|
func DebugLogF(format string, a ...any) {
|
||||||
if debugLogFunc != nil {
|
if debugLogFunc != nil {
|
||||||
debugLogFunc(fmt.Sprintf(format, a...))
|
debugLogFunc(fmt.Sprintf(format, a...))
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func ErrorLog(text string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrorLogF print the text to the error log
|
// ErrorLogF print the text to the error log
|
||||||
func ErrorLogF(format string, a ...interface{}) {
|
func ErrorLogF(format string, a ...any) {
|
||||||
lastError = fmt.Sprintf(format, a...)
|
lastError = fmt.Sprintf(format, a...)
|
||||||
if errorLogFunc != nil {
|
if errorLogFunc != nil {
|
||||||
errorLogFunc(lastError)
|
errorLogFunc(lastError)
|
||||||
|
|
|
@ -81,22 +81,22 @@ func createBackground(obj DataObject) BackgroundElement {
|
||||||
switch obj.Tag() {
|
switch obj.Tag() {
|
||||||
case "image":
|
case "image":
|
||||||
image := new(backgroundImage)
|
image := new(backgroundImage)
|
||||||
image.properties = map[string]interface{}{}
|
image.properties = map[string]any{}
|
||||||
result = image
|
result = image
|
||||||
|
|
||||||
case "linear-gradient":
|
case "linear-gradient":
|
||||||
gradient := new(backgroundLinearGradient)
|
gradient := new(backgroundLinearGradient)
|
||||||
gradient.properties = map[string]interface{}{}
|
gradient.properties = map[string]any{}
|
||||||
result = gradient
|
result = gradient
|
||||||
|
|
||||||
case "radial-gradient":
|
case "radial-gradient":
|
||||||
gradient := new(backgroundRadialGradient)
|
gradient := new(backgroundRadialGradient)
|
||||||
gradient.properties = map[string]interface{}{}
|
gradient.properties = map[string]any{}
|
||||||
result = gradient
|
result = gradient
|
||||||
|
|
||||||
case "conic-gradient":
|
case "conic-gradient":
|
||||||
gradient := new(backgroundConicGradient)
|
gradient := new(backgroundConicGradient)
|
||||||
gradient.properties = map[string]interface{}{}
|
gradient.properties = map[string]any{}
|
||||||
result = gradient
|
result = gradient
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -118,7 +118,7 @@ func createBackground(obj DataObject) BackgroundElement {
|
||||||
// NewBackgroundImage creates the new background image
|
// NewBackgroundImage creates the new background image
|
||||||
func NewBackgroundImage(params Params) BackgroundElement {
|
func NewBackgroundImage(params Params) BackgroundElement {
|
||||||
result := new(backgroundImage)
|
result := new(backgroundImage)
|
||||||
result.properties = map[string]interface{}{}
|
result.properties = map[string]any{}
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
result.Set(tag, value)
|
result.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ func (image *backgroundImage) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (image *backgroundImage) Set(tag string, value interface{}) bool {
|
func (image *backgroundImage) Set(tag string, value any) bool {
|
||||||
tag = image.normalizeTag(tag)
|
tag = image.normalizeTag(tag)
|
||||||
switch tag {
|
switch tag {
|
||||||
case Attachment, Width, Height, Repeat, ImageHorizontalAlign, ImageVerticalAlign,
|
case Attachment, Width, Height, Repeat, ImageHorizontalAlign, ImageVerticalAlign,
|
||||||
|
@ -167,7 +167,7 @@ func (image *backgroundImage) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (image *backgroundImage) Get(tag string) interface{} {
|
func (image *backgroundImage) Get(tag string) any {
|
||||||
return image.backgroundElement.Get(image.normalizeTag(tag))
|
return image.backgroundElement.Get(image.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,16 @@ type backgroundConicGradient struct {
|
||||||
type BackgroundGradientAngle struct {
|
type BackgroundGradientAngle struct {
|
||||||
// Color - the color of the key angle. Must not be nil.
|
// Color - the color of the key angle. Must not be nil.
|
||||||
// Can take a value of Color type or string (color constant or textual description of the color)
|
// Can take a value of Color type or string (color constant or textual description of the color)
|
||||||
Color interface{}
|
Color any
|
||||||
// Angle - the key angle. Optional (may be nil).
|
// Angle - the key angle. Optional (may be nil).
|
||||||
// Can take a value of AngleUnit type or string (angle constant or textual description of the angle)
|
// Can take a value of AngleUnit type or string (angle constant or textual description of the angle)
|
||||||
Angle interface{}
|
Angle any
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBackgroundConicGradient creates the new background conic gradient
|
// NewBackgroundConicGradient creates the new background conic gradient
|
||||||
func NewBackgroundConicGradient(params Params) BackgroundElement {
|
func NewBackgroundConicGradient(params Params) BackgroundElement {
|
||||||
result := new(backgroundConicGradient)
|
result := new(backgroundConicGradient)
|
||||||
result.properties = map[string]interface{}{}
|
result.properties = map[string]any{}
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
result.Set(tag, value)
|
result.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ func (gradient *backgroundConicGradient) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundConicGradient) Set(tag string, value interface{}) bool {
|
func (gradient *backgroundConicGradient) Set(tag string, value any) bool {
|
||||||
tag = gradient.normalizeTag(tag)
|
tag = gradient.normalizeTag(tag)
|
||||||
switch tag {
|
switch tag {
|
||||||
case CenterX, CenterY, Repeating, From:
|
case CenterX, CenterY, Repeating, From:
|
||||||
|
@ -153,7 +153,7 @@ func (gradient *backgroundConicGradient) Set(tag string, value interface{}) bool
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundConicGradient) stringToAngle(text string) (interface{}, bool) {
|
func (gradient *backgroundConicGradient) stringToAngle(text string) (any, bool) {
|
||||||
if text == "" {
|
if text == "" {
|
||||||
return nil, false
|
return nil, false
|
||||||
} else if text[0] == '@' {
|
} else if text[0] == '@' {
|
||||||
|
@ -216,7 +216,7 @@ func (gradient *backgroundConicGradient) parseGradientText(value string) []Backg
|
||||||
return vector
|
return vector
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundConicGradient) setGradient(value interface{}) bool {
|
func (gradient *backgroundConicGradient) setGradient(value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(gradient.properties, Gradient)
|
delete(gradient.properties, Gradient)
|
||||||
return true
|
return true
|
||||||
|
@ -262,7 +262,7 @@ func (gradient *backgroundConicGradient) setGradient(value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundConicGradient) Get(tag string) interface{} {
|
func (gradient *backgroundConicGradient) Get(tag string) any {
|
||||||
return gradient.backgroundElement.Get(gradient.normalizeTag(tag))
|
return gradient.backgroundElement.Get(gradient.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,10 @@ const (
|
||||||
type BackgroundGradientPoint struct {
|
type BackgroundGradientPoint struct {
|
||||||
// Color - the color of the point. Must not be nil.
|
// Color - the color of the point. Must not be nil.
|
||||||
// Can take a value of Color type or string (color constant or textual description of the color)
|
// Can take a value of Color type or string (color constant or textual description of the color)
|
||||||
Color interface{}
|
Color any
|
||||||
// Pos - the distance from the start of the gradient straight line. Optional (may be nil).
|
// Pos - the distance from the start of the gradient straight line. Optional (may be nil).
|
||||||
// Can take a value of SizeUnit type or string (angle constant or textual description of the SizeUnit)
|
// Can take a value of SizeUnit type or string (angle constant or textual description of the SizeUnit)
|
||||||
Pos interface{}
|
Pos any
|
||||||
}
|
}
|
||||||
|
|
||||||
type backgroundGradient struct {
|
type backgroundGradient struct {
|
||||||
|
@ -71,7 +71,7 @@ type backgroundRadialGradient struct {
|
||||||
// NewBackgroundLinearGradient creates the new background linear gradient
|
// NewBackgroundLinearGradient creates the new background linear gradient
|
||||||
func NewBackgroundLinearGradient(params Params) BackgroundElement {
|
func NewBackgroundLinearGradient(params Params) BackgroundElement {
|
||||||
result := new(backgroundLinearGradient)
|
result := new(backgroundLinearGradient)
|
||||||
result.properties = map[string]interface{}{}
|
result.properties = map[string]any{}
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
result.Set(tag, value)
|
result.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ func NewBackgroundLinearGradient(params Params) BackgroundElement {
|
||||||
// NewBackgroundRadialGradient creates the new background radial gradient
|
// NewBackgroundRadialGradient creates the new background radial gradient
|
||||||
func NewBackgroundRadialGradient(params Params) BackgroundElement {
|
func NewBackgroundRadialGradient(params Params) BackgroundElement {
|
||||||
result := new(backgroundRadialGradient)
|
result := new(backgroundRadialGradient)
|
||||||
result.properties = map[string]interface{}{}
|
result.properties = map[string]any{}
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
result.Set(tag, value)
|
result.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ func (gradient *backgroundGradient) parseGradientText(value string) []Background
|
||||||
return points
|
return points
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundGradient) Set(tag string, value interface{}) bool {
|
func (gradient *backgroundGradient) Set(tag string, value any) bool {
|
||||||
|
|
||||||
switch tag = strings.ToLower(tag); tag {
|
switch tag = strings.ToLower(tag); tag {
|
||||||
case Repeating:
|
case Repeating:
|
||||||
|
@ -296,7 +296,7 @@ func (image *backgroundLinearGradient) Clone() BackgroundElement {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundLinearGradient) Set(tag string, value interface{}) bool {
|
func (gradient *backgroundLinearGradient) Set(tag string, value any) bool {
|
||||||
if strings.ToLower(tag) == Direction {
|
if strings.ToLower(tag) == Direction {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case AngleUnit:
|
case AngleUnit:
|
||||||
|
@ -402,7 +402,7 @@ func (gradient *backgroundRadialGradient) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundRadialGradient) Set(tag string, value interface{}) bool {
|
func (gradient *backgroundRadialGradient) Set(tag string, value any) bool {
|
||||||
tag = gradient.normalizeTag(tag)
|
tag = gradient.normalizeTag(tag)
|
||||||
switch tag {
|
switch tag {
|
||||||
case RadialGradientRadius:
|
case RadialGradientRadius:
|
||||||
|
@ -426,7 +426,7 @@ func (gradient *backgroundRadialGradient) Set(tag string, value interface{}) boo
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
switch len(value) {
|
switch len(value) {
|
||||||
case 0:
|
case 0:
|
||||||
delete(gradient.properties, RadialGradientRadius)
|
delete(gradient.properties, RadialGradientRadius)
|
||||||
|
@ -477,7 +477,7 @@ func (gradient *backgroundRadialGradient) Set(tag string, value interface{}) boo
|
||||||
return gradient.backgroundGradient.Set(tag, value)
|
return gradient.backgroundGradient.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gradient *backgroundRadialGradient) Get(tag string) interface{} {
|
func (gradient *backgroundRadialGradient) Get(tag string) any {
|
||||||
return gradient.backgroundGradient.Get(gradient.normalizeTag(tag))
|
return gradient.backgroundGradient.Get(gradient.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ func (gradient *backgroundRadialGradient) cssStyle(session Session) string {
|
||||||
buffer.WriteString(" ")
|
buffer.WriteString(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count > 2 {
|
if count > 2 {
|
||||||
count = 2
|
count = 2
|
||||||
|
|
12
border.go
12
border.go
|
@ -64,9 +64,9 @@ type borderProperty struct {
|
||||||
propertyList
|
propertyList
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBorderProperty(value interface{}) BorderProperty {
|
func newBorderProperty(value any) BorderProperty {
|
||||||
border := new(borderProperty)
|
border := new(borderProperty)
|
||||||
border.properties = map[string]interface{}{}
|
border.properties = map[string]any{}
|
||||||
|
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -131,7 +131,7 @@ func newBorderProperty(value interface{}) BorderProperty {
|
||||||
// NewBorder creates the new BorderProperty
|
// NewBorder creates the new BorderProperty
|
||||||
func NewBorder(params Params) BorderProperty {
|
func NewBorder(params Params) BorderProperty {
|
||||||
border := new(borderProperty)
|
border := new(borderProperty)
|
||||||
border.properties = map[string]interface{}{}
|
border.properties = map[string]any{}
|
||||||
if params != nil {
|
if params != nil {
|
||||||
for _, tag := range []string{Style, Width, ColorTag, Left, Right, Top, Bottom,
|
for _, tag := range []string{Style, Width, ColorTag, Left, Right, Top, Bottom,
|
||||||
LeftStyle, RightStyle, TopStyle, BottomStyle,
|
LeftStyle, RightStyle, TopStyle, BottomStyle,
|
||||||
|
@ -213,7 +213,7 @@ func (border *borderProperty) writeString(buffer *strings.Builder, indent string
|
||||||
buffer.WriteString("_{ ")
|
buffer.WriteString("_{ ")
|
||||||
comma := false
|
comma := false
|
||||||
|
|
||||||
write := func(tag string, value interface{}) {
|
write := func(tag string, value any) {
|
||||||
if comma {
|
if comma {
|
||||||
buffer.WriteString(", ")
|
buffer.WriteString(", ")
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ func (border *borderProperty) Remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (border *borderProperty) Set(tag string, value interface{}) bool {
|
func (border *borderProperty) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
border.Remove(tag)
|
border.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -512,7 +512,7 @@ func (border *borderProperty) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (border *borderProperty) Get(tag string) interface{} {
|
func (border *borderProperty) Get(tag string) any {
|
||||||
tag = border.normalizeTag(tag)
|
tag = border.normalizeTag(tag)
|
||||||
|
|
||||||
if result, ok := border.properties[tag]; ok {
|
if result, ok := border.properties[tag]; ok {
|
||||||
|
|
10
bounds.go
10
bounds.go
|
@ -20,7 +20,7 @@ type boundsPropertyData struct {
|
||||||
// NewBoundsProperty creates the new BoundsProperty object
|
// NewBoundsProperty creates the new BoundsProperty object
|
||||||
func NewBoundsProperty(params Params) BoundsProperty {
|
func NewBoundsProperty(params Params) BoundsProperty {
|
||||||
bounds := new(boundsPropertyData)
|
bounds := new(boundsPropertyData)
|
||||||
bounds.properties = map[string]interface{}{}
|
bounds.properties = map[string]any{}
|
||||||
if params != nil {
|
if params != nil {
|
||||||
for _, tag := range []string{Top, Right, Bottom, Left} {
|
for _, tag := range []string{Top, Right, Bottom, Left} {
|
||||||
if value, ok := params[tag]; ok {
|
if value, ok := params[tag]; ok {
|
||||||
|
@ -79,7 +79,7 @@ func (bounds *boundsPropertyData) Remove(tag string) {
|
||||||
bounds.propertyList.Remove(bounds.normalizeTag(tag))
|
bounds.propertyList.Remove(bounds.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bounds *boundsPropertyData) Set(tag string, value interface{}) bool {
|
func (bounds *boundsPropertyData) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
bounds.Remove(tag)
|
bounds.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -98,7 +98,7 @@ func (bounds *boundsPropertyData) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bounds *boundsPropertyData) Get(tag string) interface{} {
|
func (bounds *boundsPropertyData) Get(tag string) any {
|
||||||
tag = bounds.normalizeTag(tag)
|
tag = bounds.normalizeTag(tag)
|
||||||
if value, ok := bounds.properties[tag]; ok {
|
if value, ok := bounds.properties[tag]; ok {
|
||||||
return value
|
return value
|
||||||
|
@ -228,7 +228,7 @@ func (bounds *Bounds) cssString() string {
|
||||||
return builder.finish()
|
return builder.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setBounds(tag string, value interface{}) bool {
|
func (properties *propertyList) setBounds(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
|
@ -340,7 +340,7 @@ func (properties *propertyList) removeBoundsSide(mainTag, sideTag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setBoundsSide(mainTag, sideTag string, value interface{}) bool {
|
func (properties *propertyList) setBoundsSide(mainTag, sideTag string, value any) bool {
|
||||||
bounds := properties.boundsProperty(mainTag)
|
bounds := properties.boundsProperty(mainTag)
|
||||||
if bounds.Set(sideTag, value) {
|
if bounds.Set(sideTag, value) {
|
||||||
properties.properties[mainTag] = bounds
|
properties.properties[mainTag] = bounds
|
||||||
|
|
|
@ -63,11 +63,11 @@ func (canvasView *canvasViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvasView *canvasViewData) Set(tag string, value interface{}) bool {
|
func (canvasView *canvasViewData) Set(tag string, value any) bool {
|
||||||
return canvasView.set(canvasView.normalizeTag(tag), value)
|
return canvasView.set(canvasView.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvasView *canvasViewData) set(tag string, value interface{}) bool {
|
func (canvasView *canvasViewData) set(tag string, value any) bool {
|
||||||
if tag == DrawFunction {
|
if tag == DrawFunction {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
canvasView.drawer = nil
|
canvasView.drawer = nil
|
||||||
|
@ -85,11 +85,11 @@ func (canvasView *canvasViewData) set(tag string, value interface{}) bool {
|
||||||
return canvasView.viewData.set(tag, value)
|
return canvasView.viewData.set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvasView *canvasViewData) Get(tag string) interface{} {
|
func (canvasView *canvasViewData) Get(tag string) any {
|
||||||
return canvasView.get(canvasView.normalizeTag(tag))
|
return canvasView.get(canvasView.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (canvasView *canvasViewData) get(tag string) interface{} {
|
func (canvasView *canvasViewData) get(tag string) any {
|
||||||
if tag == DrawFunction {
|
if tag == DrawFunction {
|
||||||
return canvasView.drawer
|
return canvasView.drawer
|
||||||
}
|
}
|
||||||
|
|
10
checkbox.go
10
checkbox.go
|
@ -51,7 +51,7 @@ func (button *checkboxData) Focusable() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (button *checkboxData) Get(tag string) interface{} {
|
func (button *checkboxData) Get(tag string) any {
|
||||||
switch strings.ToLower(tag) {
|
switch strings.ToLower(tag) {
|
||||||
case CheckboxChangedEvent:
|
case CheckboxChangedEvent:
|
||||||
return button.checkedListeners
|
return button.checkedListeners
|
||||||
|
@ -60,11 +60,11 @@ func (button *checkboxData) Get(tag string) interface{} {
|
||||||
return button.viewsContainerData.Get(tag)
|
return button.viewsContainerData.Get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (button *checkboxData) Set(tag string, value interface{}) bool {
|
func (button *checkboxData) Set(tag string, value any) bool {
|
||||||
return button.set(tag, value)
|
return button.set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (button *checkboxData) set(tag string, value interface{}) bool {
|
func (button *checkboxData) set(tag string, value any) bool {
|
||||||
switch tag {
|
switch tag {
|
||||||
case CheckboxChangedEvent:
|
case CheckboxChangedEvent:
|
||||||
if !button.setChangedListener(value) {
|
if !button.setChangedListener(value) {
|
||||||
|
@ -205,7 +205,7 @@ func checkboxKeyListener(view View, event KeyEvent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (button *checkboxData) setChangedListener(value interface{}) bool {
|
func (button *checkboxData) setChangedListener(value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
if len(button.checkedListeners) > 0 {
|
if len(button.checkedListeners) > 0 {
|
||||||
button.checkedListeners = []func(Checkbox, bool){}
|
button.checkedListeners = []func(Checkbox, bool){}
|
||||||
|
@ -239,7 +239,7 @@ func (button *checkboxData) setChangedListener(value interface{}) bool {
|
||||||
}
|
}
|
||||||
button.checkedListeners = listeners
|
button.checkedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(Checkbox, bool), len(value))
|
listeners := make([]func(Checkbox, bool), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
|
@ -75,11 +75,11 @@ func (picker *colorPickerData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *colorPickerData) Set(tag string, value interface{}) bool {
|
func (picker *colorPickerData) Set(tag string, value any) bool {
|
||||||
return picker.set(picker.normalizeTag(tag), value)
|
return picker.set(picker.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *colorPickerData) set(tag string, value interface{}) bool {
|
func (picker *colorPickerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
picker.remove(tag)
|
picker.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -114,7 +114,7 @@ func (picker *colorPickerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
picker.colorChangedListeners = listeners
|
picker.colorChangedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(ColorPicker, Color), len(value))
|
listeners := make([]func(ColorPicker, Color), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -166,11 +166,11 @@ func (picker *colorPickerData) colorChanged(oldColor Color) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *colorPickerData) Get(tag string) interface{} {
|
func (picker *colorPickerData) Get(tag string) any {
|
||||||
return picker.get(picker.normalizeTag(tag))
|
return picker.get(picker.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *colorPickerData) get(tag string) interface{} {
|
func (picker *colorPickerData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case ColorChangedEvent:
|
case ColorChangedEvent:
|
||||||
return picker.colorChangedListeners
|
return picker.colorChangedListeners
|
||||||
|
|
|
@ -76,7 +76,7 @@ func (columnLayout *columnLayoutData) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (columnLayout *columnLayoutData) Get(tag string) interface{} {
|
func (columnLayout *columnLayoutData) Get(tag string) any {
|
||||||
return columnLayout.get(columnLayout.normalizeTag(tag))
|
return columnLayout.get(columnLayout.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ func (columnLayout *columnLayoutData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (columnLayout *columnLayoutData) Set(tag string, value interface{}) bool {
|
func (columnLayout *columnLayoutData) Set(tag string, value any) bool {
|
||||||
return columnLayout.set(columnLayout.normalizeTag(tag), value)
|
return columnLayout.set(columnLayout.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (columnLayout *columnLayoutData) set(tag string, value interface{}) bool {
|
func (columnLayout *columnLayoutData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
columnLayout.remove(tag)
|
columnLayout.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -18,11 +18,11 @@ type columnSeparatorProperty struct {
|
||||||
propertyList
|
propertyList
|
||||||
}
|
}
|
||||||
|
|
||||||
func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
|
func newColumnSeparatorProperty(value any) ColumnSeparatorProperty {
|
||||||
|
|
||||||
if value == nil {
|
if value == nil {
|
||||||
separator := new(columnSeparatorProperty)
|
separator := new(columnSeparatorProperty)
|
||||||
separator.properties = map[string]interface{}{}
|
separator.properties = map[string]any{}
|
||||||
return separator
|
return separator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
|
||||||
|
|
||||||
case DataObject:
|
case DataObject:
|
||||||
separator := new(columnSeparatorProperty)
|
separator := new(columnSeparatorProperty)
|
||||||
separator.properties = map[string]interface{}{}
|
separator.properties = map[string]any{}
|
||||||
for _, tag := range []string{Style, Width, ColorTag} {
|
for _, tag := range []string{Style, Width, ColorTag} {
|
||||||
if val, ok := value.PropertyValue(tag); ok && val != "" {
|
if val, ok := value.PropertyValue(tag); ok && val != "" {
|
||||||
separator.set(tag, value)
|
separator.set(tag, value)
|
||||||
|
@ -42,7 +42,7 @@ func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
|
||||||
|
|
||||||
case ViewBorder:
|
case ViewBorder:
|
||||||
separator := new(columnSeparatorProperty)
|
separator := new(columnSeparatorProperty)
|
||||||
separator.properties = map[string]interface{}{
|
separator.properties = map[string]any{
|
||||||
Style: value.Style,
|
Style: value.Style,
|
||||||
Width: value.Width,
|
Width: value.Width,
|
||||||
ColorTag: value.Color,
|
ColorTag: value.Color,
|
||||||
|
@ -57,7 +57,7 @@ func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
|
||||||
// NewColumnSeparator creates the new ColumnSeparatorProperty
|
// NewColumnSeparator creates the new ColumnSeparatorProperty
|
||||||
func NewColumnSeparator(params Params) ColumnSeparatorProperty {
|
func NewColumnSeparator(params Params) ColumnSeparatorProperty {
|
||||||
separator := new(columnSeparatorProperty)
|
separator := new(columnSeparatorProperty)
|
||||||
separator.properties = map[string]interface{}{}
|
separator.properties = map[string]any{}
|
||||||
if params != nil {
|
if params != nil {
|
||||||
for _, tag := range []string{Style, Width, ColorTag} {
|
for _, tag := range []string{Style, Width, ColorTag} {
|
||||||
if value, ok := params[tag]; ok && value != nil {
|
if value, ok := params[tag]; ok && value != nil {
|
||||||
|
@ -117,7 +117,7 @@ func (separator *columnSeparatorProperty) Remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (separator *columnSeparatorProperty) Set(tag string, value interface{}) bool {
|
func (separator *columnSeparatorProperty) Set(tag string, value any) bool {
|
||||||
tag = separator.normalizeTag(tag)
|
tag = separator.normalizeTag(tag)
|
||||||
|
|
||||||
if value == nil {
|
if value == nil {
|
||||||
|
@ -140,7 +140,7 @@ func (separator *columnSeparatorProperty) Set(tag string, value interface{}) boo
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (separator *columnSeparatorProperty) Get(tag string) interface{} {
|
func (separator *columnSeparatorProperty) Get(tag string) any {
|
||||||
tag = separator.normalizeTag(tag)
|
tag = separator.normalizeTag(tag)
|
||||||
|
|
||||||
if result, ok := separator.properties[tag]; ok {
|
if result, ok := separator.properties[tag]; ok {
|
||||||
|
|
|
@ -45,26 +45,26 @@ func (customView *CustomViewData) setTag(tag string) {
|
||||||
|
|
||||||
// Get returns a value of the property with name defined by the argument.
|
// Get returns a value of the property with name defined by the argument.
|
||||||
// The type of return value depends on the property. If the property is not set then nil is returned.
|
// The type of return value depends on the property. If the property is not set then nil is returned.
|
||||||
func (customView *CustomViewData) Get(tag string) interface{} {
|
func (customView *CustomViewData) Get(tag string) any {
|
||||||
return customView.superView.Get(tag)
|
return customView.superView.Get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (customView *CustomViewData) getRaw(tag string) interface{} {
|
func (customView *CustomViewData) getRaw(tag string) any {
|
||||||
return customView.superView.getRaw(tag)
|
return customView.superView.getRaw(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (customView *CustomViewData) setRaw(tag string, value interface{}) {
|
func (customView *CustomViewData) setRaw(tag string, value any) {
|
||||||
customView.superView.setRaw(tag, value)
|
customView.superView.setRaw(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sets the value (second argument) of the property with name defined by the first argument.
|
// Set sets the value (second argument) of the property with name defined by the first argument.
|
||||||
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
||||||
// a description of the error is written to the log
|
// a description of the error is written to the log
|
||||||
func (customView *CustomViewData) Set(tag string, value interface{}) bool {
|
func (customView *CustomViewData) Set(tag string, value any) bool {
|
||||||
return customView.superView.Set(tag, value)
|
return customView.superView.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (customView *CustomViewData) SetAnimated(tag string, value interface{}, animation Animation) bool {
|
func (customView *CustomViewData) SetAnimated(tag string, value any, animation Animation) bool {
|
||||||
return customView.superView.SetAnimated(tag, value, animation)
|
return customView.superView.SetAnimated(tag, value, animation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,11 +114,11 @@ func (picker *datePickerData) remove(tag string) {
|
||||||
picker.propertyChangedEvent(tag)
|
picker.propertyChangedEvent(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *datePickerData) Set(tag string, value interface{}) bool {
|
func (picker *datePickerData) Set(tag string, value any) bool {
|
||||||
return picker.set(picker.normalizeTag(tag), value)
|
return picker.set(picker.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *datePickerData) set(tag string, value interface{}) bool {
|
func (picker *datePickerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
picker.remove(tag)
|
picker.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -262,7 +262,7 @@ func (picker *datePickerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
picker.dateChangedListeners = listeners
|
picker.dateChangedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(DatePicker, time.Time), len(value))
|
listeners := make([]func(DatePicker, time.Time), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -295,11 +295,11 @@ func (picker *datePickerData) set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *datePickerData) Get(tag string) interface{} {
|
func (picker *datePickerData) Get(tag string) any {
|
||||||
return picker.get(picker.normalizeTag(tag))
|
return picker.get(picker.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *datePickerData) get(tag string) interface{} {
|
func (picker *datePickerData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case DateChangedEvent:
|
case DateChangedEvent:
|
||||||
return picker.dateChangedListeners
|
return picker.dateChangedListeners
|
||||||
|
@ -374,7 +374,7 @@ func (picker *datePickerData) handleCommand(self View, command string, data Data
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDateProperty(view View, mainTag, shortTag string) (time.Time, bool) {
|
func getDateProperty(view View, mainTag, shortTag string) (time.Time, bool) {
|
||||||
valueToTime := func(value interface{}) (time.Time, bool) {
|
valueToTime := func(value any) (time.Time, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case time.Time:
|
case time.Time:
|
||||||
|
|
|
@ -68,11 +68,11 @@ func (detailsView *detailsViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detailsView *detailsViewData) Set(tag string, value interface{}) bool {
|
func (detailsView *detailsViewData) Set(tag string, value any) bool {
|
||||||
return detailsView.set(strings.ToLower(tag), value)
|
return detailsView.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detailsView *detailsViewData) set(tag string, value interface{}) bool {
|
func (detailsView *detailsViewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
detailsView.remove(tag)
|
detailsView.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -133,11 +133,11 @@ func (detailsView *detailsViewData) set(tag string, value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detailsView *detailsViewData) Get(tag string) interface{} {
|
func (detailsView *detailsViewData) Get(tag string) any {
|
||||||
return detailsView.get(strings.ToLower(tag))
|
return detailsView.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (detailsView *detailsViewData) get(tag string) interface{} {
|
func (detailsView *detailsViewData) get(tag string) any {
|
||||||
return detailsView.viewsContainerData.get(tag)
|
return detailsView.viewsContainerData.get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ type DropDownList interface {
|
||||||
type dropDownListData struct {
|
type dropDownListData struct {
|
||||||
viewData
|
viewData
|
||||||
items []string
|
items []string
|
||||||
disabledItems []interface{}
|
disabledItems []any
|
||||||
dropDownListener []func(DropDownList, int)
|
dropDownListener []func(DropDownList, int)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func (list *dropDownListData) Init(session Session) {
|
||||||
list.viewData.Init(session)
|
list.viewData.Init(session)
|
||||||
list.tag = "DropDownList"
|
list.tag = "DropDownList"
|
||||||
list.items = []string{}
|
list.items = []string{}
|
||||||
list.disabledItems = []interface{}{}
|
list.disabledItems = []any{}
|
||||||
list.dropDownListener = []func(DropDownList, int){}
|
list.dropDownListener = []func(DropDownList, int){}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ func (list *dropDownListData) remove(tag string) {
|
||||||
|
|
||||||
case DisabledItems:
|
case DisabledItems:
|
||||||
if len(list.disabledItems) > 0 {
|
if len(list.disabledItems) > 0 {
|
||||||
list.disabledItems = []interface{}{}
|
list.disabledItems = []any{}
|
||||||
if list.created {
|
if list.created {
|
||||||
updateInnerHTML(list.htmlID(), list.session)
|
updateInnerHTML(list.htmlID(), list.session)
|
||||||
}
|
}
|
||||||
|
@ -95,11 +95,11 @@ func (list *dropDownListData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) Set(tag string, value interface{}) bool {
|
func (list *dropDownListData) Set(tag string, value any) bool {
|
||||||
return list.set(strings.ToLower(tag), value)
|
return list.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) set(tag string, value interface{}) bool {
|
func (list *dropDownListData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
list.remove(tag)
|
list.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -133,7 +133,7 @@ func (list *dropDownListData) set(tag string, value interface{}) bool {
|
||||||
return list.viewData.set(tag, value)
|
return list.viewData.set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) setItems(value interface{}) bool {
|
func (list *dropDownListData) setItems(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
list.items = []string{value}
|
list.items = []string{value}
|
||||||
|
@ -155,7 +155,7 @@ func (list *dropDownListData) setItems(value interface{}) bool {
|
||||||
list.items[i] = str.String()
|
list.items[i] = str.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
items := make([]string, 0, len(value))
|
items := make([]string, 0, len(value))
|
||||||
for _, v := range value {
|
for _, v := range value {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
|
@ -206,16 +206,16 @@ func (list *dropDownListData) setItems(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) setDisabledItems(value interface{}) bool {
|
func (list *dropDownListData) setDisabledItems(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case []int:
|
case []int:
|
||||||
list.disabledItems = make([]interface{}, len(value))
|
list.disabledItems = make([]any, len(value))
|
||||||
for i, n := range value {
|
for i, n := range value {
|
||||||
list.disabledItems[i] = n
|
list.disabledItems[i] = n
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
disabledItems := make([]interface{}, len(value))
|
disabledItems := make([]any, len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
notCompatibleType(DisabledItems, value)
|
notCompatibleType(DisabledItems, value)
|
||||||
|
@ -248,7 +248,7 @@ func (list *dropDownListData) setDisabledItems(value interface{}) bool {
|
||||||
|
|
||||||
case string:
|
case string:
|
||||||
values := strings.Split(value, ",")
|
values := strings.Split(value, ",")
|
||||||
disabledItems := make([]interface{}, len(values))
|
disabledItems := make([]any, len(values))
|
||||||
for i, str := range values {
|
for i, str := range values {
|
||||||
str = strings.Trim(str, " ")
|
str = strings.Trim(str, " ")
|
||||||
if str == "" {
|
if str == "" {
|
||||||
|
@ -291,7 +291,7 @@ func (list *dropDownListData) setDisabledItems(value interface{}) bool {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) setDropDownListener(value interface{}) bool {
|
func (list *dropDownListData) setDropDownListener(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case func(DropDownList, int):
|
case func(DropDownList, int):
|
||||||
list.dropDownListener = []func(DropDownList, int){value}
|
list.dropDownListener = []func(DropDownList, int){value}
|
||||||
|
@ -317,7 +317,7 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool {
|
||||||
}
|
}
|
||||||
list.dropDownListener = listeners
|
list.dropDownListener = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(DropDownList, int), len(value))
|
listeners := make([]func(DropDownList, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -349,11 +349,11 @@ func (list *dropDownListData) setDropDownListener(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) Get(tag string) interface{} {
|
func (list *dropDownListData) Get(tag string) any {
|
||||||
return list.get(strings.ToLower(tag))
|
return list.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (list *dropDownListData) get(tag string) interface{} {
|
func (list *dropDownListData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Items:
|
case Items:
|
||||||
return list.items
|
return list.items
|
||||||
|
@ -479,7 +479,7 @@ func GetDropDownDisabledItems(view View, subviewID string) []int {
|
||||||
}
|
}
|
||||||
if view != nil {
|
if view != nil {
|
||||||
if value := view.Get(DisabledItems); value != nil {
|
if value := view.Get(DisabledItems); value != nil {
|
||||||
if values, ok := value.([]interface{}); ok {
|
if values, ok := value.([]any); ok {
|
||||||
count := len(values)
|
count := len(values)
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
result := make([]int, 0, count)
|
result := make([]int, 0, count)
|
||||||
|
|
12
editView.go
12
editView.go
|
@ -190,11 +190,11 @@ func (edit *editViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (edit *editViewData) Set(tag string, value interface{}) bool {
|
func (edit *editViewData) Set(tag string, value any) bool {
|
||||||
return edit.set(edit.normalizeTag(tag), value)
|
return edit.set(edit.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (edit *editViewData) set(tag string, value interface{}) bool {
|
func (edit *editViewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
edit.remove(tag)
|
edit.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -344,7 +344,7 @@ func (edit *editViewData) set(tag string, value interface{}) bool {
|
||||||
return edit.viewData.set(tag, value)
|
return edit.viewData.set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (edit *editViewData) setChangeListeners(value interface{}) bool {
|
func (edit *editViewData) setChangeListeners(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case func(EditView, string):
|
case func(EditView, string):
|
||||||
edit.textChangeListeners = []func(EditView, string){value}
|
edit.textChangeListeners = []func(EditView, string){value}
|
||||||
|
@ -370,7 +370,7 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool {
|
||||||
}
|
}
|
||||||
edit.textChangeListeners = listeners
|
edit.textChangeListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(EditView, string), len(value))
|
listeners := make([]func(EditView, string), len(value))
|
||||||
for i, v := range value {
|
for i, v := range value {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
|
@ -397,11 +397,11 @@ func (edit *editViewData) setChangeListeners(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (edit *editViewData) Get(tag string) interface{} {
|
func (edit *editViewData) Get(tag string) any {
|
||||||
return edit.get(edit.normalizeTag(tag))
|
return edit.get(edit.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (edit *editViewData) get(tag string) interface{} {
|
func (edit *editViewData) get(tag string) any {
|
||||||
return edit.viewData.get(tag)
|
return edit.viewData.get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,11 +139,11 @@ func (picker *filePickerData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *filePickerData) Set(tag string, value interface{}) bool {
|
func (picker *filePickerData) Set(tag string, value any) bool {
|
||||||
return picker.set(strings.ToLower(tag), value)
|
return picker.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *filePickerData) set(tag string, value interface{}) bool {
|
func (picker *filePickerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
picker.remove(tag)
|
picker.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -178,7 +178,7 @@ func (picker *filePickerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
picker.fileSelectedListeners = listeners
|
picker.fileSelectedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(FilePicker, []FileInfo), len(value))
|
listeners := make([]func(FilePicker, []FileInfo), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
|
@ -20,7 +20,7 @@ const (
|
||||||
LostFocusEvent = "lost-focus-event"
|
LostFocusEvent = "lost-focus-event"
|
||||||
)
|
)
|
||||||
|
|
||||||
func valueToFocusListeners(value interface{}) ([]func(View), bool) {
|
func valueToFocusListeners(value any) ([]func(View), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ func valueToFocusListeners(value interface{}) ([]func(View), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -96,7 +96,7 @@ var focusEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
LostFocusEvent: {jsEvent: "onblur", jsFunc: "blurEvent"},
|
LostFocusEvent: {jsEvent: "onblur", jsFunc: "blurEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setFocusListener(tag string, value interface{}) bool {
|
func (view *viewData) setFocusListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToFocusListeners(value)
|
listeners, ok := valueToFocusListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,5 +1,5 @@
|
||||||
module github.com/anoshenko/rui
|
module github.com/anoshenko/rui
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
require github.com/gorilla/websocket v1.5.0
|
require github.com/gorilla/websocket v1.5.0
|
||||||
|
|
|
@ -37,11 +37,11 @@ func (gridLayout *gridLayoutData) String() string {
|
||||||
return getViewString(gridLayout)
|
return getViewString(gridLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) setGridCellSize(tag string, value interface{}) bool {
|
func (style *viewStyle) setGridCellSize(tag string, value any) bool {
|
||||||
setValues := func(values []string) bool {
|
setValues := func(values []string) bool {
|
||||||
count := len(values)
|
count := len(values)
|
||||||
if count > 1 {
|
if count > 1 {
|
||||||
sizes := make([]interface{}, count)
|
sizes := make([]any, count)
|
||||||
for i, val := range values {
|
for i, val := range values {
|
||||||
val = strings.Trim(val, " \t\n\r")
|
val = strings.Trim(val, " \t\n\r")
|
||||||
if isConstantName(val) {
|
if isConstantName(val) {
|
||||||
|
@ -99,13 +99,13 @@ func (style *viewStyle) setGridCellSize(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
invalidPropertyValue(tag, value)
|
invalidPropertyValue(tag, value)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
sizes := make([]interface{}, count)
|
sizes := make([]any, count)
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
switch val := val.(type) {
|
switch val := val.(type) {
|
||||||
case SizeUnit:
|
case SizeUnit:
|
||||||
|
@ -195,11 +195,11 @@ func (gridLayout *gridLayoutData) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gridLayout *gridLayoutData) Get(tag string) interface{} {
|
func (gridLayout *gridLayoutData) Get(tag string) any {
|
||||||
return gridLayout.get(gridLayout.normalizeTag(tag))
|
return gridLayout.get(gridLayout.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gridLayout *gridLayoutData) get(tag string) interface{} {
|
func (gridLayout *gridLayoutData) get(tag string) any {
|
||||||
if tag == Gap {
|
if tag == Gap {
|
||||||
rowGap := GetGridRowGap(gridLayout, "")
|
rowGap := GetGridRowGap(gridLayout, "")
|
||||||
columnGap := GetGridColumnGap(gridLayout, "")
|
columnGap := GetGridColumnGap(gridLayout, "")
|
||||||
|
@ -239,11 +239,11 @@ func (gridLayout *gridLayoutData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gridLayout *gridLayoutData) Set(tag string, value interface{}) bool {
|
func (gridLayout *gridLayoutData) Set(tag string, value any) bool {
|
||||||
return gridLayout.set(gridLayout.normalizeTag(tag), value)
|
return gridLayout.set(gridLayout.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gridLayout *gridLayoutData) set(tag string, value interface{}) bool {
|
func (gridLayout *gridLayoutData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
gridLayout.remove(tag)
|
gridLayout.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -285,7 +285,7 @@ func gridCellSizes(properties Properties, tag string, session Session) []SizeUni
|
||||||
case SizeUnit:
|
case SizeUnit:
|
||||||
return []SizeUnit{value}
|
return []SizeUnit{value}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
result := make([]SizeUnit, len(value))
|
result := make([]SizeUnit, len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
result[i] = AutoSize()
|
result[i] = AutoSize()
|
||||||
|
|
10
imageView.go
10
imageView.go
|
@ -114,11 +114,11 @@ func (imageView *imageViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (imageView *imageViewData) Set(tag string, value interface{}) bool {
|
func (imageView *imageViewData) Set(tag string, value any) bool {
|
||||||
return imageView.set(imageView.normalizeTag(tag), value)
|
return imageView.set(imageView.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToImageListeners(value interface{}) ([]func(ImageView), bool) {
|
func valueToImageListeners(value any) ([]func(ImageView), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ func valueToImageListeners(value interface{}) ([]func(ImageView), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -189,7 +189,7 @@ func valueToImageListeners(value interface{}) ([]func(ImageView), bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (imageView *imageViewData) set(tag string, value interface{}) bool {
|
func (imageView *imageViewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
imageView.remove(tag)
|
imageView.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -248,7 +248,7 @@ func (imageView *imageViewData) set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (imageView *imageViewData) Get(tag string) interface{} {
|
func (imageView *imageViewData) Get(tag string) any {
|
||||||
return imageView.viewData.get(imageView.normalizeTag(tag))
|
return imageView.viewData.get(imageView.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ type KeyEvent struct {
|
||||||
MetaKey bool
|
MetaKey bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
|
func valueToKeyListeners(value any) ([]func(View, KeyEvent), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ func valueToKeyListeners(value interface{}) ([]func(View, KeyEvent), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -180,7 +180,7 @@ var keyEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
KeyUpEvent: {jsEvent: "onkeyup", jsFunc: "keyUpEvent"},
|
KeyUpEvent: {jsEvent: "onkeyup", jsFunc: "keyUpEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setKeyListener(tag string, value interface{}) bool {
|
func (view *viewData) setKeyListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToKeyListeners(value)
|
listeners, ok := valueToKeyListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (listLayout *listLayoutData) normalizeTag(tag string) string {
|
||||||
return tag
|
return tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listLayout *listLayoutData) Get(tag string) interface{} {
|
func (listLayout *listLayoutData) Get(tag string) any {
|
||||||
return listLayout.get(listLayout.normalizeTag(tag))
|
return listLayout.get(listLayout.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ func (listLayout *listLayoutData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listLayout *listLayoutData) Set(tag string, value interface{}) bool {
|
func (listLayout *listLayoutData) Set(tag string, value any) bool {
|
||||||
return listLayout.set(listLayout.normalizeTag(tag), value)
|
return listLayout.set(listLayout.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listLayout *listLayoutData) set(tag string, value interface{}) bool {
|
func (listLayout *listLayoutData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
listLayout.remove(tag)
|
listLayout.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
|
22
listView.go
22
listView.go
|
@ -193,11 +193,11 @@ func (listView *listViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) Set(tag string, value interface{}) bool {
|
func (listView *listViewData) Set(tag string, value any) bool {
|
||||||
return listView.set(listView.normalizeTag(tag), value)
|
return listView.set(listView.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) set(tag string, value interface{}) bool {
|
func (listView *listViewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
listView.remove(tag)
|
listView.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -288,7 +288,7 @@ func (listView *listViewData) set(tag string, value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
|
func (listView *listViewData) setItemCheckedEvent(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case func(ListView, []int):
|
case func(ListView, []int):
|
||||||
listView.checkedListeners = []func(ListView, []int){value}
|
listView.checkedListeners = []func(ListView, []int){value}
|
||||||
|
@ -316,7 +316,7 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
|
||||||
}
|
}
|
||||||
listView.checkedListeners = listeners
|
listView.checkedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(ListView, []int), len(value))
|
listeners := make([]func(ListView, []int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -343,11 +343,11 @@ func (listView *listViewData) setItemCheckedEvent(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) Get(tag string) interface{} {
|
func (listView *listViewData) Get(tag string) any {
|
||||||
return listView.get(listView.normalizeTag(tag))
|
return listView.get(listView.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) get(tag string) interface{} {
|
func (listView *listViewData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case ListItemClickedEvent:
|
case ListItemClickedEvent:
|
||||||
return listView.clickedListeners
|
return listView.clickedListeners
|
||||||
|
@ -376,7 +376,7 @@ func (listView *listViewData) get(tag string) interface{} {
|
||||||
return listView.viewData.get(tag)
|
return listView.viewData.get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) setItems(value interface{}) bool {
|
func (listView *listViewData) setItems(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case []string:
|
case []string:
|
||||||
listView.adapter = NewTextListAdapter(value, nil)
|
listView.adapter = NewTextListAdapter(value, nil)
|
||||||
|
@ -412,7 +412,7 @@ func (listView *listViewData) setItems(value interface{}) bool {
|
||||||
listView.adapter = NewTextListAdapter(items, nil)
|
listView.adapter = NewTextListAdapter(items, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
items := make([]View, len(value))
|
items := make([]View, len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
switch value := val.(type) {
|
switch value := val.(type) {
|
||||||
|
@ -460,7 +460,7 @@ func (listView *listViewData) setItems(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) valueToItemListeners(value interface{}) []func(ListView, int) {
|
func (listView *listViewData) valueToItemListeners(value any) []func(ListView, int) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return []func(ListView, int){}
|
return []func(ListView, int){}
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis
|
||||||
}
|
}
|
||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(ListView, int), len(value))
|
listeners := make([]func(ListView, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -515,7 +515,7 @@ func (listView *listViewData) valueToItemListeners(value interface{}) []func(Lis
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (listView *listViewData) setChecked(value interface{}) bool {
|
func (listView *listViewData) setChecked(value any) bool {
|
||||||
var checked []int
|
var checked []int
|
||||||
if value == nil {
|
if value == nil {
|
||||||
checked = []int{}
|
checked = []int{}
|
||||||
|
|
|
@ -185,11 +185,11 @@ func (player *mediaPlayerData) remove(tag string) {
|
||||||
player.propertyChanged(tag)
|
player.propertyChanged(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (player *mediaPlayerData) Set(tag string, value interface{}) bool {
|
func (player *mediaPlayerData) Set(tag string, value any) bool {
|
||||||
return player.set(strings.ToLower(tag), value)
|
return player.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (player *mediaPlayerData) set(tag string, value interface{}) bool {
|
func (player *mediaPlayerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
player.remove(tag)
|
player.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -257,7 +257,7 @@ func (player *mediaPlayerData) set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (player *mediaPlayerData) setSource(value interface{}) bool {
|
func (player *mediaPlayerData) setSource(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
src := MediaSource{Url: value, MimeType: ""}
|
src := MediaSource{Url: value, MimeType: ""}
|
||||||
|
@ -311,7 +311,7 @@ func (player *mediaPlayerData) setSource(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToPlayerListeners(value interface{}) ([]func(MediaPlayer), bool) {
|
func valueToPlayerListeners(value any) ([]func(MediaPlayer), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ func valueToPlayerListeners(value interface{}) ([]func(MediaPlayer), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -382,7 +382,7 @@ func valueToPlayerListeners(value interface{}) ([]func(MediaPlayer), bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64), bool) {
|
func valueToPlayerTimeListeners(value any) ([]func(MediaPlayer, float64), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -507,7 +507,7 @@ func valueToPlayerTimeListeners(value interface{}) ([]func(MediaPlayer, float64)
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, string), bool) {
|
func valueToPlayerErrorListeners(value any) ([]func(MediaPlayer, int, string), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ func valueToPlayerErrorListeners(value interface{}) ([]func(MediaPlayer, int, st
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
|
|
@ -144,7 +144,7 @@ type MouseEvent struct {
|
||||||
MetaKey bool
|
MetaKey bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
|
func valueToMouseListeners(value any) ([]func(View, MouseEvent), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ func valueToMouseListeners(value interface{}) ([]func(View, MouseEvent), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -280,7 +280,7 @@ var mouseEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
ContextMenuEvent: {jsEvent: "oncontextmenu", jsFunc: "contextMenuEvent"},
|
ContextMenuEvent: {jsEvent: "oncontextmenu", jsFunc: "contextMenuEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setMouseListener(tag string, value interface{}) bool {
|
func (view *viewData) setMouseListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToMouseListeners(value)
|
listeners, ok := valueToMouseListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
|
@ -87,11 +87,11 @@ func (picker *numberPickerData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *numberPickerData) Set(tag string, value interface{}) bool {
|
func (picker *numberPickerData) Set(tag string, value any) bool {
|
||||||
return picker.set(picker.normalizeTag(tag), value)
|
return picker.set(picker.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *numberPickerData) set(tag string, value interface{}) bool {
|
func (picker *numberPickerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
picker.remove(tag)
|
picker.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -126,7 +126,7 @@ func (picker *numberPickerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
picker.numberChangedListeners = listeners
|
picker.numberChangedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(NumberPicker, float64), len(value))
|
listeners := make([]func(NumberPicker, float64), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -208,11 +208,11 @@ func (picker *numberPickerData) propertyChanged(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *numberPickerData) Get(tag string) interface{} {
|
func (picker *numberPickerData) Get(tag string) any {
|
||||||
return picker.get(picker.normalizeTag(tag))
|
return picker.get(picker.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *numberPickerData) get(tag string) interface{} {
|
func (picker *numberPickerData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case NumberChangedEvent:
|
case NumberChangedEvent:
|
||||||
return picker.numberChangedListeners
|
return picker.numberChangedListeners
|
||||||
|
|
|
@ -18,7 +18,7 @@ type outlinePropertyData struct {
|
||||||
|
|
||||||
func NewOutlineProperty(params Params) OutlineProperty {
|
func NewOutlineProperty(params Params) OutlineProperty {
|
||||||
outline := new(outlinePropertyData)
|
outline := new(outlinePropertyData)
|
||||||
outline.properties = map[string]interface{}{}
|
outline.properties = map[string]any{}
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
outline.Set(tag, value)
|
outline.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func (outline *outlinePropertyData) Remove(tag string) {
|
||||||
delete(outline.properties, outline.normalizeTag(tag))
|
delete(outline.properties, outline.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (outline *outlinePropertyData) Set(tag string, value interface{}) bool {
|
func (outline *outlinePropertyData) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
outline.Remove(tag)
|
outline.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -85,7 +85,7 @@ func (outline *outlinePropertyData) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (outline *outlinePropertyData) Get(tag string) interface{} {
|
func (outline *outlinePropertyData) Get(tag string) any {
|
||||||
return outline.propertyList.Get(outline.normalizeTag(tag))
|
return outline.propertyList.Get(outline.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ func getOutline(properties Properties) OutlineProperty {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) setOutline(value interface{}) bool {
|
func (style *viewStyle) setOutline(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case OutlineProperty:
|
case OutlineProperty:
|
||||||
style.properties[Outline] = value
|
style.properties[Outline] = value
|
||||||
|
|
10
params.go
10
params.go
|
@ -3,25 +3,25 @@ package rui
|
||||||
import "sort"
|
import "sort"
|
||||||
|
|
||||||
// Params defines a type of a parameters list
|
// Params defines a type of a parameters list
|
||||||
type Params map[string]interface{}
|
type Params map[string]any
|
||||||
|
|
||||||
func (params Params) Get(tag string) interface{} {
|
func (params Params) Get(tag string) any {
|
||||||
return params.getRaw(tag)
|
return params.getRaw(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (params Params) getRaw(tag string) interface{} {
|
func (params Params) getRaw(tag string) any {
|
||||||
if value, ok := params[tag]; ok {
|
if value, ok := params[tag]; ok {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (params Params) Set(tag string, value interface{}) bool {
|
func (params Params) Set(tag string, value any) bool {
|
||||||
params.setRaw(tag, value)
|
params.setRaw(tag, value)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (params Params) setRaw(tag string, value interface{}) {
|
func (params Params) setRaw(tag string, value any) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
params[tag] = value
|
params[tag] = value
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -87,7 +87,7 @@ type PointerEvent struct {
|
||||||
IsPrimary bool
|
IsPrimary bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), bool) {
|
func valueToPointerListeners(value any) ([]func(View, PointerEvent), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ func valueToPointerListeners(value interface{}) ([]func(View, PointerEvent), boo
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -221,7 +221,7 @@ var pointerEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
PointerOver: {jsEvent: "onpointerover", jsFunc: "pointerOverEvent"},
|
PointerOver: {jsEvent: "onpointerover", jsFunc: "pointerOverEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setPointerListener(tag string, value interface{}) bool {
|
func (view *viewData) setPointerListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToPointerListeners(value)
|
listeners, ok := valueToPointerListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
2
popup.go
2
popup.go
|
@ -102,7 +102,7 @@ func (popup *popupData) init(view View, params Params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
for _, val := range value {
|
for _, val := range value {
|
||||||
if val != nil {
|
if val != nil {
|
||||||
switch fn := val.(type) {
|
switch fn := val.(type) {
|
||||||
|
|
|
@ -73,11 +73,11 @@ func (progress *progressBarData) propertyChanged(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (progress *progressBarData) Set(tag string, value interface{}) bool {
|
func (progress *progressBarData) Set(tag string, value any) bool {
|
||||||
return progress.set(progress.normalizeTag(tag), value)
|
return progress.set(progress.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (progress *progressBarData) set(tag string, value interface{}) bool {
|
func (progress *progressBarData) set(tag string, value any) bool {
|
||||||
if progress.viewData.set(tag, value) {
|
if progress.viewData.set(tag, value) {
|
||||||
progress.propertyChanged(tag)
|
progress.propertyChanged(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -85,7 +85,7 @@ func (progress *progressBarData) set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (progress *progressBarData) Get(tag string) interface{} {
|
func (progress *progressBarData) Get(tag string) any {
|
||||||
return progress.get(progress.normalizeTag(tag))
|
return progress.get(progress.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,13 @@ import (
|
||||||
type Properties interface {
|
type Properties interface {
|
||||||
// Get returns a value of the property with name defined by the argument.
|
// Get returns a value of the property with name defined by the argument.
|
||||||
// The type of return value depends on the property. If the property is not set then nil is returned.
|
// The type of return value depends on the property. If the property is not set then nil is returned.
|
||||||
Get(tag string) interface{}
|
Get(tag string) any
|
||||||
getRaw(tag string) interface{}
|
getRaw(tag string) any
|
||||||
// Set sets the value (second argument) of the property with name defined by the first argument.
|
// Set sets the value (second argument) of the property with name defined by the first argument.
|
||||||
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
||||||
// a description of the error is written to the log
|
// a description of the error is written to the log
|
||||||
Set(tag string, value interface{}) bool
|
Set(tag string, value any) bool
|
||||||
setRaw(tag string, value interface{})
|
setRaw(tag string, value any)
|
||||||
// Remove removes the property with name defined by the argument
|
// Remove removes the property with name defined by the argument
|
||||||
Remove(tag string)
|
Remove(tag string)
|
||||||
// Clear removes all properties
|
// Clear removes all properties
|
||||||
|
@ -25,25 +25,25 @@ type Properties interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
type propertyList struct {
|
type propertyList struct {
|
||||||
properties map[string]interface{}
|
properties map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) init() {
|
func (properties *propertyList) init() {
|
||||||
properties.properties = map[string]interface{}{}
|
properties.properties = map[string]any{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) Get(tag string) interface{} {
|
func (properties *propertyList) Get(tag string) any {
|
||||||
return properties.getRaw(strings.ToLower(tag))
|
return properties.getRaw(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) getRaw(tag string) interface{} {
|
func (properties *propertyList) getRaw(tag string) any {
|
||||||
if value, ok := properties.properties[tag]; ok {
|
if value, ok := properties.properties[tag]; ok {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setRaw(tag string, value interface{}) {
|
func (properties *propertyList) setRaw(tag string, value any) {
|
||||||
properties.properties[tag] = value
|
properties.properties[tag] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ func (properties *propertyList) remove(tag string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) Clear() {
|
func (properties *propertyList) Clear() {
|
||||||
properties.properties = map[string]interface{}{}
|
properties.properties = map[string]any{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) AllTags() []string {
|
func (properties *propertyList) AllTags() []string {
|
||||||
|
|
|
@ -32,49 +32,49 @@ func TestProperties(t *testing.T) {
|
||||||
t.Error(`list.Get("name") is not string`)
|
t.Error(`list.Get("name") is not string`)
|
||||||
}
|
}
|
||||||
|
|
||||||
sizeValues := []interface{}{"@small", "auto", "10px", Pt(20), AutoSize()}
|
sizeValues := []any{"@small", "auto", "10px", Pt(20), AutoSize()}
|
||||||
for _, value := range sizeValues {
|
for _, value := range sizeValues {
|
||||||
if !list.setSizeProperty("size", value) {
|
if !list.setSizeProperty("size", value) {
|
||||||
t.Errorf(`setSizeProperty("size", %v) fail`, value)
|
t.Errorf(`setSizeProperty("size", %v) fail`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failSizeValues := []interface{}{"@small,big", "abc", "10", Color(20), 100}
|
failSizeValues := []any{"@small,big", "abc", "10", Color(20), 100}
|
||||||
for _, value := range failSizeValues {
|
for _, value := range failSizeValues {
|
||||||
if list.setSizeProperty("size", value) {
|
if list.setSizeProperty("size", value) {
|
||||||
t.Errorf(`setSizeProperty("size", %v) success`, value)
|
t.Errorf(`setSizeProperty("size", %v) success`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
angleValues := []interface{}{"@angle", "2pi", "π", "3deg", "60°", Rad(1.5), Deg(45), 1, 1.5}
|
angleValues := []any{"@angle", "2pi", "π", "3deg", "60°", Rad(1.5), Deg(45), 1, 1.5}
|
||||||
for _, value := range angleValues {
|
for _, value := range angleValues {
|
||||||
if !list.setAngleProperty("angle", value) {
|
if !list.setAngleProperty("angle", value) {
|
||||||
t.Errorf(`setAngleProperty("angle", %v) fail`, value)
|
t.Errorf(`setAngleProperty("angle", %v) fail`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failAngleValues := []interface{}{"@angle,2", "pi32", "deg", "60°x", Color(0xFFFFFFFF)}
|
failAngleValues := []any{"@angle,2", "pi32", "deg", "60°x", Color(0xFFFFFFFF)}
|
||||||
for _, value := range failAngleValues {
|
for _, value := range failAngleValues {
|
||||||
if list.setAngleProperty("angle", value) {
|
if list.setAngleProperty("angle", value) {
|
||||||
t.Errorf(`setAngleProperty("angle", %v) success`, value)
|
t.Errorf(`setAngleProperty("angle", %v) success`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colorValues := []interface{}{"@color", "#FF234567", "#234567", "rgba(30%, 128, 0.5, .25)", "rgb(30%, 128, 0.5)", Color(0xFFFFFFFF), 0xFFFFFFFF, White}
|
colorValues := []any{"@color", "#FF234567", "#234567", "rgba(30%, 128, 0.5, .25)", "rgb(30%, 128, 0.5)", Color(0xFFFFFFFF), 0xFFFFFFFF, White}
|
||||||
for _, color := range colorValues {
|
for _, color := range colorValues {
|
||||||
if !list.setColorProperty("color", color) {
|
if !list.setColorProperty("color", color) {
|
||||||
t.Errorf(`list.setColorProperty("color", %v) fail`, color)
|
t.Errorf(`list.setColorProperty("color", %v) fail`, color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failColorValues := []interface{}{"@color|2", "#FF234567FF", "#TT234567", "rgba(500%, 128, 10.5, .25)", 10.6}
|
failColorValues := []any{"@color|2", "#FF234567FF", "#TT234567", "rgba(500%, 128, 10.5, .25)", 10.6}
|
||||||
for _, color := range failColorValues {
|
for _, color := range failColorValues {
|
||||||
if list.setColorProperty("color", color) {
|
if list.setColorProperty("color", color) {
|
||||||
t.Errorf(`list.setColorProperty("color", %v) success`, color)
|
t.Errorf(`list.setColorProperty("color", %v) success`, color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enumValues := []interface{}{"@enum", "inherit", "on", Inherit, 2}
|
enumValues := []any{"@enum", "inherit", "on", Inherit, 2}
|
||||||
inheritOffOn := inheritOffOnValues()
|
inheritOffOn := inheritOffOnValues()
|
||||||
for _, value := range enumValues {
|
for _, value := range enumValues {
|
||||||
if !list.setEnumProperty("enum", value, inheritOffOn) {
|
if !list.setEnumProperty("enum", value, inheritOffOn) {
|
||||||
|
@ -82,56 +82,56 @@ func TestProperties(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failEnumValues := []interface{}{"@enum 13", "inherit2", "onn", -1, 10}
|
failEnumValues := []any{"@enum 13", "inherit2", "onn", -1, 10}
|
||||||
for _, value := range failEnumValues {
|
for _, value := range failEnumValues {
|
||||||
if list.setEnumProperty("enum", value, inheritOffOn) {
|
if list.setEnumProperty("enum", value, inheritOffOn) {
|
||||||
t.Errorf(`list.setEnumProperty("enum", %v, %v) success`, value, inheritOffOn)
|
t.Errorf(`list.setEnumProperty("enum", %v, %v) success`, value, inheritOffOn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolValues := []interface{}{"@bool", "true", "yes ", "on", " 1", "false", "no", "off", "0", 0, 1, false, true}
|
boolValues := []any{"@bool", "true", "yes ", "on", " 1", "false", "no", "off", "0", 0, 1, false, true}
|
||||||
for _, value := range boolValues {
|
for _, value := range boolValues {
|
||||||
if !list.setBoolProperty("bool", value) {
|
if !list.setBoolProperty("bool", value) {
|
||||||
t.Errorf(`list.setBoolProperty("bool", %v) fail`, value)
|
t.Errorf(`list.setBoolProperty("bool", %v) fail`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failBoolValues := []interface{}{"@bool,2", "tr", "ys", "10", -1, 10, 0.8}
|
failBoolValues := []any{"@bool,2", "tr", "ys", "10", -1, 10, 0.8}
|
||||||
for _, value := range failBoolValues {
|
for _, value := range failBoolValues {
|
||||||
if list.setBoolProperty("bool", value) {
|
if list.setBoolProperty("bool", value) {
|
||||||
t.Errorf(`list.setBoolProperty("bool", %v) success`, value)
|
t.Errorf(`list.setBoolProperty("bool", %v) success`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intValues := []interface{}{"@int", " 100", "-10 ", 0, 250}
|
intValues := []any{"@int", " 100", "-10 ", 0, 250}
|
||||||
for _, value := range intValues {
|
for _, value := range intValues {
|
||||||
if !list.setIntProperty("int", value) {
|
if !list.setIntProperty("int", value) {
|
||||||
t.Errorf(`list.setIntProperty("int", %v) fail`, value)
|
t.Errorf(`list.setIntProperty("int", %v) fail`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failIntValues := []interface{}{"@int|10", "100i", "-1.0 ", 0.0}
|
failIntValues := []any{"@int|10", "100i", "-1.0 ", 0.0}
|
||||||
for _, value := range failIntValues {
|
for _, value := range failIntValues {
|
||||||
if list.setIntProperty("int", value) {
|
if list.setIntProperty("int", value) {
|
||||||
t.Errorf(`list.setIntProperty("int", %v) success`, value)
|
t.Errorf(`list.setIntProperty("int", %v) success`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
floatValues := []interface{}{"@float", " 100.25", "-1.5e12 ", uint(0), 250, float32(10.2), float64(0)}
|
floatValues := []any{"@float", " 100.25", "-1.5e12 ", uint(0), 250, float32(10.2), float64(0)}
|
||||||
for _, value := range floatValues {
|
for _, value := range floatValues {
|
||||||
if !list.setFloatProperty("float", value) {
|
if !list.setFloatProperty("float", value) {
|
||||||
t.Errorf(`list.setFloatProperty("float", %v) fail`, value)
|
t.Errorf(`list.setFloatProperty("float", %v) fail`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failFloatValues := []interface{}{"@float|2", " 100.25i", "-1.5ee12 ", "abc"}
|
failFloatValues := []any{"@float|2", " 100.25i", "-1.5ee12 ", "abc"}
|
||||||
for _, value := range failFloatValues {
|
for _, value := range failFloatValues {
|
||||||
if list.setFloatProperty("float", value) {
|
if list.setFloatProperty("float", value) {
|
||||||
t.Errorf(`list.setFloatProperty("float", %v) success`, value)
|
t.Errorf(`list.setFloatProperty("float", %v) success`, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boundsValues := []interface{}{"@bounds", "10px,20pt,@bottom,0", Em(2), []interface{}{"@top", Px(10), AutoSize(), "14pt"}}
|
boundsValues := []any{"@bounds", "10px,20pt,@bottom,0", Em(2), []any{"@top", Px(10), AutoSize(), "14pt"}}
|
||||||
for _, value := range boundsValues {
|
for _, value := range boundsValues {
|
||||||
if !list.setBoundsProperty("margin", value) {
|
if !list.setBoundsProperty("margin", value) {
|
||||||
t.Errorf(`list.setBoundsProperty("margin", %v) fail`, value)
|
t.Errorf(`list.setBoundsProperty("margin", %v) fail`, value)
|
||||||
|
|
|
@ -31,7 +31,7 @@ func imageProperty(properties Properties, tag string, session Session) (string,
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToSizeUnit(value interface{}, session Session) (SizeUnit, bool) {
|
func valueToSizeUnit(value any, session Session) (SizeUnit, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case SizeUnit:
|
case SizeUnit:
|
||||||
|
@ -67,7 +67,7 @@ func angleProperty(properties Properties, tag string, session Session) (AngleUni
|
||||||
return AngleUnit{Type: 0, Value: 0}, false
|
return AngleUnit{Type: 0, Value: 0}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToColor(value interface{}, session Session) (Color, bool) {
|
func valueToColor(value any, session Session) (Color, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case Color:
|
case Color:
|
||||||
|
@ -88,7 +88,7 @@ func colorProperty(properties Properties, tag string, session Session) (Color, b
|
||||||
return valueToColor(properties.getRaw(tag), session)
|
return valueToColor(properties.getRaw(tag), session)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToEnum(value interface{}, tag string, session Session, defaultValue int) (int, bool) {
|
func valueToEnum(value any, tag string, session Session, defaultValue int) (int, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
values := enumProperties[tag].values
|
values := enumProperties[tag].values
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -155,7 +155,7 @@ func enumProperty(properties Properties, tag string, session Session, defaultVal
|
||||||
return valueToEnum(properties.getRaw(tag), tag, session, defaultValue)
|
return valueToEnum(properties.getRaw(tag), tag, session, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToBool(value interface{}, session Session) (bool, bool) {
|
func valueToBool(value any, session Session) (bool, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
|
@ -184,7 +184,7 @@ func boolProperty(properties Properties, tag string, session Session) (bool, boo
|
||||||
return valueToBool(properties.getRaw(tag), session)
|
return valueToBool(properties.getRaw(tag), session)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToInt(value interface{}, session Session, defaultValue int) (int, bool) {
|
func valueToInt(value any, session Session, defaultValue int) (int, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
|
@ -214,7 +214,7 @@ func intProperty(properties Properties, tag string, session Session, defaultValu
|
||||||
return valueToInt(properties.getRaw(tag), session, defaultValue)
|
return valueToInt(properties.getRaw(tag), session, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToFloat(value interface{}, session Session, defaultValue float64) (float64, bool) {
|
func valueToFloat(value any, session Session, defaultValue float64) (float64, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case float64:
|
case float64:
|
||||||
|
@ -238,7 +238,7 @@ func floatProperty(properties Properties, tag string, session Session, defaultVa
|
||||||
return valueToFloat(properties.getRaw(tag), session, defaultValue)
|
return valueToFloat(properties.getRaw(tag), session, defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToRange(value interface{}, session Session) (Range, bool) {
|
func valueToRange(value any, session Session) (Range, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case Range:
|
case Range:
|
||||||
|
|
|
@ -431,11 +431,11 @@ var enumProperties = map[string]struct {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func notCompatibleType(tag string, value interface{}) {
|
func notCompatibleType(tag string, value any) {
|
||||||
ErrorLogF(`"%T" type not compatible with "%s" property`, value, tag)
|
ErrorLogF(`"%T" type not compatible with "%s" property`, value, tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func invalidPropertyValue(tag string, value interface{}) {
|
func invalidPropertyValue(tag string, value any) {
|
||||||
ErrorLogF(`Invalid value "%v" of "%s" property`, value, tag)
|
ErrorLogF(`Invalid value "%v" of "%s" property`, value, tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ func isConstantName(text string) bool {
|
||||||
return !strings.ContainsAny(text, ",;|\"'`+(){}[]<>/\\*&%! \t\n\r")
|
return !strings.ContainsAny(text, ",;|\"'`+(){}[]<>/\\*&%! \t\n\r")
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInt(value interface{}) (int, bool) {
|
func isInt(value any) (int, bool) {
|
||||||
var n int
|
var n int
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case int:
|
case int:
|
||||||
|
@ -497,7 +497,7 @@ func isInt(value interface{}) (int, bool) {
|
||||||
return n, true
|
return n, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setSimpleProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setSimpleProperty(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(properties.properties, tag)
|
delete(properties.properties, tag)
|
||||||
return true
|
return true
|
||||||
|
@ -515,7 +515,7 @@ func (properties *propertyList) setSimpleProperty(tag string, value interface{})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setSizeProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setSizeProperty(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
var size SizeUnit
|
var size SizeUnit
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -556,7 +556,7 @@ func (properties *propertyList) setSizeProperty(tag string, value interface{}) b
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setAngleProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setAngleProperty(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
var angle AngleUnit
|
var angle AngleUnit
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -589,7 +589,7 @@ func (properties *propertyList) setAngleProperty(tag string, value interface{})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setColorProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setColorProperty(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
var result Color
|
var result Color
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -621,7 +621,7 @@ func (properties *propertyList) setColorProperty(tag string, value interface{})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setEnumProperty(tag string, value interface{}, values []string) bool {
|
func (properties *propertyList) setEnumProperty(tag string, value any, values []string) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
var n int
|
var n int
|
||||||
if text, ok := value.(string); ok {
|
if text, ok := value.(string); ok {
|
||||||
|
@ -646,7 +646,7 @@ func (properties *propertyList) setEnumProperty(tag string, value interface{}, v
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setBoolProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setBoolProperty(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
if text, ok := value.(string); ok {
|
if text, ok := value.(string); ok {
|
||||||
switch strings.ToLower(strings.Trim(text, " \t")) {
|
switch strings.ToLower(strings.Trim(text, " \t")) {
|
||||||
|
@ -683,7 +683,7 @@ func (properties *propertyList) setBoolProperty(tag string, value interface{}) b
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setIntProperty(tag string, value interface{}) bool {
|
func (properties *propertyList) setIntProperty(tag string, value any) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
if text, ok := value.(string); ok {
|
if text, ok := value.(string); ok {
|
||||||
n, err := strconv.Atoi(strings.Trim(text, " \t"))
|
n, err := strconv.Atoi(strings.Trim(text, " \t"))
|
||||||
|
@ -704,7 +704,7 @@ func (properties *propertyList) setIntProperty(tag string, value interface{}) bo
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setFloatProperty(tag string, value interface{}, min, max float64) bool {
|
func (properties *propertyList) setFloatProperty(tag string, value any, min, max float64) bool {
|
||||||
if !properties.setSimpleProperty(tag, value) {
|
if !properties.setSimpleProperty(tag, value) {
|
||||||
f := float64(0)
|
f := float64(0)
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
@ -742,11 +742,11 @@ func (properties *propertyList) setFloatProperty(tag string, value interface{},
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) Set(tag string, value interface{}) bool {
|
func (properties *propertyList) Set(tag string, value any) bool {
|
||||||
return properties.set(strings.ToLower(tag), value)
|
return properties.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) set(tag string, value interface{}) bool {
|
func (properties *propertyList) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(properties.properties, tag)
|
delete(properties.properties, tag)
|
||||||
return true
|
return true
|
||||||
|
|
14
radius.go
14
radius.go
|
@ -109,7 +109,7 @@ type radiusPropertyData struct {
|
||||||
// NewRadiusProperty creates the new RadiusProperty
|
// NewRadiusProperty creates the new RadiusProperty
|
||||||
func NewRadiusProperty(params Params) RadiusProperty {
|
func NewRadiusProperty(params Params) RadiusProperty {
|
||||||
result := new(radiusPropertyData)
|
result := new(radiusPropertyData)
|
||||||
result.properties = map[string]interface{}{}
|
result.properties = map[string]any{}
|
||||||
if params != nil {
|
if params != nil {
|
||||||
for _, tag := range []string{X, Y, TopLeft, TopRight, BottomLeft, BottomRight, TopLeftX, TopLeftY,
|
for _, tag := range []string{X, Y, TopLeft, TopRight, BottomLeft, BottomRight, TopLeftX, TopLeftY,
|
||||||
TopRightX, TopRightY, BottomLeftX, BottomLeftY, BottomRightX, BottomRightY} {
|
TopRightX, TopRightY, BottomLeftX, BottomLeftY, BottomRightX, BottomRightY} {
|
||||||
|
@ -172,7 +172,7 @@ func (radius *radiusPropertyData) deleteUnusedTags() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
equalValue := func(value1, value2 interface{}) bool {
|
equalValue := func(value1, value2 any) bool {
|
||||||
switch value1 := value1.(type) {
|
switch value1 := value1.(type) {
|
||||||
case string:
|
case string:
|
||||||
switch value2 := value2.(type) {
|
switch value2 := value2.(type) {
|
||||||
|
@ -243,7 +243,7 @@ func (radius *radiusPropertyData) Remove(tag string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (radius *radiusPropertyData) Set(tag string, value interface{}) bool {
|
func (radius *radiusPropertyData) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
radius.Remove(tag)
|
radius.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -318,7 +318,7 @@ func (radius *radiusPropertyData) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (radius *radiusPropertyData) Get(tag string) interface{} {
|
func (radius *radiusPropertyData) Get(tag string) any {
|
||||||
tag = radius.normalizeTag(tag)
|
tag = radius.normalizeTag(tag)
|
||||||
if value, ok := radius.properties[tag]; ok {
|
if value, ok := radius.properties[tag]; ok {
|
||||||
return value
|
return value
|
||||||
|
@ -570,7 +570,7 @@ func getRadiusProperty(style Properties) RadiusProperty {
|
||||||
return NewRadiusProperty(nil)
|
return NewRadiusProperty(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setRadius(value interface{}) bool {
|
func (properties *propertyList) setRadius(value any) bool {
|
||||||
|
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(properties.properties, Radius)
|
delete(properties.properties, Radius)
|
||||||
|
@ -664,7 +664,7 @@ func (properties *propertyList) removeRadiusElement(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setRadiusElement(tag string, value interface{}) bool {
|
func (properties *propertyList) setRadiusElement(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
properties.removeRadiusElement(tag)
|
properties.removeRadiusElement(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -679,7 +679,7 @@ func (properties *propertyList) setRadiusElement(tag string, value interface{})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRadiusElement(style Properties, tag string) interface{} {
|
func getRadiusElement(style Properties, tag string) any {
|
||||||
value := style.Get(Radius)
|
value := style.Get(Radius)
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
|
|
@ -108,11 +108,11 @@ func (resizable *resizableData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resizable *resizableData) Set(tag string, value interface{}) bool {
|
func (resizable *resizableData) Set(tag string, value any) bool {
|
||||||
return resizable.set(strings.ToLower(tag), value)
|
return resizable.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resizable *resizableData) set(tag string, value interface{}) bool {
|
func (resizable *resizableData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
resizable.remove(tag)
|
resizable.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -183,7 +183,7 @@ func (resizable *resizableData) set(tag string, value interface{}) bool {
|
||||||
return resizable.viewData.set(tag, value)
|
return resizable.viewData.set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resizable *resizableData) Get(tag string) interface{} {
|
func (resizable *resizableData) Get(tag string) any {
|
||||||
return resizable.get(strings.ToLower(tag))
|
return resizable.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ func (resizable *resizableData) getSide() int {
|
||||||
return AllSides
|
return AllSides
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resizable *resizableData) setSide(value interface{}) bool {
|
func (resizable *resizableData) setSide(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
if n, err := strconv.Atoi(value); err == nil {
|
if n, err := strconv.Atoi(value); err == nil {
|
||||||
|
|
|
@ -21,7 +21,7 @@ func (view *viewData) onResize(self View, x, y, width, height float64) {
|
||||||
func (view *viewData) onItemResize(self View, index string, x, y, width, height float64) {
|
func (view *viewData) onItemResize(self View, index string, x, y, width, height float64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setFrameListener(tag string, value interface{}) bool {
|
func (view *viewData) setFrameListener(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(view.properties, tag)
|
delete(view.properties, tag)
|
||||||
return true
|
return true
|
||||||
|
@ -117,7 +117,7 @@ func (view *viewData) setFrameListener(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
view.properties[tag] = listeners
|
view.properties[tag] = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
delete(view.properties, tag)
|
delete(view.properties, tag)
|
||||||
|
|
|
@ -13,7 +13,7 @@ type ruiWriter interface {
|
||||||
endObject()
|
endObject()
|
||||||
startArrayProperty(tag string)
|
startArrayProperty(tag string)
|
||||||
endObArray()
|
endObArray()
|
||||||
writeProperty(tag string, value interface{})
|
writeProperty(tag string, value any)
|
||||||
finish() string
|
finish() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ func (writer *ruiWriterData) endObArray() {
|
||||||
writer.buffer.WriteString("],\n")
|
writer.buffer.WriteString("],\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (writer *ruiWriterData) writeValue(value interface{}) {
|
func (writer *ruiWriterData) writeValue(value any) {
|
||||||
|
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
|
@ -175,7 +175,7 @@ func (writer *ruiWriterData) writeValue(value interface{}) {
|
||||||
writer.buffer.WriteRune(']')
|
writer.buffer.WriteRune(']')
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
switch len(value) {
|
switch len(value) {
|
||||||
case 0:
|
case 0:
|
||||||
writer.buffer.WriteString("[]\n")
|
writer.buffer.WriteString("[]\n")
|
||||||
|
@ -205,7 +205,7 @@ func (writer *ruiWriterData) writeValue(value interface{}) {
|
||||||
writer.buffer.WriteString(",\n")
|
writer.buffer.WriteString(",\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (writer *ruiWriterData) writeProperty(tag string, value interface{}) {
|
func (writer *ruiWriterData) writeProperty(tag string, value any) {
|
||||||
writer.writeIndent()
|
writer.writeIndent()
|
||||||
writer.writeString(tag)
|
writer.writeString(tag)
|
||||||
writer.buffer.WriteString(" = ")
|
writer.buffer.WriteString(" = ")
|
||||||
|
|
12
session.go
12
session.go
|
@ -59,11 +59,11 @@ type Session interface {
|
||||||
RootView() View
|
RootView() View
|
||||||
// Get returns a value of the view (with id defined by the first argument) property with name defined by the second argument.
|
// Get returns a value of the view (with id defined by the first argument) property with name defined by the second argument.
|
||||||
// The type of return value depends on the property. If the property is not set then nil is returned.
|
// The type of return value depends on the property. If the property is not set then nil is returned.
|
||||||
Get(viewID, tag string) interface{}
|
Get(viewID, tag string) any
|
||||||
// Set sets the value (third argument) of the property (second argument) of the view with id defined by the first argument.
|
// Set sets the value (third argument) of the property (second argument) of the view with id defined by the first argument.
|
||||||
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
||||||
// a description of the error is written to the log
|
// a description of the error is written to the log
|
||||||
Set(viewID, tag string, value interface{}) bool
|
Set(viewID, tag string, value any) bool
|
||||||
|
|
||||||
// DownloadFile downloads (saves) on the client side the file located at the specified path on the server.
|
// DownloadFile downloads (saves) on the client side the file located at the specified path on the server.
|
||||||
DownloadFile(path string)
|
DownloadFile(path string)
|
||||||
|
@ -80,7 +80,7 @@ type Session interface {
|
||||||
|
|
||||||
viewByHTMLID(id string) View
|
viewByHTMLID(id string) View
|
||||||
nextViewID() string
|
nextViewID() string
|
||||||
styleProperty(styleTag, property string) interface{}
|
styleProperty(styleTag, property string) any
|
||||||
|
|
||||||
setBrige(events chan DataObject, brige WebBrige)
|
setBrige(events chan DataObject, brige WebBrige)
|
||||||
writeInitScript(writer *strings.Builder)
|
writeInitScript(writer *strings.Builder)
|
||||||
|
@ -219,7 +219,7 @@ func (session *sessionData) close() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *sessionData) styleProperty(styleTag, propertyTag string) interface{} {
|
func (session *sessionData) styleProperty(styleTag, propertyTag string) any {
|
||||||
if style := session.getCurrentTheme().style(styleTag); style != nil {
|
if style := session.getCurrentTheme().style(styleTag); style != nil {
|
||||||
return style.getRaw(propertyTag)
|
return style.getRaw(propertyTag)
|
||||||
}
|
}
|
||||||
|
@ -309,14 +309,14 @@ func (session *sessionData) setIgnoreViewUpdates(ignore bool) {
|
||||||
session.ignoreUpdates = ignore
|
session.ignoreUpdates = ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *sessionData) Get(viewID, tag string) interface{} {
|
func (session *sessionData) Get(viewID, tag string) any {
|
||||||
if view := ViewByID(session.RootView(), viewID); view != nil {
|
if view := ViewByID(session.RootView(), viewID); view != nil {
|
||||||
return view.Get(tag)
|
return view.Get(tag)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *sessionData) Set(viewID, tag string, value interface{}) bool {
|
func (session *sessionData) Set(viewID, tag string, value any) bool {
|
||||||
if view := ViewByID(session.RootView(), viewID); view != nil {
|
if view := ViewByID(session.RootView(), viewID); view != nil {
|
||||||
return view.Set(tag, value)
|
return view.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ func (shadow *viewShadowData) Remove(tag string) {
|
||||||
delete(shadow.properties, strings.ToLower(tag))
|
delete(shadow.properties, strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (shadow *viewShadowData) Set(tag string, value interface{}) bool {
|
func (shadow *viewShadowData) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
shadow.Remove(tag)
|
shadow.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -127,7 +127,7 @@ func (shadow *viewShadowData) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (shadow *viewShadowData) Get(tag string) interface{} {
|
func (shadow *viewShadowData) Get(tag string) any {
|
||||||
return shadow.propertyList.Get(strings.ToLower(tag))
|
return shadow.propertyList.Get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ func (shadow *viewShadowData) writeString(buffer *strings.Builder, indent string
|
||||||
buffer.WriteString(" }")
|
buffer.WriteString(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (properties *propertyList) setShadow(tag string, value interface{}) bool {
|
func (properties *propertyList) setShadow(tag string, value any) bool {
|
||||||
|
|
||||||
if value == nil {
|
if value == nil {
|
||||||
delete(properties.properties, tag)
|
delete(properties.properties, tag)
|
||||||
|
|
|
@ -97,11 +97,11 @@ func (layout *stackLayoutData) popFinished(view View, tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (layout *stackLayoutData) Set(tag string, value interface{}) bool {
|
func (layout *stackLayoutData) Set(tag string, value any) bool {
|
||||||
return layout.set(strings.ToLower(tag), value)
|
return layout.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (layout *stackLayoutData) set(tag string, value interface{}) bool {
|
func (layout *stackLayoutData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
layout.remove(tag)
|
layout.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -179,11 +179,11 @@ func (layout *stackLayoutData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (layout *stackLayoutData) Get(tag string) interface{} {
|
func (layout *stackLayoutData) Get(tag string) any {
|
||||||
return layout.get(strings.ToLower(tag))
|
return layout.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (layout *stackLayoutData) get(tag string) interface{} {
|
func (layout *stackLayoutData) get(tag string) any {
|
||||||
if tag == Current {
|
if tag == Current {
|
||||||
return layout.peek
|
return layout.peek
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ type TableAdapter interface {
|
||||||
// * rui.View
|
// * rui.View
|
||||||
// * fmt.Stringer
|
// * fmt.Stringer
|
||||||
// * rui.VerticalTableJoin, rui.HorizontalTableJoin
|
// * rui.VerticalTableJoin, rui.HorizontalTableJoin
|
||||||
Cell(row, column int) interface{}
|
Cell(row, column int) any
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableColumnStyle describes the style of TableView columns.
|
// TableColumnStyle describes the style of TableView columns.
|
||||||
|
@ -59,15 +59,15 @@ type TableAllowRowSelection interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimpleTableAdapter is implementation of TableAdapter where the content
|
// SimpleTableAdapter is implementation of TableAdapter where the content
|
||||||
// defines as [][]interface{}.
|
// defines as [][]any.
|
||||||
// When you assign [][]interface{} value to the "content" property, it is converted to SimpleTableAdapter
|
// When you assign [][]any value to the "content" property, it is converted to SimpleTableAdapter
|
||||||
type SimpleTableAdapter interface {
|
type SimpleTableAdapter interface {
|
||||||
TableAdapter
|
TableAdapter
|
||||||
TableCellStyle
|
TableCellStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
type simpleTableAdapter struct {
|
type simpleTableAdapter struct {
|
||||||
content [][]interface{}
|
content [][]any
|
||||||
columnCount int
|
columnCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ type HorizontalTableJoin struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSimpleTableAdapter creates the new SimpleTableAdapter
|
// NewSimpleTableAdapter creates the new SimpleTableAdapter
|
||||||
func NewSimpleTableAdapter(content [][]interface{}) SimpleTableAdapter {
|
func NewSimpleTableAdapter(content [][]any) SimpleTableAdapter {
|
||||||
if content == nil {
|
if content == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ func (adapter *simpleTableAdapter) ColumnCount() int {
|
||||||
return adapter.columnCount
|
return adapter.columnCount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (adapter *simpleTableAdapter) Cell(row, column int) interface{} {
|
func (adapter *simpleTableAdapter) Cell(row, column int) any {
|
||||||
if adapter.content != nil && row >= 0 && row < len(adapter.content) &&
|
if adapter.content != nil && row >= 0 && row < len(adapter.content) &&
|
||||||
adapter.content[row] != nil && column >= 0 && column < len(adapter.content[row]) {
|
adapter.content[row] != nil && column >= 0 && column < len(adapter.content[row]) {
|
||||||
return adapter.content[row][column]
|
return adapter.content[row][column]
|
||||||
|
@ -220,7 +220,7 @@ func (adapter *textTableAdapter) ColumnCount() int {
|
||||||
return adapter.columnCount
|
return adapter.columnCount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (adapter *textTableAdapter) Cell(row, column int) interface{} {
|
func (adapter *textTableAdapter) Cell(row, column int) any {
|
||||||
if adapter.content != nil && row >= 0 && row < len(adapter.content) &&
|
if adapter.content != nil && row >= 0 && row < len(adapter.content) &&
|
||||||
adapter.content[row] != nil && column >= 0 && column < len(adapter.content[row]) {
|
adapter.content[row] != nil && column >= 0 && column < len(adapter.content[row]) {
|
||||||
return adapter.content[row][column]
|
return adapter.content[row][column]
|
||||||
|
@ -242,7 +242,7 @@ func (style *simpleTableRowStyle) RowStyle(row int) Params {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) setRowStyle(value interface{}) bool {
|
func (table *tableViewData) setRowStyle(value any) bool {
|
||||||
newSimpleTableRowStyle := func(params []Params) TableRowStyle {
|
newSimpleTableRowStyle := func(params []Params) TableRowStyle {
|
||||||
if len(params) == 0 {
|
if len(params) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -319,7 +319,7 @@ func (style *simpleTableColumnStyle) ColumnStyle(row int) Params {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) setColumnStyle(value interface{}) bool {
|
func (table *tableViewData) setColumnStyle(value any) bool {
|
||||||
newSimpleTableColumnStyle := func(params []Params) TableColumnStyle {
|
newSimpleTableColumnStyle := func(params []Params) TableColumnStyle {
|
||||||
if len(params) == 0 {
|
if len(params) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|
16
tableView.go
16
tableView.go
|
@ -293,7 +293,7 @@ func (table *tableViewData) Focusable() bool {
|
||||||
return GetTableSelectionMode(table, "") != NoneSelection
|
return GetTableSelectionMode(table, "") != NoneSelection
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) Get(tag string) interface{} {
|
func (table *tableViewData) Get(tag string) any {
|
||||||
return table.get(table.normalizeTag(tag))
|
return table.get(table.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,11 +340,11 @@ func (table *tableViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) Set(tag string, value interface{}) bool {
|
func (table *tableViewData) Set(tag string, value any) bool {
|
||||||
return table.set(table.normalizeTag(tag), value)
|
return table.set(table.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) set(tag string, value interface{}) bool {
|
func (table *tableViewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
table.remove(tag)
|
table.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -356,7 +356,7 @@ func (table *tableViewData) set(tag string, value interface{}) bool {
|
||||||
case TableAdapter:
|
case TableAdapter:
|
||||||
table.properties[Content] = value
|
table.properties[Content] = value
|
||||||
|
|
||||||
case [][]interface{}:
|
case [][]any:
|
||||||
table.properties[Content] = NewSimpleTableAdapter(val)
|
table.properties[Content] = NewSimpleTableAdapter(val)
|
||||||
|
|
||||||
case [][]string:
|
case [][]string:
|
||||||
|
@ -676,7 +676,7 @@ func (table *tableViewData) currentInactiveStyle() string {
|
||||||
return "ruiCurrentTableCell"
|
return "ruiCurrentTableCell"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) valueToCellListeners(value interface{}) []func(TableView, int, int) {
|
func (table *tableViewData) valueToCellListeners(value any) []func(TableView, int, int) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return []func(TableView, int, int){}
|
return []func(TableView, int, int){}
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table
|
||||||
}
|
}
|
||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(TableView, int, int), len(value))
|
listeners := make([]func(TableView, int, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -731,7 +731,7 @@ func (table *tableViewData) valueToCellListeners(value interface{}) []func(Table
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableView, int) {
|
func (table *tableViewData) valueToRowListeners(value any) []func(TableView, int) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return []func(TableView, int){}
|
return []func(TableView, int){}
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ func (table *tableViewData) valueToRowListeners(value interface{}) []func(TableV
|
||||||
}
|
}
|
||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(TableView, int), len(value))
|
listeners := make([]func(TableView, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
|
@ -2,11 +2,11 @@ package rui
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
func (cell *tableCellView) Set(tag string, value interface{}) bool {
|
func (cell *tableCellView) Set(tag string, value any) bool {
|
||||||
return cell.set(strings.ToLower(tag), value)
|
return cell.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cell *tableCellView) set(tag string, value interface{}) bool {
|
func (cell *tableCellView) set(tag string, value any) bool {
|
||||||
switch tag {
|
switch tag {
|
||||||
case VerticalAlign:
|
case VerticalAlign:
|
||||||
tag = TableVerticalAlign
|
tag = TableVerticalAlign
|
||||||
|
|
|
@ -108,11 +108,11 @@ func (tabsLayout *tabsLayoutData) currentItem(defaultValue int) int {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) Get(tag string) interface{} {
|
func (tabsLayout *tabsLayoutData) Get(tag string) any {
|
||||||
return tabsLayout.get(strings.ToLower(tag))
|
return tabsLayout.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) get(tag string) interface{} {
|
func (tabsLayout *tabsLayoutData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case CurrentTabChangedEvent:
|
case CurrentTabChangedEvent:
|
||||||
return tabsLayout.tabListener
|
return tabsLayout.tabListener
|
||||||
|
@ -190,11 +190,11 @@ func (tabsLayout *tabsLayoutData) remove(tag string) {
|
||||||
tabsLayout.propertyChangedEvent(tag)
|
tabsLayout.propertyChangedEvent(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) Set(tag string, value interface{}) bool {
|
func (tabsLayout *tabsLayoutData) Set(tag string, value any) bool {
|
||||||
return tabsLayout.set(strings.ToLower(tag), value)
|
return tabsLayout.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) set(tag string, value interface{}) bool {
|
func (tabsLayout *tabsLayoutData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
tabsLayout.remove(tag)
|
tabsLayout.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -286,7 +286,7 @@ func (tabsLayout *tabsLayoutData) set(tag string, value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(TabsLayout, int, int) {
|
func (tabsLayout *tabsLayoutData) valueToTabListeners(value any) []func(TabsLayout, int, int) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return []func(TabsLayout, int, int){}
|
return []func(TabsLayout, int, int){}
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
|
||||||
}
|
}
|
||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(TabsLayout, int, int), len(value))
|
listeners := make([]func(TabsLayout, int, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -433,7 +433,7 @@ func (tabsLayout *tabsLayoutData) valueToTabListeners(value interface{}) []func(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []func(TabsLayout, int) {
|
func (tabsLayout *tabsLayoutData) valueToCloseListeners(value any) []func(TabsLayout, int) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return []func(TabsLayout, int){}
|
return []func(TabsLayout, int){}
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ func (tabsLayout *tabsLayoutData) valueToCloseListeners(value interface{}) []fun
|
||||||
}
|
}
|
||||||
return listeners
|
return listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(TabsLayout, int), len(value))
|
listeners := make([]func(TabsLayout, int), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (textView *textViewData) String() string {
|
||||||
return getViewString(textView)
|
return getViewString(textView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (textView *textViewData) Get(tag string) interface{} {
|
func (textView *textViewData) Get(tag string) any {
|
||||||
return textView.get(strings.ToLower(tag))
|
return textView.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ func (textView *textViewData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (textView *textViewData) Set(tag string, value interface{}) bool {
|
func (textView *textViewData) Set(tag string, value any) bool {
|
||||||
return textView.set(strings.ToLower(tag), value)
|
return textView.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (textView *textViewData) set(tag string, value interface{}) bool {
|
func (textView *textViewData) set(tag string, value any) bool {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Text:
|
case Text:
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
|
|
|
@ -114,11 +114,11 @@ func (picker *timePickerData) remove(tag string) {
|
||||||
picker.propertyChangedEvent(tag)
|
picker.propertyChangedEvent(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *timePickerData) Set(tag string, value interface{}) bool {
|
func (picker *timePickerData) Set(tag string, value any) bool {
|
||||||
return picker.set(picker.normalizeTag(tag), value)
|
return picker.set(picker.normalizeTag(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *timePickerData) set(tag string, value interface{}) bool {
|
func (picker *timePickerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
picker.remove(tag)
|
picker.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -250,7 +250,7 @@ func (picker *timePickerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
picker.timeChangedListeners = listeners
|
picker.timeChangedListeners = listeners
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
listeners := make([]func(TimePicker, time.Time), len(value))
|
listeners := make([]func(TimePicker, time.Time), len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
@ -283,11 +283,11 @@ func (picker *timePickerData) set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *timePickerData) Get(tag string) interface{} {
|
func (picker *timePickerData) Get(tag string) any {
|
||||||
return picker.get(picker.normalizeTag(tag))
|
return picker.get(picker.normalizeTag(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (picker *timePickerData) get(tag string) interface{} {
|
func (picker *timePickerData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case TimeChangedEvent:
|
case TimeChangedEvent:
|
||||||
return picker.timeChangedListeners
|
return picker.timeChangedListeners
|
||||||
|
@ -362,7 +362,7 @@ func (picker *timePickerData) handleCommand(self View, command string, data Data
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTimeProperty(view View, mainTag, shortTag string) (time.Time, bool) {
|
func getTimeProperty(view View, mainTag, shortTag string) (time.Time, bool) {
|
||||||
valueToTime := func(value interface{}) (time.Time, bool) {
|
valueToTime := func(value any) (time.Time, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case time.Time:
|
case time.Time:
|
||||||
|
|
|
@ -90,7 +90,7 @@ type TouchEvent struct {
|
||||||
MetaKey bool
|
MetaKey bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
|
func valueToTouchListeners(value any) ([]func(View, TouchEvent), bool) {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return nil, true
|
return nil, true
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ func valueToTouchListeners(value interface{}) ([]func(View, TouchEvent), bool) {
|
||||||
}
|
}
|
||||||
return listeners, true
|
return listeners, true
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
count := len(value)
|
count := len(value)
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -222,7 +222,7 @@ var touchEvents = map[string]struct{ jsEvent, jsFunc string }{
|
||||||
TouchCancel: {jsEvent: "ontouchcancel", jsFunc: "touchCancelEvent"},
|
TouchCancel: {jsEvent: "ontouchcancel", jsFunc: "touchCancelEvent"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) setTouchListener(tag string, value interface{}) bool {
|
func (view *viewData) setTouchListener(tag string, value any) bool {
|
||||||
listeners, ok := valueToTouchListeners(value)
|
listeners, ok := valueToTouchListeners(value)
|
||||||
if !ok {
|
if !ok {
|
||||||
notCompatibleType(tag, value)
|
notCompatibleType(tag, value)
|
||||||
|
|
|
@ -77,11 +77,11 @@ func (player *videoPlayerData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (player *videoPlayerData) Set(tag string, value interface{}) bool {
|
func (player *videoPlayerData) Set(tag string, value any) bool {
|
||||||
return player.set(strings.ToLower(tag), value)
|
return player.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (player *videoPlayerData) set(tag string, value interface{}) bool {
|
func (player *videoPlayerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
player.remove(tag)
|
player.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
|
10
view.go
10
view.go
|
@ -54,7 +54,7 @@ type View interface {
|
||||||
// SetAnimated sets the value (second argument) of the property with name defined by the first argument.
|
// SetAnimated sets the value (second argument) of the property with name defined by the first argument.
|
||||||
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
// Return "true" if the value has been set, in the opposite case "false" are returned and
|
||||||
// a description of the error is written to the log
|
// a description of the error is written to the log
|
||||||
SetAnimated(tag string, value interface{}, animation Animation) bool
|
SetAnimated(tag string, value any, animation Animation) bool
|
||||||
// SetChangeListener set the function to track the change of the View property
|
// SetChangeListener set the function to track the change of the View property
|
||||||
SetChangeListener(tag string, listener func(View, string))
|
SetChangeListener(tag string, listener func(View, string))
|
||||||
// HasFocus returns 'true' if the view has focus
|
// HasFocus returns 'true' if the view has focus
|
||||||
|
@ -290,11 +290,11 @@ func (view *viewData) propertyChangedEvent(tag string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) Set(tag string, value interface{}) bool {
|
func (view *viewData) Set(tag string, value any) bool {
|
||||||
return view.set(strings.ToLower(tag), value)
|
return view.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) set(tag string, value interface{}) bool {
|
func (view *viewData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
view.remove(tag)
|
view.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -665,11 +665,11 @@ func viewPropertyChanged(view *viewData, tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) Get(tag string) interface{} {
|
func (view *viewData) Get(tag string) any {
|
||||||
return view.get(strings.ToLower(tag))
|
return view.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *viewData) get(tag string) interface{} {
|
func (view *viewData) get(tag string) any {
|
||||||
if tag == ID {
|
if tag == ID {
|
||||||
if view.viewID != "" {
|
if view.viewID != "" {
|
||||||
return view.viewID
|
return view.viewID
|
||||||
|
|
38
viewClip.go
38
viewClip.go
|
@ -27,7 +27,7 @@ type circleClip struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type polygonClip struct {
|
type polygonClip struct {
|
||||||
points []interface{}
|
points []any
|
||||||
}
|
}
|
||||||
|
|
||||||
// InsetClip creates a rectangle View clipping area.
|
// InsetClip creates a rectangle View clipping area.
|
||||||
|
@ -73,9 +73,9 @@ func EllipseClip(x, y, rx, ry SizeUnit) ClipShape {
|
||||||
// PolygonClip creates a polygon View clipping area.
|
// PolygonClip creates a polygon View clipping area.
|
||||||
// The elements of the function argument can be or text constants,
|
// The elements of the function argument can be or text constants,
|
||||||
// or the text representation of SizeUnit, or elements of SizeUnit type.
|
// or the text representation of SizeUnit, or elements of SizeUnit type.
|
||||||
func PolygonClip(points []interface{}) ClipShape {
|
func PolygonClip(points []any) ClipShape {
|
||||||
clip := new(polygonClip)
|
clip := new(polygonClip)
|
||||||
clip.points = []interface{}{}
|
clip.points = []any{}
|
||||||
if clip.Set(Points, points) {
|
if clip.Set(Points, points) {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
|
@ -85,14 +85,14 @@ func PolygonClip(points []interface{}) ClipShape {
|
||||||
// PolygonPointsClip creates a polygon View clipping area.
|
// PolygonPointsClip creates a polygon View clipping area.
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape {
|
func PolygonPointsClip(points []SizeUnit) ClipShape {
|
||||||
clip := new(polygonClip)
|
clip := new(polygonClip)
|
||||||
clip.points = []interface{}{}
|
clip.points = []any{}
|
||||||
if clip.Set(Points, points) {
|
if clip.Set(Points, points) {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) Set(tag string, value interface{}) bool {
|
func (clip *insetClip) Set(tag string, value any) bool {
|
||||||
switch strings.ToLower(tag) {
|
switch strings.ToLower(tag) {
|
||||||
case Top, Right, Bottom, Left:
|
case Top, Right, Bottom, Left:
|
||||||
if value == nil {
|
if value == nil {
|
||||||
|
@ -168,7 +168,7 @@ func (clip *insetClip) valid(session Session) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) Set(tag string, value interface{}) bool {
|
func (clip *circleClip) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
clip.Remove(tag)
|
clip.Remove(tag)
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ func (clip *circleClip) valid(session Session) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) Set(tag string, value interface{}) bool {
|
func (clip *ellipseClip) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
clip.Remove(tag)
|
clip.Remove(tag)
|
||||||
}
|
}
|
||||||
|
@ -302,23 +302,23 @@ func (clip *ellipseClip) valid(session Session) bool {
|
||||||
return rx.Value != 0 && ry.Value != 0
|
return rx.Value != 0 && ry.Value != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) Get(tag string) interface{} {
|
func (clip *polygonClip) Get(tag string) any {
|
||||||
if Points == strings.ToLower(tag) {
|
if Points == strings.ToLower(tag) {
|
||||||
return clip.points
|
return clip.points
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) getRaw(tag string) interface{} {
|
func (clip *polygonClip) getRaw(tag string) any {
|
||||||
return clip.Get(tag)
|
return clip.Get(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) Set(tag string, value interface{}) bool {
|
func (clip *polygonClip) Set(tag string, value any) bool {
|
||||||
if Points == strings.ToLower(tag) {
|
if Points == strings.ToLower(tag) {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case []interface{}:
|
case []any:
|
||||||
result := true
|
result := true
|
||||||
clip.points = make([]interface{}, len(value))
|
clip.points = make([]any, len(value))
|
||||||
for i, val := range value {
|
for i, val := range value {
|
||||||
switch val := val.(type) {
|
switch val := val.(type) {
|
||||||
case string:
|
case string:
|
||||||
|
@ -343,7 +343,7 @@ func (clip *polygonClip) Set(tag string, value interface{}) bool {
|
||||||
return result
|
return result
|
||||||
|
|
||||||
case []SizeUnit:
|
case []SizeUnit:
|
||||||
clip.points = make([]interface{}, len(value))
|
clip.points = make([]any, len(value))
|
||||||
for i, point := range value {
|
for i, point := range value {
|
||||||
clip.points[i] = point
|
clip.points[i] = point
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ func (clip *polygonClip) Set(tag string, value interface{}) bool {
|
||||||
case string:
|
case string:
|
||||||
result := true
|
result := true
|
||||||
values := strings.Split(value, ",")
|
values := strings.Split(value, ",")
|
||||||
clip.points = make([]interface{}, len(values))
|
clip.points = make([]any, len(values))
|
||||||
for i, val := range values {
|
for i, val := range values {
|
||||||
val = strings.Trim(val, " \t\n\r")
|
val = strings.Trim(val, " \t\n\r")
|
||||||
if isConstantName(val) {
|
if isConstantName(val) {
|
||||||
|
@ -370,18 +370,18 @@ func (clip *polygonClip) Set(tag string, value interface{}) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) setRaw(tag string, value interface{}) {
|
func (clip *polygonClip) setRaw(tag string, value any) {
|
||||||
clip.Set(tag, value)
|
clip.Set(tag, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) Remove(tag string) {
|
func (clip *polygonClip) Remove(tag string) {
|
||||||
if Points == strings.ToLower(tag) {
|
if Points == strings.ToLower(tag) {
|
||||||
clip.points = []interface{}{}
|
clip.points = []any{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) Clear() {
|
func (clip *polygonClip) Clear() {
|
||||||
clip.points = []interface{}{}
|
clip.points = []any{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) AllTags() []string {
|
func (clip *polygonClip) AllTags() []string {
|
||||||
|
@ -422,7 +422,7 @@ func (clip *polygonClip) cssStyle(session Session) string {
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
|
||||||
writePoint := func(value interface{}) {
|
writePoint := func(value any) {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
if val, ok := session.resolveConstants(value); ok {
|
if val, ok := session.resolveConstants(value); ok {
|
||||||
|
@ -501,7 +501,7 @@ func parseClipShape(obj DataObject) ClipShape {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) setClipShape(tag string, value interface{}) bool {
|
func (style *viewStyle) setClipShape(tag string, value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case ClipShape:
|
case ClipShape:
|
||||||
style.properties[tag] = value
|
style.properties[tag] = value
|
||||||
|
|
|
@ -130,7 +130,7 @@ func newViewFilter(obj DataObject) ViewFilter {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (filter *viewFilter) Set(tag string, value interface{}) bool {
|
func (filter *viewFilter) Set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
filter.Remove(tag)
|
filter.Remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -224,7 +224,7 @@ func (filter *viewFilter) cssStyle(session Session) string {
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) setFilter(tag string, value interface{}) bool {
|
func (style *viewStyle) setFilter(tag string, value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case ViewFilter:
|
case ViewFilter:
|
||||||
style.properties[tag] = value
|
style.properties[tag] = value
|
||||||
|
|
16
viewStyle.go
16
viewStyle.go
|
@ -442,7 +442,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueToOrientation(value interface{}, session Session) (int, bool) {
|
func valueToOrientation(value any, session Session) (int, bool) {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case int:
|
case int:
|
||||||
|
@ -471,11 +471,11 @@ func valueToOrientation(value interface{}, session Session) (int, bool) {
|
||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) Get(tag string) interface{} {
|
func (style *viewStyle) Get(tag string) any {
|
||||||
return style.get(strings.ToLower(tag))
|
return style.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) get(tag string) interface{} {
|
func (style *viewStyle) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Border, CellBorder:
|
case Border, CellBorder:
|
||||||
return getBorder(&style.propertyList, tag)
|
return getBorder(&style.propertyList, tag)
|
||||||
|
@ -539,7 +539,7 @@ func (style *viewStyle) AllTags() []string {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func supportedPropertyValue(value interface{}) bool {
|
func supportedPropertyValue(value any) bool {
|
||||||
switch value.(type) {
|
switch value.(type) {
|
||||||
case string:
|
case string:
|
||||||
case []string:
|
case []string:
|
||||||
|
@ -551,7 +551,7 @@ func supportedPropertyValue(value interface{}) bool {
|
||||||
case fmt.Stringer:
|
case fmt.Stringer:
|
||||||
case []ViewShadow:
|
case []ViewShadow:
|
||||||
case []View:
|
case []View:
|
||||||
case []interface{}:
|
case []any:
|
||||||
case map[string]Animation:
|
case map[string]Animation:
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
@ -559,7 +559,7 @@ func supportedPropertyValue(value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func writePropertyValue(buffer *strings.Builder, tag string, value interface{}, indent string) {
|
func writePropertyValue(buffer *strings.Builder, tag string, value any, indent string) {
|
||||||
|
|
||||||
writeString := func(text string) {
|
writeString := func(text string) {
|
||||||
simple := (tag != Text && tag != Title && tag != Summary)
|
simple := (tag != Text && tag != Title && tag != Summary)
|
||||||
|
@ -697,7 +697,7 @@ func writePropertyValue(buffer *strings.Builder, tag string, value interface{},
|
||||||
buffer.WriteRune(']')
|
buffer.WriteRune(']')
|
||||||
}
|
}
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
switch count := len(value); count {
|
switch count := len(value); count {
|
||||||
case 0:
|
case 0:
|
||||||
buffer.WriteString("[]")
|
buffer.WriteString("[]")
|
||||||
|
@ -755,7 +755,7 @@ func writeViewStyle(name string, view ViewStyle, buffer *strings.Builder, indent
|
||||||
buffer.WriteString(" {\n")
|
buffer.WriteString(" {\n")
|
||||||
indent += "\t"
|
indent += "\t"
|
||||||
|
|
||||||
writeProperty := func(tag string, value interface{}) {
|
writeProperty := func(tag string, value any) {
|
||||||
if supportedPropertyValue(value) {
|
if supportedPropertyValue(value) {
|
||||||
buffer.WriteString(indent)
|
buffer.WriteString(indent)
|
||||||
buffer.WriteString(tag)
|
buffer.WriteString(tag)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (style *viewStyle) setRange(tag string, value interface{}) bool {
|
func (style *viewStyle) setRange(tag string, value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case string:
|
case string:
|
||||||
if strings.Contains(value, "@") {
|
if strings.Contains(value, "@") {
|
||||||
|
@ -31,7 +31,7 @@ func (style *viewStyle) setRange(tag string, value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) setBackground(value interface{}) bool {
|
func (style *viewStyle) setBackground(value any) bool {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case BackgroundElement:
|
case BackgroundElement:
|
||||||
style.properties[Background] = []BackgroundElement{value}
|
style.properties[Background] = []BackgroundElement{value}
|
||||||
|
@ -122,11 +122,11 @@ func (style *viewStyle) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) Set(tag string, value interface{}) bool {
|
func (style *viewStyle) Set(tag string, value any) bool {
|
||||||
return style.set(strings.ToLower(tag), value)
|
return style.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (style *viewStyle) set(tag string, value interface{}) bool {
|
func (style *viewStyle) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
style.remove(tag)
|
style.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -3,7 +3,7 @@ package rui
|
||||||
// Get returns a value of the property with name "tag" of the "rootView" subview with "viewID" id value.
|
// Get returns a value of the property with name "tag" of the "rootView" subview with "viewID" id value.
|
||||||
// The type of return value depends on the property.
|
// The type of return value depends on the property.
|
||||||
// If the subview don't exists or the property is not set then nil is returned.
|
// If the subview don't exists or the property is not set then nil is returned.
|
||||||
func Get(rootView View, viewID, tag string) interface{} {
|
func Get(rootView View, viewID, tag string) any {
|
||||||
var view View
|
var view View
|
||||||
if viewID != "" {
|
if viewID != "" {
|
||||||
view = ViewByID(rootView, viewID)
|
view = ViewByID(rootView, viewID)
|
||||||
|
@ -19,7 +19,7 @@ func Get(rootView View, viewID, tag string) interface{} {
|
||||||
// Set sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result:
|
// Set sets the property with name "tag" of the "rootView" subview with "viewID" id by value. Result:
|
||||||
// true - success,
|
// true - success,
|
||||||
// false - error (incompatible type or invalid format of a string value, see AppLog).
|
// false - error (incompatible type or invalid format of a string value, see AppLog).
|
||||||
func Set(rootView View, viewID, tag string, value interface{}) bool {
|
func Set(rootView View, viewID, tag string, value any) bool {
|
||||||
var view View
|
var view View
|
||||||
if viewID != "" {
|
if viewID != "" {
|
||||||
view = ViewByID(rootView, viewID)
|
view = ViewByID(rootView, viewID)
|
||||||
|
@ -976,9 +976,9 @@ func GetNotTranslate(view View, subviewID string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func valueFromStyle(view View, tag string) interface{} {
|
func valueFromStyle(view View, tag string) any {
|
||||||
session := view.Session()
|
session := view.Session()
|
||||||
getValue := func(styleTag string) interface{} {
|
getValue := func(styleTag string) any {
|
||||||
if style, ok := stringProperty(view, styleTag, session); ok {
|
if style, ok := stringProperty(view, styleTag, session); ok {
|
||||||
if style, ok := session.resolveConstants(style); ok {
|
if style, ok := session.resolveConstants(style); ok {
|
||||||
return session.styleProperty(style, tag)
|
return session.styleProperty(style, tag)
|
||||||
|
|
|
@ -172,11 +172,11 @@ func (container *viewsContainerData) remove(tag string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *viewsContainerData) Set(tag string, value interface{}) bool {
|
func (container *viewsContainerData) Set(tag string, value any) bool {
|
||||||
return container.set(strings.ToLower(tag), value)
|
return container.set(strings.ToLower(tag), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *viewsContainerData) set(tag string, value interface{}) bool {
|
func (container *viewsContainerData) set(tag string, value any) bool {
|
||||||
if value == nil {
|
if value == nil {
|
||||||
container.remove(tag)
|
container.remove(tag)
|
||||||
return true
|
return true
|
||||||
|
@ -224,7 +224,7 @@ func (container *viewsContainerData) set(tag string, value interface{}) bool {
|
||||||
}
|
}
|
||||||
container.views = views
|
container.views = views
|
||||||
|
|
||||||
case []interface{}:
|
case []any:
|
||||||
views := []View{}
|
views := []View{}
|
||||||
for _, v := range value {
|
for _, v := range value {
|
||||||
switch v := v.(type) {
|
switch v := v.(type) {
|
||||||
|
@ -279,11 +279,11 @@ func (container *viewsContainerData) set(tag string, value interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *viewsContainerData) Get(tag string) interface{} {
|
func (container *viewsContainerData) Get(tag string) any {
|
||||||
return container.get(strings.ToLower(tag))
|
return container.get(strings.ToLower(tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *viewsContainerData) get(tag string) interface{} {
|
func (container *viewsContainerData) get(tag string) any {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Content:
|
case Content:
|
||||||
return container.views
|
return container.views
|
||||||
|
|
Loading…
Reference in New Issue