████████╗ █████╗ ██████╗ ██╗ ███████╗ ███████╗██████╗ ██╗████████╗ ██████╗ ██████╗ ╚══██╔══╝██╔══██╗██╔══██╗██║ ██╔════╝ ██╔════╝██╔══██╗██║╚══██╔══╝██╔═══██╗██╔══██╗ ██║ ███████║██████╔╝██║ █████╗ █████╗ ██║ ██║██║ ██║ ██║ ██║██████╔╝ ██║ ██╔══██║██╔══██╗██║ ██╔══╝ ██╔══╝ ██║ ██║██║ ██║ ██║ ██║██╔══██╗ ██║ ██║ ██║██████╔╝███████╗███████╗ ███████╗██████╔╝██║ ██║ ╚██████╔╝██║ ██║ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
A simple table editor with formula support build in Java & Swing
- Java 21 or higher
git clone https://github.com/Teoneag/Table-Editor
You can run it directly from gradle
./gradlew run
Or alternatively, first build it
./gradlew build
And then run it
java -jar app/build/libs/app.jar
Or you can use IntelliJ IDEA to run it. (open the project and run the App class)
=
before the formula in the cell, just like in Excel!
- create new table with custom size
- save table as CSV
- open table from CSV
- cells can hold
- normal text
- formulas
- the result of the formula is displayed
- just double click it to edit it and you can see the formula
- move, resize columns
- Parentheses: ()
- Binary operators: +, -, *, /, %, ^
- Unary operators: - (negation)
- Named functions with variable nr of args: pow, sqrt, abs, log, log10, exp, sin, cos, tan, min, max, sum, avg
- References to table cells: A1, ZZ3
- live formula update (when you change a cell, all cells that depend on it are updated)
- the design is very modular, so it's easy to add new functions or operators
- Save data: CSV
- UI
- AppBar
- File
- New
- Select rows and columns
- Open
- Save
- Save As
- Exit
- New
- Edit
- Undo
- Redo
- Cut
- Copy
- Paste
- Table
- Insert Row
- Insert Column
- Delete Row
- Delete Column
- Help
- About
- File
- Table
- Show all saved ros and columns
- Before any row, column: "-" button to delete
- Between any row, column: "+" button to insert
- See the result of any cell, when selected show the formula
- If it's between "" it's text, otherwise it's a formula
- If the formula is invalid, show an error message as a pop-up
- AppBar
- For decimal numbers use comma: 1,5
- calculating equation
- tokenizer
- parser AST
- evaluator
Write a table editor with formula support.
- Language: Java
- UI framework: Swing
- Requirements
- edit a cell directly in the cell itself (not like Excel where you have a separate input field)
- optional: select/edit multiple cells at once
- Formulas (write parser myself)
- parentheses
- binary operators
- unary operators
- named functions
- references to table cells
Example:
pow(-2, A1 - 3) * (42 + B2)
- My choice: set of supported operators, functions names
- the completeness of the implementation (the application should behave correctly with any user actions and any user input in the table cells)
- code quality (assume we will have to develop and maintain this project for a long time)
- simple, tidy interface (not expected a particularly beautiful UI)
Chronological order. Planned time -> actual time
- read + make initial plan: 30m -> 34m
- swing example from GeeksForGeeks: 20m -> 5m
- read similar projects: 20m -> 21m
- Sketch UI: 10m -> 11m
- UI in Swing: 30m -> 2:30h
- Formula parser & evaluator: 3h -> 5h
- https://en.wikipedia.org/wiki/Shunting_yard_algorithm
- fix comma in cell: 10m -> 20m
- https://www.geeksforgeeks.org/expression-evaluation/
- test, fix & write tests: 3h -> 2h:38m
- allow strings in cells, fix empty cell: 13m
- make formulas auto update: 20m
- not happened: fix infinite recursion if happens (a=b, b=a)
- make table full screen: 1m
- show row numbers: 20m
- make open file work: 1:10h
- refactor: 34m
- fix create a new table pop up: if you change a value, and the other one is wrong, when u are asked again for the values, the good one is lost
- refactor table: 1h
- documentation & push: 30m -> 30m
- bonus: multiple cells: 1h
- style: 1h
- final testing + fix todos: 1h
- when editing a cell, if you click on another cell, add that string to the current cell
- if trying to open invalide file, show its contents and suggest fix
- resize (add, remove cols)
- icon
- shortcuts (pressing esc on a cell should cancel the edit)
- implement the following
- Comparison (==, !=, <, >, <=, >=)
- Logical AND (&&)
- Logical OR (||)
- Logical NOT (!)
- if(condition, value_if_true, value_if_false) - Returns one of two values depending on the condition.
- concat(string1, string2, ...)
- select column when clicking on the name
- theme changing
- import, export to excel