TextTableWidget - JTable base

Started by unya, September 21, 2010, 01:24:06 AM

Previous topic - Next topic

unya

Hello all,

I tried to add features TextTableWidget based JTable.

(cell value is string only!)

;;; text-table function in text-table-demo.lsp did not change guiserver.lsp.

(gs:text-table ID action ["ColumnName 1" ...])
(gs:text-table ID row column "value")
(gs:text-table-get-cell ID row col)
(gs:text-table-get ID)
(gs:text-table-add-row ID [ColumnValue 1] [ColumnValue 2] ...)
(gs:text-table-add-column ID [Column Name 1] ...)
(gs:text-table-set-row-number ID boolean)
(gs:text-table-set-column ID ColumnNumber Width Justification)

replace java files and run make in guiserver directory, copy guiserver.jar c:Program Filesnewlisp.

It made on newlisp-10.2.13(working 10.2.15). other version need  change Dispatcher.java.



Please tell me if you have suggestions for implementation or function.



Thank you,

Lutz

#1
Thanks Unya, this looks very promising, but I ran into the following problem:



Run text-table-demo.lsp then click on any cell in the table before doing anything else:


ERR: missing parenthesis : "...A=" "cjAgYzE=" )("cjEgYzA=" "cjEgYzE"
called from user defined function gs:listen
server shutdown


probably a closing parenthesis missing when formatting the message sent from the guiserver.



When checking the "row number" box first, or adding a row or column number first, then the error will not occur. It occurs only if clicking a cell is the first action.



Other then that, I like the API and think we can incorporate your code into Guiserver.



Perhaps you can put help text into the functions headers describing the parameters and return values, similar to how it is done for other API functions in guiserver.lsp.

unya

#2
Thanks Lutz, for interest.



I modified code, and add function spec. (may be spec information is poor, sorry)

Lutz

#3
Thanks for syntax descriptions.



Unfortunately the same problem remains when clicking a cell first, before anything else:
(("r0 c0" "r0 c1") ("r1 c0" "r1 c1") ("0" "1"))

ERR: missing parenthesis : "...A=" "cjAgYzE=" )("cjEgYzA=" "cjEgYzE"
called from user defined function gs:listen

and I also get a crash using this sequence:



add row

click r0 c0

add row

click r0 c1

add row

click r0 c0

add row

click r0 c1   ===> crash
(("r0 c0" "r0 c1") ("r1 c0" "r1 c1") ("0" "1") ("" "") ("" "") ("" "") ("" ""))

ERR: missing parenthesis : "...("cjEgYzA=" "cjEgYzE=" )("MA==" "MQ="
called from user defined function gs:listen
server shutdown


Both crashes can be reliably repeated on the old and new version of text-table.zip



At one point clicking around without registering my click and keystrokes and adding rows and columns, I got this:
(("r0 c0" "r0 c1" "") ("r1 c0" "r1 c1" "") ("0" "1" ""))

ERR: string token too long : " )))n"
called from user defined function gs:check-event
called from user defined function gs:text-table-get-cell
called from user defined function action-handler
called from user defined function gs:listen
server shutdown

make sure you test thoroughly ;-)

Lutz

#4
I just repeated the tests on Windows XP, and it doesn't crash there, but you see no printout of the list as usual in the terminal window when clicking cells. So when I click a cell before anything else, it doesn't crash on Windows XP but the terminal output is mute, and I can continue operating the table. On Mac OS X it will crash immediately and reliably.



On UBUNTU Linux 10.04, the behavior is mostly like on Windows XP, but occasionally also crashes as on Mac OS X. On UBUNTU sometimes the crash comes after several working operations after having clicked 'r0 c0' first. As on Windows XP clicking 'r0 c0' doesn't cause display of content information in the terminal window.

unya

#5
A similar problem occurred in my environment.



many java files are changed, because Asynchronous Java Listener action-handler event was to obtain data for the abnormal situation that had been run more than one.

Add a socket and asynchronous events run to solve the problem, I tried to separate the events to run simultaneously.



gs:listen - run only async event, Java Listener (key, mouse listener) send.

gs:check-event - function return



thanks,

Lutz

#6
Thanks Unya, it will not make it into 10.2.15 this week, but in the next development version in a few weeks (with some changes).



Both, the password feature, you submitted earlier, and these new table functions are nice additions to Guiserver.

unya

#7
Thank you Lutz,



It was good that I can contribute a little.

Lutz

#8
The new table widget made it into the current development release 10.2.16. The instabilities, which we observed, were entirely due to the interaction of 'gs:listen' and 'gs:check-event', now fixed. The code now runs without the suggested separation of synchronous versus asynchronous communication ports, stable on all platforms tested: Mac OS X on PPC and Intel, Windows XP Sp2 and UBUNTU Linux 10.04.



The problems Cormullion observed, should also go away in v.10.2.16. It is now safe to call 'gs:check-event' from inside an event handler called invoked by 'gs:listen'. The function 'gs:get-text' and a few others use 'gs;check-event' when used in blocking mode. The table support functions retrieving table data, also work in blocking mode.



I made small adjustments to the table API and shortened the names dropping of the "text" prefix from the names.



ps: table entries can also be edited by double-clicking on a cell

unya

#9
Thank you Lutz,



it's nice.