swing-ui 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/SwingUI.js +120 -6
- package/classes/ComboBox.js +3 -3
- package/classes/ComponentContainer.js +6 -0
- package/classes/List.js +3 -3
- package/classes/RadioButton.js +4 -3
- package/classes/RadioButtonMenuItem.js +5 -5
- package/classes/Table.js +30 -17
- package/classes/ToolBar.js +2 -2
- package/classes/Tree.js +12 -0
- package/classes/Window.js +42 -1
- package/functions.js +1 -1
- package/icon.png +0 -0
- package/jar/gui-11.jar +0 -0
- package/package.json +1 -1
- package/types/SwingUI.d.ts +63 -65
- package/types/classes/ComponentContainer.d.ts +0 -24
- package/types/classes/RadioButton.d.ts +4 -3
- package/types/classes/RadioButtonMenuItem.d.ts +5 -5
- package/types/classes/ScrollableComponent.d.ts +0 -6
- package/types/classes/Shape.d.ts +0 -9
- package/types/classes/ShapeContainer.d.ts +0 -5
- package/types/classes/Table.d.ts +15 -7
- package/types/classes/TextArea.d.ts +0 -10
- package/types/classes/TextComponent.d.ts +0 -6
- package/types/classes/ToolBar.d.ts +1 -1
- package/types/classes/Tree.d.ts +7 -0
- package/types/classes/UIComponent.d.ts +0 -89
- package/types/classes/Window.d.ts +9 -0
- package/types/functions.d.ts +1 -11
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Build once, run it on Windows, Linux and macOS in your favorite JavaScript runti
|
|
|
9
9
|

|
|
10
10
|
[](https://www.npmjs.com/package/swing-ui)
|
|
11
11
|
|
|
12
|
-
`swing-ui`
|
|
12
|
+
`swing-ui` brings a new experience to Java Swing with enhanced components and a simple JavaScript API, allowing you to build native-looking, cross-platform desktop applications entirely in JavaScript using the JS runtime you already know: Node.js, Bun, or Deno 2+.
|
|
13
13
|
|
|
14
14
|
You only write JavaScript and the GUI gets built, or better yet, use our [Visual GUI Designer](https://swing-ui.com/visual-gui-designer/) to skip coding at all.
|
|
15
15
|
|
package/SwingUI.js
CHANGED
|
@@ -72,7 +72,6 @@ export class SwingUI
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @internal
|
|
75
|
-
* @private
|
|
76
75
|
*/
|
|
77
76
|
_msg = {
|
|
78
77
|
0: "Calling a function of a destroyed UI component",
|
|
@@ -167,7 +166,6 @@ export class SwingUI
|
|
|
167
166
|
/**
|
|
168
167
|
* <b>NOTE:</b> Do not instantiate this class. It's already instantiated and assigned to a global variable `ui`.
|
|
169
168
|
* @internal
|
|
170
|
-
* @private
|
|
171
169
|
*/
|
|
172
170
|
constructor(module_dir, JBridge)
|
|
173
171
|
{
|
|
@@ -186,6 +184,9 @@ export class SwingUI
|
|
|
186
184
|
process.on("SIGHUP", this.exit.bind(this, 0, "SIGHUP"));
|
|
187
185
|
}
|
|
188
186
|
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
189
190
|
async InitGUIProcess()
|
|
190
191
|
{
|
|
191
192
|
if(this.runtime === "bun" || this.os === "darwin") this.#useWorkerThread = true;
|
|
@@ -775,6 +776,7 @@ export class SwingUI
|
|
|
775
776
|
*
|
|
776
777
|
* @example <h2>Sending queued messages without compressing:</h2>
|
|
777
778
|
* ui.sendMessageQueue(false);
|
|
779
|
+
* @internal
|
|
778
780
|
*/
|
|
779
781
|
sendMessageQueue(compress = true)
|
|
780
782
|
{
|
|
@@ -912,8 +914,64 @@ export class SwingUI
|
|
|
912
914
|
* Getter property that returns an array of available UI look and feel IDs on your system. For example Windows OS can have a Windows look and feel that linux doesn't have. Use them to set the desired look and feel using ui.ui(id) method.
|
|
913
915
|
*
|
|
914
916
|
* @readonly
|
|
915
|
-
* @see
|
|
916
|
-
* @type {
|
|
917
|
+
* @see SwingUI#ui
|
|
918
|
+
* @type {object[]}
|
|
919
|
+
* @example <h2>Example of a returned array</h2>
|
|
920
|
+
* [
|
|
921
|
+
* {
|
|
922
|
+
* "name": "Default",
|
|
923
|
+
* "id": "MetalLookAndFeel"
|
|
924
|
+
* },
|
|
925
|
+
* {
|
|
926
|
+
* "name": "OS",
|
|
927
|
+
* "id": "WindowsLookAndFeel"
|
|
928
|
+
* },
|
|
929
|
+
* {
|
|
930
|
+
* "name": "Metal",
|
|
931
|
+
* "dark": false,
|
|
932
|
+
* "id": "MetalLookAndFeel"
|
|
933
|
+
* },
|
|
934
|
+
* {
|
|
935
|
+
* "name": "Nimbus",
|
|
936
|
+
* "dark": false,
|
|
937
|
+
* "id": "NimbusLookAndFeel"
|
|
938
|
+
* },
|
|
939
|
+
* {
|
|
940
|
+
* "name": "CDE/Motif",
|
|
941
|
+
* "dark": false,
|
|
942
|
+
* "id": "MotifLookAndFeel"
|
|
943
|
+
* },
|
|
944
|
+
* {
|
|
945
|
+
* "name": "Windows",
|
|
946
|
+
* "dark": false,
|
|
947
|
+
* "id": "WindowsLookAndFeel"
|
|
948
|
+
* },
|
|
949
|
+
* {
|
|
950
|
+
* "name": "Windows Classic",
|
|
951
|
+
* "dark": false,
|
|
952
|
+
* "id": "WindowsClassicLookAndFeel"
|
|
953
|
+
* },
|
|
954
|
+
* {
|
|
955
|
+
* "name": "FlatLaf Light",
|
|
956
|
+
* "dark": false,
|
|
957
|
+
* "id": "FlatLightLaf"
|
|
958
|
+
* },
|
|
959
|
+
* {
|
|
960
|
+
* "name": "FlatLaf Dark",
|
|
961
|
+
* "dark": true,
|
|
962
|
+
* "id": "FlatDarkLaf"
|
|
963
|
+
* },
|
|
964
|
+
* {
|
|
965
|
+
* "name": "FlatLaf IntelliJ",
|
|
966
|
+
* "dark": false,
|
|
967
|
+
* "id": "FlatIntelliJLaf"
|
|
968
|
+
* },
|
|
969
|
+
* {
|
|
970
|
+
* "name": "FlatLaf Darcula",
|
|
971
|
+
* "dark": true,
|
|
972
|
+
* "id": "FlatDarculaLaf"
|
|
973
|
+
* }
|
|
974
|
+
* ]
|
|
917
975
|
*/
|
|
918
976
|
get list()
|
|
919
977
|
{
|
|
@@ -982,7 +1040,7 @@ export class SwingUI
|
|
|
982
1040
|
}
|
|
983
1041
|
|
|
984
1042
|
/**
|
|
985
|
-
* Gets a
|
|
1043
|
+
* Gets a swing-ui software license information including the path on your file system where the license is stored.
|
|
986
1044
|
*
|
|
987
1045
|
* @readonly
|
|
988
1046
|
* @type {Object}
|
|
@@ -1211,7 +1269,9 @@ export class SwingUI
|
|
|
1211
1269
|
* @return {string|SwingUI} When setting arguments, `this` instance of SwingUI is returned, otherwise current value is returned.
|
|
1212
1270
|
* @throws Error When argument is invalid.
|
|
1213
1271
|
* @see SwingUI#list
|
|
1214
|
-
* @example <h2>Setting
|
|
1272
|
+
* @example <h2>Setting System's UI Theme</h2>
|
|
1273
|
+
* ui.ui(ui.list.find(t => t.name === "OS").id);
|
|
1274
|
+
* @example <h2>Setting FlatDarkLaf UI theme with all options</h2>
|
|
1215
1275
|
* ui.ui(
|
|
1216
1276
|
* "FlatDarkLaf",
|
|
1217
1277
|
* {
|
|
@@ -2630,5 +2690,59 @@ export class SwingUI
|
|
|
2630
2690
|
return this;
|
|
2631
2691
|
}
|
|
2632
2692
|
|
|
2693
|
+
/**
|
|
2694
|
+
* Registers, unregisters and retrieves event handler for event emitted by changes to screens on the computer, such as connecting a screen, disconnecting a screen, or changes to screen resolution.
|
|
2695
|
+
*
|
|
2696
|
+
* @param {function(Object):any|null|undefined} [callback] - Function to handle the event, `null` to remove all handlers, or omit to retrieve an array of handlers.
|
|
2697
|
+
* @param {boolean} remove - Removed the callback from this event
|
|
2698
|
+
* @return {SwingUI|function[]} If called without parameters, an array of registered callbacks is returned; otherwise `this` instance of SwingUI class is returned.
|
|
2699
|
+
* @example <h2>Registering screens change event handler:</h2>
|
|
2700
|
+
* ui.onScreensChange(e => {console.log(e.screens});
|
|
2701
|
+
* @see ui#screens
|
|
2702
|
+
*/
|
|
2703
|
+
onScreensChange(callback = undefined, remove = false)
|
|
2704
|
+
{
|
|
2705
|
+
const name = "onScreensChange";
|
|
2706
|
+
|
|
2707
|
+
// return callbacks
|
|
2708
|
+
if(callback === undefined) return Array.isArray(this.callback[name]) ? [...this.callback[name]] : [];
|
|
2709
|
+
|
|
2710
|
+
// remove callback
|
|
2711
|
+
if(remove === true || callback === null)
|
|
2712
|
+
{
|
|
2713
|
+
if(!Array.isArray(this.callback[name])) return this;
|
|
2714
|
+
|
|
2715
|
+
if(callback === null)
|
|
2716
|
+
{
|
|
2717
|
+
this.callback[name].length = 0;
|
|
2718
|
+
}
|
|
2719
|
+
else
|
|
2720
|
+
{
|
|
2721
|
+
this.callback[name] = this.callback[name].filter(l => l !== callback);
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
if(this.callback[name].length === 0)
|
|
2725
|
+
{
|
|
2726
|
+
delete this.callback[name]; // delete array
|
|
2727
|
+
this.sendToGUI({system: name, remove: true}); // notify GUI
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
// add callback
|
|
2731
|
+
else
|
|
2732
|
+
{
|
|
2733
|
+
if(typeof callback !== "function") throw new Error(`Invalid argument for callback function. Must be a "function" type.`);
|
|
2734
|
+
|
|
2735
|
+
if(!Array.isArray(this.callback[name]))
|
|
2736
|
+
{
|
|
2737
|
+
this.callback[name] = []; // create array
|
|
2738
|
+
this.sendToGUI({system: name, remove: false}); // notify GUI
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
this.callback[name].push(callback); // add callback (don't bind to this here, do it at call)
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
return this;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2633
2747
|
//endregion
|
|
2634
2748
|
}
|
package/classes/ComboBox.js
CHANGED
|
@@ -31,20 +31,20 @@ export class ComboBox extends TextComponent
|
|
|
31
31
|
* @see ListItem
|
|
32
32
|
* @example
|
|
33
33
|
* // Creating combo box, then adding each item separately.
|
|
34
|
-
* const combo1 = new ComboBox().add("Item 1").add(45).add({text: "Item 2", font:{
|
|
34
|
+
* const combo1 = new ComboBox().add("Item 1").add(45).add({text: "Item 2", font:{bold:true}});
|
|
35
35
|
*
|
|
36
36
|
* // Creating combo box, then adding items as an array.
|
|
37
37
|
* const combo2 = new ComboBox().items([
|
|
38
38
|
* "Item 1",
|
|
39
39
|
* 45,
|
|
40
|
-
* {text: "Item 3", font:{
|
|
40
|
+
* {text: "Item 3", font:{bold:true}}
|
|
41
41
|
* ]);
|
|
42
42
|
*
|
|
43
43
|
* // Creating combo box with items as a string and object. Items can be a mix of strings and objects.
|
|
44
44
|
* const combo3 = new ComboBox([
|
|
45
45
|
* "Item 1",
|
|
46
46
|
* 45,
|
|
47
|
-
* {text: "Item 3", font:{
|
|
47
|
+
* {text: "Item 3", font:{bold:true}}
|
|
48
48
|
* ]);
|
|
49
49
|
*/
|
|
50
50
|
constructor(...args) // accepts an optional parameter, array of string for list items
|
|
@@ -13,7 +13,13 @@ export class ComponentContainer extends UIComponent
|
|
|
13
13
|
#_children = []; // child components of this component
|
|
14
14
|
#descriptorObject = null;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
16
19
|
static preInitProperties = ["position", "size", "innerSize"];
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
17
23
|
static postInitProperties = ["defaultButton", "state", "visible"]; // state must be applied after all children apply anchor property
|
|
18
24
|
|
|
19
25
|
/**
|
package/classes/List.js
CHANGED
|
@@ -46,20 +46,20 @@ export class List extends ScrollableComponent
|
|
|
46
46
|
* @param {Array<string|number|ListItem>} [items] - Items as an Array of ListItem formatted objects, strings or numbers. Can be a mix of these types.
|
|
47
47
|
* @example
|
|
48
48
|
* // Creating combo box, then adding each item separately.
|
|
49
|
-
* const combo1 = new ComboBox().add("Item 1").add(45).add({text: "Item 2", font:{
|
|
49
|
+
* const combo1 = new ComboBox().add("Item 1").add(45).add({text: "Item 2", font:{bold:true}});
|
|
50
50
|
*
|
|
51
51
|
* // Creating combo box, then adding items as an array.
|
|
52
52
|
* const combo2 = new ComboBox().items([
|
|
53
53
|
* "Item 1",
|
|
54
54
|
* 45,
|
|
55
|
-
* {text: "Item 2", font:{
|
|
55
|
+
* {text: "Item 2", font:{bold:true}}
|
|
56
56
|
* ]);
|
|
57
57
|
*
|
|
58
58
|
* // Creating combo box with items as a string and object. Items can be a mix of strings and objects.
|
|
59
59
|
* const combo3 = new ComboBox([
|
|
60
60
|
* "Item 1",
|
|
61
61
|
* 45,
|
|
62
|
-
* {text: "Item 2", font:{
|
|
62
|
+
* {text: "Item 2", font:{bold:true}}
|
|
63
63
|
* ]);
|
|
64
64
|
*/
|
|
65
65
|
constructor(...args)
|
package/classes/RadioButton.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import {UIComponent} from "./UIComponent.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* RadioButton is a component used to select of multiple option by clicking on it.
|
|
6
|
-
*
|
|
7
|
-
* To group them pick one main RadioButton and group other RadioButton components with it.
|
|
5
|
+
* RadioButton is a component used to select one of multiple option by clicking on it.
|
|
6
|
+
*
|
|
7
|
+
* Multiple RadioButton components must be grouped for selection to work. To group them pick one main RadioButton and group other RadioButton components with it.
|
|
8
|
+
*
|
|
8
9
|
* For example if you have three RadioButton components, you must group second component with first one, then third component with any component that is already grouped (first or second).
|
|
9
10
|
* Then to detect selection changes add onChange(e => {console.log(e.value);}) to only one of the grouped RadioButton components, and e.value will be the value of currently selected RadioButton.
|
|
10
11
|
* @class
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {MenuItem} from "./MenuItem.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Radio button menu item UI component
|
|
5
|
+
* Radio button menu item UI component.
|
|
6
|
+
*
|
|
7
|
+
* RadioButtonMenuItem is a component used to select one of multiple option by clicking on it. Multiple RadioButtonMenuItem components must be grouped for selection to work as expected. To group them pick one main RadioButtonMenuItem and group other RadioButtonMenuItem with it.
|
|
6
8
|
*
|
|
7
|
-
* RadioButton is a component used to select of multiple option by clicking on it.
|
|
8
|
-
* Multiple RadioButton components must be grouped for selection to work as expected.
|
|
9
|
-
* To group them pick one main RadioButtonMenuItem and group other RadioButtonMenuItem with it.
|
|
10
9
|
* For example if you have three RadioButtonMenuItem components that you want to group, you must group second component with first one, then third component with any component that is already grouped (first or second).
|
|
11
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* Then to detect selection changes add onChange(e => {console.log(e.value);}) to only one of the grouped RadioButton components, and e.value will be the value of currently selected RadioButton in the group.
|
|
12
12
|
* See example below.
|
|
13
13
|
*
|
|
14
14
|
* @class
|
package/classes/Table.js
CHANGED
|
@@ -751,6 +751,36 @@ export class Table extends ScrollableComponent
|
|
|
751
751
|
return this.property("editingCell", [])
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.
|
|
757
|
+
*
|
|
758
|
+
* @param {number} [clicks] - Amount of clicks: 1, 2, or 3. Default is 2 (double-click).
|
|
759
|
+
* @return {number|Table} Returns the current value if no parameters are provided; otherwise, and instance of `this` Table is returned.
|
|
760
|
+
*/
|
|
761
|
+
clicksToEdit(...args)
|
|
762
|
+
{
|
|
763
|
+
if(args.length > 0)
|
|
764
|
+
{
|
|
765
|
+
// enforce int
|
|
766
|
+
args[0] = Math.max(1, Number.parseInt(args[0]));
|
|
767
|
+
if(!Number.isSafeInteger(args[0])) throw new TypeError(`Invalid Table.clickToEdit() argument. A positive integer is required.`);
|
|
768
|
+
}
|
|
769
|
+
return this.property("clicksToEdit", args);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Sets or gets whether to allow row selection with a click of a right mouse button.
|
|
774
|
+
*
|
|
775
|
+
* @param {boolean} [enable] - Boolean value that enables or disables right-click row selection.
|
|
776
|
+
* @return {boolean|List} Returns `this` component instance if at least one argument is provided, otherwise returns current value.
|
|
777
|
+
* @since 1.1.0
|
|
778
|
+
*/
|
|
779
|
+
rightClickSelect(...args)
|
|
780
|
+
{
|
|
781
|
+
if(args.length > 0) args[0] = (args[0] === true); // ensure boolean
|
|
782
|
+
return this.property("rightClickSelect", arguments);
|
|
783
|
+
}
|
|
754
784
|
|
|
755
785
|
/**
|
|
756
786
|
* Sets or gets whether sorting can be toggled to unsorted state.
|
|
@@ -884,23 +914,6 @@ export class Table extends ScrollableComponent
|
|
|
884
914
|
return ui.sendToGUI({control: this.id, get: "cellAt", data: {x: x, y: y}});
|
|
885
915
|
}
|
|
886
916
|
|
|
887
|
-
/**
|
|
888
|
-
* Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.
|
|
889
|
-
*
|
|
890
|
-
* @param {number} [clicks] - Amount of clicks: 1, 2, or 3. Default is 2 (double-click).
|
|
891
|
-
* @return {number|Table} Returns the current value if no parameters are provided; otherwise, and instance of `this` Table is returned.
|
|
892
|
-
*/
|
|
893
|
-
clicksToEdit(...args)
|
|
894
|
-
{
|
|
895
|
-
if(args.length > 0)
|
|
896
|
-
{
|
|
897
|
-
// enforce int
|
|
898
|
-
args[0] = Math.max(1, Number.parseInt(args[0]));
|
|
899
|
-
if(!Number.isSafeInteger(args[0])) throw new TypeError(`Invalid Table.clickToEdit() argument. A positive integer is required.`);
|
|
900
|
-
}
|
|
901
|
-
return this.property("clicksToEdit", args);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
917
|
//endregion
|
|
905
918
|
|
|
906
919
|
//region Events
|
package/classes/ToolBar.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {ComponentContainer} from "./ComponentContainer.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A toolbar component that is usually used at the top of window and can hold {@link Label}, {@link Button}, {@link TextField}, {@link ComboBox}, and a {@link Separator} to display useful tools for a user.
|
|
5
|
+
* A toolbar component that is usually used at the top of window and can hold {@link Label}, {@link Button}, {@link TextField}, {@link PasswordField}, {@link Spinner}, {@link ComboBox}, {@link CheckBox}, {@link RadioButton} and a {@link Separator} to display useful tools for a user.
|
|
6
6
|
*
|
|
7
7
|
* Toolbar can be draggable and can be detached and displayed in a separate dedicated window. It can also be in horizontal (default) and vertical orientation.
|
|
8
8
|
*
|
|
@@ -57,7 +57,7 @@ export class ToolBar extends ComponentContainer
|
|
|
57
57
|
{
|
|
58
58
|
return this.property("orientation", args);
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
/**
|
|
62
62
|
* Sets or gets a padding size between edge of the component and items inside it, and spacing between items.
|
|
63
63
|
*
|
package/classes/Tree.js
CHANGED
|
@@ -491,6 +491,18 @@ export class Tree extends ScrollableComponent
|
|
|
491
491
|
return this.property("clicksToEdit", args.length > 0 ? [parseInt(args[0])] : args);
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
/**
|
|
495
|
+
* Sets or gets whether to allow selecting list items with a click of a right mouse button.
|
|
496
|
+
* @param {boolean} [enable] - Boolean value that enables or disables right-click item selection.
|
|
497
|
+
* @return {boolean|List} Returns `this` component instance if at least one argument is provided, otherwise returns current value.
|
|
498
|
+
* @since 1.1.0
|
|
499
|
+
*/
|
|
500
|
+
rightClickSelect(...args)
|
|
501
|
+
{
|
|
502
|
+
if(args.length > 0) args[0] = (args[0] === true); // ensure boolean
|
|
503
|
+
return this.property("rightClickSelect", arguments);
|
|
504
|
+
}
|
|
505
|
+
|
|
494
506
|
/**
|
|
495
507
|
* Sets or gets whether Tree nodes' text can be edited by user.
|
|
496
508
|
*
|
package/classes/Window.js
CHANGED
|
@@ -26,7 +26,8 @@ class Window extends ShapeContainer
|
|
|
26
26
|
#owner = null; // used only for modal window
|
|
27
27
|
#prop = {
|
|
28
28
|
closeOperation: Window.CloseOperation.Exit,
|
|
29
|
-
innerOffset: null
|
|
29
|
+
innerOffset: null,
|
|
30
|
+
toolBar:{}
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -604,6 +605,46 @@ class Window extends ShapeContainer
|
|
|
604
605
|
return this.property("opacity", args);
|
|
605
606
|
}
|
|
606
607
|
|
|
608
|
+
/**
|
|
609
|
+
* Sets a ToolBar to one of locations: `top`, `right`, `bottom` and `left`, or gets a ToolBar at a specified location.
|
|
610
|
+
*
|
|
611
|
+
* @param {string} dockLocation - One of: `top`, `right`, `bottom` and `left`.
|
|
612
|
+
* @param {ToolBar} [toolbar] - ToolBar to set to specified location. Set `null` to remove the toolbar from that location. Omit to get the toolbar already in that location.
|
|
613
|
+
* @returns {ToolBar|null|Window} If only location is specified, a {@link ToolBar} or `null` is returned. When `toolbar` argument is passed, an instance of `this` Window is returned.
|
|
614
|
+
* @since 1.0.8
|
|
615
|
+
*/
|
|
616
|
+
toolBar(dockLocation, toolbar = undefined)
|
|
617
|
+
{
|
|
618
|
+
if(typeof dockLocation !== "string")
|
|
619
|
+
{
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
else if(toolbar === undefined) // gets toolbar
|
|
623
|
+
{
|
|
624
|
+
const id = ui.sendToGUI({control: this.id, get: "toolBar", data: dockLocation});
|
|
625
|
+
|
|
626
|
+
return id === -1 ? null : UIComponent.get(id) ?? null; // in case it was destroyed already
|
|
627
|
+
}
|
|
628
|
+
else if(toolbar === null)
|
|
629
|
+
{
|
|
630
|
+
if(this.#prop.toolBar[dockLocation] instanceof ToolBar)
|
|
631
|
+
{
|
|
632
|
+
this.property("toolBar", [{id: null, location: dockLocation}])
|
|
633
|
+
delete this.#prop.toolBar[dockLocation];
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if(toolbar instanceof ToolBar) // sets toolbar
|
|
637
|
+
{
|
|
638
|
+
if("top right bottom left".includes(dockLocation))
|
|
639
|
+
{
|
|
640
|
+
if(this.#prop.toolBar[dockLocation] instanceof ToolBar) this.property("toolBar", [{id: null, location: dockLocation}])
|
|
641
|
+
this.#prop.toolBar[dockLocation] = toolbar;
|
|
642
|
+
|
|
643
|
+
this.property("toolBar", [{id: toolbar.id, location: dockLocation}])
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return this;
|
|
647
|
+
}
|
|
607
648
|
}
|
|
608
649
|
|
|
609
650
|
export {Window};
|
package/functions.js
CHANGED
|
@@ -119,7 +119,7 @@ export function stringify(variable)
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Displays a dialog window with a specified
|
|
122
|
+
* Displays a dialog window with a specified message and optional icon.
|
|
123
123
|
*
|
|
124
124
|
* @param {string} message - A message to be displayed in the dialog window
|
|
125
125
|
* @param {string} [title="Message"] - Dialog window title bar text
|
package/icon.png
CHANGED
|
Binary file
|
package/jar/gui-11.jar
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/SwingUI.d.ts
CHANGED
|
@@ -13,66 +13,6 @@
|
|
|
13
13
|
* ui.openURL("http://swing-ui.com/");
|
|
14
14
|
*/
|
|
15
15
|
export class SwingUI {
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
private static WorkerSignalIndex;
|
|
21
|
-
/**
|
|
22
|
-
* @internal
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
private static WorkerSignal;
|
|
26
|
-
/**
|
|
27
|
-
* <b>NOTE:</b> Do not instantiate this class. It's already instantiated and assigned to a global variable `ui`.
|
|
28
|
-
* @internal
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
private constructor();
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
private stats;
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
* @private
|
|
40
|
-
*/
|
|
41
|
-
private gui_process_id;
|
|
42
|
-
/**
|
|
43
|
-
* @internal
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
private callback;
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
private _msg;
|
|
52
|
-
InitGUIProcess(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Send a messages to GUI process via STD out. Use internally for communication only.
|
|
55
|
-
* @param {Object} msg - JSON Object message to send to GUI.
|
|
56
|
-
* @param {function(any):any} [callback] - Only pass callback to block event loop and wait for response
|
|
57
|
-
* @return {any|void} Returns response from GUI or undefined.
|
|
58
|
-
* @internal
|
|
59
|
-
* @ignore
|
|
60
|
-
*/
|
|
61
|
-
sendToGUI(msg: Object, callback?: (arg0: any) => any): any | void;
|
|
62
|
-
/**
|
|
63
|
-
* Immediately sends all queued messages to GUI without waiting for queue threshold or execution end. It's similar to flush() function in data streams.
|
|
64
|
-
* It can be used to force messages to be sent imedietly instead of waiting for message queue to be full, if it's important to update some UI component or content right away.
|
|
65
|
-
* It may improve performance to set `compress` to `false` to skip compression for already compressed data, such as UI component's background image or large icon.
|
|
66
|
-
*
|
|
67
|
-
* @param {boolean} [compress=true] - Whether to compress messages before sending.
|
|
68
|
-
* @return {this} Returns `this` instance for chaining.
|
|
69
|
-
* @example <h2>Sending queued messages before proceeding:</h2>
|
|
70
|
-
* ui.sendMessageQueue();
|
|
71
|
-
*
|
|
72
|
-
* @example <h2>Sending queued messages without compressing:</h2>
|
|
73
|
-
* ui.sendMessageQueue(false);
|
|
74
|
-
*/
|
|
75
|
-
sendMessageQueue(compress?: boolean): this;
|
|
76
16
|
/**
|
|
77
17
|
* Returns a detected or specified application root directory.
|
|
78
18
|
*
|
|
@@ -101,10 +41,66 @@ export class SwingUI {
|
|
|
101
41
|
* Getter property that returns an array of available UI look and feel IDs on your system. For example Windows OS can have a Windows look and feel that linux doesn't have. Use them to set the desired look and feel using ui.ui(id) method.
|
|
102
42
|
*
|
|
103
43
|
* @readonly
|
|
104
|
-
* @see
|
|
105
|
-
* @type {
|
|
44
|
+
* @see SwingUI#ui
|
|
45
|
+
* @type {object[]}
|
|
46
|
+
* @example <h2>Example of a returned array</h2>
|
|
47
|
+
* [
|
|
48
|
+
* {
|
|
49
|
+
* "name": "Default",
|
|
50
|
+
* "id": "MetalLookAndFeel"
|
|
51
|
+
* },
|
|
52
|
+
* {
|
|
53
|
+
* "name": "OS",
|
|
54
|
+
* "id": "WindowsLookAndFeel"
|
|
55
|
+
* },
|
|
56
|
+
* {
|
|
57
|
+
* "name": "Metal",
|
|
58
|
+
* "dark": false,
|
|
59
|
+
* "id": "MetalLookAndFeel"
|
|
60
|
+
* },
|
|
61
|
+
* {
|
|
62
|
+
* "name": "Nimbus",
|
|
63
|
+
* "dark": false,
|
|
64
|
+
* "id": "NimbusLookAndFeel"
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* "name": "CDE/Motif",
|
|
68
|
+
* "dark": false,
|
|
69
|
+
* "id": "MotifLookAndFeel"
|
|
70
|
+
* },
|
|
71
|
+
* {
|
|
72
|
+
* "name": "Windows",
|
|
73
|
+
* "dark": false,
|
|
74
|
+
* "id": "WindowsLookAndFeel"
|
|
75
|
+
* },
|
|
76
|
+
* {
|
|
77
|
+
* "name": "Windows Classic",
|
|
78
|
+
* "dark": false,
|
|
79
|
+
* "id": "WindowsClassicLookAndFeel"
|
|
80
|
+
* },
|
|
81
|
+
* {
|
|
82
|
+
* "name": "FlatLaf Light",
|
|
83
|
+
* "dark": false,
|
|
84
|
+
* "id": "FlatLightLaf"
|
|
85
|
+
* },
|
|
86
|
+
* {
|
|
87
|
+
* "name": "FlatLaf Dark",
|
|
88
|
+
* "dark": true,
|
|
89
|
+
* "id": "FlatDarkLaf"
|
|
90
|
+
* },
|
|
91
|
+
* {
|
|
92
|
+
* "name": "FlatLaf IntelliJ",
|
|
93
|
+
* "dark": false,
|
|
94
|
+
* "id": "FlatIntelliJLaf"
|
|
95
|
+
* },
|
|
96
|
+
* {
|
|
97
|
+
* "name": "FlatLaf Darcula",
|
|
98
|
+
* "dark": true,
|
|
99
|
+
* "id": "FlatDarculaLaf"
|
|
100
|
+
* }
|
|
101
|
+
* ]
|
|
106
102
|
*/
|
|
107
|
-
readonly get list():
|
|
103
|
+
readonly get list(): object[];
|
|
108
104
|
/**
|
|
109
105
|
* Returns an array of screen objects [{x,y,width,height}] that are configured on this computer. X and Y is the position of screens relative to one virtual screen. It's useful when you have multiple screens.
|
|
110
106
|
*
|
|
@@ -150,7 +146,7 @@ export class SwingUI {
|
|
|
150
146
|
*/
|
|
151
147
|
readonly get systemTraySupported(): boolean;
|
|
152
148
|
/**
|
|
153
|
-
* Gets a
|
|
149
|
+
* Gets a swing-ui software license information including the path on your file system where the license is stored.
|
|
154
150
|
*
|
|
155
151
|
* @readonly
|
|
156
152
|
* @type {Object}
|
|
@@ -281,7 +277,9 @@ export class SwingUI {
|
|
|
281
277
|
* @return {string|SwingUI} When setting arguments, `this` instance of SwingUI is returned, otherwise current value is returned.
|
|
282
278
|
* @throws Error When argument is invalid.
|
|
283
279
|
* @see SwingUI#list
|
|
284
|
-
* @example <h2>Setting
|
|
280
|
+
* @example <h2>Setting System's UI Theme</h2>
|
|
281
|
+
* ui.ui(ui.list.find(t => t.name === "OS").id);
|
|
282
|
+
* @example <h2>Setting FlatDarkLaf UI theme with all options</h2>
|
|
285
283
|
* ui.ui(
|
|
286
284
|
* "FlatDarkLaf",
|
|
287
285
|
* {
|
|
@@ -6,30 +6,6 @@
|
|
|
6
6
|
* @global
|
|
7
7
|
*/
|
|
8
8
|
export class ComponentContainer extends UIComponent {
|
|
9
|
-
static preInitProperties: string[];
|
|
10
|
-
static postInitProperties: string[];
|
|
11
|
-
/**
|
|
12
|
-
* ComponentContainer constructor.
|
|
13
|
-
* @internal
|
|
14
|
-
* @ignore
|
|
15
|
-
*/
|
|
16
|
-
constructor(...args: any[]);
|
|
17
|
-
/**
|
|
18
|
-
* Loads UI Components and properties from UI designer file FILE_NAME.ui.json where FILE_NAME is the name of JavaScript file of the component.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} class_name - Class name for which to load UI
|
|
21
|
-
* @private
|
|
22
|
-
* @ignore
|
|
23
|
-
*/
|
|
24
|
-
private _applyUIDefinition;
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
private _applyComponentPropertiesV1_0;
|
|
29
|
-
/**
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
private _buildComponentResources;
|
|
33
9
|
/**
|
|
34
10
|
* Gets an array of child components.
|
|
35
11
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RadioButton is a component used to select of multiple option by clicking on it.
|
|
3
|
-
*
|
|
4
|
-
* To group them pick one main RadioButton and group other RadioButton components with it.
|
|
2
|
+
* RadioButton is a component used to select one of multiple option by clicking on it.
|
|
3
|
+
*
|
|
4
|
+
* Multiple RadioButton components must be grouped for selection to work. To group them pick one main RadioButton and group other RadioButton components with it.
|
|
5
|
+
*
|
|
5
6
|
* For example if you have three RadioButton components, you must group second component with first one, then third component with any component that is already grouped (first or second).
|
|
6
7
|
* Then to detect selection changes add onChange(e => {console.log(e.value);}) to only one of the grouped RadioButton components, and e.value will be the value of currently selected RadioButton.
|
|
7
8
|
* @class
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Radio button menu item UI component
|
|
2
|
+
* Radio button menu item UI component.
|
|
3
|
+
*
|
|
4
|
+
* RadioButtonMenuItem is a component used to select one of multiple option by clicking on it. Multiple RadioButtonMenuItem components must be grouped for selection to work as expected. To group them pick one main RadioButtonMenuItem and group other RadioButtonMenuItem with it.
|
|
3
5
|
*
|
|
4
|
-
* RadioButton is a component used to select of multiple option by clicking on it.
|
|
5
|
-
* Multiple RadioButton components must be grouped for selection to work as expected.
|
|
6
|
-
* To group them pick one main RadioButtonMenuItem and group other RadioButtonMenuItem with it.
|
|
7
6
|
* For example if you have three RadioButtonMenuItem components that you want to group, you must group second component with first one, then third component with any component that is already grouped (first or second).
|
|
8
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* Then to detect selection changes add onChange(e => {console.log(e.value);}) to only one of the grouped RadioButton components, and e.value will be the value of currently selected RadioButton in the group.
|
|
9
9
|
* See example below.
|
|
10
10
|
*
|
|
11
11
|
* @class
|
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
* @global
|
|
7
7
|
*/
|
|
8
8
|
export class ScrollableComponent extends UIComponent {
|
|
9
|
-
/**
|
|
10
|
-
* ScrollableComponent constructor.
|
|
11
|
-
* @internal
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
constructor(...args: any[]);
|
|
15
9
|
/**
|
|
16
10
|
* Sets or gets scroll bars visibility for horizontal and vertical scroll bars.
|
|
17
11
|
*
|
package/types/classes/Shape.d.ts
CHANGED
|
@@ -70,15 +70,6 @@ export class Shape {
|
|
|
70
70
|
* @return {Shape} Returns this `Shape` for method chaining.
|
|
71
71
|
*/
|
|
72
72
|
toObject(include?: string): Shape;
|
|
73
|
-
/**
|
|
74
|
-
* Updates properties of this Shape. It's called by other methods of Shape object when shape properties change.
|
|
75
|
-
*
|
|
76
|
-
* @param {string|boolean} [what="all"] - What to update: "all", "min", "stroke", "background", "points". Shapes that derive from this class may also have their own values. Pass a `boolean` to enable and disable this shape redraw. Before making multiple changes to the Shape it helps to disable redraw, make the changes, then enable redraw.
|
|
77
|
-
* @returns {void}
|
|
78
|
-
* @internal
|
|
79
|
-
* @ignore
|
|
80
|
-
*/
|
|
81
|
-
update(what?: string | boolean): void;
|
|
82
73
|
/**
|
|
83
74
|
* Sets or gets location of the shape relative to top-left corner of its parent component.
|
|
84
75
|
*
|
|
@@ -55,11 +55,6 @@ export class ShapeContainer extends ComponentContainer {
|
|
|
55
55
|
* @see Shape#remove
|
|
56
56
|
*/
|
|
57
57
|
removeShape(index: any): Shape | boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
* @ignore
|
|
61
|
-
*/
|
|
62
|
-
verifyToken(token: any): boolean;
|
|
63
58
|
/**
|
|
64
59
|
* Registers, unregisters and gets a list of handler functions for Shape events (such as when mouse enters, leaves, mouse button clicks, etc.).
|
|
65
60
|
*
|
package/types/classes/Table.d.ts
CHANGED
|
@@ -486,6 +486,21 @@ export class Table extends ScrollableComponent {
|
|
|
486
486
|
* const _rows = table.rows(); // read new data
|
|
487
487
|
*/
|
|
488
488
|
editingCell(...args: any[]): TableCell | null | Table;
|
|
489
|
+
/**
|
|
490
|
+
* Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.
|
|
491
|
+
*
|
|
492
|
+
* @param {number} [clicks] - Amount of clicks: 1, 2, or 3. Default is 2 (double-click).
|
|
493
|
+
* @return {number|Table} Returns the current value if no parameters are provided; otherwise, and instance of `this` Table is returned.
|
|
494
|
+
*/
|
|
495
|
+
clicksToEdit(...args: any[]): number | Table;
|
|
496
|
+
/**
|
|
497
|
+
* Sets or gets whether to allow row selection with a click of a right mouse button.
|
|
498
|
+
*
|
|
499
|
+
* @param {boolean} [enable] - Boolean value that enables or disables right-click row selection.
|
|
500
|
+
* @return {boolean|List} Returns `this` component instance if at least one argument is provided, otherwise returns current value.
|
|
501
|
+
* @since 1.1.0
|
|
502
|
+
*/
|
|
503
|
+
rightClickSelect(...args: any[]): boolean | List;
|
|
489
504
|
/**
|
|
490
505
|
* Sets or gets whether sorting can be toggled to unsorted state.
|
|
491
506
|
*
|
|
@@ -580,13 +595,6 @@ export class Table extends ScrollableComponent {
|
|
|
580
595
|
* @return {TableCell|null} Returns the cell at specified location, or `null` if the coordinates are outside any cell.
|
|
581
596
|
*/
|
|
582
597
|
cellAt(x: number, y: number): TableCell | null;
|
|
583
|
-
/**
|
|
584
|
-
* Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.
|
|
585
|
-
*
|
|
586
|
-
* @param {number} [clicks] - Amount of clicks: 1, 2, or 3. Default is 2 (double-click).
|
|
587
|
-
* @return {number|Table} Returns the current value if no parameters are provided; otherwise, and instance of `this` Table is returned.
|
|
588
|
-
*/
|
|
589
|
-
clicksToEdit(...args: any[]): number | Table;
|
|
590
598
|
/**
|
|
591
599
|
* Gets, registers or unregisters a column event handler function. This event handler is called when a column is inserted, removed, resized, or moved (reordered).
|
|
592
600
|
*
|
|
@@ -23,16 +23,6 @@ export class TextArea extends TextComponent {
|
|
|
23
23
|
* textarea.text("New Text", TextAction.ReplaceSelection); // Replaces selected text or inserts at current cursor position if no text is selected
|
|
24
24
|
*/
|
|
25
25
|
text(text?: string, action?: TextAction, i?: undefined, ...args: any[]): string | TextArea;
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
* @ignore
|
|
29
|
-
*/
|
|
30
|
-
rows(...args: any[]): any;
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
* @ignore
|
|
34
|
-
*/
|
|
35
|
-
columns(...args: any[]): any;
|
|
36
26
|
/**
|
|
37
27
|
* Sets or gets line wrapping mode. Line wrapping helps to display long lines without having to scroll horizontally.
|
|
38
28
|
*
|
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
* @global
|
|
7
7
|
*/
|
|
8
8
|
export class TextComponent extends UIComponent {
|
|
9
|
-
/**
|
|
10
|
-
* TextComponent constructor.
|
|
11
|
-
* @internal
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
constructor(...args: any[]);
|
|
15
9
|
/**
|
|
16
10
|
* Sets or gets whether component's text can be edited by user typing. Applies to components such as TextField, TextArea, DocumentEditor, ComboBox, Password, Spinner, Tree (to edit list item).
|
|
17
11
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A toolbar component that is usually used at the top of window and can hold {@link Label}, {@link Button}, {@link TextField}, {@link ComboBox}, and a {@link Separator} to display useful tools for a user.
|
|
2
|
+
* A toolbar component that is usually used at the top of window and can hold {@link Label}, {@link Button}, {@link TextField}, {@link PasswordField}, {@link Spinner}, {@link ComboBox}, {@link CheckBox}, {@link RadioButton} and a {@link Separator} to display useful tools for a user.
|
|
3
3
|
*
|
|
4
4
|
* Toolbar can be draggable and can be detached and displayed in a separate dedicated window. It can also be in horizontal (default) and vertical orientation.
|
|
5
5
|
*
|
package/types/classes/Tree.d.ts
CHANGED
|
@@ -296,6 +296,13 @@ export class Tree extends ScrollableComponent {
|
|
|
296
296
|
* @see Tree#editable
|
|
297
297
|
*/
|
|
298
298
|
clicksToEdit(...args: any[]): number | Tree;
|
|
299
|
+
/**
|
|
300
|
+
* Sets or gets whether to allow selecting list items with a click of a right mouse button.
|
|
301
|
+
* @param {boolean} [enable] - Boolean value that enables or disables right-click item selection.
|
|
302
|
+
* @return {boolean|List} Returns `this` component instance if at least one argument is provided, otherwise returns current value.
|
|
303
|
+
* @since 1.1.0
|
|
304
|
+
*/
|
|
305
|
+
rightClickSelect(...args: any[]): boolean | List;
|
|
299
306
|
/**
|
|
300
307
|
* Sets or gets whether Tree nodes' text can be edited by user.
|
|
301
308
|
*
|
|
@@ -8,30 +8,6 @@ export class UIComponent {
|
|
|
8
8
|
static "__#1@#controls_id": number;
|
|
9
9
|
static "__#1@#_freed_ids": any[];
|
|
10
10
|
static "__#1@#_components": any[];
|
|
11
|
-
/**
|
|
12
|
-
* This is used to be notified when the component loses all references to it, to notify SwingUI to destroy the component for garbage collection
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
private static "__#1@#refRegistry";
|
|
16
|
-
/**
|
|
17
|
-
* Makes one class implements methods, setters, and getters of another class.
|
|
18
|
-
* @param toClass
|
|
19
|
-
* @param fromClass
|
|
20
|
-
* @throws {Error} When one or more parameters are `null`.
|
|
21
|
-
* @internal
|
|
22
|
-
* @ignore
|
|
23
|
-
*/
|
|
24
|
-
static implementClass(toClass: any, fromClass: any): void;
|
|
25
|
-
/**
|
|
26
|
-
* Removes references to UI component with provided ID. Make sure to destroy all other references to the component to truly destroy it to free RAM.
|
|
27
|
-
*
|
|
28
|
-
* @internal
|
|
29
|
-
* @ignore
|
|
30
|
-
* @private
|
|
31
|
-
* @param {number} id - ID of a component to be destroyed
|
|
32
|
-
* @return {void} Doesn't return a value
|
|
33
|
-
*/
|
|
34
|
-
private static destroy;
|
|
35
11
|
/**
|
|
36
12
|
* Get UI component by ID.
|
|
37
13
|
*
|
|
@@ -39,49 +15,11 @@ export class UIComponent {
|
|
|
39
15
|
* @return {any|undefined} Returns UI component or `undefined` if there is no valid component with specified ID.
|
|
40
16
|
*/
|
|
41
17
|
static get(id: number): any | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Returns last visible non-PopUp Window or null if no Window component is not found.
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
|
-
* @static
|
|
47
|
-
* @readonly
|
|
48
|
-
* @returns {Window|null} Returns Window component or null.
|
|
49
|
-
*/
|
|
50
|
-
static readonly getVisibleWindow(): Window | null;
|
|
51
|
-
/**
|
|
52
|
-
* Not to be instantiated by itself. This call is extended dby other UI components.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} type - Component type.
|
|
55
|
-
* @param {boolean} leaf - `true` if the UI component was not extended by a custom class.
|
|
56
|
-
* @param {...any} [data] - Additional component init data (used by some UI components).
|
|
57
|
-
* @internal
|
|
58
|
-
* @ignore
|
|
59
|
-
*/
|
|
60
|
-
constructor(type: string, leaf: boolean, ...data?: any[]);
|
|
61
18
|
parent_id: null;
|
|
62
19
|
callback: {
|
|
63
20
|
onError: ((e: any) => any)[];
|
|
64
21
|
onRectangleUpdate: ((e: any) => void)[];
|
|
65
22
|
};
|
|
66
|
-
/**
|
|
67
|
-
* Locks methods from being overwritten or deleted.
|
|
68
|
-
* @param {Function} prototype_class
|
|
69
|
-
* @ignore
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
finalize(..._classes: any[]): void;
|
|
73
|
-
/**
|
|
74
|
-
* @internal
|
|
75
|
-
* @ignore
|
|
76
|
-
*/
|
|
77
|
-
isFinalized(methodName: any): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
* @readonly
|
|
81
|
-
* @ignore
|
|
82
|
-
* @type {object}
|
|
83
|
-
*/
|
|
84
|
-
readonly get prop(): object;
|
|
85
23
|
/**
|
|
86
24
|
* Returns a unique ID of the component. ID is reusable, so one component may have an ID of a previously destroyed component.
|
|
87
25
|
* @readonly
|
|
@@ -254,33 +192,6 @@ export class UIComponent {
|
|
|
254
192
|
* textfield.text("New Text", TextAction.ReplaceSelection); // Replaces selected text or inserts at current cursor position if no text is selected (applies only to text editing components, like TextField, TextArea, ...).
|
|
255
193
|
*/
|
|
256
194
|
text(...args: any[]): string | this;
|
|
257
|
-
/**
|
|
258
|
-
* @internal
|
|
259
|
-
* @ignore
|
|
260
|
-
* @param {string} property
|
|
261
|
-
* @param {any} value
|
|
262
|
-
* @return {any}
|
|
263
|
-
*/
|
|
264
|
-
property(property: string, ...args: any[]): any;
|
|
265
|
-
/**
|
|
266
|
-
* Registers, unregisters, and gets an event handler callback function for a specified events.
|
|
267
|
-
*
|
|
268
|
-
* - component.event(name, function, true); // unregisters one callback function (even if the same callback was registered multiple times)
|
|
269
|
-
* - component.event(name, function); // registers callback to be called when the event is emitted
|
|
270
|
-
* - component.event(name); // returns all callback functions for specified event
|
|
271
|
-
*
|
|
272
|
-
* @param {string} name - Name of event
|
|
273
|
-
* @param {function(Object):any|null} [callback=undefined] - Callback function. Pass `null` to unregister all handler functions.
|
|
274
|
-
* @param {boolean} [remove=false] - Set to true to unregister the callback function.
|
|
275
|
-
* @return {Function[]|this} If only the `name` argument is provided, returns an array of registered callback functions. Otherwise, returns `this` component.
|
|
276
|
-
* @internal
|
|
277
|
-
* @ignore
|
|
278
|
-
* @example
|
|
279
|
-
* const _callbacks_array = button.event("onAction"); // gets an array of previously registered handler functions
|
|
280
|
-
* button.event("onAction", _callbacks_array[0], true); // unregisters callback function, same as button.onAction(_callbacks_array[0], true);
|
|
281
|
-
* button.event("onAction", e => {console.debug(e);}); // registers new event handler function, same as button.onAction(e => {console.debug(e);});
|
|
282
|
-
*/
|
|
283
|
-
event(name: string, callback?: (arg0: Object) => any | null, remove?: boolean): Function[] | this;
|
|
284
195
|
/**
|
|
285
196
|
* Sets or gets the background color of the component. <br />
|
|
286
197
|
* <br />
|
|
@@ -329,6 +329,15 @@ export class Window extends ShapeContainer {
|
|
|
329
329
|
* @return {number|this} If `opacity` argument is provided, `this` component is returned, otherwise opacity `number` is returned.
|
|
330
330
|
*/
|
|
331
331
|
opacity(...args: any[]): number | this;
|
|
332
|
+
/**
|
|
333
|
+
* Sets a ToolBar to one of locations: `top`, `right`, `bottom` and `left`, or gets a ToolBar at a specified location.
|
|
334
|
+
*
|
|
335
|
+
* @param {string} dockLocation - One of: `top`, `right`, `bottom` and `left`.
|
|
336
|
+
* @param {ToolBar} [toolbar] - ToolBar to set to specified location. Set `null` to remove the toolbar from that location. Omit to get the toolbar already in that location.
|
|
337
|
+
* @returns {ToolBar|null|Window} If only location is specified, a {@link ToolBar} or `null` is returned. When `toolbar` argument is passed, an instance of `this` Window is returned.
|
|
338
|
+
* @since 1.0.8
|
|
339
|
+
*/
|
|
340
|
+
toolBar(dockLocation: string, toolbar?: ToolBar): ToolBar | null | Window;
|
|
332
341
|
#private;
|
|
333
342
|
}
|
|
334
343
|
import { ShapeContainer } from "./ShapeContainer.js";
|
package/types/functions.d.ts
CHANGED
|
@@ -24,17 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
export function error(message: string | Error, show_stack_trace?: boolean | Error): void;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
|
-
* @ignore
|
|
31
|
-
* @global
|
|
32
|
-
* @param {any} variable - Any variable to be converted to a string representation
|
|
33
|
-
* @return {string} Serialized object as a String
|
|
34
|
-
*/
|
|
35
|
-
export function stringify(variable: any): string;
|
|
36
|
-
/**
|
|
37
|
-
* Displays a dialog window with a specified error message and an error icon.
|
|
27
|
+
* Displays a dialog window with a specified message and optional icon.
|
|
38
28
|
*
|
|
39
29
|
* @param {string} message - A message to be displayed in the dialog window
|
|
40
30
|
* @param {string} [title="Message"] - Dialog window title bar text
|