TextTableWidget - JTable base

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
unya
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am
Contact:

TextTableWidget - JTable base

Post by 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.

Code: Select all

(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 Files\newlisp.
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,
Attachments
image text-table-demo1.lsp
image text-table-demo1.lsp
text-table-demo1.JPG (60.13 KiB) Viewed 12273 times
image text-table-demo.lsp
image text-table-demo.lsp
text-table-demo.JPG (13.96 KiB) Viewed 12273 times
text-table.zip
Dispatcher.java
TextTableWidget.java
text-table-demo.lsp
text-table-demo1.lsp
(8.19 KiB) Downloaded 500 times

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: TextTableWidget - JTable base

Post by Lutz »

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:

Code: Select all

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
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am
Contact:

Re: TextTableWidget - JTable base

Post by unya »

Thanks Lutz, for interest.

I modified code, and add function spec. (may be spec information is poor, sorry)
Attachments
text-table-1.zip
Modified code, and function spec(in demo)
(9.45 KiB) Downloaded 522 times

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: TextTableWidget - JTable base

Post by Lutz »

Thanks for syntax descriptions.

Unfortunately the same problem remains when clicking a cell first, before anything else:

Code: Select all

(("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

Code: Select all

(("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:

Code: Select all

(("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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: TextTableWidget - JTable base

Post by Lutz »

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
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am
Contact:

Re: TextTableWidget - JTable base

Post by unya »

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,
Attachments
text-table-2.zip
(138.92 KiB) Downloaded 519 times

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: TextTableWidget - JTable base

Post by Lutz »

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
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am
Contact:

Re: TextTableWidget - JTable base

Post by unya »

Thank you Lutz,

It was good that I can contribute a little.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: TextTableWidget - JTable base

Post by Lutz »

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
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am
Contact:

Re: TextTableWidget - JTable base

Post by unya »

Thank you Lutz,

it's nice.

Locked