Setting absolute position in prerender() - java

Im completely new to Java web stuff, but here goes my question:
1) How can I add new controls to a JSF page (webuijsf) in the prerender() function?
2) How can I change the position of elements already added using the visual designer? Also in prerender().
I have a number of input fields + labels to show, coming from a database. So I imagine I read from the database and add the appropriate number of controls during prerender. There's also a grid below these dynamically added controls, which I'd like to move further down at the same time.
Thanks!

You would need to write your own component if you wished to render forms based on database data. You should position your grid using standard html techniques or writing your own custom grid component.

Related

Vaadin - adding components as elements of another components

I've been using a ComboBox to store some values and make a selection from those values, but the problem is, ComboBox, as it is, only allows one selection at the time and I need multiple selections, ie checkboxes, but that cannot be done via Vaadin. I figured if I could present checkboxes as the elements of the ComboBox, that would solve the issue, except adding components to a component that is not a layout doesn't seem to be possible.
I've done this tutorial https://vaadin.com/docs/-/part/framework/components/components-customcomponent.html
Basically it combines two Vaadin components into one panel and displays them together, but that's not what I need, as I need certain components to be placed inside a parent component.
So what are my options if I'm to do this?
This is not an answer to the question that you are asking (component within a component), but rather the underlying problem that you present. In other words, I believe your question is an example of an XY problem.
I think you want to use a Grid with multi-select turned on. In this mode, check boxes are automatically added to each row and there is a checkbox in the header to allow toggling all on/off, ability to filter, ability to sort columns, etc. See the documentation for more details.

Drag and Drop Drawing in Web

The problem is to create a dynamic label printing where in I will present to the user the fields that are available (ex. Name, ID No, Address etc) and I will let them draw their own label.
It is something like on the left side, there are the available fields, and on the right side is a big field where I let them drag and drop the fields and draw boxes and grids.
The system should be able to save the drawing (in any format as long as it can be saved in the database) that they created and the fields in that drawing can be called in the backend.
The saving part is important because if the user created so many labels, I want them to be able to choose which drawing they can use to Print their labels.
I would like to integrate this with my existing web Maven Spring 3.x system.
If anybody could point to where to look, either in the drawing creation or in the saving it would be great.
I did that drawing/saving stuff in a webapp some time ago using Javascript. Use the HTML canvas element to define a place users can draw on.
Guess there are several js/jquery libraries for that (It is also possible to do everything on your own)
There are also exporting functionalities (I do not remember exactly) but it is possible to convert the drawing to a data-url and upload it with a hidden text field. Of course it can be directly stored on the user's computer as well.
Start by having a look at introduction to canvas drawing on w3cschools.com

How do I render a grid only on the last page in BIRT?

Using BIRT 3.7.2, I'm trying to place a grid at the bottom part of the last page of a report for signatories. However I can't seem to find a way to do that.
I've tried to place the grid in a footer and render it using:
if(BirtComp.lessThan(pageNumber, totalPage)) {
this.getStyle().display = "none";
}
on the grid's onRender.
However this only works on the webviewer, and I need it to work in PDF with my Java application. When I use run and format=pdf parameters, there is still that grid at every page, and using frameset instead of run makes it not appear at all. Are there other techniques to do this? If else I may have to settle for placing the signatory grid below the table data so at least it will be on the last page.

TableView (FX 2) of Simple data type

i want to make a tableView without making an object Row like the official tutorial
i just want it to reflect a simple 2D array like double[][] and if that is possible can it be editable
Building a custom control that holds a double value, renders it, provides editing mode (through some action like on click), and putting these custom controls to some layout (GridPane, TilePane, FlowPane) should be more suitable in your case.

Create a properties frame in Java

I am trying to make a properties frame just like the one in netBeans (or Visual Studio). My problem is that I don't know exactly how to design it. First I thought I'll make it with JTable (2 columns, multiple rows) but then I realised that on the second column I will have different types of values (booleans, String, color choosers, etc.), but I think that JTable allows only 1 type of data to be placed in a column.
I would like someone to tell me "JTable allows multiple data types on the same column" and show me how to do it, or tell me a different approach to the problem.
You can perfectly tell a JTable to have a column that contains Object, this way you will be able to put whatever ou want in.
BUT.
You'll then have to implement a very good TableCellRenderer/TableCellEditor pair in order to display whatever the cell contains.
Another option would be to use a Grid or GridBag layout inside of a JScrollPane, then dynamically populate the cells of the grid with different editors depending on the data type of the property.
If you can use external libraries, the JGoodies FormLayout is really suited to create such dialogs. Just take a look at the screenshots in their demo.
There is also a rather good PDF available containing with some examples and explanations.

Categories