Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e8df6bd
Removed deprecated URL call.
HackusatePvP Nov 18, 2025
0b9bbc2
Set connection timeout to 1000 milliseconds.
HackusatePvP Nov 18, 2025
829d5d9
Added DownloadListener callback when downloading an asset.
HackusatePvP Nov 18, 2025
6a69bd4
Added utilities for comparing software versions.
HackusatePvP Nov 18, 2025
7d3ec56
Added utility for unzipping files.
HackusatePvP Nov 18, 2025
d68f14c
Updated pom version.
HackusatePvP Nov 18, 2025
76f8f28
Improved LimitedHasMap.
HackusatePvP Nov 18, 2025
b44e825
Window will now use the Container cached node if available.
HackusatePvP Nov 18, 2025
622fd5f
Fixed issues with SliderOverlay.
HackusatePvP Nov 22, 2025
12a42dc
Fixed parsing issues with some versioning schemes.
HackusatePvP Nov 22, 2025
9b90107
Fixed container positioning issues.
HackusatePvP Nov 23, 2025
6f3edcc
Fixed pathing for some linux systems.
HackusatePvP Nov 23, 2025
cf8cb06
Linux appdata will be pathed to .var
HackusatePvP Nov 26, 2025
19e96bf
Added support Linux support for ProcessUtil
HackusatePvP Nov 27, 2025
b4caf2d
Appdata directory will now create if it doesn't exist.
HackusatePvP Nov 27, 2025
5713146
Added function to create zip files.
HackusatePvP Nov 27, 2025
e5e653e
Added setMaxSize for consistency.
HackusatePvP Nov 29, 2025
08e95a4
Removed scaleY and scaleX.
HackusatePvP Nov 29, 2025
671f077
Added IconOverlay.
HackusatePvP Nov 29, 2025
46cd918
Added copy function for InfoFile.
HackusatePvP Nov 29, 2025
0c37599
Fixed scrolling conditions not being applied.
HackusatePvP Nov 30, 2025
f9ab2e0
Views can now hold special properties and data.
HackusatePvP Nov 30, 2025
1ede0fc
Improved version examples.
HackusatePvP Nov 30, 2025
dd67216
Fixed Windows 11 pathing issues.
HackusatePvP Dec 1, 2025
e2cf4b0
Removed system print lines.
HackusatePvP Dec 1, 2025
7a181b7
Converted system print to logger.
HackusatePvP Dec 1, 2025
5e885fd
Added default item to FileChooserOverlay.
HackusatePvP Dec 1, 2025
fa6501c
Added FileSaveOverlay.
HackusatePvP Dec 1, 2025
e341b0c
Fixed TextField text being reset after layout changes.
HackusatePvP Dec 1, 2025
94fba5c
Replaced system err with logger.
HackusatePvP Dec 1, 2025
9379c45
Fixed rendering order issues when the index was being shuffled.
HackusatePvP Dec 1, 2025
5507d21
Added commons-compress and plexus-archiver.
HackusatePvP Dec 7, 2025
8546c1c
Added key parameter to set static pass keys.
HackusatePvP Dec 7, 2025
35cf2d9
Exception will now be logged instead of thrown.
HackusatePvP Dec 7, 2025
b27755e
Added logging for api calls.
HackusatePvP Dec 7, 2025
974c504
Added tar.gz file support.
HackusatePvP Dec 7, 2025
3031618
Button icon will now use IconOverlay.
HackusatePvP Dec 7, 2025
d5a3f68
Icon color now defaults to white.
HackusatePvP Dec 7, 2025
ccc4ac7
Removed FontIcon parameter.
HackusatePvP Dec 11, 2025
725bf3c
Added text alignment.
HackusatePvP Dec 11, 2025
d6a8f23
Changed linux appdata back to .local.
HackusatePvP Dec 11, 2025
572f2b4
Added RingProgressOverlay.
HackusatePvP Dec 12, 2025
6a5918d
Fixed height issues with the window.
HackusatePvP Dec 12, 2025
43fa781
Node will reflect scroll position changes.
HackusatePvP Dec 12, 2025
917602d
Removed invalid border position.
HackusatePvP Dec 17, 2025
c20b8e9
Removed old RenJava image pathing.
HackusatePvP Dec 17, 2025
d6f36bb
Added more removeElement functions.
HackusatePvP Dec 17, 2025
5f6e1b0
Styling will be applied automatically to the node.
HackusatePvP Dec 17, 2025
6a07cea
Removed empty mouse handler.
HackusatePvP Dec 31, 2025
7154b68
Fixed possible race condition when the submit handler was set before …
HackusatePvP Dec 31, 2025
a2c4f80
Cleaned up TextAreaOverlay constructors.
HackusatePvP Dec 31, 2025
c0d1166
Added text alignment parameter.
HackusatePvP Dec 31, 2025
053e2cd
Pane will request the layout to be recalculated after adding the node…
HackusatePvP Dec 31, 2025
0603d07
Added documentation for adding pre-rendered nodes to container.
HackusatePvP Dec 31, 2025
5a5a78f
Added oshi-core.
HackusatePvP Dec 31, 2025
1a5affe
Fixed versioning scheme returning null if matcher didn't pass.
HackusatePvP Dec 31, 2025
a053c97
Moved mouse events to Element class.
HackusatePvP Jan 4, 2026
7378531
Fixed casting issues when using a different layout for scroll container.
HackusatePvP Jan 13, 2026
ca65cfd
Fixed inconsistent return type for choice box selection.
HackusatePvP Jan 13, 2026
e289e50
Added graphics card information.
HackusatePvP Jan 13, 2026
cabc335
Added getFirstElement and getLastElement.
HackusatePvP Jan 14, 2026
2598461
Added contains element method.
HackusatePvP Jan 19, 2026
fecc878
Added hash checking for downloads.
HackusatePvP Apr 3, 2026
badef7d
Added exceptions when using an invalid addElement function.
HackusatePvP Apr 8, 2026
456f45a
Added DownloadContainer for software updates.
HackusatePvP Apr 8, 2026
3c2358f
Reverted ImageLoader constructors to support RenJava.
HackusatePvP Apr 8, 2026
1095ec9
Added custom css styling to buttons.
HackusatePvP Apr 8, 2026
79e7c16
Added generic events to overlays.
HackusatePvP Apr 8, 2026
be314c4
Added generic events to elements.
HackusatePvP Apr 8, 2026
6bd89c9
Removed old clean function.
HackusatePvP Apr 8, 2026
2ed944e
Migrated from plain text to binary.
HackusatePvP Apr 8, 2026
ebe34f5
Downloads now support hash checking.
HackusatePvP Apr 8, 2026
df32644
FontLoader no longer uses old RenJava API.
HackusatePvP Apr 8, 2026
b0c6b34
Removed old comments.
HackusatePvP Apr 10, 2026
95f122f
Removed old comments.
HackusatePvP Apr 12, 2026
f987dfa
Added JavaDoc comments.
HackusatePvP Apr 12, 2026
bffa15a
Renderer will now automatically draw background and border updates.
HackusatePvP May 6, 2026
0ceb256
Fixed logical issue with GitHub request property.
HackusatePvP May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.piitex.engine</groupId>
<artifactId>ren-engine</artifactId>
<version>1.0.6-SNAPSHOT</version>
<version>1.0.7-SNAPSHOT</version>
<name>RenEngine</name>

<properties>
Expand Down Expand Up @@ -119,6 +119,23 @@
<version>6.7</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.28.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.10.4</version>
</dependency>

<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.9.1</version>
</dependency>

</dependencies>

<distributionManagement>
Expand Down
218 changes: 201 additions & 17 deletions src/main/java/me/piitex/engine/Element.java
Original file line number Diff line number Diff line change
@@ -1,49 +1,67 @@
package me.piitex.engine;


import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import me.piitex.engine.containers.Container;
import me.piitex.engine.exceptions.NodeNotDefinedException;
import me.piitex.engine.hanlders.events.*;
import me.piitex.engine.layouts.Layout;
import me.piitex.engine.overlays.ImageOverlay;
import me.piitex.engine.overlays.Overlay;
import me.piitex.engine.overlays.TextOverlay;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.function.Consumer;

/**
* Represents a graphical element that can be rendered to the {@link Window} or a {@link Container}.
* Represents the foundational graphical element that can be rendered inside a {@link Renderer}
* (which includes {@link Container} and {@link Layout}).
* <p>
* This abstract base class provides the core lifecycle, state management, and event handling for all
* renderable components within the GUI framework. It acts as a bridge between the engine's logical
* representations and the underlying JavaFX {@link Node}.
* </p>
* <p>
* This is an abstract base class for all renderable elements in the GUI framework.
* Elements are organized by their rendering index, which determines the order in which
* they are drawn. A lower index means the element will be rendered earlier (underneath others).
* Elements are heavily dependent on their rendering index (Z-order). A lower index dictates that the
* element is drawn earlier, placing it underneath elements with a higher index.
* </p>
*
* @see Renderer
* @see Container
* @see Overlay
* @see Layout
*/
public abstract class Element {
private int index = 0;
private boolean enabled = true;
private Node node; // Underlying JavaFX component
@Nullable private Node node; // Underlying JavaFX component
private Cursor cursor;
private Consumer<ElementHoverEvent> hoverConsumer;
private Consumer<ElementClickEvent> clickConsumer;
private Consumer<ElementExitEvent> mouseExitConsumer;
private Consumer<ElementClickReleaseEvent> clickReleaseConsumer;

private static final Logger logger = LoggerFactory.getLogger(Element.class);

/**
* Retrieves the rendering index of this element.
* Retrieves the rendering index (Z-order) of this element.
*
* @return The rendering index of the element. A lower value means the element is rendered earlier. An index of 0 results in automatic assignment. Use '1' as the lowest layer.
* @return The rendering index. A lower value indicates the element is rendered earlier (closer to the background).
* An index of 0 indicates automatic assignment by the engine. The lowest manual layer should generally be 1.
*/
public int getIndex() {
return index;
}

/**
* Sets the rendering index of this element.
* Sets the rendering index (Z-order) of this element.
* <p>
* An index of 1 will cause the element to be rendered first (at the bottom layer).
* Higher index values will render the element on top of those with lower indices. An index of 0 results in automatic assignment.
* Modifying this value allows you to control the depth of the element on the screen. Higher index values
* will render the element on top of those with lower indices. Set to 0 to let the engine automatically
* assign the index based on insertion order.
* </p>
*
* @param index The new rendering index for the element.
Expand All @@ -52,6 +70,16 @@ public void setIndex(int index) {
this.index = index;
}

/**
* Toggles the interactive state of the element.
* <p>
* When disabled, the underlying JavaFX node will no longer process user inputs or events.
* If the underlying {@link Node} has not been assembled or set yet, this will log an error
* rather than crashing the application.
* </p>
*
* @param enabled {@code true} to enable interactions, {@code false} to disable them.
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
if (getNode() != null) {
Expand All @@ -62,31 +90,187 @@ public void setEnabled(boolean enabled) {
}
}

/**
* Checks if the element is currently enabled for user interaction.
*
* @return {@code true} if the element is enabled, {@code false} otherwise.
*/
public boolean isEnabled() {
return enabled;
}

/**
* Retrieves the cached JavaFX {@link Node} associated with this element.
* <p>
* This cache is typically populated when the engine invokes the {@link #assemble()} method.
* If the element has not been assembled yet, this method will return null.
* </p>
*
* @return The cached JavaFX node if present, {@code null} otherwise.
*/
@Nullable
public Node getNode() {
return node;
}

/**
* Manually assigns the underlying JavaFX {@link Node} for this element.
*
* @param node The JavaFX node to associate with this engine element.
*/
public void setNode(Node node) {
this.node = node;
}

/**
* Assembles the element into its JavaFX {@link Node}.
* Retrieves the currently assigned mouse cursor for this element.
*
* @return The JavaFX {@link Cursor} applied to this element when hovered, or {@code null} if default.
*/
public Cursor getCursor() {
return cursor;
}

/**
* Sets a specific mouse cursor to display when the user hovers over this element.
* <p>
* For {@link Overlay}'s it will return the render functions. Examples: {@link TextOverlay#render()}, {@link ImageOverlay#render()}
* This automatically applies the cursor to the underlying JavaFX {@link Node} if it is currently cached.
* </p>
*
* @param cursor The JavaFX {@link Cursor} to display.
*/
public void setCursor(Cursor cursor) {
this.cursor = cursor;
if (node != null) {
node.setCursor(cursor);
}
}

/**
* Registers a callback to be fired when the user clicks on this element.
* <p>
* For {@link Layout}'s it will return the {@link Layout#render()} result.
* This wraps the native JavaFX {@link MouseEvent#MOUSE_CLICKED} event into a framework-specific {@link ElementClickEvent}.
* </p>
*
* @param clickConsumer The consumer to accept the click event logic.
*/
public void onClick(Consumer<ElementClickEvent> clickConsumer) {
this.clickConsumer = clickConsumer;

if (node != null) {
if (clickConsumer != null) {
node.addEventHandler(MouseEvent.MOUSE_CLICKED, mouseEvent -> {
clickConsumer.accept(new ElementClickEvent(this, mouseEvent, mouseEvent.getSceneX(), mouseEvent.getSceneY()));
});
}
}
}

/**
* Registers a callback to be fired when the user releases a mouse click on this element.
* <p>
* For {@link Container}'s it will return the {@link Container#build()} result.
* This wraps the native JavaFX {@link MouseEvent#MOUSE_RELEASED} event into a framework-specific {@link ElementClickReleaseEvent}.
* </p>
* @return The constructed node.
*
* @param clickReleaseConsumer The consumer to accept the click release event logic.
*/
public void onClickRelease(Consumer<ElementClickReleaseEvent> clickReleaseConsumer) {
this.clickReleaseConsumer = clickReleaseConsumer;

if (node != null) {
if (clickReleaseConsumer != null) {
node.addEventHandler(MouseEvent.MOUSE_RELEASED, mouseEvent -> {
clickReleaseConsumer.accept(new ElementClickReleaseEvent(this, mouseEvent));
});
}
}
}

/**
* Registers a callback to be fired when the user's mouse pointer enters the bounds of this element.
* <p>
* This wraps the native JavaFX {@link MouseEvent#MOUSE_ENTERED} event into a framework-specific {@link ElementHoverEvent}.
* </p>
*
* @param hoverConsumer The consumer to accept the hover event logic.
*/
public void onHover(Consumer<ElementHoverEvent> hoverConsumer) {
this.hoverConsumer = hoverConsumer;

if (node != null) {
if (hoverConsumer != null) {
node.addEventHandler(MouseEvent.MOUSE_ENTERED, mouseEvent -> {
hoverConsumer.accept(new ElementHoverEvent(this, mouseEvent));
});
}
}
}

/**
* Registers a callback to be fired when the user's mouse pointer exits the bounds of this element.
* <p>
* This wraps the native JavaFX {@link MouseEvent#MOUSE_EXITED} event into a framework-specific {@link ElementExitEvent}.
* </p>
*
* @param mouseExitConsumer The consumer to accept the mouse exit event logic.
*/
public void onMouseExit(Consumer<ElementExitEvent> mouseExitConsumer) {
this.mouseExitConsumer = mouseExitConsumer;

if (node != null) {
if (mouseExitConsumer != null) {
node.addEventHandler(MouseEvent.MOUSE_EXITED, mouseEvent -> {
mouseExitConsumer.accept(new ElementExitEvent(this, mouseEvent));
});
}
}
}

/**
* Retrieves the registered click event consumer.
* @return The consumer handling click events, or {@code null} if none is set.
*/
public Consumer<ElementClickEvent> getOnClick() {
return clickConsumer;
}

/**
* Retrieves the registered click release event consumer.
* @return The consumer handling click release events, or {@code null} if none is set.
*/
public Consumer<ElementClickReleaseEvent> getOnRelease() {
return clickReleaseConsumer;
}

/**
* Retrieves the registered mouse exit event consumer.
* @return The consumer handling mouse exit events, or {@code null} if none is set.
*/
public Consumer<ElementExitEvent> getOnMouseExit() {
return mouseExitConsumer;
}

/**
* Retrieves the registered mouse hover event consumer.
* @return The consumer handling mouse hover events, or {@code null} if none is set.
*/
public Consumer<ElementHoverEvent> getOnHover() {
return hoverConsumer;
}

/**
* Compiles and constructs the engine element into a standard JavaFX {@link Node}.
* <p>
* This method is called by the engine during the rendering phase to translate custom elements
* into the native scene graph.
* </p>
* <ul>
* <li>For {@link Overlay} instances, this invokes their specific rendering functions (e.g., {@link TextOverlay#render()}).</li>
* <li>For {@link Layout} instances, this invokes {@link Layout#render()}.</li>
* <li>For {@link Container} instances, this invokes {@link Container#build()}.</li>
* </ul>
*
* @return The fully constructed JavaFX node ready for the scene graph.
*/
public abstract Node assemble();
}
}
Loading
Loading