java

JTable Editor Change with Live Data

I have a table model that is populated by live (external) data source that updates every xx seconds. The data is displayed in a JTable. The user can override the data in the table cell through an celleditor that extends the AbstractCellEditor. If the user clicks away, the code checks to see if the new value equals the value in the t...

Getting maven to start jetty (Tapestry Tutorial)

I'm trying to work through the Tapestry tutorial. I think I got everything set up right and so far so good but I get to the part where the tut rather glibly states: Change into the newly created directory, and execute the command: mvn jetty:run Again, the first time, there's a dizzying number of downloads, but before...

Instantiate singleton object using Class.forName()?

I want to instantiate one instance of a class from the string name of the class. ( using Class.forName().newInstance(). ) Here's the problem: I want that instance to be a singleton.. I could do this using a singleton pattern, except that newInstance calls the default constructor for a class, and with a singleton, that constructor must ...

How to suppress Java warnings for specific directories or files such as generated code

I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generated source files. I know I can use the @SuppressWarning annotation to suppress particular warnings in particular elements, but any annotations I add by hand will be lost when the parser generator ru...

Specifying generic collection type param at runtime (Java Reflection)

Hi, I'd like to get the generic type of a collection, using reflection, at runtime. Code (JAVA): Field collectionObject = object.getClass().getDeclaredField( collectionField.getName()); //here I compare to see if a collection if (Collection.class.isAssignableFrom(collectionObject.getType())) { // here I have to use the generic t...

Google DataStore Unowned One-to-Many Relationships

So, I'm using google datastore for my GWT app and my coworker came up with an interesting question that I don't have the answer to. What happens to the set of keys when you delete some of the objects? For example, Person.java @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Person { @PrimaryKey @Persi...

What is a good FIX protocol API library for Java?

Wondering if anyone has any experience working with the FIX protocol using in trading. ...

gwt mosaic preventing deploy

I have a gwt project that uses gwt-mosaic. Here is the error message I get: Compiling module com.athena.Athena Refreshing module from source Validating newly compiled units Removing units with errors [ERROR] Errors in 'jar:file:/Users/kevmo/AthenaLibs/gwt-mosaic/gwt-mosaic-r951.jar!/org/gwt/mosaic...

Choosing an excel java api.

All I need to do is open an MS excel sheet - not sure which kind yet (2003, 2007, etc.) - and parse the information in each row into an object. I'm performing only readonly operations. out of Apache POI, JExcelAPI, or OpenXLS which is best for this task? I'd rather not find out about anymore api's but if you're certain that none of the...

Write Java Method Signature with Annotated paramaters with JDT

Hi, I am writing an eclipse plug-in which generates code. I am leveraging eclipse jdt to gen out classes, fields, and methods. One of the requirements I have is to generate methods with annotated paramaters... public returnType foo(@someAnnotation int id) { ..... ..... } Does anybody know how to write out the @someAnnotat...

Load DTD into SAX Parser in java

I need to parse a bunch of incoming xml documents, they all have the same DTD. I don't want the Sax Parser to load the DTD every time it has to parse a new xml document. Is there anyway I can load a DTD into the parser and have it reused on subsequent parse calls? ...

nullobject for File in Java

I have a class that occasionally gets passed null for File objects. During normal operation it uses a Scanner class to parse through the file. Instead of littering my code with null checks against the File objects, I thought I could replace the Files with nullobjects (Gang of Four style). However, it looks like File isn't really design...

GWT URL Parameters

What is the proper way to use URL parameters? My URL is this: http://localhost:8080/#pg5?testing=abc In my code I try to get the value of testing using this line of code: String value = com.google.gwt.user.client.Window.Location.getParameter("testing"); Unfortunately all this does is set my string to "undefined". I thought perhaps ...

Java, default encoding

Possible Duplicate: What is the default encoding of jvm? Hello, what is the default character encoding in Java, when used to process text data? I have browsed quite a while, however, I cannot find an answer (or I am not searching properly). I have text data, which was downloaded from web pages. Java was used for this, and the ...

In Java, how can I test if an Array contains a certain value?

I have a String[] with values like so: public static final String[] VALUES = new String[] {"AB","BC","CD","AE"}; Given String s, is there a good way of testing whether VALUES contains s? ...

Convert PDF to RTF in Java

Does anyone know of an easily available library or SDK which can be used to convert a PDF document to RTF in Java? ...

Java: Need efficient notifications between site users.

I have a simple ajax game between 2 users with java backend (tomcat, spring). I need some good way of notifying one user that his opponent made a turn. Now all communication is done through database and waiting for opponent to finish his turn looks like this: while(!timeout && !opponentIsDone) { //...get the game record from db and...

Java NIO framework for filesystems instead of networks?

There are several high quality frameworks that hide the complexity of NIO based network programming (mina, netty, grizzly, etc.). Are there similar frameworks that simplify NIO based file-system programming? For example, as a learning exercise, I would like to implement a disk backed Map based on this (awesome!) article: http://www.jav...

Tile-like windows on Swing

I have zero experience writing applications with Swing, but I have one application with which to start experimenting. For this application, I want my window to have a variable number of small "tile"-like structures, which can be moved/closed/minimized just like windows by the user inside my main frame, and which will display, each a sma...

Var-arg of object arrays vs. object array -- trying to understand a SCJP self test question

I'm having trouble understanding this question, and the explanation of the answer for an SCJP 1.6 self test question. Here is the problem: class A { } class B extends A { } public class ComingThru { static String s = "-"; public static void main(String[] args) { A[] aa = new A[2]; B[] ba = new B[2]; sifter(aa); ...