view src/luan/modules/swing/Document.luan @ 1871:299331f3fcba

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Apr 2025 08:46:30 -0600
parents e3a8568a11be
children
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
require "java"
local UndoManagerLuan = require "java:luan.modules.swing.UndoManagerLuan"
local Logging = require "luan:logging/Logging.luan"
local logger = Logging.logger "swing/Document"


local Document = {}

function Document.new(jdocument)
	local document = { java = jdocument }
	local undo = UndoManagerLuan.new()
	jdocument.addUndoableEditListener(undo)
	jdocument.putProperty("undo",undo);
	document.undo = undo.undo
	document.redo = undo.redo
	document.can_undo = undo.canUndo
	document.can_redo = undo.canRedo
	document.add_undo_listener = undo.addListener
	document.is_unedited = undo.isUnedited
	document.set_unedited = undo.setUnedited
	return document
end

return Document