wrapping the contents of List in SWT - java

I have created fixed size List. If the list has one item which is bigger than the List size it self, then the item should be wrapped to multiple lines.
SWT.WRAP can't be used as it supports only Label and Text controls.

For item customization of List you need to create your own widget.
Check e.g. http://www.snip2code.com/Snippet/11489/Custom-SWT-List-Box
In this way you will have full control on the rendering of the different items

If you want to have multiple lines in labels per item in a list, then you use a table instead. See the SWT snippet "draw multiple lines in a table item" for the relevant code.
The bad news is that all items must have the same height...

Related

Efficient Algorithm - Comparing lists with Virtual Scrolling

I need to test an application through UI where there are two panels.
One being available items and the other is selected items
These panes can contain thousands of items
Each available item has a checkbox used to select it and then the add button will add it to the selected pane.
My problem is there is virtual scrolling implemented on the panels.
Meaning I can only ever access a maximum of 16 items at a time,
(I've tried scrolling down to the bottom - but still, css selectors only work for the items I can see on the screen)
My Question is what is the best way to test this in terms of moving items from one panel to the next?
Possible approaches:
1) Move available items over to the selected items list (16 at a time) and assert they 16 got moved correctly ?
2) Move items over one by one asserting as I go they moved ok
3) Save all available items to a list then add them all over and compared the selected items to the saved list.
Could threading be an option?
Arquillian, Drone and Graphene are used so tests are done with page objects using Java

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.

Hide some items from JList Java

I'm trying to hide (not remove) some items from a JList Java, but I can't find the way.
The process I'm trying to realize is a list with JCheckbox and a search form (textfield). When the user fire some text I filter the list, but I need to keep the state of the checkbox, so I can't remove the item, but only hide or show it.
Thanks for the help.
When the user fire some text I filter the list,
JList does not support filtering.
You can use a single column JTable. JTable does support filtering.
Read the section from the Swing tutorial on Sorting and Filtering for more information and working examples.

how to disable a list element in swt list eclipse

Is it possible to disable only certain elements of a swt list display.I want a list display with a certain clickable strings and a few disabled strings based on my conditions.Is it possible to this?
It is not possible with SWT List widget. you might need to come up with your own widget( may be Table with one Column)
If you really want it then add a selection listener that would detect if the selection is on the "disabled" item and then adjust up/down/clear selection depending on the list contents.
You may also use table with a single column - then you should be able to custom-draw disabled items (e.g. to use lighter font or a different background).

Filtering a ListView in wicket using 2 drop down boxes

I am trying to filter a list that is placed into a listview through the use of 2 drop down boxes.
The first dropdown box is titled price and the second is owner.
I want to be able to select a value in one or more of these drop down boxes and then have the List view re-render with the filtered results.
The trouble is I do not know how to begin this task, would someone be so kind as to enlighten me :D
Thanks in advance!
Your best starting point is probably this example: (Source code also available on this page, ChoicePage.java is the name)
First of all, you have to use a dynamic model in your ListView that generates the list of items depending on what you had selected in the dropdown boxes.
Then the basic idea is that you add an AjaxFormComponentUpdatingBehavior to the components that control the updates (your two dropdown boxes in your case), and in the onUpdate() method of this behaviour you should add the component you want to update to that AjaxRequestTarget passed.

Categories