Want to have a layout which arrange in a tabular form - java

I am very new to Vaadin. My requirement is like in my page I need to have 4 input component per row. There would be 4 rows like this. I need a layout which will allow me to define number of columns and keep align it.
There should not be any border like we have in table. Please suggest me any suitable layout and how can I customize that.
Thanks

You are probably looking for a GridLayout, it provides enough flexibility to size your grid 'cells', maintain consistency and set expand ratios for row and columns separately.
The other option for you is to use a CustomComponent and in case you are using Vaadin plugin for eclipse (and I don't have experience with Vaadin on any other IDE) you can use their WYSIWYG editor to translate your requirement to a custom component.

Related

Make specific columns of a Grid editable in Vaadin 8

In Vaadin 8, I have a Grid with columns and rows populated from jsondata using setDataProvider. Now, I have an edit button, upon clicking it user should be able to edit (a few) columns in the Grid.
In Vaadin 8, there are number of ways to incorporate editing in Grid.
There is a builtin feature of row editor, which can be used also in unbuffered mode. This is not equivalent of having the whole column editable, but mimics it pretty well, while you can use Binder for setting fields, validation, etc. There exists also an add-on that helps keyboard navigation with un-buffered editor.
Alternatively you can use the Grid Renderers Collection add-on, that provides set of editable renderers with edit events etc.. This is literaly what you are looking for, column oriented editing. This is useful approach when only few columns are editable.
https://vaadin.com/directory/component/grid-renderers-collection-for-vaadin7
If you use renderers extensively, there will be more widgets for the browser to render, and that will UI possibly slower than using e.g. row editor in un-buffered mode. This depends heavily on your application and use case. I recommend to study multiple approaches and select the one that fits you the best.
Third alternative is to use ComponentColumn feature, see chapter Component Renderer in Vaadin documentation. This is somewhat easier than implementing custom renderers, but adds some further overhead.

Creating set of JButtons according to retrieved database values

I'm working on a POS system for a fast food restaurant. I've developed Adding, updating and deleting products using a MySQL Database. Now I need to create the POS GUI (using SWING) which the cashier uses to create the bill. The interface I have in mind is like what MacDonald's uses, there's a set of buttons with the product images. (I have stored BLOBS of products successfully)
example image :
I have no idea on how to accomplish this, it would be awesome if its possible to generate a set of dynamic Jbuttons which gets the image of a product along with the name and price. Is this the best way to accomplish this? and how do I achieve this? A few details to put me on the correct path will be greatly appreciated!
Thanks.
You have at least four containers, the top row, the bottom row and each row containing a separate container in the middle (for the buttons).
The basic layout for the rows might be a GridLayout, each row would probably use a BorderLayout with the nav buttons in the WEST and EAST positions. CENTER container could use a GridLayout, but won't give you the look you're after. You could use a FlowLayout and even a GridBagLayout, but you'd need to ensure the size of the buttons where correct for your needs
On the left I see a JTable and two JPanels, containing the buttons, held together with a GridBagLayout.
On the right I see a JList. See How to Use Lists for more details. You'll probably also want to have a look at Concepts: Editors and Renderers and Writing a Custom Cell Renderer for details about how you could customise the look of the cells and How to Write a List Selection Listener for details about how to determine when the user changes the selection
Together, they are probably maintained by a GridBagLayout within a single container for ease of use
Along the button is probably another container using a GridBagLayout.
Altogether, they are probably held together by a GridBagLayout
Have a look at Laying Out Components Within a Container, How to Use GridBagLayout, How to Use BorderLayout and How to Use FlowLayout for more details
You will need to look into the GridLayout.
In your case, it might be a little bit more complex since you have multiple grids, some of which seem to be nested within each other.
You should be able to allocate the grid dynamically and then leave it to the layout manager to distribute things evenly over the page.
Depending on the complexity of your layout, it might also be a good idea to look into the GridPane provided by JavaFX.
Hi I look for you this problem and I find this solution ;
http://www.javasrilankansupport.com/2012/06/create-dynamic-jbutton-with-image-and.html

Eclipse Plugin - TreeViewer display large amount of Text

I am currently writing on a Plugin that uses a view with a TreeViewer. The thing is, as content for my Nodes I get plain HTML. I would like to display the HTML styled or, if not possible, the simple plain text without any HTML. But the issue I run into is that the TreeViewer is not displaying enough text.
As you can see the HTML is not completly displayed and that everyting is only one line is not pretty aswell. I would like to have a box or something that can display the text (doesnt matter if the box does not support the HTML-styling, I can do this from hand).
Currently I'm using a LabelProvider that is returning the Text of a Node as string (and from what I can see this is the only possible Option with a LabelProvider).
As workaround I could only think of cutting the text into serval nodes but I would like to know if there are better options out there ;)
If it's your own LabelProvider, you can truncate or manipulate the text shown however you wish. Since it ultimately ends up as a native control, you're basically stuck with text label with a single image (plus whatever IColorLabelProvider offers) as long as you're using a tree control.
You could experiment with the Figures from the GEF project or the Nebula CompositeTable as alternatives.
you can use a editor to show the content, this would be appropriate with your requirement. View can also be think for it. tableviewer clould also be least choice. TreeViewer generaly use to deal with hierarchical data.
There are several label providers available in Eclipse in the org.eclipse.jface.viewers package. You can choose to implement your own or extend one of them to choose your need.
Looking at the image, I would recommend to display only few words in the tree and the entire content of the node could be in a different pane/tool tip.

Vertical document points-of-interest highlighter component of an IDE. What's it called?

Both Eclipse an Netbeans provide a vertical points of interest highlighter next to document scroll bars, which appears to be a part of an extended JScrollPane or is simply a standalone custom component.
I've marked it on the picture below (Netbeans and Eclipse version, in that order).
It highlights lots of different things and represents a flat view of the entire document.
What is this area/component called in general?
I've been looking around on pointers on how to implement such a thing in swing or abuse an existing implementation to my liking but I don't even know what to search for. Both implementations of this thing appear to be quite similar, so I'm hoping they are based on the same piece of code.
It's an extend JScrollPane which has implemted some kind of column footer.
The default JScrollPane provides row and column headers by default, check out How to use scroll panes for more details
Try taking a look at JideScrollPane from jidesoft
Eclipse just calls these vertical rulers (they are implemented with SWT in Eclipse).

Is there a standard or open-source tag cloud implementation for SWT?

I need functionality for displaying and allowing selections of tags in SWT. Something that uses space efficiently, and ideally allows scaling of tags.
Is there a tag cloud widget or is there one that is easily available?
The closest that I've been able to come to a tag cloud manually and without too much work is to use a row layout with a button per each tag, but then to merely place a number next to each tag. If I tried to adjust size based on frequency, I would end up with too much open space because each row would have the vertical space of its latest tag. I'm assuming that a tag cloud implementation would use a more specialized layout.
Maybe OpenCloud can move you in the right direction:
http://opencloud.sourceforge.net/
While not swt specific, it is Java and Tag-Cloud specific.
Good Luck.

Categories

Resources