How to expose a Java enum as a drop-down list in the ADF?

Seems like a very simple, stupid question, that is, I'm totally new to the ADF, this one is stumping me, and Google does not help things.

Here is a simplified version of what I'm trying to do:
(1) I have an enumeration of 'Color' that contains red, green and blue.
(2) I have a class of "Snowball" that includes a color, say:
Color ballColor;
(3) in a JSF page, I want the user to select the color of a list of choices and a store is the color selected in ballColor so I don't know what color my ball.

Unfortunately, in JDeveloper, when I drag ballColor on my page and select "ADF select a choice" as the control, I can not add attributes to the data mapping.

Obviously, I need to add attributes "somewhere".

Someone has a link to a tutorial or documentation, where someone implements an enumeration of Java as a list of choices ADF? I'm sure it's easy and I am embarrassed to ask, but after 3 hours of fruitless search, it's time to ask someone who knows what they are doing.

Thank you!

Hello

You must use a dynamic list for this. so use something like:


  

Where controllerBean is a managed bean and the following method:

public List getAvailableColors()
{
    List colors = new ArrayList(3);
    colors.add(new SelectItem(Color.RED));
    colors.add(new SelectItem(Color.BLUE));
    colors.add(new SelectItem(Color.GREEN));

    return colors;
}

Note that could have specified a custom label by adding a second argument to the constructor SelectItem, but by default it will use Celsius.ToString where the value is the first argument to the constructor, so in this case Color.toString () which is Color.name () default for enums if your list contains the labels RED, BLUE and GREEN respectively.

Kind regards

~ Simon

EDIT: What happened to my handle :(

Tags: Java

Similar Questions

  • How does one increase the number of entries in the drop-down list of the address bar?

    It seems that the number of entries in the drop-down list of the address bar is limited to twelve URLS. I would find it convenient that more than twelve years can be shown, but do not know how to increase the number.

    Increase or decrease browser.urlbar.maxRichResults using Subject: config

    NOTE: The FasterFox extension may affect the number of items displayed if you have it installed (addons > Extensions).

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

  • How to choose a specific value in a drop-down list using javascript

    Hello

    I'm looking for a way to select a specific value in a drop-down list (the first value) using javascript? How would I do that? Thank you in advance.

    Here's how you can select the first item without having to know what it is:

    Set the value of the drop-down list to the first element cb1

    var f = getField ("cb1");

    var val = f.getItemAt (0, true);

    If (val) f.value = val;

    Change 0 to a different index if desired, or use-1 for the last item in the list. More information for the field getItemAt method is in the Acrobat JavaScript documentation.

  • How to restore the search bar drop-down list and the search engine icon today as it was in version FF 33?

    Some ealier time, I managed to go back to the drop down list via editing about: config and setting browser.search.showOneOffButtons to false.

    But yesterday firefox asked me to improve my search and I agreed. After that, I see ugly new tile instead of the drop-down list.

    How can I go back to find it is old menu drop-down appearance?

    "browser.search.showOneOffButtons" was a temporary pref which lasted from Firefox 34 upward through 42 of Firefox. The underlying code that have supported this preference is gone like Firefox 43.

    https://addons.Mozilla.org/en-us/Firefox/addon/classicthemerestorer/ has an option for old search (experimental) in Options of CTR > UI (1)

  • Drop-down list retains the sign misspelled names. How to modify this list?

    From time to time when you connect to a Web site, I type my user name. This is an example that I could type the first letter of a username and when the drop-down list appears, I accidentally miss the mark and click on new in the box. After realizing immediately what I did, I click on the input box again to highlight the letter I typed and start again, but I did so too quickly and the computer reads it as a double click. The dropdown now has recorded the entrance of the one letter that has been accidentally entered. Because of this and other mistakes, over time I find myself with a dropdown menu with several incorrect user names and a correct. How can I change this list to remove the mistypes and keep only the good ones, or clear the list completely and start again?

    Follow these steps to delete the recorded data (form) in a drop-down list:

    1. Click on the (empty) input field on the web page to open the drop-down list
    2. Select an entry in the drop-down list
    3. Press the DELETE key (on a Mac: shift + delete) to remove it.
  • How can I disable the menu drop-down list on the back button?

    I use a laptop and my hands are not too clever. Whenever I click on the 'back' button, I get the drop-down list, which means that I must then back up my hand to the pad (gently!) to move the pointer, and then try again. It may take me several attempts to turn back a site now!

    I searched for hours how activate the drop-down list, nothing is done and even looked through all the settings in: config to try to find a way around it. Seriously impact my ability to use my laptop on the web now, so if someone can you please come up with a way to return to the old back button, with no menu when my finger slow old cannot move pretty fast down the key, I would be very grateful.

    There are two other ways to return to a page.

    • Right click on a box empty page you visit and use the dos command
    • From the keyboard, press {Alt + left arrow}
  • How can I clear the drop-down list in the user credentials dialog box in windows XP?

    I deleted a .net passport account by using the network password manage
    I have cleare IE cache and everything related to passwords
    But when I opened a credential information, such the connection to Outlook dialog box, in the drop-down list I see still some old user names, none of them is not in the list of Auditors .net.
    How can I delete all the entries in the drop-down list?

    Hi PiterAsquini,

    You can review the article and check if that helps:

    How to handle the names of stored user and passwords on a computer that is not in a domain in Windows XP

  • How to pre-select an item in a drop-down list

    Hello

    I need to pre-select an item in a drop-down list, but I don't see how to achieve this using the current or existing methods.  I know that if I set the rawValue then it works, but later when I try to retrieve the data in the selected drop-down list the order of the day list, I get an 'empty' which does not help.  What he needs, is the value, the pair of label to work properly. When I manually select an item in the drop-down list, it works perfectly. But not when I try programtically set. So now I wonder if it is possible to set the index for the drop-down menu, so that he believes have a selected item, when I survey I get the correct value.

    Hope you can help.

    Kind regards

    Ian

    Hello

    You can use the selectedIndex property to set the desired value.

    And to retrieve a value, I recommend you to use *.getDisplayItem (*.selectedIndex);

    I hope this will help you!

  • Drop-down list in the contact form: how to get results in an email?

    I built a contact form for my website using a tutorial from Lynda.com on building UI elements.  The last step of this tutorial is to put all the elements together in a form of contact, but for some reason, that they have left behind the menu item drop-down, and for the life of me I can't figure out how to write this code.  The problem is that the menu is designed as a movieclip containing several other movieclips and actionscript (button, list, scrollbar, etc.). I can get it to trace the information selected with this code in the drop of movieclip:

    arrow_mc.mouseEnabled = false;

    addEventListener (Event.CHANGE, checkChange);

    function checkChange(event:Event):void

    {

    trace (currentValue);

    }

    But how this value is displayed in the email with the information in the text fields?  This is the code to the movieclip shape, all other information in the text fields.

    function sendForm(event:MouseEvent):void

    {

    var req:URLRequest = new URLRequest ("mailto:[email protected]");

    var vars: URLVariables = new URLVariables();

    vars.body = "this is a form that you received of" + email_txt.text + "" < "+ zip_txt.text +" > "+ height_txt.text +" < "+ width_txt.text +": \n\n ";"

    vars.body += "----------------------------------------------\n\n";

    vars.body += notes_txt.text + "\n\n";

    vars.body += "----------------------------------------------\n\n";

    req.data = vars;

    navigateToURL (req, "_self");

    }

    submit_mc.label = 'send ';

    submit_mc.addEventListener (MouseEvent.CLICK, sendForm);

    I have sent Lynda.com on this subject, but I was told that they could not respond to what it is not included in the tutorial, although it seems when they leave info, that they should be able.  Anyway, thanks for any advice!

    If currentValue is the variable of the partition that you want to send in your email, then simply add another property in your vars URLVariables:

    "Vars.Body =" this is a form that you received from "+ email_txt.text +" <" +="" zip_txt.text="" +="" "="">"+ height_txt.text +"<" +="" width_txt.text="" +="">

    vars.body += "----------------------------------------------\n\n";

    Vars.Body += notes_txt.text + "\n\n";

    Vars.Body += "This is your score" + currentValue "\n\n";

    vars.body += "----------------------------------------------\n\n";

    or something like that. You may need to include a path to the currentValue variable, if it is not available everywhere wherever this form is in the film you.

  • How to fill a textfield based on a drop-down list and a checkbox control

    Hi guys,.

    I need help.
    first step: I have a drop down list, if I click in the dropdownlist control 'a' and place it in the digital field a number greater than 99, checkbox must be marked and second step: a textfield1 must be visible.

    the first stage works perfectly, but the second does not.
    This is my code for the second stage of the event: java script of change of

    If ((DropDownList1.rawValue == "a") & & (this.rawValue == 1))
    {
    TextField1.presence = "visible";
    }
    on the other
    TextField1.presence = 'hidden ';


    everyone has no idea why?

    Thank you!!

    Diana

    Hi Diana,

    You are on the right track. deleteItem is zero base; so if you want to remove the second point, it would be deleteItem (1).

    I would recommend a script similar to the output from the drop-down list, so that if the user goes back and changes the value, the same logic would apply. Also when you remove items from a drop-down list by using script, it is useful to addItem() again in the other part of the if statement. In this way, you can restore the list because the shape is changed.

    Also I would wrap the script in the numberField in another State to check for null first.

    Attached example.

    Good luck

    Niall

  • How are added as a drop-down list in the printer options to create a file PDF Adobe Acrobat?

    How can I add adobe acrobat in the drop down menu the option to printer on my win7 system?

    Original title: create PDF files

    Also: Free Office, Open Office, Microsoft Word (versions), and Word Perfect will save in the form of pdf files. For example, you can create a document save as a pdf or open an existing document, change if you wish and save as PDF.

    Tom Ferguson

  • How to remove a web address in the address bar drop down list? The old advice does not work. Help!

    The OLD advice for this problem, listed below, does NOT work. Web addresses just do not detach:

    1) click the arrow located on the right side of the address bar of Firefox. A list of URLS will come down.

    (2) place your cursor on the URL that you want to delete manually.

    (3) press and hold the "shift" on your keyboard. Then, press the "Del" key The URL highlighted is removed. Or I have been advised to hold the 'Ctrl' key Neither work.

    There are a few new instructions, updates on how to remove the unwanted drop web addresses. Everyone?

    Hi, if your problem is removal of the history of the site. Click on the firefox menu and go to history-> history-> click history on the left side of the window. Now you can remove unwanted Web sites from the list.
    If you want to delete bookmarks fallow the instructions remove bookmarks

  • How to remove entries or register a new in the drop-down list of the Anyconnect client?

    I have a user who uses Anyconnect for quite awhile now, and we have activated the ASA profiles a few times over the past year.

    My client seems very well, but maybe also because I have a new laptop without the previous hidden settings.

    The problem: old entries in the 'box' connection to still appear and if I type a new entry it will connect but not save it as a connection profile.

    If I start from scratch by uninstalling the client, ranging on the external right site (vpn.mydomain.com), it will automatically install the customer very well yet.  But the client install still just shows the old entries and not the correct (what should the list as vpn.mydomain.com).

    I deleted the entries in personal profile under c:\users\username\appdata\local\Cisco and that to remove an entry, but the other is still there and I can't find where on the system, it is stored.

    However, the great thing is that it does not save the correct entry of vpn.mydomain.com in the list of connections, so the user must either enter it and click on connect manually or if they have to go to the website https://vpn.mydomain.com and connect via the site itself.

    Any ideas on how to get this fixed so that his client only shows the correct host in the customer?

    On Windows, see C:\ProgramData\Cisco\Cisco AnyConnect guarantee mobility Client\Profile. profile entries must complete this directory.

    New connections should add profiles or you can construct one manually using the following simple model, replacing it with your values where I typed xxxx:

    http://schemas.xmlsoap.org/encoding/">."

    xxx

    xxx.xxx.xxx.xxx

    SSL

    There are many more entries in option, but it's a bone at naked one.

  • How can I sort alphabetically in the drop-down list in the Tools menu of Firefox?

    The Tools menu has a drop-down list, but the entries are not in alphabetical order. Options and a few individual add-ons/extensions appear in the list, but not in alphabetical order. It would be useful to them in alphabetical order in the list, however, I can't find any option to sort. Did I miss a hidden, built-in option for sorting? Is there an add-on may be providing a way to sort? Someone has an idea? I have not found anything this either in my research on the subject... just what is the sorting of bookmarks. But it's the combo of Tools menu I want to be able to twist. Anyone?

    There is no built-in opportunities to change the menus of the application. The easiest way to do this is by using the editor from Menu Add-on.

    Advanced users familiar with CSS can create a custom style sheet and apply it with Stylish.

  • How can I add a search engine "You Tube" to the drop-down list to the right of the address bar?

    It is no longer available and I can't find it on You Tube site, as suggested in one of the help pages. I lost looking through them.

    https://support.Mozilla.org/en-us/KB/search-bar-easily-choose-your-search-engine?ESAB=a & As = AAQ

    I use Firefox 22 with the Windows 7 operating system.

    Please let know us if there is a solution, I have to do.

    I was rather surprised not to see one myself. Perhaps because it is now considered that Google a using the video option is that the same one you tube search.

    You can order lists in

Maybe you are looking for