TextTableWidget - JTable base

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE

TextTableWidget - JTable base

Postby unya » Tue Sep 21, 2010 8:24 am

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
text-table-demo1.JPG
image text-table-demo1.lsp
text-table-demo1.JPG (60.13 KiB) Viewed 6305 times
text-table-demo.JPG
image text-table-demo.lsp
text-table-demo.JPG (13.96 KiB) Viewed 6305 times
text-table.zip
Dispatcher.java
TextTableWidget.java
text-table-demo.lsp
text-table-demo1.lsp
(8.19 KiB) Downloaded 225 times
unya
 
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am

Re: TextTableWidget - JTable base

Postby Lutz » Tue Sep 21, 2010 3:21 pm

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: TextTableWidget - JTable base

Postby unya » Wed Sep 22, 2010 4:17 am

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

Re: TextTableWidget - JTable base

Postby Lutz » Wed Sep 22, 2010 11:49 am

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: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: TextTableWidget - JTable base

Postby Lutz » Wed Sep 22, 2010 11:58 am

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: TextTableWidget - JTable base

Postby unya » Tue Sep 28, 2010 4:48 pm

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

Re: TextTableWidget - JTable base

Postby Lutz » Wed Sep 29, 2010 1:15 am

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.
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: TextTableWidget - JTable base

Postby unya » Wed Sep 29, 2010 2:31 am

Thank you Lutz,

It was good that I can contribute a little.
unya
 
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am

Re: TextTableWidget - JTable base

Postby Lutz » Fri Oct 01, 2010 1:48 pm

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
Lutz
 
Posts: 5258
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: TextTableWidget - JTable base

Postby unya » Mon Oct 04, 2010 7:49 am

Thank you Lutz,

it's nice.
unya
 
Posts: 27
Joined: Fri Feb 26, 2010 8:30 am


Return to newLISP Graphics & Sound

Who is online

Users browsing this forum: No registered users and 1 guest

cron