swing-ui 1.0.6 → 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/SwingUI.js +1 -1
- 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 +0 -2
- package/classes/UIComponent.js +1 -1
- package/functions.js +3 -3
- package/icon.png +0 -0
- package/jar/gui-11.jar +0 -0
- package/package.json +1 -1
- 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/UIComponent.d.ts +1 -1
- package/types/functions.d.ts +3 -3
- package/ui-process-manager.js +1 -9
package/SwingUI.js
CHANGED
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
|
@@ -740,8 +740,6 @@ export class Table extends ScrollableComponent
|
|
|
740
740
|
*/
|
|
741
741
|
editingCell(...args)
|
|
742
742
|
{
|
|
743
|
-
let msg = {control: this.id};
|
|
744
|
-
|
|
745
743
|
if(args.length > 0)
|
|
746
744
|
{
|
|
747
745
|
const cell = args[0] == null ? null : (typeof args[0] === "object") ? args[0] : {row: parseInt(args[0]), col: parseInt(args[1])};
|
package/classes/UIComponent.js
CHANGED
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
|
@@ -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";
|
|
@@ -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.
|
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
|
{
|