This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Loading Excel data into and out of Yoplet applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Loading Excel data into and out of Yoplet applet" Watch "Loading Excel data into and out of Yoplet applet" New topic
Author

Loading Excel data into and out of Yoplet applet

Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
I am looking for some simple coding help with java and jquery, does anyone know both of these coding languages?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Yes, there are quite a few people (including some people who post here regularly) who know both of those languages. So if you're looking for coding help, this would be a good forum to post your questions in.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
Ok so I am i am trying to create an application that reads/writes and modifies an excel file via clientside.

I am using jquery tablesorter and jquery datatables. Not using them together however, I am just troubleshooting which will work best.

My first big hurdle with this is how I need to load the info from Excel and then write back to it as well.

I have heard of java web start/ javasheet and Yoplet found here code.google.com/p/yoplet/

please help me fix this issue !
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

Nit: jQuery is a JavaScript library, not a language.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Michael William wrote:please help me fix this issue !

It isn't clear what issue there is to fix. What problem are you having?


Steve
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

As pointed out, jQuery is a JavaScript library and as such, doesn't have much at all to do with Java.

Before talking tools, have done any research at all on dealing with Excel files? It seems to me you may be picking tools prematurely. What have you discovered that leads you to think either of those jQuery plugins will be of assistance?
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
I am currently using jquery tablesorter and jquery datatables (not together). however, I am unable to read an excel file and write back to it. I found an application called yoplet, its free. and its java. I am curious how I can get this to work.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

You haven't really answered the questeon: does either of these jQuery plugins profess to supporting Excel?
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
yoplet is not designed for use with jquery so it needs to be modded in, thats what I dont know how to do, and need help with its not specifically for excel its for any file stored locally. I am hoping this works great since i cant use a web server
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

Without a server, I assume that the applet can somehow be loaded from the local system?

This is really going to all about the applet until you can solve how to get the applet loaded locally, and get the Excel data into and out of the applet, so any discussion of jQuery or JavaScript is premature at this point.

I've moved this topic to the Applets forum, and with a suitable change of subject, to get that aspect concentrated on.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
code.google.com/p/yoplet/

Looking at the description, I'm lost. Can you describe what the underlying problem is that you're trying to solve, and how this applet, and either of the jQuery plugins you mentioned figure into it?

If this is all on the client side, my first advice would be not to use web technologies. A Java desktop app would be easier to develop, and be more flexible, than an applet (no worrying about permissions).

If you need to manipulate Excel files, then Apache POI is the library of choice.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
thanks for the quick response, are you aware of any sample java desktop applications that allow an excel file to be opened and then saved locally?

Also, the bulk of the project I have built is made around using jquery tablesorter and I found yoplet and it appears to work well with jquery.

My goal is to build something that allwos multiple users to check rows off of a "datatable" or spreadsheet derived from excel and then save those results (rows checked and unchecked_ back to excel.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
So this application should load Excel files from the local file system, present them to the user in a tabular format, allow the user to select entire rows, and then save the selected rows to a new Excel file?

If so, then a desktop app using a Swing JTable and Apache POI might work. Personally, I might just use Excel/OpenOffice/LibreOffice to select the rows in question and copy them to a new spreadsheet.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
I have it right now so it imports a CSV file that I got from resaving the excel file as CSV. It uploads into jquery tablesorter with checkboxes on the 1st column, when a user clicks that they dissappear, however if the first column header is clicked, it shows all checked rows. The problem is where it doesnt write back.

What is this Excel/openoffice/Libreoffice you speak of? I have heard of openoffice.org

I thought Swing Jtable required a web server
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
As i eagerly await the response I provided prior, I would like some understanding as to if ...
http://docs.oracle.com/javase/tutorialJWS/uiswing/components/ex6/TableSortDemo.jnlp requires a web server Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Swing is the standard Java GUI toolkit; none of its components require a web server. If you want to serve the app via JavaWebStart (a.k.a. JNLP), then, yes, a web server would be required. But that's just a distribution mechanism. It has nothing to do with the app per se.

Excel, OpenOffice and LibreOffice are applications that allow you to manipulate spreadsheets by hand - which is, I take it, basically what this app should do.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
Ah ok perfect. I guess the only question that remains is what route to take with this. #1. use jquery tablesorter to read/write the excel files is this possible using the yoplet or using jtable within IE? or #2. Use this sample which i believe is jTable and make something from it http://docs.oracle.com/javase/tutorialJWS/uiswing/components/ex6/TableSortDemo.jnlp Or #3 is there an better option? I think Jtable may have the options I am looking for but I have put so much time into the look and layout in HTML per the jquery Tablesorter work. thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
I'd go with #2, mostly because it sounds to me as if this is a desktop solution, so applying web technologies seems a stretch to me. And, of course, JavaScript (and thus jQuery) have no way of storing anything in a local file.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
So at this point I would like to start working with JTable but do they have an official website? More importantly, is there a simple example that I can modify? I found a few but they are all referencing external files. I am familiar with html and php so this shouldnt be too hard.

I found this link, but I am not sure how to create the files locally.

http://www.java2s.com/Tutorial/Java/0240__Swing/CreatingaJTable.htm
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
Just as a further example, I went to http://docs.oracle.com/javase/tutorial/uiswing/examples/components/

and downloaded the Simple Table Demo Project and also the viewed the SimpleTableDemo.java
but there is no launchable file within this zipped folder, no jlnp file, altho i see the link for it is here http://docs.oracle.com/javase/tutorialJWS/uiswing/components/ex6/SimpleTableDemo.jnlp

I want to create it locally
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Any class with a main method -like SimpleTableDemo- can be launched from the command line via "java SimpleTableDemo". Note that you may need to account for package names. Have you created Java desktop apps before? If so, the process should be familiar.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
I have not created any java apps before but I am a quick learner. I know it can be launched in that manner but how can I sync up the jnlp file with the java file. It doesnt even appear they reference each other. Just looking to start somewhere
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
If there's no web server involved, then there's no point in having a JNLP file. That's for JavaWebStart apps.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
Ah. I guess I am slightly confused. Right now i have the zip file for the SimpleTable Demo but I want to see what I am doing. Thus I am looking for the JNLP file. I know you said to use the run command but that didnt work for me. if possible I would like to have a file that loads what I have done automatically, just like the JNLP file does. So if I wanted to show it to someone on the intranet level I could. Thanks!
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
Do I need to download Netbeans IDE?

This is the code for simpletabledemo



Can this truly be run locally (clientside)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Yes, it can. What happened when you tried? An IDE is not needed.

Please forget all about JNLP files right now. You're just getting yourself more confused. I said nothing about a "run" command, I said to run it from the command line via the "java" command.

Oh, and you need to make up your mind whether you want to run it off a web server or not. Either it is a JavaWebStart app, or it isn't. I suggest you start out with it not being a JavaWebStart app, and add that later. It's not a big deal, but it's better to take the hurdles one at a time.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
understood.

I downloaded the Simple Table Demo Project and it only has a .java file in it along with other items, but I cant RUN it like i can a jnlp file. Sorry im still learning.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Java source files need to be compiled using the "javac" command, and then you can run them using the "java" command (provided they have a main method).

You can make it easier on yourself by removing the libe "package components;" from the source.
Michael William
Greenhorn

Joined: Mar 29, 2013
Posts: 23
I am still a bit confused so I think the best way for me to understand is to use a metaphor. If I want to edit HTML code I simply edit an html file in notepad. If I want to edit the java code found on this page http://docs.oracle.com/javase/tutorial/uiswing/examples/components/, the simpletabledemo, how do I edit it? Pardon my stupidity or slowness to learn. Please help me get from point A to point B. Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
Any text editor will do, Notepad included. Notepad++ has the benefit of syntax coloring.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
I see you've also asked this question in this topic. Let's use that topic for questions about editing source code, and not mix subjects in this one any further.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loading Excel data into and out of Yoplet applet