Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

Commit 4855fec

Browse files
Merge pull request #2 from FoxesWorld/test
Updates
2 parents d6723cb + 3a5f68a commit 4855fec

9 files changed

Lines changed: 445 additions & 116 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,4 @@ bin/
3838
### Mac OS ###
3939
.DS_Store
4040
/src/main/resources/config/
41-
/src/main/resources/engine.json
42-
/src/main/resources/log4j2.xml
4341
/cache/

logs/lastlog.log

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
[03:30:18.666][INFO] ===== Engine Initialization =====
2-
[03:30:18.668][INFO]
1+
[07:39:48.308][INFO]
2+
╔════════════════════════════════════════╗
3+
║ ===== FoxEngine Initialization ===== ║
4+
║ Engine Version: 1.15.16 ║
5+
║ Operating System: windows ║
6+
║ Available Processors: 20 ║
7+
║ System Load Average: -1,00 ║
8+
║ Log Level: INFO ║
9+
╚════════════════════════════════════════╝
10+
311
_____ _____ _____
412
/\ \ /\ \ /\ \
513
/::\ \ /::\ \ /::\ \
@@ -20,37 +28,39 @@
2028
\:::\ \
2129
\:::\____\
2230
\::/ /
23-
\/____/
24-
[03:30:18.674][INFO] Engine Version: 1.15.15
25-
[03:30:18.674][INFO] Application Title: FoxesLauncher-1.24.1
26-
[03:30:18.674][INFO] Operating System: windows
27-
[03:30:18.674][INFO] Available Processors: 20
28-
[03:30:18.675][INFO] System Load Average: -1.0
29-
[03:30:18.675][INFO] Log Level: INFO
30-
[03:30:18.679][INFO] Log level set to INFO
31-
[03:30:18.762][INFO] Initializing ExecutorService with pool size: 10
32-
[03:30:18.763][WARN] executor-config.properties not found, using default settings.
33-
[03:30:18.763][INFO] Creating default ExecutorService with pool size: 10
34-
[03:30:18.884][INFO]forge-0 Sounds loaded successfully
35-
[03:30:19.087][INFO] FrameConstructor initialization
36-
[03:30:19.091][INFO] Building FrameConstructor...
37-
[03:30:19.210][INFO]forge-1 Initializing StyleProvider with path: assets/styles/
38-
[03:30:19.220][INFO]forge-1 Registering json adapter...
39-
[03:30:19.221][INFO]forge-1 Registering json5 adapter...
40-
[03:30:19.221][INFO]forge-1 Registered adapters: [json5, json]
41-
[03:30:19.233][INFO]forge-1 - Registered component: label
42-
[03:30:19.235][INFO]forge-1 - Registered component: progressBar
43-
[03:30:19.235][INFO]forge-1 - Registered component: button
44-
[03:30:19.235][INFO]forge-1 - Registered component: textArea
45-
[03:30:19.236][INFO]forge-1 - Registered component: checkBox
46-
[03:30:19.236][INFO]forge-1 - Registered component: textField
47-
[03:30:19.236][INFO]forge-1 - Registered component: spriteImage
48-
[03:30:19.237][INFO]forge-1 - Registered component: passField
49-
[03:30:19.237][INFO]forge-1 - Registered component: spinner
50-
[03:30:19.237][INFO]forge-1 - Registered component: multiButton
51-
[03:30:19.238][INFO]forge-1 - Registered component: dropBox
52-
[03:30:19.238][INFO]forge-1 - Registered component: slider
53-
[03:30:19.238][INFO]forge-1 - Registered component: compositeSlider
54-
[03:30:19.239][INFO]forge-1 - Registered component: fileSelector
55-
[03:30:19.239][INFO]forge-1 - Registered component: compositeComponent
56-
[03:30:19.345][INFO] Created font - mcfontBold
31+
\/____/
32+
— TestApp-1.0.0
33+
[07:39:48.315][INFO] Log level set to INFO
34+
[07:39:48.402][INFO] Initializing ExecutorService with pool size: 10
35+
[07:39:48.403][WARN] executor-config.properties not found, using default settings.
36+
[07:39:48.403][INFO] Creating default ExecutorService with pool size: 10
37+
[07:39:48.524][INFO]forge-0 Sounds loaded successfully
38+
[07:39:48.702][INFO] FrameConstructor: initialization started
39+
[07:39:48.702][INFO] FrameConstructor: building AppFrame from 'assets/frames/frame.json'
40+
[07:39:48.846][INFO] FrameConstructor: frame is visible (title='ЛисийМир', size=850x500)
41+
[07:39:48.846][INFO] FrameConstructor: frame successfully built from 'assets/frames/frame.json'
42+
[07:39:48.847][INFO] FrameConstructor: initialization completed
43+
[07:39:48.849][INFO]forge-1 Initializing StyleProvider with path: assets/styles/
44+
[07:39:48.861][INFO]forge-1 Registering json adapter...
45+
[07:39:48.861][INFO]forge-1 Registering json5 adapter...
46+
[07:39:48.861][INFO]forge-1 Registered adapters: [json5, json]
47+
[07:39:48.874][INFO]forge-1 - Registered component: label
48+
[07:39:48.874][INFO]forge-1 - Registered component: progressBar
49+
[07:39:48.875][INFO]forge-1 - Registered component: button
50+
[07:39:48.875][INFO]forge-1 - Registered component: textArea
51+
[07:39:48.875][INFO]forge-1 - Registered component: checkBox
52+
[07:39:48.876][INFO]forge-1 - Registered component: textField
53+
[07:39:48.876][INFO]forge-1 - Registered component: spriteImage
54+
[07:39:48.876][INFO]forge-1 - Registered component: passField
55+
[07:39:48.877][INFO]forge-1 - Registered component: spinner
56+
[07:39:48.877][INFO]forge-1 - Registered component: multiButton
57+
[07:39:48.877][INFO]forge-1 - Registered component: dropBox
58+
[07:39:48.878][INFO]forge-1 - Registered component: slider
59+
[07:39:48.878][INFO]forge-1 - Registered component: compositeSlider
60+
[07:39:48.878][INFO]forge-1 - Registered component: fileSelector
61+
[07:39:48.879][INFO]forge-1 - Registered component: compositeComponent
62+
[07:39:48.884][INFO]forge-1 ActionHandler created with mainFrame panel and listens [class org.foxesworld.engine.gui.components.multiButton.MultiButton, class org.foxesworld.engine.gui.components.button.Button]
63+
[07:39:48.974][INFO] FrameConstructor: frame focus gained
64+
[07:39:48.975][INFO] FrameConstructor: frame focus gained
65+
[07:39:49.004][INFO] Created font - mcfontBold
66+
[07:39:49.093][INFO] Created font - mcfont

src/main/java/org/foxesworld/engine/Engine.java

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,24 +165,30 @@ public Engine(int poolSize, String worker, Map<String, Class<?>> configFiles) {
165165
appTitle = engineData.getLauncherBrand() + '-' + engineData.getLauncherVersion();
166166
this.panelVisibility = new PanelVisibility(this);
167167

168-
LOGGER.info("===== Engine Initialization =====");
169-
LOGGER.info(this.engineInfo.getEngineBrand());
170-
LOGGER.info("Engine Version: {}", this.engineInfo.getEngineVersion());
171-
LOGGER.info("Application Title: {}", appTitle);
172-
LOGGER.info("Operating System: {}", currentOS);
173-
LOGGER.info("Available Processors: {}", osBean.getAvailableProcessors());
174-
LOGGER.info("System Load Average: {}", osBean.getSystemLoadAverage());
175-
LOGGER.info("Log Level: {}", engineData.getLogLevel());
176-
if(configFiles != null) {
177-
LOGGER.info("Configuration Files: {}", configFiles.keySet());
178-
}
168+
logEngineInfoBox(
169+
LOGGER,
170+
this.engineInfo.getEngineBrand(),
171+
this.engineInfo.getEngineVersion(),
172+
appTitle,
173+
currentOS,
174+
osBean,
175+
engineData.getLogLevel(),
176+
configFiles
177+
);
178+
179179

180180
this.FONTUTILS = new FontUtils(this);
181181
setLogLevel(Level.valueOf(engineData.getLogLevel()));
182182
executorServiceProvider = new ExecutorServiceProvider(poolSize, worker);
183183

184184
this.imageUtils = new ImageUtils();
185185
FlatIntelliJLaf.setup();
186+
187+
//Basic Components Initialisation
188+
this.LANG = new LanguageProvider(this, fileProperties.getLocaleFile(), 0);
189+
this.SOUND = new Sound(this, getClass().getClassLoader().getResourceAsStream(fileProperties.getSoundsFile()));
190+
this.frameConstructor = new FrameConstructor(this);
191+
this.CRYPTO = new CryptUtils();
186192
}
187193

188194
/**
@@ -195,6 +201,56 @@ public void setLogLevel(Level level) {
195201
LOGGER.info("Log level set to " + level);
196202
}
197203

204+
public static void logEngineInfoBox(
205+
Logger LOGGER,
206+
String engineBrand,
207+
String engineVersion,
208+
String appTitle,
209+
String currentOS,
210+
OperatingSystemMXBean osBean,
211+
String logLevel,
212+
Map<String, ?> configFiles // nullable
213+
) {
214+
String header = String.format(
215+
"%s \n— %s",
216+
engineBrand != null ? engineBrand : "Unknown Engine",
217+
appTitle != null ? appTitle : "Untitled"
218+
);
219+
220+
// Prepare lines
221+
List<String> lines = new ArrayList<>();
222+
lines.add("===== FoxEngine Initialization =====");
223+
lines.add(String.format("Engine Version: %s", engineVersion));
224+
lines.add(String.format("Operating System: %s", currentOS));
225+
if (osBean != null) {
226+
lines.add(String.format("Available Processors: %d", osBean.getAvailableProcessors()));
227+
lines.add(String.format("System Load Average: %.2f", osBean.getSystemLoadAverage()));
228+
}
229+
lines.add(String.format("Log Level: %s", logLevel));
230+
if (configFiles != null && !configFiles.isEmpty()) {
231+
lines.add(String.format("Configuration Files: %s", configFiles.keySet()));
232+
}
233+
234+
// Compute max width
235+
int max = 0;
236+
for (String l : lines) if (l.length() > max) max = l.length();
237+
int padding = 2; // left + right inner padding
238+
int innerWidth = max + padding * 2;
239+
240+
// Box drawing
241+
String top = "╔" + "═".repeat(innerWidth) + "╗\n";
242+
String middle = "";
243+
String bottom = "╚" + "═".repeat(innerWidth) + "╝";
244+
245+
for (String l : lines) {
246+
String padded = " ".repeat(padding) + l + " ".repeat(innerWidth - padding - l.length());
247+
middle += "║" + padded + "║\n";
248+
}
249+
String box = top + middle + bottom;
250+
LOGGER.info("\n" + box + "\n" + header );
251+
}
252+
253+
198254
/**
199255
* Abstract method for initializing the concrete engine implementation.
200256
* Implement application-specific initialization (load services, GUI, etc.).
@@ -676,6 +732,10 @@ public IconUtils getIconUtils() {
676732
return iconUtils;
677733
}
678734

735+
public FileProperties getFileProperties() {
736+
return fileProperties;
737+
}
738+
679739
/**
680740
* Sets the icon utilities.
681741
*

src/main/java/org/foxesworld/engine/Test.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
import org.foxesworld.engine.gui.GuiBuilder;
55
import org.foxesworld.engine.gui.components.ComponentAttributes;
66
import org.foxesworld.engine.gui.components.ComponentFactoryListener;
7-
import org.foxesworld.engine.gui.components.frame.FrameConstructor;
7+
import org.foxesworld.engine.gui.components.button.Button;
88
import org.foxesworld.engine.gui.components.frame.OptionGroups;
9+
import org.foxesworld.engine.gui.components.multiButton.MultiButton;
910
import org.foxesworld.engine.gui.styles.StyleProvider;
10-
import org.foxesworld.engine.locale.LanguageProvider;
11-
import org.foxesworld.engine.sound.Sound;
12-
import org.foxesworld.engine.utils.Crypt.CryptUtils;
1311
import org.foxesworld.engine.utils.IconUtils;
1412

1513
import javax.swing.*;
@@ -53,20 +51,17 @@ protected void preInit() {
5351
System.setProperty("AppDir", System.getenv("APPDATA"));
5452
System.setProperty("RamAmount", String.valueOf(Runtime.getRuntime().maxMemory() / 45));
5553

56-
this.LANG = new LanguageProvider(this, fileProperties.getLocaleFile(), 0);
57-
this.SOUND = new Sound(this, getClass().getClassLoader().getResourceAsStream(fileProperties.getSoundsFile()));
58-
this.frameConstructor = new FrameConstructor(this);
59-
this.CRYPTO = new CryptUtils();
6054
this.frameConstructor.setFocusStatusListener(this);
6155
}
6256

6357
@Override
6458
protected void postInit() {
59+
setActionHandler(new ActionHandler(this.getGuiBuilder(), "mainFrame", List.of(MultiButton.class, Button.class)));
6560
}
6661

6762
@Override
6863
public void onPanelsBuilt() {
69-
64+
this.getFrame().repaint();
7065
}
7166

7267
@Override
@@ -76,7 +71,6 @@ public void onAdditionalPanelBuild(JPanel panel) {
7671

7772
@Override
7873
public void onGuiBuilt() {
79-
this.getFrame().repaint();
8074
}
8175

8276
@Override
@@ -86,15 +80,15 @@ public void onPanelBuild(Map<String, OptionGroups> panels, String componentGroup
8680

8781
@Override
8882
public void actionPerformed(ActionEvent e) {
89-
83+
actionHandler.handleAction(e);
9084
}
9185

9286
@Override
9387
public void updateFocus(boolean hasFocus) {
9488

9589
}
9690

97-
class InitialValue extends ComponentValue implements ComponentFactoryListener {
91+
static class InitialValue extends ComponentValue implements ComponentFactoryListener {
9892

9993
private int count;
10094
private final Test launcher;
@@ -121,7 +115,7 @@ public void setInitialData(ComponentAttributes componentAttributes) {
121115
}
122116
}
123117

124-
class ActionHandler extends org.foxesworld.engine.gui.ActionHandler {
118+
static class ActionHandler extends org.foxesworld.engine.gui.ActionHandler {
125119

126120
public ActionHandler(GuiBuilder guiBuilder, String panelId, List<Class<?>> componentTypes) {
127121
super(guiBuilder, panelId, componentTypes);
@@ -130,7 +124,15 @@ public ActionHandler(GuiBuilder guiBuilder, String panelId, List<Class<?>> compo
130124

131125
@Override
132126
public void handleAction(ActionEvent e) {
133-
127+
switch (e.getActionCommand()){
128+
case "closeButton":
129+
System.exit(0);
130+
break;
131+
132+
case "hideButton":
133+
engine.getFrame().setExtendedState(Frame.ICONIFIED);
134+
break;
135+
}
134136
}
135137

136138
@Override
@@ -145,7 +147,7 @@ public void unregisterCommand(String key) {
145147

146148
@Override
147149
public void executeCommand(String key, ActionEvent event) {
148-
150+
System.out.println(key);
149151
}
150152
}
151153
}

src/main/java/org/foxesworld/engine/gui/ActionHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public abstract class ActionHandler extends ComponentsAccessor implements Dynami
1414

1515
public ActionHandler(GuiBuilder guiBuilder, String panelId, List<Class<?>> componentTypes) {
1616
super(guiBuilder, panelId, componentTypes);
17+
this.engine = guiBuilder.getEngine();
18+
Engine.LOGGER.info("ActionHandler created with {} panel and listens {}", panelId, componentTypes);
1719
}
1820

1921
@SuppressWarnings("unused")

src/main/java/org/foxesworld/engine/gui/componentAccessor/ComponentsAccessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public ComponentsAccessor(GuiBuilder guiBuilder, String panelId, List<Class<?>>
8989
* Scans declared fields of this class for the {@code @Component} annotation and injects
9090
* matching {@link JComponent} instances into annotated fields.
9191
*
92-
* <p>
92+
*
9393
* Injection rules:
9494
* <ul>
9595
* <li>If annotation's {@code value()} is non-empty, it is used as the component id.</li>
9696
* <li>Otherwise the Java field name is used as the component id.</li>
9797
* </ul>
98-
* </p>
98+
*
9999
*
100100
* @throws RuntimeException if a field cannot be set due to access restrictions.
101101
* @throws IllegalArgumentException if a required component id cannot be found in the collected components.

0 commit comments

Comments
 (0)