I'd like to display a web page that shows the results of a test containing numerous multiple choice type questions. I have the list of options, the candidate's answer and the correct answer to the questions.
For each question I'd like to display a set of disabled radio buttons where you see the correct answer and the candidate's answer. The problem is that when the two differs I have to display two checked radio buttons (background color would indicate the correct one) and it seems to me that primefaces selectOneRadio or the h:selectOneRadio component don't provide a standard way to do that.
Could you suggest something? Should I try to set it somehow from javascript, or is there a way to do this with standard components based on information acquired from the backing JSF bean?
Related
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.
I have a NatTable grid and use excel like filters in order to filter my content. However, I want to add a feature to the filters as a quick search (not unlike the excel one)
Can anyone give me advice on how I might do that?
I've noticed that the other nattable filter FilterRowHeaderComposite has a textbox filter for filtering words that contain the typed string, so I wonder if I could somehow combine it with the ComboBoxFilterRowHeaderComposite to get a combobox with a quick-search feature.
Can I have two header layers, one with comboboxes and the other with the textbox?
Or maybe combine them in one cell as to work like the regular filter and only when I press on the filter icon to expand into the comboboxes context menu?
Or are there already implementations for this feature I'm trying to do, in NatTable 1.2.0 or 1.3.0? (I'm currently using 1.1.1)
NatTable questions typically get more attention in the Eclipse forum as you already noticed.
For others having the same question, I answered the question there: https://www.eclipse.org/forums/index.php?t=msg&th=1070518&goto=1709109&#msg_1709109
I need to build an AutoCompleteTextField-like component where the user can mark some options as favourites (when he starts to write, some options show up and each option has a checkbox to mark it as favourite). The user can then check a checkbox outside the AutoCompleteTextField to choose whether only the favourites will be shown or on the contrary all the values no matter if they are favourites or not, will be all shown.
I have read Using panels instead of String in Autocompletetextfield and i think it could be done using IAutoCompleteRenderer...
Any ideas?
I would go with the solution provided by Robert in https://stackoverflow.com/a/15484348/461499.
Why?
If you have complete control over how the choices are rendered (by using plain Wicket Components instead of javscript), you can built a very rich component. Although I think it will take some extra javascript effort to make the choices-panel look and feel correct, it should be worth the investment.
I have a large set of data from which the user has to select one. I'm thinking of a way to implement it (of course, in a GUI). I have a few ideas. But just thought of posting here as there may be better alternatives..
Say, user has to select a name from a large set of user base. If I simply put a text field for user to enter the name, then there can be issues like entering same name in different formats, misspelling etc...
I see two options here
Using a combo box
Using a list (Actually i'm thinking of something like a tool tip. As I cant show the whole list always due to space issues)
But combo box won't be much user friendly i guess. As the user will have to scroll around the whole list to select an entry. If the number of entries are too large, this will be
Which means, now I'm left only one option. A popping up list, which will change the content according the text user is entering in the text field. So he can type first few letters and the list will show all the entries starting from the entered text. Got my point, right?
Are there any other better to achieve this kind of need?
If I'm going to implement above, what will be the best way to follow. I'm thinking of extending the JTextField to add required functionality. Well, I'll put some method to set the popup list entries. And I'll add some actionListner to watch the text field, and control the popup list accordingly...
Autocomplete is what you are probably looking for. Google for "java swing jcombobox autocomplete" and limit results for the last couple of years to get relevant results. There will be a lot of examples and ideas on how to implement this with custom code.
I believe there is also some custom libraries like "swingx" that provide at least partial or full implementations to save time.
http://swingx.java.net/
They have released code as recently as the beginning of this years so it appears active and might have what you need.
You could take a look at SwingLab's autocomplete feature, it allows you to attach it to a JCombBox, JList or JTextComponent
use AutoComplete JComboBox/JTextField
based on Standard Java Classes
no issue with larger sets of data
no issue with Focus, BackSpace Key, Caret
for better performance to required sort the array before use
simple workaround for setStrict(true/false), restrict input to array
I am using JSF 1.1 and I'm looking for a JSF list of values component.
I have a button and when I click that a popup window should open with one text field and buttons, where either I could search for what I am looking for in the text field or select all the values when I click on the buttons and from the available list of values I should be able to select one item.
Is any such type of component available in JSF 1.1 or with the icefaces, richfaces or apache jsf components?
Your question title is a little bit confusing, as you don't seem to ask for just a "list of values"-component, but a bunch of different components. Your situation is too specific to have a single existing component covering it all, but you can rather easily achieve the effect by combining a number of components.
Anyway, RichFaces has a modalPanel that you can use for the popup. Text fields and buttons are in the standard Faces library and the 'available list of values` can be handled by a selectOneMenu component, which is also in the standard library.
One additional hint, if it's in anyway possible try not to use JSF 1.1. This is an extremely old version where the list of problems is nearly endless. If you are somehow stuck on a very servlet container you should at least use JSF 1.2, but much better is to use the latest 2.1 release.