API for using XML w/ UI & external DB calls - java

I am looking to find out if any API exists that can complete a task I am considering. I want to create a tool that allows a user to upload a xml file. I want that XML file to be displayed visually in a GUI. Using an API (I assume) I then want to give the user the ability to click on any tag. Once the user clicks a tag I would like for a second method to run which takes that value and runs some other methods. (The other methods include some DB calls but are not important).
I'm rather in the dark here with no idea how to accomplish this. I know how to display a XML in a java swing GUI but I am not sure how to allow a user to click on those tags AND have the values captured.
Would a API be required to do this or are there already some ways within vanilla Java that could allow it? Please give me a name of an API if you know.
Thank you.

You should be able to do that with javax.swing.JTree and javax.swing.event.TreeSelectionListener.
https://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html
https://docs.oracle.com/javase/7/docs/api/javax/swing/event/TreeSelectionListener.html

Related

Saving a information displayed as different tab in browser to .html file

I am working on a project which is developed with Java Struts 2 framework. I am completely new to this. In project, when user clicks on a report button, a report is shown in different tab (the url of it looks like https://localhost:8181/myApplication/businessReport.do).
Goal: What I want is saving this report as html file in backend somehow. It is perfectly OK when user sees the report as he is seeing currently. It just needs to be saved in backend somewhere. The reason to do this is, te application is going to shutdown soon and our client wants to save those reports somewhere for future reference.
I could find businessReportForm.java, businessReportAction.java and also businessReport.jsp files in my project. I assume they should be of my interest.
Note: It uses mapping.findForward from Action mapping
I do not understand following and it would be nice if someone can help with that.
What could be the last point in (with respect to strut framework) where all the information for report would be ready ? (I would lke to use it to create .html file out of it)
What I need to change here in order to achieve the goal ? changing .jsp , changing Action or should change be done in corresponding Action class ?
in the url what does businessProcess.do actually mean with respect to jsp and servlet ?
any other idea what should be the approach to do what I want to do ? (saving report as html in background)

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.

any way to manually set the "Script Name" when adding JavaScript?

I use iText to batch enable shared reviews in pdf files at the server level. Injecting the required javascript is accomplished using the PdfStamper's addJavascript() function. This does enable the shared review, however i cannot create archive versions properly because the document level javascript "Script Name" is not correct. iText sets the Script Name sequentially starting with 0000000000000000, then 0000000000000001, etc. I need to set the Script Name to "com.adobe.acrobat.SharedReview.Register" instead. Is there any reasonable way to accomplish this?
I had to check the iText source code myself, and to my surprise I discovered that we overlooked a method. There was supposed to be a method that allows you to choose the name, but there isn't.
You can work around this by adding the JavaScript straight to the writer:
stamper.getWriter().addJavaScript(
"com.adobe.acrobat.SharedReview.Register",
PdfAction.javaScript(js, stamper.getWriter(), !PdfEncodings.isPdfDocEncoding(js)));
where js is the JavaScript you want to add.
Granted, this isn't elegant. Let me know if this works, and I'll see if I can add the extra method in one of the next releases.

Navigating a website and uploading a PDF using a submit button using JAVA

To explain my situation, I currently have a large amount of PDFs (In the hundreds). Each PDF has a name associated with it and I need browse an external website my job uses to manage their files manually, clicking a button to "attach file" every time and manually selecting the file to upload to the site. If this sounds incredibly inefficient that's because it is, and doing this takes hours to finish while more of them pile up.
I already know how to deal with files, moving them around on a computer, and modifying them using JAVA, but I haven't done anything related to interacting with websites so I wouldn't know where to start.
I'll need to be able to perform the following actions or actions similar in order to complete what I have in mind.
General browsing of a website
Navigating through the website using
links provided by buttons on the page
Being able to click buttons.
Reading Strings present on the screen in order to compare names (Under a certain section there is a list of peoples names. If I detect that there are multiple people with the same name I want to skip the file and deal with it manually)
Clicking a button which brings up an upload menu and selecting a file to upload to it, or any other way of interacting with a feature such as this. (Like when you click Computer on IMGUR and it asks you to choose an image you would like to upload)
I'm not asking for anyone to straight up give me the answer I'm looking for (Though I'm not opposed if you are aware of how to do things such as these and would like to share.) but any guidance on where to find information on performing such actions would be helpful. I've already been searching and will be continuing to search for relevant information.
Thank you for any help you may be able to give.
It appears you want to automate some manual steps on a browser. You can take a look at Selenium WebDriver.

Text to image on web server

I'm wondering if there is a way to create images out of text in a Java web app.
I'm using GWT to design a web app, and would like to allow some administration so that a small number of things could be edited by someone without a ton of savvy and not require a migration. This would be, say, menu headings, which I would otherwise create out of text in (e.g.) Photoshop, and include in my ear. Instead I want to allow an administrator to add some text, and I'd have some code to convert this to an image, using some specified formatting, for "nice" presentation.
As an example, the administrator might want to add a "news" page. So he will enter News and it will come out looking like:
Am I making sense? Is this something that is done? Are there libraries available for this?
This explains the concept pretty well.
Are you wanted to create Vector graphic then yes. You could also convert image into base64 string to store the image and reverse back loading at client.

Categories

Resources