How vishalla/mathai-v2 works
Project Type and Purpose
• This is a standalone JavaFX desktop application (MathAI_GUI) for organizing and editing “documents,” “notebooks,” and “folders,” with a responsive GUI built using FXML views and CSS styles. Data is persisted locally as JSON files.
Key Architectural Layers
a. Presentation Layer (UI)
• FXML Views (MathAI_GUI/src/view/*.fxml)
• CSS Stylesheets (MathAI_GUI/src/styles/*.css)
• Images (MathAI_GUI/src/images/)
b. Controller Layer (MVC Controllers)
• Scene Controllers under src/controllers (Home, Favorites, Trash, NotebookEditor, itemControllers, etc.)
• A base Controllerabstract.java and shared TriConsumer event handler
c. Domain & Utility Layer
• StorageManager.java: handles all JSON file I/O under MathAI_GUI/data/
• ThemeManager.java: applies and switches UI themes via CSS
d. Application / Entry Point
• Main.java: Application.launch, initializes primary scene
• Test.java: auxiliary startup/test harness
e. Data Layer
• Local JSON files for documents, notebooks, folders (MathAI_GUI/data/**/*.json)
• index.json for file indexing
Interactions and Data Flow
• User actions in the GUI (button clicks, menu selections) → Controller methods
• Controllers update the View (via FXMLLoader, injecting model data into UI controls)
• Controllers call StorageManager to read/write JSON files → local filesystem
• ThemeManager invoked by controllers to switch CSS on active Scene
• Application entry point (Main) wires together initial Scene, loads Home.fxml
Architectural Patterns
• Model-View-Controller: clear separation between FXML views (View), Controllers (Controller), and JSON-backed models (Model via StorageManager)
• Layered architecture: UI → Controllers → Utilities → Data storage
• Single process monolith; no external services
• Frontend/UI Module
• View files (FXML)
• CSS styles
• Images
• Controller Module
• Scene controllers
• Item controllers (DocumentItemController, FolderItemController, etc.)
• Utility Module
• StorageManager (JSON I/O)
• ThemeManager (CSS management)
• Data Store
• Local filesystem JSON directory (data/)
• Application Layer
• Main.java
Essential Elements
• Component names matching actual directories/files (e.g., NotebookEditorController)
• Data storage structure (folders and JSON files)