Examples of implementing Java Document model - java

Does anyone have any real life use cases where someone had to make a non-trivial implementation of the Java Document interface?
I'm looking for descriptions of the real use case, not examples of code, and not tutorials.

I did a little work for an open source MMO game known as HackWars. As part of the game I implemented an in-game chat system that ran as in InternalJFrame inside the main client. I used Document in conjunction with a JTextPane so that I could insert strings and use different fonts for different users within the same JTextPane.
The project source is hosted here: https://www.assembla.com/code/hackwars/git/nodes
The chat code starts here: https://www.assembla.com/code/hackwars/git/nodes/HWTomcatServer/webapps/ROOT/WEB-INF/classes/HWChat
The specific file I used Document in was HWChat.client.chatPane which you can see the source code for here: https://www.assembla.com/code/hackwars/git/nodes/HWTomcatServer/webapps/ROOT/WEB-INF/classes/HWChat/client/chatPane.java

As part of a Java IDE I implemented an editor kit for Java source text. The document handled things like balancing brackets and quotes and auto-indenting, and also kicked off the incremental compilation process.

Related

Can one open another application within a javaFX frame?

I am currently working on a desktop application in which one can generate a responsive website for documentation (java-doc like) by providing nothing more than a simple word document.
I currently have a prototype working in which I select for styles on certain paragraphs to determine its function and how it should be transformed to a correct HTML representation. I also found a way to dynamically link to certain section of the document. Everything is working however I would really like to combine the list of documents to generate, a preview of the to-be generated website and a text editor program in 1.
since this will be relying on word heavily I was wondering if Java FX provides a means to display an application such as word or openoffice within an internal frame. Much like how Java Fx's webview displays websites.
In an ideal situation it would look something like this:
Any help would be greatly appreciated.
Alas, not possible in a plausible way.

Check printing with Java/JSP

I'm working on an existing Java web application (HTML/CSS/JS/JSP/Servlets and Java classes in this particular app) that currently uses an applet to print checks.
My boss recently came to me and informed me that there are errors coming back on user's machines when testing the check printing against the latest versions of Java.
He is wondering how we could set up the application to print checks off without using an applet.
In the past, I've used Crystal Reports to lay out forms and print them but that was in asp.net.
I know there are Java PDF libraries available but I'm not at all familiar with any of them and not sure that they could be used to format and print checks in a Java web application.
So, I'm ultimately wanting to know about what has worked for those who have implemented check or form printing using Java/JSP/Servlets.
2012-02-24 # 13:15EST edit
I mentioned "Java PDF libraries" above but have since found out that PDF cannot be used as end-users should not be able to save the check documents (unless PDF's can be made to not be saveable and just printable). All of the data is managed right on the database (Oracle in our case).
I've used iText to create PDF files before for things like this. PDF is your answer, since the whole point of the format is that it never really changes. Much better than an Applet.
http://itextpdf.com/
I ended up digging deeper into using iText and came across flying-saucer which makes it super-easy to render a PDF from XML or XHTML.
Check it out at http://code.google.com/p/flying-saucer/
I also found out how to partially hide the save functionality by rendering the PDF inside a hidden iframe: Create a "print-only" PDF with itext

Generating CCD document using MDHT API

I am trying to use MDHT API to generate CCD documents. I am doing this in the following way.
Downloaded Java runtime libraries and placed them in classpath and writing code to generate all the sections using MDHT API.
Writing code for each section is taking long (a bit complicated). I was wondering if I am missing anything. Is there any open source mdht GUI that generates code for each section or am I moving in the right direction?
I am currently stuck at Medications Section/Immunization Section. Can anyone please redirect me to any examples/tutorials related to each section. I have already looked at user guide/developers guide.
Any help is appreciated.
I think MDHT API will only provide a Model for the CCD document.
if it contains any default implimentaion to generate CCD document,,i dont know..
any way better you just generate the XML in DOM,STAXs API.
CCD example link
Another better API that i found is MIRTH
follow the link
Mirth User guide
The best place to look for help/sample code is the developers forum: Eclipse Community Forums ยป Model Driven Health Tools.
You may need to create a (free) account to get access.
You could also go to the forums to post your specific MedicationsSection/immunization question for a possible specific answer.
Another good site is CDA tools: MDHT Developers Guide. Look at Produce CDA Content using MDHT API.
There are countless examples of building documents in the test code projects.
Download the All In One (MDHT_CDATools) from GitHub linked in the MDHT project site and look at the code in the test projects such as: org.openhealthtools.mdht.cda.consol.example
The closest (current) thing to a GUI based document building application in MDHT would be using the all in one to modify the existing models and generate sample snippets/documents that way (or creating a model from scratch, which includes only what you need). If you wanted the entire document produced in XML, you could then generate the instance from GeneralHeaderConstraints as opposed to any of the many child templates (which would give you snippets). Either way, this is not really the intention of the model interface (it's more for conformance) and would take you far longer to implement than using the API itself - which accesses the models which already exist in order to auto-generate conformant content quickly.

OpenOffice use .odm programmatically in Java

I need to do some work on a Master Document (.odm) with the UNO IDL and it's binding to Java.
I want to know if there is a way to access all the documents it's referencing and, if possible, without extracting the content.xml.
What I managed to do so far is to open the document as a XComponent, to open it's XTextDocument interface (and to extract the text belonging to the document but not the one from the included documents). And I'm unable to gather some useful information from that.
Is there an interface that could help? Or some other stuff?
You might want to look into the ODF Toolkit, since the easier parts are Java-based.
The ODF Toolkit project is currently moving to an Apache incubator project.
The current site is here: http://odftoolkit.org/
The new project is at http://incubator.apache.org/odftoolkit/
On the other hand, extracting the content.xml of the .odm might be a better way to go. There is probably some XSLT magic you can use to locate the references to the separate parts.
Also, when you open the master document in an OpenOffice.org consumer, doesn't it show clues about how the constituent documents are found? The one time I messed with this, I noticed that the components had software-generated names that were pretty obvious.

Java Swing: Generating dynamic GUI forms from XML

I am writing this application in Java, where I have a JTree on the left of the JFrame, and the item selected in the JTree determines what appears on the right. This is similar to Edit --> Preferences in Thunderbird, and several other applications' preferences.
Anyhow the main difference is that in my app the stuff on the right is dynamic, and needs to be generated at run time using input from a file.
What I am after is various ways in which this can be accomplished, code snippets or existing frameworks / libraries if they exist.
The input file needs to be something higher level than the sort of XML generated during Serialization. No output capability is required.
Thanks
The JEasy Framework looks to do exactly what you're asking for.
But here's a whole list of similar projects: http://java-source.net/open-source/xml-user-interface-toolkits
There's a short description for each one and a link to their project page. You'll want to look at a handful of the ones that sound good to you, and then try one or two for yourself.
As of now i think one of the most actively used is Swixml. better support compared to JEasy.
have been using it for some while now, and is very easy to learn too
Perhaps it - http://www.soyatec.com/eface/ - XAML/WPF for Java.

Categories

Resources