Thanks to visit codestin.com
Credit goes to github.com

Skip to content

seerainer/CSVedit

Repository files navigation

📊 CSV Editor

A modern, feature-rich CSV editor built with Java and SWT

Java License Tests Version

FeaturesInstallationUsageArchitectureDocumentation


✨ Features

🎯 Core Capabilities

📝 Editing & Navigation

  • ✏️ Double-click cell editing
  • 🏷️ Editable column headers
  • ⌨️ Keyboard shortcuts
  • 🖱️ Context menu support
  • 🎨 Dark theme support

💾 File Operations

  • 📂 Open/Save CSV files
  • 📥 Import JSON/XML
  • 📤 Export JSON/XML
  • 🎯 Drag & drop files
  • 🔄 Auto-save (30s)

🔍 Data Management

  • ↩️ Undo/Redo (100 actions)
  • 🔎 Search and replace
  • 🔢 Smart column sorting
  • ➕ Add/Delete rows & columns
  • 📊 Large file support (>10MB)
  • 🔄 Duplicate row detection

⚙️ Customization

  • 🎨 Theme management
  • 🔧 Comprehensive settings
  • 🖋️ Font customization
  • 📐 Configurable CSV parsing
  • 💾 Persistent preferences
  • 🖼️ Optimized icon loading

🚀 Installation

Prerequisites

  • Java 25+ (with GraalVM support for native compilation)
  • 📦 Gradle (wrapper included)

Quick Start

# Clone the repository
git clone https://github.com/yourusername/CSVedit.git
cd CSVedit

# Build the project
./gradlew build

# Run the application
./gradlew run

Build Options

# Create executable JAR
./gradlew jar

# Create distribution packages
./gradlew distZip distTar

# Build native image (GraalVM required)
./gradlew nativeCompile

# Run tests
./gradlew test

📦 Dependencies

The project declares its dependencies in build.gradle. Below are the main runtime, build-time (native), and test dependencies with the versions currently used in this repository.

  • Runtime / Implementation

    • Java: Java 25 (configured via Gradle toolchain)
    • CSV parsing library: com.github.seerainer:CSVparser:0.2.1
    • JSON utilities: com.grack:nanojson:1.10
    • SWT (GUI): org.eclipse.platform:org.eclipse.swt.<platform>:3.132.0 (platform-specific artifact is selected dynamically in build.gradle via detectSwtArtifact(); the artifact suffix depends on OS and architecture)
  • Test

    • JUnit Jupiter: org.junit.jupiter:junit-jupiter:6.0.1
    • AssertJ (assertions): org.assertj:assertj-core:3.27.6

📖 Usage

🎬 Getting Started

  1. Launch the editor: ./gradlew run
  2. Open a CSV file: Ctrl+O or drag & drop
  3. Edit cells: Double-click any cell
  4. Save changes: Ctrl+S

⌨️ Keyboard Shortcuts

Action Shortcut Description
📄 New Ctrl+N Create new CSV file
📂 Open Ctrl+O Open existing file
💾 Save Ctrl+S Save current file
💾 Save As Ctrl+Shift+S Save with new name
↩️ Undo Ctrl+Z Undo last action
↪️ Redo Ctrl+Y Redo last undone action
➕ Add Row Ctrl+R Insert new row
➕ Add Column Ctrl+L Insert new column
❌ Delete Row Ctrl+D Delete selected row
🔍 Find Ctrl+F Open search dialog
📝 Text Editor Ctrl+T Edit as plain text
🔄 Refresh F5 Refresh display

🗜️ Gzip compression support

CSVedit can open and save gzip-compressed CSV files using the .csv.gz extension. This lets you work with compressed CSVs directly (open/edit/save) without manually decompressing or recompressing files.


🎛️ Menu Bar

📁 File Menu

  • New (Ctrl+N) - Create a new CSV file
  • Open (Ctrl+O) - Open an existing CSV file
  • Save (Ctrl+S) - Save the current file
  • Save As (Ctrl+Shift+S) - Save with a new filename
  • Import → From JSON/XML - Import data from various formats
  • Export → To JSON/XML - Export data to various formats
  • Exit - Close the application

✏️ Edit Menu

  • Undo (Ctrl+Z) - Undo the last action
  • Redo (Ctrl+Y) - Redo the previously undone action
  • Add Row (Ctrl+R) - Add a new row to the table
  • Add Column (Ctrl+L) - Add a new column to the table
  • Delete Row (Ctrl+D) - Delete the selected row
  • Delete Column - Remove the last column
  • Find (Ctrl+F) - Search for text in the table

👁️ View Menu

  • Refresh (F5) - Refresh the table display
  • Text Editor (Ctrl+T) - Edit CSV data as plain text
  • Settings - Configure application preferences

❓ Help Menu

  • About - Display application information

🔧 Settings & Configuration

⚙️ Settings Dialog (6 Tabs)

📋 CSV Configuration
  • Field Delimiter - Character to separate fields (default: comma)
  • Quote Character - Character for quoting special fields (default: ")
  • Escape Character - Character to escape quotes (default: ")
  • Trim Whitespace - Remove leading/trailing spaces
  • Detect BOM - Handle UTF-8 BOM detection
  • Performance Settings - Buffer size, max field size
🔍 Parsing Options
  • Preserve Empty Fields - Keep empty fields in data
  • Skip Empty Lines - Ignore empty data lines
  • Skip Blank Lines - Ignore completely blank lines
  • Null Value Handling - Custom null representation
🚀 Advanced Parsing
  • Quoting Options - Strict quoting rules
  • Line Ending Options - Normalize line endings
  • Record Validation - Max record length, error handling
  • Debugging - Track field positions
🖥️ UI Options
  • Default Table Size - Rows (1-1000), Columns (1-100)
  • Column Width - 50-1000 pixels (default: 150)
  • Display Options - Show grid lines
  • Behavior - Auto-save, delete confirmations
📂 File Options
  • Character Encoding - UTF-8, UTF-16, ISO-8859-1, Windows-1252, US-ASCII
  • Line Ending - System, Windows (CRLF), Unix (LF), Mac (CR)
🖋️ Font Options
  • Font Selection - Family, size, style
  • Live Preview - See changes in real-time
  • Custom Fonts - Choose any system font

🏗️ Architecture

📦 Core Components

┌─────────────────────────────────────────────────────────┐
│                     Main.java                           │
│              (Application Entry Point)                  │
└─────────────────────┬───────────────────────────────────┘
                      │
┌─────────────────────▼───────────────────────────────────┐
│                  MainWindow.java                        │
│         (UI Manager & Event Coordinator)                │
└─┬─────────┬─────────┬─────────┬─────────┬───────────────┘
  │         │         │         │         │
  ▼         ▼         ▼         ▼         ▼
┌────┐  ┌──────┐  ┌──────┐  ┌──────┐  ┌────────┐
│Data│  │Table │  │File  │  │Theme │  │Settings│
│Mgmt│  │Mgmt  │  │Ops   │  │Mgr   │  │Dialog  │
└────┘  └──────┘  └──────┘  └──────┘  └────────┘

🧩 Key Classes

Component Responsibility
CSVTableModel Data storage & manipulation
TableManager Table UI operations
FileOperations CSV file I/O with CSVParser
JSONOperations JSON import/export
XMLOperations XML import/export
UndoRedoManager Command pattern for undo/redo
FindReplaceDialog Advanced search & replace
LazyCSVLoader Large file handling with async loading
ThemeManager Dark/light theme support
SettingsDialog Configuration UI with 6 tabs
Icons Centralized icon management (singleton)
DuplicateRowsDialog Find and remove duplicate rows

🧪 Testing

✅ Test Coverage

📊 Total Tests: 60
✅ Passing: 60 (100%)
❌ Failing: 0

Unit Tests (24):
  ✓ CSVTableModelTest - Data model operations
  ✓ CSVParserCallbackTest - Callback-based CSV parsing

Integration Tests (36):
  ✓ FileOperationsTest - File I/O operations
  ✓ TextEditorDialogTest - Text editor/preview behavior

🧪 Running Tests

# All tests
./gradlew test

# Unit tests only
./gradlew unitTest

# Integration tests only
./gradlew integrationTest

# With detailed output
./gradlew test --info

📚 Documentation

🎨 Supported Formats

CSV Format

  • ✅ Standard comma-separated values
  • ✅ Custom delimiters
  • ✅ Quoted fields with commas
  • ✅ Escaped quotes ("")
  • ✅ Multi-line values
  • ✅ Empty fields
  • ✅ UTF-8 BOM detection

JSON Format

{
  "headers": ["Name", "Age", "City"],
  "rows": [
    ["Alice", "30", "New York"],
    ["Bob", "25", "London"]
  ]
}

XML Format

<csv>
  <headers>
    <header>Name</header>
    <header>Age</header>
  </headers>
  <rows>
    <row>
      <cell>Alice</cell>
      <cell>30</cell>
    </row>
  </rows>
</csv>

💡 Advanced Features

🔍 Find & Replace Dialog

  • 🔤 Case-sensitive/insensitive matching
  • 📝 Whole word matching
  • 🔄 Find Next / Replace / Replace All
  • 🎯 Cell-by-cell navigation

🔄 Duplicate Row Detection

  • 📊 Scan entire dataset for duplicates
  • 👁️ Visual preview of duplicate rows
  • 🎯 Selective or batch removal
  • 📈 Real-time statistics
  • ✅ Undo support for removals

⚡ Performance

  • 📦 Lazy loading for large files (>10MB)
  • 📊 Progress dialog with cancel button
  • 💾 Efficient memory usage with resource pooling
  • 🚀 Chunk-based async processing
  • ⏱️ Background loading with progress updates
  • 🧹 Automatic resource cleanup

🎨 User Experience

  • 🌓 Automatic dark theme detection
  • 💾 Dirty state tracking with visual indicator (*)
  • ⚠️ Smart confirmation dialogs
  • 📊 Status bar with file statistics
  • 🖱️ Intuitive right-click context menus
  • 🔄 Auto-save every 30 seconds
  • ⌨️ Comprehensive keyboard shortcuts
  • 🎯 Drag & drop support for CSV/JSON/XML

🛠️ Technical Stack

Technology Purpose
Java 25 Core language with modern features
SWT Native UI framework (Eclipse Standard Widget Toolkit)
CSVParser v0.2.1 Robust, configurable CSV parsing
JUnit Jupiter 6.0.1 Modern testing framework
AssertJ 3.27.6 Fluent test assertions
GraalVM Native image compilation support
Gradle 9.2.1 Build automation & dependency management

🎯 Design Principles

  1. 🏗️ Separation of Concerns - Clear Model-View separation
  2. 🧪 Test-Driven Development - Comprehensive unit & integration tests
  3. ⚡ Performance First - Optimized for large datasets
  4. 🎨 User-Centric Design - Intuitive UI with helpful feedback
  5. 🔧 Highly Configurable - Extensive customization options
  6. 📦 Zero Configuration - Works out of the box with sensible defaults
  7. 🌍 Cross-Platform - Windows, macOS, Linux support
  8. 🧹 Resource Management - Proper lifecycle management following SWT best practices
  9. ♿ Accessibility - Keyboard navigation and screen reader support
  10. 🔒 Data Integrity - Undo/redo with data validation

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🤝 Contributing

Contributions are welcome! Please feel free to fork and submit a Pull Request.


📧 Contact

For questions or support, please open an issue on GitHub.


Made with ☕ and ❤️

⭐ Star this repo if you find it useful!

About

CSV editor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages