swing-ui 1.0.6 → 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.
@@ -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 {@link SwingUI#ui|ui.ui(id)}
105
- * @type {string[]}
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(): string[];
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 GUI software license information stored in the package.json file of your project.
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 FlatDarkLaf UI with all options</h2>
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
  *
@@ -38,7 +14,7 @@ export class ComponentContainer extends UIComponent {
38
14
  * In loops `for..in`, `for..of` or `component.children.forEach((c, i)=>{...})` it's accessed only once, so you are looping through the same array.
39
15
  *
40
16
  * @readonly
41
- * @type {Object[]}
17
+ * @type {UIComponent[]}
42
18
  * @example <h2>Looping through Window's components</h2>
43
19
  * // method 1
44
20
  * for(child of window.children)
@@ -59,7 +35,7 @@ export class ComponentContainer extends UIComponent {
59
35
  * ...
60
36
  * });
61
37
  */
62
- readonly get children(): Object[];
38
+ readonly get children(): UIComponent[];
63
39
  /**
64
40
  * Gets the number of components added to this container.
65
41
  * @readonly
@@ -76,15 +52,15 @@ export class ComponentContainer extends UIComponent {
76
52
  /**
77
53
  * Gets or sets the index of a child component within this container. Setting new index changes z-order of the component.
78
54
  *
79
- * @param {Object} child - Child component
55
+ * @param {UIComponent} child - Child component
80
56
  * @param {number} [new_index] - The new index to assign to the child. Moves the component in z-order.
81
57
  * @return {this|null|number} If `new_index` is provided, returns `this` component. If the child is not found in this container, returns `null`. Otherwise, returns the child's current z-index.
82
58
  */
83
- childIndex(child: Object, new_index?: number): this | null | number;
59
+ childIndex(child: UIComponent, new_index?: number): this | null | number;
84
60
  /**
85
61
  * Adds a child component to this container component.
86
62
  *
87
- * @param {object} component - UI Component that can be a child of this component.
63
+ * @param {UIComponent} component - UI Component that can be a child of this component.
88
64
  * @param {number|object} [data_or_index] - Argument to pass some extra data (such as Tab Name to add Panel to Tabs), or index at which to insert the child. By default component is added to the end.
89
65
  * @returns {this} Returns an instance of `this` component for chaining.
90
66
  * @see UIComponent#addTo
@@ -94,24 +70,24 @@ export class ComponentContainer extends UIComponent {
94
70
  * @example <h2>Adding a component at specified index</h2>
95
71
  * tabs.addChild(new Panel(), {text: "Registration", enabled: true, tooltip: "Create new account", icon: "images/user.png"});
96
72
  */
97
- addChild(component: object, ...args: any[]): this;
73
+ addChild(component: UIComponent, ...args: any[]): this;
98
74
  /**
99
75
  * Removes component's child by child object or child index.
100
76
  *
101
- * @param {object|number} child_or_index - Child component object or index of the child.
77
+ * @param {UIComponent|number} child_or_index - Child component object or index of the child.
102
78
  * @param {boolean} [recursive=false] - Boolean indicates if all descendents of this child should also be removed.
103
79
  * @returns {UIComponent|null} The removed child component, or `null` if there is no child at specified index.
104
80
  */
105
- removeChild(child_or_index: object | number, recursive?: boolean): UIComponent | null;
81
+ removeChild(child_or_index: UIComponent | number, recursive?: boolean): UIComponent | null;
106
82
  /**
107
83
  * Checks if passed component is a descendant of this container component.
108
84
  *
109
- * @param descendant - Child component to check.
85
+ * @param {UIComponent} descendant - Child component to check.
110
86
  * @returns {boolean} If the descendant component is inside of this component.
111
87
  * @throws {TypeError} When passed argument is not an instance of UIComponent.
112
88
  * @see UIComponent#insideOf
113
89
  */
114
- contains(descendant: any): boolean;
90
+ contains(descendant: UIComponent): boolean;
115
91
  /**
116
92
  * Gets, registers or unregisters an event handler function for container-related events
117
93
  * triggered when a child component is added or removed.
@@ -53,10 +53,10 @@ export class ContextMenu extends ComponentContainer {
53
53
  /**
54
54
  * Adds this ContextMenu to a specified parent component.
55
55
  *
56
- * @param {object} parent - A valid component that accepts ContextMenu. `parent` must be derived from UIComponent.
56
+ * @param {ComponentContainer} parent - A valid component that accepts ContextMenu. `parent` must be derived from UIComponent.
57
57
  * @return {ContextMenu} Returns an instance of `this` object.
58
58
  */
59
- addTo(parent: object, ...args: any[]): ContextMenu;
59
+ addTo(parent: ComponentContainer, ...args: any[]): ContextMenu;
60
60
  /**
61
61
  * Removes this ContextMenu from all parent components or removes a specified child component from this ContextMenu.
62
62
  *
@@ -1,7 +1,8 @@
1
1
  /**
2
- * RadioButton is a component used to select of multiple option by clicking on it.
3
- * Multiple RadioButton components must be grouped for selection to work.
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 that extends MenuItem class.
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
- * 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
+ * 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
@@ -15,9 +15,9 @@ export class ScrollPane extends ComponentContainer {
15
15
  /**
16
16
  * Adds a child component to this container component.
17
17
  *
18
- * @param {Object} component - UI Component that can be a child of this component.
18
+ * @param {UIComponent} component - UI Component that can be a child of this component.
19
19
  * @returns {this} Returns an instance of `this` component.
20
20
  */
21
- addChild(component: Object, ...data: any[]): this;
21
+ addChild(component: UIComponent, ...data: any[]): this;
22
22
  }
23
23
  import { ComponentContainer } from "./ComponentContainer.js";
@@ -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
  *
@@ -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
  *
@@ -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
  *
@@ -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
@@ -166,7 +104,7 @@ export class UIComponent {
166
104
  * @param {boolean} [recursive=false] - Set to true to also destroy all of its descendants recursively
167
105
  * @returns {void}
168
106
  */
169
- destroy(...args: any[]): void;
107
+ destroy(recursive?: boolean): void;
170
108
  destroyed: boolean | undefined;
171
109
  /**
172
110
  * This function may be called to make sure the component wasn't destroyed yet before performing another operation with the component. If it's already destroyed, Exception is thrown.
@@ -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";
@@ -24,17 +24,7 @@
24
24
  */
25
25
  export function error(message: string | Error, show_stack_trace?: boolean | Error): void;
26
26
  /**
27
- * Returns a text representation of passed variable. Similar to JSON.stringify().
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
@@ -89,10 +79,10 @@ export function confirm(message: string, window?: Window): boolean;
89
79
  *
90
80
  * @param {string} message - String message to user. It can be plain text or HTML.
91
81
  * @param {string} [title=""] - Dialog window title shown in the title bar of the window
92
- * @param {string[]} [buttons=["OK","Cancel"]] - An Array of button names. Indicate a default button by surrounding the text with square brackets like so: "[Cancel]"
82
+ * @param {string[]} [buttons=["[OK]","Cancel"]] - An array of button names. Indicate a default button by surrounding the text with square brackets like so: "[OK]"
93
83
  * @param {MessageIcon|string} [icon=null] - One of MessageIcon icons, or an absolute path to an image from a file system.
94
84
  * @param {Window} [window=null] - Owner window that will be overlaid by this dialog window. If omitted, last created visible Window that's not PopUp will be used.
95
- * @return {number|undefined} Returns a zero-based number of a clicked button, or `null` if the dialog window was closed without clicking provided buttons.
85
+ * @return {number|null} Returns a zero-based number of a clicked button, or `null` if the dialog window was closed without clicking provided buttons.
96
86
  * @global
97
87
  * @example <h2>Usage example</h2>
98
88
  * let response = dialog("Are you ready?", "Confirm readiness", ["Yes", "No", "[Maybe]"], MessageIcon.Question, window);
@@ -106,4 +96,4 @@ export function confirm(message: string, window?: Window): boolean;
106
96
  * @example <h2>Using custom image</h2>
107
97
  * let response = dialog("Is this you?", "Question #5", ["Yes","[No]"], "C://User/John/profile_icon.jpg", window);
108
98
  */
109
- export function dialog(message: string, title?: string, buttons?: string[], icon?: MessageIcon | string, window?: Window): number | undefined;
99
+ export function dialog(message: string, title?: string, buttons?: string[], icon?: MessageIcon | string, window?: Window): number | null;
@@ -58,7 +58,7 @@ async function startJar()
58
58
  let JAVA_OPTS = (env.JAVA_OPTS ?? "").split(" ").filter(Boolean);
59
59
  if(JAVA_OPTS.indexOf("-Dfile.encoding=UTF-8") === -1) JAVA_OPTS.push("-Dfile.encoding=UTF-8"); // important
60
60
  if(workerData.debugJava) JAVA_OPTS.push("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"); // for debugging JAR
61
- if(workerData.os === "linux") JAVA_OPTS.push("--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED"); // to be able to set WM_CLASS to project name in Java GUI
61
+ if(workerData.os === "linux") JAVA_OPTS.push("--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED"); // to be able to set WM_CLASS to project name in Java GUI
62
62
 
63
63
  const _opts = [...JAVA_OPTS, "-jar", JAR_PATH, "--root-dir", workerData.rootDir, "--module-dir", workerData.moduleDir];
64
64
 
@@ -292,14 +292,6 @@ parentPort.on("message", (msg) => {
292
292
  if(msg.respond) syncMode = true;
293
293
  sendLineToJar(msg.data);
294
294
  }
295
- // Config override: { type: "__config", jarPath?, javaBin?, javaOpts? }
296
- else if(msg.type === "__config")
297
- {
298
- if(msg.jarPath) JAR_PATH = msg.jarPath;
299
- if(msg.javaBin) JAVA_BIN = msg.javaBin;
300
- if(msg.javaOpts) JAVA_OPTS = msg.javaOpts;
301
- console.log(`[jar-worker] Config updated — jar: ${JAR_PATH}`);
302
- }
303
295
  // Shutdown: { type: "__shutdown" }
304
296
  else if(msg.type === "__shutdown")
305
297
  {