swing-ui 1.0.5 → 1.0.7
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 +2 -2
- package/SwingUI.js +5 -4
- package/classes/Arc.js +1 -1
- package/classes/ComponentContainer.js +9 -9
- package/classes/ContextMenu.js +1 -1
- package/classes/ScrollPane.js +1 -1
- package/classes/Table.js +11 -11
- package/classes/UIComponent.js +5 -8
- package/functions.js +3 -3
- package/icon.png +0 -0
- package/jar/gui-11.jar +0 -0
- package/package.json +1 -1
- package/typedefs.js +3 -3
- package/types/SwingUI.d.ts +8 -0
- package/types/classes/ComponentContainer.d.ts +10 -10
- package/types/classes/ContextMenu.d.ts +2 -2
- package/types/classes/ScrollPane.d.ts +2 -2
- package/types/classes/Table.d.ts +9 -9
- package/types/classes/UIComponent.d.ts +8 -10
- package/types/functions.d.ts +3 -3
- package/ui-process-manager.js +1 -9
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ If you've shipped a desktop app in JS before, you've probably lived one of these
|
|
|
67
67
|
npm install swing-ui
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
> Install it locally in each project — not with `-g
|
|
70
|
+
> Install it locally in each project — not with `-g` option.
|
|
71
71
|
|
|
72
72
|
```js
|
|
73
73
|
import "swing-ui";
|
|
@@ -117,7 +117,7 @@ That's just a taste. Tables, trees, tabs, menus, system tray icons, custom drawi
|
|
|
117
117
|
- Financial software with graphical graphs and charts
|
|
118
118
|
- and much more...
|
|
119
119
|
|
|
120
|
-
Anywhere you want a real desktop app without the weight of a browser runtime, and without leaving JavaScript to get it. With thousands
|
|
120
|
+
Anywhere you want a real desktop app without the weight of a browser runtime, and without leaving JavaScript to get it. With thousands of JavaScript modules now almost anything is possible in JavaScript.
|
|
121
121
|
|
|
122
122
|
---
|
|
123
123
|
|
package/SwingUI.js
CHANGED
|
@@ -892,7 +892,7 @@ export class SwingUI
|
|
|
892
892
|
*/
|
|
893
893
|
get os()
|
|
894
894
|
{
|
|
895
|
-
let os
|
|
895
|
+
let os;
|
|
896
896
|
|
|
897
897
|
if(this.runtime === "deno")
|
|
898
898
|
{
|
|
@@ -1162,13 +1162,13 @@ export class SwingUI
|
|
|
1162
1162
|
* data[DataType.HTML] = "<b>HTML Content</b>";
|
|
1163
1163
|
* ui.clipboard(data);
|
|
1164
1164
|
*/
|
|
1165
|
-
clipboard()
|
|
1165
|
+
clipboard(...args)
|
|
1166
1166
|
{
|
|
1167
|
-
if(
|
|
1167
|
+
if(args.length > 0)
|
|
1168
1168
|
{
|
|
1169
1169
|
this.sendToGUI({
|
|
1170
1170
|
system: "clipboard",
|
|
1171
|
-
value: (typeof
|
|
1171
|
+
value: (typeof args[0] === "string") ? {Text: args[0]} : args[0]
|
|
1172
1172
|
});
|
|
1173
1173
|
return this;
|
|
1174
1174
|
}
|
|
@@ -1250,6 +1250,7 @@ export class SwingUI
|
|
|
1250
1250
|
*
|
|
1251
1251
|
* @param {boolean} enabled - `true` to enable double-buffering (default), `false` to disable.
|
|
1252
1252
|
* @return {SwingUI|boolean} When setting a value, an instance of this `ui` object is returned, otherwise a current value is returned.
|
|
1253
|
+
* @since 1.0.5
|
|
1253
1254
|
*/
|
|
1254
1255
|
doubleBuffer(...args)
|
|
1255
1256
|
{
|
package/classes/Arc.js
CHANGED
|
@@ -129,7 +129,7 @@ export class ComponentContainer extends UIComponent
|
|
|
129
129
|
* 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.
|
|
130
130
|
*
|
|
131
131
|
* @readonly
|
|
132
|
-
* @type {
|
|
132
|
+
* @type {UIComponent[]}
|
|
133
133
|
* @example <h2>Looping through Window's components</h2>
|
|
134
134
|
* // method 1
|
|
135
135
|
* for(child of window.children)
|
|
@@ -181,7 +181,7 @@ export class ComponentContainer extends UIComponent
|
|
|
181
181
|
/**
|
|
182
182
|
* Gets or sets the index of a child component within this container. Setting new index changes z-order of the component.
|
|
183
183
|
*
|
|
184
|
-
* @param {
|
|
184
|
+
* @param {UIComponent} child - Child component
|
|
185
185
|
* @param {number} [new_index] - The new index to assign to the child. Moves the component in z-order.
|
|
186
186
|
* @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.
|
|
187
187
|
*/
|
|
@@ -213,7 +213,7 @@ export class ComponentContainer extends UIComponent
|
|
|
213
213
|
/**
|
|
214
214
|
* Adds a child component to this container component.
|
|
215
215
|
*
|
|
216
|
-
* @param {
|
|
216
|
+
* @param {UIComponent} component - UI Component that can be a child of this component.
|
|
217
217
|
* @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.
|
|
218
218
|
* @returns {this} Returns an instance of `this` component for chaining.
|
|
219
219
|
* @see UIComponent#addTo
|
|
@@ -319,7 +319,7 @@ export class ComponentContainer extends UIComponent
|
|
|
319
319
|
/**
|
|
320
320
|
* Removes component's child by child object or child index.
|
|
321
321
|
*
|
|
322
|
-
* @param {
|
|
322
|
+
* @param {UIComponent|number} child_or_index - Child component object or index of the child.
|
|
323
323
|
* @param {boolean} [recursive=false] - Boolean indicates if all descendents of this child should also be removed.
|
|
324
324
|
* @returns {UIComponent|null} The removed child component, or `null` if there is no child at specified index.
|
|
325
325
|
*/
|
|
@@ -366,11 +366,11 @@ export class ComponentContainer extends UIComponent
|
|
|
366
366
|
* @param {boolean} [recursive=false] - Set to true to also destroy all of its descendants recursively
|
|
367
367
|
* @returns {void}
|
|
368
368
|
*/
|
|
369
|
-
destroy(
|
|
369
|
+
destroy(recursive=false)
|
|
370
370
|
{
|
|
371
371
|
if(this.destroyed) return;
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
recursive = (recursive === true);
|
|
374
374
|
|
|
375
375
|
// remove all child components, from last to first (IMPORTANT)
|
|
376
376
|
for(let i = this.#_children.length - 1; i >= 0; i--)
|
|
@@ -389,13 +389,13 @@ export class ComponentContainer extends UIComponent
|
|
|
389
389
|
{error(ex);}
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
super.destroy(
|
|
392
|
+
super.destroy(recursive);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
/**
|
|
396
396
|
* Checks if passed component is a descendant of this container component.
|
|
397
397
|
*
|
|
398
|
-
* @param descendant - Child component to check.
|
|
398
|
+
* @param {UIComponent} descendant - Child component to check.
|
|
399
399
|
* @returns {boolean} If the descendant component is inside of this component.
|
|
400
400
|
* @throws {TypeError} When passed argument is not an instance of UIComponent.
|
|
401
401
|
* @see UIComponent#insideOf
|
|
@@ -821,7 +821,7 @@ export class ComponentContainer extends UIComponent
|
|
|
821
821
|
{
|
|
822
822
|
if(!(event in component))
|
|
823
823
|
{
|
|
824
|
-
error(`${class_name}.${event} is not valid event function for ${class_name} in your .ui.json file:\n\n${common.ui_file}`, false);
|
|
824
|
+
error(`${class_name}.${event} is not a valid event function for ${class_name} in your .ui.json file:\n\n${common.ui_file}`, false);
|
|
825
825
|
continue;
|
|
826
826
|
}
|
|
827
827
|
|
package/classes/ContextMenu.js
CHANGED
|
@@ -103,7 +103,7 @@ export class ContextMenu extends ComponentContainer
|
|
|
103
103
|
/**
|
|
104
104
|
* Adds this ContextMenu to a specified parent component.
|
|
105
105
|
*
|
|
106
|
-
* @param {
|
|
106
|
+
* @param {ComponentContainer} parent - A valid component that accepts ContextMenu. `parent` must be derived from UIComponent.
|
|
107
107
|
* @return {ContextMenu} Returns an instance of `this` object.
|
|
108
108
|
*/
|
|
109
109
|
addTo(parent, ...args)
|
package/classes/ScrollPane.js
CHANGED
|
@@ -38,7 +38,7 @@ class ScrollPane extends ComponentContainer
|
|
|
38
38
|
/**
|
|
39
39
|
* Adds a child component to this container component.
|
|
40
40
|
*
|
|
41
|
-
* @param {
|
|
41
|
+
* @param {UIComponent} component - UI Component that can be a child of this component.
|
|
42
42
|
* @returns {this} Returns an instance of `this` component.
|
|
43
43
|
*/
|
|
44
44
|
addChild(component, ...data)
|
package/classes/Table.js
CHANGED
|
@@ -707,15 +707,16 @@ export class Table extends ScrollableComponent
|
|
|
707
707
|
/**
|
|
708
708
|
* Sets or gets a row and a column of selected cell.
|
|
709
709
|
*
|
|
710
|
-
* @param {number} [
|
|
710
|
+
* @param {number|TableCell} [row_or_cell] - Row or a TableCell object. (Original order is used, sorting is disregarded.)
|
|
711
711
|
* @param {number} [column] - Column of a cell (required if row is specified). (Original order is used, column reordering is disregarded.)
|
|
712
|
-
* @return {
|
|
712
|
+
* @return {TableCell|Table} When both `row` and `cell` are passed, an instance of `this` Table is returned, otherwise a currently selected `TableCell` object is returned, or NULL if there is no selection.
|
|
713
713
|
*/
|
|
714
714
|
selectedCell(...args)
|
|
715
715
|
{
|
|
716
|
-
if(args.length >
|
|
716
|
+
if(args.length > 0)
|
|
717
717
|
{
|
|
718
|
-
|
|
718
|
+
const cell = (typeof args[0] === "object") ? args[0] : {row: parseInt(args[0]), col: parseInt(args[1])};
|
|
719
|
+
return this.property("selectedCell", [cell]);
|
|
719
720
|
}
|
|
720
721
|
else
|
|
721
722
|
{
|
|
@@ -729,21 +730,20 @@ export class Table extends ScrollableComponent
|
|
|
729
730
|
* Pass `null` as a first argument to stop editing currently edited cell. Do it before reading data from the Table to make sure the cell editor commits it's new value to the Table's data.
|
|
730
731
|
* When called with no arguments, returns the cell currently being edited, or `null` if no cell is being edited.
|
|
731
732
|
*
|
|
732
|
-
* @param {number} [
|
|
733
|
+
* @param {number|TableCell} [row_or_cell] - Row index of the cell or a TableCell object to edit, or `null` to stop editing currently edited cell (if any).
|
|
733
734
|
* @param {number} [column] - Column index of the cell to edit.
|
|
734
735
|
* @param {boolean} [new_order=false] - Specified if row and column should be interpreted as new index as displayed (after row sorting and column reordering) or not.
|
|
735
|
-
* @return {
|
|
736
|
+
* @return {TableCell|null|Table} When row and cell is specified, an instance of `this` Table is returned, otherwise a currently edited cell is retuned of `null` if no cell is being edited.
|
|
736
737
|
* @example <h2>Stop editing before reading Table data</h2>
|
|
737
738
|
* if(table.editingCell() != null) table.editingCell(null); // stop editing a cell to commit its changes
|
|
738
739
|
* const _rows = table.rows(); // read new data
|
|
739
740
|
*/
|
|
740
741
|
editingCell(...args)
|
|
741
742
|
{
|
|
742
|
-
let msg = {control: this.id};
|
|
743
|
-
|
|
744
743
|
if(args.length > 0)
|
|
745
744
|
{
|
|
746
|
-
|
|
745
|
+
const cell = args[0] == null ? null : (typeof args[0] === "object") ? args[0] : {row: parseInt(args[0]), col: parseInt(args[1])};
|
|
746
|
+
ui.sendToGUI({control:this.id, set: "editingCell", value: cell, data: {new_order: (args[2] === true)}});
|
|
747
747
|
return this;
|
|
748
748
|
}
|
|
749
749
|
else
|
|
@@ -873,11 +873,11 @@ export class Table extends ScrollableComponent
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
/**
|
|
876
|
-
* Gets a
|
|
876
|
+
* Gets a TableCell {row,column} located at specified X and Y coordinates relative to the Table's top-left corner.
|
|
877
877
|
*
|
|
878
878
|
* @param {number} x - X
|
|
879
879
|
* @param {number} y - Y
|
|
880
|
-
* @return {
|
|
880
|
+
* @return {TableCell|null} Returns the cell at specified location, or `null` if the coordinates are outside any cell.
|
|
881
881
|
*/
|
|
882
882
|
cellAt(x, y)
|
|
883
883
|
{
|
package/classes/UIComponent.js
CHANGED
|
@@ -267,7 +267,7 @@ class UIComponent
|
|
|
267
267
|
* Gets a previous sibling component. If this component wasn't added to any container component, then `null` is returned.
|
|
268
268
|
* @readonly
|
|
269
269
|
* @type {UIComponent|null}
|
|
270
|
-
* @since 1.0.
|
|
270
|
+
* @since 1.0.2
|
|
271
271
|
*/
|
|
272
272
|
get previousSibling()
|
|
273
273
|
{
|
|
@@ -281,7 +281,7 @@ class UIComponent
|
|
|
281
281
|
* Gets a next sibling component. If this component wasn't added to any container component, then `null` is returned.
|
|
282
282
|
* @readonly
|
|
283
283
|
* @type {UIComponent|null}
|
|
284
|
-
* @since 1.0.
|
|
284
|
+
* @since 1.0.2
|
|
285
285
|
*/
|
|
286
286
|
get nextSibling()
|
|
287
287
|
{
|
|
@@ -294,7 +294,7 @@ class UIComponent
|
|
|
294
294
|
* Gets an array of sibling components.
|
|
295
295
|
* @readonly
|
|
296
296
|
* @type {UIComponent[]}
|
|
297
|
-
* @since 1.0.
|
|
297
|
+
* @since 1.0.2
|
|
298
298
|
*/
|
|
299
299
|
get siblings()
|
|
300
300
|
{
|
|
@@ -399,7 +399,7 @@ class UIComponent
|
|
|
399
399
|
* @param {boolean} [recursive=false] - Set to true to also destroy all of its descendants recursively
|
|
400
400
|
* @returns {void}
|
|
401
401
|
*/
|
|
402
|
-
destroy(
|
|
402
|
+
destroy(recursive=false)
|
|
403
403
|
{
|
|
404
404
|
if(this.destroyed) return;
|
|
405
405
|
|
|
@@ -445,7 +445,7 @@ class UIComponent
|
|
|
445
445
|
|
|
446
446
|
/**
|
|
447
447
|
* Checks if this component is inside specified ancestor component (at any level, not just direct child).
|
|
448
|
-
* @param {
|
|
448
|
+
* @param {Object} ancestor - Ancestor component to test against
|
|
449
449
|
* @return {boolean}
|
|
450
450
|
* @see ComponentContainer#contains
|
|
451
451
|
*/
|
|
@@ -662,7 +662,6 @@ class UIComponent
|
|
|
662
662
|
/**
|
|
663
663
|
* @internal
|
|
664
664
|
* @ignore
|
|
665
|
-
* @private
|
|
666
665
|
* @param {string} property
|
|
667
666
|
* @param {any} value
|
|
668
667
|
* @return {any}
|
|
@@ -697,7 +696,6 @@ class UIComponent
|
|
|
697
696
|
* @return {Function[]|this} If only the `name` argument is provided, returns an array of registered callback functions. Otherwise, returns `this` component.
|
|
698
697
|
* @internal
|
|
699
698
|
* @ignore
|
|
700
|
-
* @private
|
|
701
699
|
* @example
|
|
702
700
|
* const _callbacks_array = button.event("onAction"); // gets an array of previously registered handler functions
|
|
703
701
|
* button.event("onAction", _callbacks_array[0], true); // unregisters callback function, same as button.onAction(_callbacks_array[0], true);
|
|
@@ -1175,7 +1173,6 @@ class UIComponent
|
|
|
1175
1173
|
if(this === menu || typeof menu !== "object" || !(menu instanceof globalThis.ContextMenu)) // can't use !(menu instanceof ContextMenu) because ContextMenu imports this class, thus would create circular import.
|
|
1176
1174
|
{
|
|
1177
1175
|
throw new Error(ui._msg[10]);
|
|
1178
|
-
return this;
|
|
1179
1176
|
}
|
|
1180
1177
|
|
|
1181
1178
|
if(this.#context_menu != null) this.contextMenu(null); // remove existing menu before setting a new one
|
package/functions.js
CHANGED
|
@@ -212,10 +212,10 @@ export function confirm(message, window = null)
|
|
|
212
212
|
*
|
|
213
213
|
* @param {string} message - String message to user. It can be plain text or HTML.
|
|
214
214
|
* @param {string} [title=""] - Dialog window title shown in the title bar of the window
|
|
215
|
-
* @param {string[]} [buttons=["OK","Cancel"]] - An
|
|
215
|
+
* @param {string[]} [buttons=["[OK]","Cancel"]] - An array of button names. Indicate a default button by surrounding the text with square brackets like so: "[OK]"
|
|
216
216
|
* @param {MessageIcon|string} [icon=null] - One of MessageIcon icons, or an absolute path to an image from a file system.
|
|
217
217
|
* @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.
|
|
218
|
-
* @return {number|
|
|
218
|
+
* @return {number|null} Returns a zero-based number of a clicked button, or `null` if the dialog window was closed without clicking provided buttons.
|
|
219
219
|
* @global
|
|
220
220
|
* @example <h2>Usage example</h2>
|
|
221
221
|
* let response = dialog("Are you ready?", "Confirm readiness", ["Yes", "No", "[Maybe]"], MessageIcon.Question, window);
|
|
@@ -229,7 +229,7 @@ export function confirm(message, window = null)
|
|
|
229
229
|
* @example <h2>Using custom image</h2>
|
|
230
230
|
* let response = dialog("Is this you?", "Question #5", ["Yes","[No]"], "C://User/John/profile_icon.jpg", window);
|
|
231
231
|
*/
|
|
232
|
-
export function dialog(message, title = "", buttons = ["OK", "Cancel"], icon = null, window = null)
|
|
232
|
+
export function dialog(message, title = "", buttons = ["[OK]", "Cancel"], icon = null, window = null)
|
|
233
233
|
{
|
|
234
234
|
// find first visible window
|
|
235
235
|
if(window == null)
|
package/icon.png
CHANGED
|
Binary file
|
package/jar/gui-11.jar
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/typedefs.js
CHANGED
|
@@ -695,13 +695,13 @@
|
|
|
695
695
|
/**
|
|
696
696
|
* Table cell coordinates containing column and row property.
|
|
697
697
|
*
|
|
698
|
-
* @typedef {Object}
|
|
698
|
+
* @typedef {Object} TableCell
|
|
699
699
|
* @property {number} column - a column index of the cell
|
|
700
700
|
* @property {number} row - a row index of the cell
|
|
701
701
|
*
|
|
702
702
|
* @see Table#cellAt
|
|
703
|
-
* @see Table#
|
|
704
|
-
* @see Table#
|
|
703
|
+
* @see Table#selectedCell
|
|
704
|
+
* @see Table#editingCell
|
|
705
705
|
*
|
|
706
706
|
*/
|
|
707
707
|
|
package/types/SwingUI.d.ts
CHANGED
|
@@ -295,6 +295,14 @@ export class SwingUI {
|
|
|
295
295
|
* );
|
|
296
296
|
*/
|
|
297
297
|
ui(...args: any[]): string | SwingUI;
|
|
298
|
+
/**
|
|
299
|
+
* Sets/get whether double-buffering should be used in rendering GUI in Java. Disabling may help to fix some graphical issues in Linux if flickering happens on component repaint.
|
|
300
|
+
*
|
|
301
|
+
* @param {boolean} enabled - `true` to enable double-buffering (default), `false` to disable.
|
|
302
|
+
* @return {SwingUI|boolean} When setting a value, an instance of this `ui` object is returned, otherwise a current value is returned.
|
|
303
|
+
* @since 1.0.5
|
|
304
|
+
*/
|
|
305
|
+
doubleBuffer(...args: any[]): SwingUI | boolean;
|
|
298
306
|
/**
|
|
299
307
|
* Shows a message dialog window like alert() in web browser.
|
|
300
308
|
*
|
|
@@ -38,7 +38,7 @@ export class ComponentContainer extends UIComponent {
|
|
|
38
38
|
* 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
39
|
*
|
|
40
40
|
* @readonly
|
|
41
|
-
* @type {
|
|
41
|
+
* @type {UIComponent[]}
|
|
42
42
|
* @example <h2>Looping through Window's components</h2>
|
|
43
43
|
* // method 1
|
|
44
44
|
* for(child of window.children)
|
|
@@ -59,7 +59,7 @@ export class ComponentContainer extends UIComponent {
|
|
|
59
59
|
* ...
|
|
60
60
|
* });
|
|
61
61
|
*/
|
|
62
|
-
readonly get children():
|
|
62
|
+
readonly get children(): UIComponent[];
|
|
63
63
|
/**
|
|
64
64
|
* Gets the number of components added to this container.
|
|
65
65
|
* @readonly
|
|
@@ -76,15 +76,15 @@ export class ComponentContainer extends UIComponent {
|
|
|
76
76
|
/**
|
|
77
77
|
* Gets or sets the index of a child component within this container. Setting new index changes z-order of the component.
|
|
78
78
|
*
|
|
79
|
-
* @param {
|
|
79
|
+
* @param {UIComponent} child - Child component
|
|
80
80
|
* @param {number} [new_index] - The new index to assign to the child. Moves the component in z-order.
|
|
81
81
|
* @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
82
|
*/
|
|
83
|
-
childIndex(child:
|
|
83
|
+
childIndex(child: UIComponent, new_index?: number): this | null | number;
|
|
84
84
|
/**
|
|
85
85
|
* Adds a child component to this container component.
|
|
86
86
|
*
|
|
87
|
-
* @param {
|
|
87
|
+
* @param {UIComponent} component - UI Component that can be a child of this component.
|
|
88
88
|
* @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
89
|
* @returns {this} Returns an instance of `this` component for chaining.
|
|
90
90
|
* @see UIComponent#addTo
|
|
@@ -94,24 +94,24 @@ export class ComponentContainer extends UIComponent {
|
|
|
94
94
|
* @example <h2>Adding a component at specified index</h2>
|
|
95
95
|
* tabs.addChild(new Panel(), {text: "Registration", enabled: true, tooltip: "Create new account", icon: "images/user.png"});
|
|
96
96
|
*/
|
|
97
|
-
addChild(component:
|
|
97
|
+
addChild(component: UIComponent, ...args: any[]): this;
|
|
98
98
|
/**
|
|
99
99
|
* Removes component's child by child object or child index.
|
|
100
100
|
*
|
|
101
|
-
* @param {
|
|
101
|
+
* @param {UIComponent|number} child_or_index - Child component object or index of the child.
|
|
102
102
|
* @param {boolean} [recursive=false] - Boolean indicates if all descendents of this child should also be removed.
|
|
103
103
|
* @returns {UIComponent|null} The removed child component, or `null` if there is no child at specified index.
|
|
104
104
|
*/
|
|
105
|
-
removeChild(child_or_index:
|
|
105
|
+
removeChild(child_or_index: UIComponent | number, recursive?: boolean): UIComponent | null;
|
|
106
106
|
/**
|
|
107
107
|
* Checks if passed component is a descendant of this container component.
|
|
108
108
|
*
|
|
109
|
-
* @param descendant - Child component to check.
|
|
109
|
+
* @param {UIComponent} descendant - Child component to check.
|
|
110
110
|
* @returns {boolean} If the descendant component is inside of this component.
|
|
111
111
|
* @throws {TypeError} When passed argument is not an instance of UIComponent.
|
|
112
112
|
* @see UIComponent#insideOf
|
|
113
113
|
*/
|
|
114
|
-
contains(descendant:
|
|
114
|
+
contains(descendant: UIComponent): boolean;
|
|
115
115
|
/**
|
|
116
116
|
* Gets, registers or unregisters an event handler function for container-related events
|
|
117
117
|
* 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 {
|
|
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:
|
|
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
|
*
|
|
@@ -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 {
|
|
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:
|
|
21
|
+
addChild(component: UIComponent, ...data: any[]): this;
|
|
22
22
|
}
|
|
23
23
|
import { ComponentContainer } from "./ComponentContainer.js";
|
package/types/classes/Table.d.ts
CHANGED
|
@@ -466,26 +466,26 @@ export class Table extends ScrollableComponent {
|
|
|
466
466
|
/**
|
|
467
467
|
* Sets or gets a row and a column of selected cell.
|
|
468
468
|
*
|
|
469
|
-
* @param {number} [
|
|
469
|
+
* @param {number|TableCell} [row_or_cell] - Row or a TableCell object. (Original order is used, sorting is disregarded.)
|
|
470
470
|
* @param {number} [column] - Column of a cell (required if row is specified). (Original order is used, column reordering is disregarded.)
|
|
471
|
-
* @return {
|
|
471
|
+
* @return {TableCell|Table} When both `row` and `cell` are passed, an instance of `this` Table is returned, otherwise a currently selected `TableCell` object is returned, or NULL if there is no selection.
|
|
472
472
|
*/
|
|
473
|
-
selectedCell(...args: any[]):
|
|
473
|
+
selectedCell(...args: any[]): TableCell | Table;
|
|
474
474
|
/**
|
|
475
475
|
* Gets or sets the cell currently being edited.
|
|
476
476
|
* When `row` and `column` are provided and are valid, the specified cell enters edit mode.
|
|
477
477
|
* Pass `null` as a first argument to stop editing currently edited cell. Do it before reading data from the Table to make sure the cell editor commits it's new value to the Table's data.
|
|
478
478
|
* When called with no arguments, returns the cell currently being edited, or `null` if no cell is being edited.
|
|
479
479
|
*
|
|
480
|
-
* @param {number} [
|
|
480
|
+
* @param {number|TableCell} [row_or_cell] - Row index of the cell or a TableCell object to edit, or `null` to stop editing currently edited cell (if any).
|
|
481
481
|
* @param {number} [column] - Column index of the cell to edit.
|
|
482
482
|
* @param {boolean} [new_order=false] - Specified if row and column should be interpreted as new index as displayed (after row sorting and column reordering) or not.
|
|
483
|
-
* @return {
|
|
483
|
+
* @return {TableCell|null|Table} When row and cell is specified, an instance of `this` Table is returned, otherwise a currently edited cell is retuned of `null` if no cell is being edited.
|
|
484
484
|
* @example <h2>Stop editing before reading Table data</h2>
|
|
485
485
|
* if(table.editingCell() != null) table.editingCell(null); // stop editing a cell to commit its changes
|
|
486
486
|
* const _rows = table.rows(); // read new data
|
|
487
487
|
*/
|
|
488
|
-
editingCell(...args: any[]):
|
|
488
|
+
editingCell(...args: any[]): TableCell | null | Table;
|
|
489
489
|
/**
|
|
490
490
|
* Sets or gets whether sorting can be toggled to unsorted state.
|
|
491
491
|
*
|
|
@@ -573,13 +573,13 @@ export class Table extends ScrollableComponent {
|
|
|
573
573
|
height: number;
|
|
574
574
|
};
|
|
575
575
|
/**
|
|
576
|
-
* Gets a
|
|
576
|
+
* Gets a TableCell {row,column} located at specified X and Y coordinates relative to the Table's top-left corner.
|
|
577
577
|
*
|
|
578
578
|
* @param {number} x - X
|
|
579
579
|
* @param {number} y - Y
|
|
580
|
-
* @return {
|
|
580
|
+
* @return {TableCell|null} Returns the cell at specified location, or `null` if the coordinates are outside any cell.
|
|
581
581
|
*/
|
|
582
|
-
cellAt(x: number, y: number):
|
|
582
|
+
cellAt(x: number, y: number): TableCell | null;
|
|
583
583
|
/**
|
|
584
584
|
* Sets or gets how many quick mouse clicks on editable cells are required to change the cell to editing mode.
|
|
585
585
|
*
|
|
@@ -98,21 +98,21 @@ export class UIComponent {
|
|
|
98
98
|
* Gets a previous sibling component. If this component wasn't added to any container component, then `null` is returned.
|
|
99
99
|
* @readonly
|
|
100
100
|
* @type {UIComponent|null}
|
|
101
|
-
* @since 1.0.
|
|
101
|
+
* @since 1.0.2
|
|
102
102
|
*/
|
|
103
103
|
readonly get previousSibling(): UIComponent | null;
|
|
104
104
|
/**
|
|
105
105
|
* Gets a next sibling component. If this component wasn't added to any container component, then `null` is returned.
|
|
106
106
|
* @readonly
|
|
107
107
|
* @type {UIComponent|null}
|
|
108
|
-
* @since 1.0.
|
|
108
|
+
* @since 1.0.2
|
|
109
109
|
*/
|
|
110
110
|
readonly get nextSibling(): UIComponent | null;
|
|
111
111
|
/**
|
|
112
112
|
* Gets an array of sibling components.
|
|
113
113
|
* @readonly
|
|
114
114
|
* @type {UIComponent[]}
|
|
115
|
-
* @since 1.0.
|
|
115
|
+
* @since 1.0.2
|
|
116
116
|
*/
|
|
117
117
|
readonly get siblings(): UIComponent[];
|
|
118
118
|
/**
|
|
@@ -166,7 +166,7 @@ export class UIComponent {
|
|
|
166
166
|
* @param {boolean} [recursive=false] - Set to true to also destroy all of its descendants recursively
|
|
167
167
|
* @returns {void}
|
|
168
168
|
*/
|
|
169
|
-
destroy(
|
|
169
|
+
destroy(recursive?: boolean): void;
|
|
170
170
|
destroyed: boolean | undefined;
|
|
171
171
|
/**
|
|
172
172
|
* 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.
|
|
@@ -176,11 +176,11 @@ export class UIComponent {
|
|
|
176
176
|
verifyComponent(): this;
|
|
177
177
|
/**
|
|
178
178
|
* Checks if this component is inside specified ancestor component (at any level, not just direct child).
|
|
179
|
-
* @param {
|
|
179
|
+
* @param {Object} ancestor - Ancestor component to test against
|
|
180
180
|
* @return {boolean}
|
|
181
181
|
* @see ComponentContainer#contains
|
|
182
182
|
*/
|
|
183
|
-
insideOf(ancestor:
|
|
183
|
+
insideOf(ancestor: Object): boolean;
|
|
184
184
|
/**
|
|
185
185
|
* Sets or gets component's visibility.
|
|
186
186
|
* NOTE: Window and InternalWindow components visibility is set to `false` by default. Use .visible(true) or .show() to make it visible.
|
|
@@ -257,12 +257,11 @@ export class UIComponent {
|
|
|
257
257
|
/**
|
|
258
258
|
* @internal
|
|
259
259
|
* @ignore
|
|
260
|
-
* @private
|
|
261
260
|
* @param {string} property
|
|
262
261
|
* @param {any} value
|
|
263
262
|
* @return {any}
|
|
264
263
|
*/
|
|
265
|
-
|
|
264
|
+
property(property: string, ...args: any[]): any;
|
|
266
265
|
/**
|
|
267
266
|
* Registers, unregisters, and gets an event handler callback function for a specified events.
|
|
268
267
|
*
|
|
@@ -276,13 +275,12 @@ export class UIComponent {
|
|
|
276
275
|
* @return {Function[]|this} If only the `name` argument is provided, returns an array of registered callback functions. Otherwise, returns `this` component.
|
|
277
276
|
* @internal
|
|
278
277
|
* @ignore
|
|
279
|
-
* @private
|
|
280
278
|
* @example
|
|
281
279
|
* const _callbacks_array = button.event("onAction"); // gets an array of previously registered handler functions
|
|
282
280
|
* button.event("onAction", _callbacks_array[0], true); // unregisters callback function, same as button.onAction(_callbacks_array[0], true);
|
|
283
281
|
* button.event("onAction", e => {console.debug(e);}); // registers new event handler function, same as button.onAction(e => {console.debug(e);});
|
|
284
282
|
*/
|
|
285
|
-
|
|
283
|
+
event(name: string, callback?: (arg0: Object) => any | null, remove?: boolean): Function[] | this;
|
|
286
284
|
/**
|
|
287
285
|
* Sets or gets the background color of the component. <br />
|
|
288
286
|
* <br />
|
package/types/functions.d.ts
CHANGED
|
@@ -89,10 +89,10 @@ export function confirm(message: string, window?: Window): boolean;
|
|
|
89
89
|
*
|
|
90
90
|
* @param {string} message - String message to user. It can be plain text or HTML.
|
|
91
91
|
* @param {string} [title=""] - Dialog window title shown in the title bar of the window
|
|
92
|
-
* @param {string[]} [buttons=["OK","Cancel"]] - An
|
|
92
|
+
* @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
93
|
* @param {MessageIcon|string} [icon=null] - One of MessageIcon icons, or an absolute path to an image from a file system.
|
|
94
94
|
* @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|
|
|
95
|
+
* @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
96
|
* @global
|
|
97
97
|
* @example <h2>Usage example</h2>
|
|
98
98
|
* let response = dialog("Are you ready?", "Confirm readiness", ["Yes", "No", "[Maybe]"], MessageIcon.Question, window);
|
|
@@ -106,4 +106,4 @@ export function confirm(message: string, window?: Window): boolean;
|
|
|
106
106
|
* @example <h2>Using custom image</h2>
|
|
107
107
|
* let response = dialog("Is this you?", "Question #5", ["Yes","[No]"], "C://User/John/profile_icon.jpg", window);
|
|
108
108
|
*/
|
|
109
|
-
export function dialog(message: string, title?: string, buttons?: string[], icon?: MessageIcon | string, window?: Window): number |
|
|
109
|
+
export function dialog(message: string, title?: string, buttons?: string[], icon?: MessageIcon | string, window?: Window): number | null;
|
package/ui-process-manager.js
CHANGED
|
@@ -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")
|
|
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
|
{
|