How do I create a GUI to customize content using Java? - java

This is for my Java programming assignment, and I've only been working with Java for about 3 months.
We need something simple, so I thought of going with a program that allows the user to customise and design a greeting card cover. Not too complex, it's an introductory course. I would really like some guidelines on how to go about this, and if there is some existing code available. We are allowed to refer to existing codes to create our program as long as we include it as a reference.
So far I can only think of something that can allow custom borders, or a bunch of existing borders as options, fonts, colours and background choices, either colours or textures.
I would appreciate all the help I can get. Thanks.

You could use Jasper reports and create different templates with thumbnails for greeting cards. User would fill the required fields and select thumb of report template. You would then load and preview the selected report.
If you would like more complex solution, you could create "plugin engine" which would allow user to load custom Jasper report templates. You could then save the plugin reports data in xml file. That should be more than enough for any school project.
You could use your knowlege in any future project since you would learn how to create reports, how to create xml files and a lot more ... Most application today use reports and xml files so it would be more than useful knowledge.

Related

Linking Website form progress data to GIS

We are trying to develop a website for tracking the progress of pipeline and assets. I want to link progress data entered from forms developed in Java to GIS. We will be capturing all the lat and longs of pipeline stretch and lat and log of progress of work.
I need help in developing shapefile dynamically based on the progress and also to view that shape file in my webpage
The javascript API does have functionality for uploading shapefiles form your desktop into the browser, but you will need another tool to create those shapefiles based on the progress.
For uploading the shapefiles, see the example here: https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html
There may be more examples available at https://developers.arcgis.com/javascript/3/.
For creating the shapefiles dynamically, you could use ArcMap or ArcPro if you have those, or one of many python libraries to help write shapefiles. There may even be some Java libraries to help with this as well but I only work on the front end so I cannot help you there.
For something simple in context, the complexity of what kind of workflow to best suite your needs can range depending on these questions (and probably others I'm not thinking of):
Do you absolutely need to create a shapefile for this? Why can't you just push the form to a spatial database (e.g. PostGIS) and then return the XYs of the points or the string of XYs for line features, etc.?
Where is the source of the data & what is the format? Is it a PDF, text on an HTML page, a .csv file downloadable from a page, etc.? You may need to implement scraping (from a site) or download and update, or your data could be live streaming - these are all different workflows and you need to establish these boundaries before setting up your workflow.
If your end game are points, all you need is XYs in a table format to display in GIS software. If they are lines or polygons, it'd be a little different. Again - what output type are they and what are you trying to do with it (e.g. import into QGIS)?
Without these answers, it doesn't make sense for anyone to suggest something to you that could be totally impossible for you to execute. Please answer these and think through your workflow from beginning to end and/or visa versa.
Cheers,
Shawn

Java web application : managing picture/thumbnail galleries

I'm pretty new to Java web application and I just started a sample project in order to get some experience in this area.
Here's the matter on which I am currently working : let's assume that my web application will display a bunch of items with a grid containing a small picture (thumbnail) for each of them. What are the best or common practices to implement such an application, with consideration for performance issues (here, I'm mainly thinking about the payload size every time a user would load the list of items)?
Do we usually create a smaller size copy of the uploaded image files, or do we use some Javascript, CSS transformation, you name it, to reduce the images to display?
FYI, I'm using Spring MVC for my sample project.
Hope my question was clear enough. Thx in advance.
The best way is to create a separate thumbnail file for each picture when uploaded. When your client will display your gallery, he will only get reduced picture, and then save a lot of download and presentation time

Moving widgets on fly using GWT?

I have just started working with GWT. I was wondering how I can dynamically move widgets on fly (at web page on client browser) for example to move a row of table up and down, or upload a excel file and display its content right away....something like a dashboard I am talking about. Are there any comprehensive tutorial to refer.
Have a look at the gwt-dnd lib:
http://code.google.com/p/gwt-dnd/
GWT is made for doing the kind of things you are describing. To move widgets you can either set their position or dynamically modify their css. To move rows around in a table look at the api of whatever table class you are using. To upload an excel file do a google search for 'gwt upload' and there will be some instructions - but to display the file you will need to convert it (probably to xml). Converting the file on the server will depend on which server you are using - I also have seen a 3rd party widget that will do that for you.
If youre looking for transition effects or animations , than check out gwtquery. Its really similar to jquery and has pretty simple good examples to start with.

How to generate editable drawing of connected shapes in Java

Can anybody tell me how I could do the following:
I want my Java code to generate a drawing that has multiple connected shapes. Perhaps hundreds of shapes--not huge. I'd like to generate this and save it as a standard file format that somebody could open in a viewer or an editor. I do not want to implement viewing or editing logic--generation only.
I'd like the user to be able to take my generated file, open it in a WYSIWYG editor, and move the shapes around with the lines that connect the shapes staying connected to the shapes as they move. That way, my generation code does not have to be super smart about making sure that connectors don't overlap.
Can anybody suggest a combination of file format, Java library, editor (or some subset of those three) that would work well for this task?
Thoughts so far:
yEd allows this editing behavior and uses graphml as the format. However, I'm not sure how widely used graphml is, and I'm concerned about availability of glyphs.
Inkscape and SVG are widely used, but I'm a complete novice, and so far I haven't been able to get lines to stay connected to other shapes using Inkscape when I move them around.
I'm open to other options...

Create customized Jasper report layout

I would like to create a report that has the following layout:
It has three parts as you can see. The third part is a subreport done as a list, that is the easy part! My question is this: is there a better way of doing the first two parts than drawing boxes and lines in element groups and doing crazy calculations with positioning them? (I am talking about the .jrxml)
Try using iReport. It is a gui application for designing jasper reports.
You can drag and drop text fields and other report elements, so you don't have to worry about positioning.
I have had several problems using the .jrxml gerenated by iReport, but finally I have found an artikle that explains how to use iReport. It also explains how to fill the report.
I have had problems since I was using a manually written .jrxml, which had to be compiled and filled. Now based on the code in the artikel I am not using .jrxml anymore, but the .jasper file compiled by the iReport and everything works like a charm.

Categories