Embedding a displayable form in enums?

Hi,
Java coding best practices suggest that enum values are spcified in upper case.
Something like:
public enum WeekDay { SUN, MON, TUE, WED, THU, FRI, SAT; };However, when displaying a single value you would normally want to display in a prettier way.
You would like to see for example the value SUN displayed as "Sunday".
I thought of embedding the view of the value into the enum the following way:
public enum WeekDay {
  SUN("Sunday"),
  MON("Monday"),
  TUE("Tuesday"),
  WED("Wednesday"),
  THU("Thursday"),
  FRI("Friday"),
  SAT("Saterday");
private final String view; // viewable form
    WeekDay(String view) {
      this.view = view;
    private String view() {
      return view;
};So when you want to print the value you can do something like:
System.out.println(WeekDay.SUN.view());I supose that you should only consider using this if you normally have only one way of showing the value (so in this case it is a bit problematic because you will not get other forms of the value, such as "Sun") and it also does not work for localised values.
But for a short list of values with one way of viewing each value, in a single language, it looks acceptable to me.
What do you think?
Madala

madala wrote:
So you would use a switch statement to convert to the human readable form in the toString()?No, you could code toString() exactly as you coded view() in your example.
Or, in some cases, I have enums where most of the names are understandable and only some of the toString() methods are overridden (you can override it for specific values).

Similar Messages

  • I have to make inaccessible the Javascript code embedded in a form pdf. How can I do?

    I have to make inaccessible the Javascript code embedded in a form pdf. How can I do?

    You can secure the file and prevent access to the code, but it's very easy
    to overcome that. Alternatively you can use a code obfuscator to make the
    code less legible.
    On Feb 11, 2015 3:51 PM, "marcogolinelli88" <[email protected]>

  • How to stop an embedded 'Adobe FormsCentral Form' jumping to the top of page?

    I have asked this over on the Muse disscussion forum also but no responce...
    I'm using an embedded "adobe formscentral' form in my Muse website. The form has several 'pages' so the problem is when I click the 'next' button within these forms, the new browser window places the form at the top of the page so the user has to keep scolling back to it... very annoying. See here...
    http://thinksmarttestsite.businesscatalyst.com/parthorus-resume-design .html
    I have applied a scroll motion to the inserted HTML box to ensure it dosn't move and that works fine when using Firefox but when i check the published site on any other browser or in fact any other computer the problem persists.
    Any ideas guys?

    Hi,
    >>when I click the 'next' button within these forms, the new browser window places the form at the top of the page
    Yes, this is the expected behavior.
    >>I have applied a scroll motion to the inserted HTML box to ensure it dosn't move...
    Will you post the actual html page that is having problem, so that we can take a look? the link you provided in your earlier message, resulted in a 'page not found' error. 
    Thanks,
    Lucia

  • Can I upload a php file to my host with an embedded html contact form in Muse for it to work?

    Can I upload a php file to my host with an embedded html contact form in Muse for it to work?

    That would require to know your hosting provider and his requirements. And therein also lies the answer: You cannot blindly design a form in Muse and just hope it will work, you have to know this stuff beforehand and design "to spec".
    Mylenium

  • Acrobat Forms - receiving Images embedded in Distributed Forms

    Hi, I've been using the Acrobat forms through Live Cycle for a while now for small simple projects, but trying to implement it now in something a bit more complex (as well as learning more as I go).
    I've made a form in LiveCycle ES2 requesting Text, Radio Buttons ...
    ...BUT also that the respondee can send their company logo with the form. To make it simpler than just attaching the logo seperately in an Email.
    I've found the Image Field Object which allows the respondee to upload their Logo into the PDF which then gets mailed back to me.
    What I haven't seen is a way to extract this logo to a databank or similar.
    The text I can collect, sort through, and export as CSV or XML which is great, but other than the logos being embedded in the returned PDF, they don't seem to be accessible anywhere.
    I've probably overlooked it somewhere. (I hope). Can someone assist?
    (I'm also not certain what the difference between creating forms in LiveCycle and straight through Acrobat is, but I'll ask that in another question).
    Thanks Angus
    Acrobat X Pro
    LiveCycle ES2
    CS 5.5 Design Pro Suite

    Since your question is specific to Designer, ask in the LiveCycle forum. Be aware that adding pictures is a rather new process and may not work for folks with older versions of Acrobat or Reader (don't remember how far back this goes).

  • Embedding Fonts with Forms Service RenderPDFForm

    We have several custom fonts being used in PDFs we're rendering using the Forms Service RenderPDFForm API. Rather than require consumers of these PDFs to have those fonts installed, we'd like to embed them in the PDFs being generated. Is it possible to embed fonts using RenderPDFForm?
    Tom

    In the adobe/LiveCycle8.2/deploy folder there is a file called:
    adobe-forms-ivs-jboss.ear
    Deploy that file on your app server (note that the name may change to reflect your app server). Once it is deployed you can access the application (it is a testing program for Forms). The URL is:
    http://machinename:port/FormsIVS
    Once it is loaded click on the preferences in the top right corner. Scroll to the bottom and add the administrator/password for your installation. In the first field (called Options) changed the parameter PADebug=0 to PADebug=1. Don't forget to hit the save button at the bottom of the screen. This will return you to the Test Form Design screen. Choose a form from the right List (I chose PurchaseOrder_Dynamic Interactive.xdp). In the Output format dropdown, choose PDFForm. Now click on the Use EJB button. A call to form server will be generated and returned to the screen. Because we have PADebug set to true the whole process is being traced. I am running a JBoss server so the files are written to:
    C:\Adobe\LiveCycle8.2\jboss\server\all\svcdata\FormServer\Debug
    It will be a different location depending on the appserver type you are running. In that folder is a file called:
    debug_xci_pdf.xml
    Make a copy of this file and rename it to MyTest.xci. This is the control file we will pass into the call and also modify to embed fonts. Open this file with an XML editor. In the xci file look for the pdf node under the present tag. In that node there is a child node called fontInfo. There is an embed tag in there that is set to 0. Change it to a 1 and save the file. Now in the call to Forms you can pass in a URI to this file in the XCI URI parameter. You can change this in the FormsIVS application in the options string and try it for yourself before changing our app. So now each time you want to embed the fonts pass the XCI URI into the call otherwise use the default one that is embedded in the jar file.
    Let me know that it worked for you.

  • Embedding HTML into forms to make 3rd party Host Work

    My form looks wonderful!  Only one problem.... It doesn't work!
    It won't says the form was submitted successfully, but I don't receive it.  After reading a thread that said I have to make sure my host provider enables PHPmail, I contacted them they said I need to enter the following:
    mail("receiving-email","subject","message-body","headers");
    Into the form to make it work.
    Is this right?
    If so, how and where in the form do I embed it.  I don't want to screw up the widget.  I opened the html page for the form, but again I don't know where to put this line, if at all.
    Thanks in advance,
    Doc

    i tried uploading using FILEZILLA and everything worked perfectly!!
    consider this solved!!

  • Embedding Flash With Forms using ActiveX Controls

    I have problem embedding Flash Movie using Active X control. I always come up with the message
    " No tenant for this object" can You help me out with this.
    thank you.
    Khurram.

    This forum is for feedback about the OTN program and problems with OTN accounts. Technical questions cannot be answered here. Please post your question in the appropriate product or technology forum.
    http://forums.oracle.com/forums/index.jsp?cat=48

  • Embedding a google form into wiki

    I am using the xserve for a wiki site and I would like to be able to embed a google form into the wiki page. I can do this in wikispaces, but I would like to have it on our own wiki site. I would also like to embed a video that same way. Can this be done on the wiki site?

    Hi Ralph,
    We can use fragments for such requirements but at the end when you add a fragment only the xfo is copied not the data.
    so ideally this is not possible in Adobe forms atleast for now. so we need to have links to launch the child form.
    Cheers,
    Sai

  • Embedding a google form into iWeb.

    I am trying to embed a google form into iWeb and the full form does not show up. I used the HTML widget and copied and pasted the google link.
    Thoughts?

    Hi Ralph,
    We can use fragments for such requirements but at the end when you add a fragment only the xfo is copied not the data.
    so ideally this is not possible in Adobe forms atleast for now. so we need to have links to launch the child form.
    Cheers,
    Sai

  • ORACLE 11G: Embedding an ORACLE Form within an ADF JSF page

    We are currently reviewing the options available to allow us to embed an ORACLE 11G form within an ADF application (11.1.1.4), we are aware of the 'oraformsfaces' functionality but wanted to ask whether there were any other options available to us within ORACLE 11G?
    The reason for the question is that we were informed by ORACLE prior to upgrading to ORACLE 11G that the facility to embed an ORACLE form was 'standard' within ADF 11G hence the reason for upgrading.
    Thanks in Advance!
    Neil

    As I noted before, when you seamless, if you mean the user will be unaware that he has switched from a Forms app to an ADF app then I think he will notice - some clever integration of things like JS maps and Graphs might be seamless but a complete ADF app would be obvious to a user. Physically the Forms widgets are a different technology to ADF Faces - you can get the colors the same, you can event get the widgets the same size but it will pretty much be impossible to get the same because you are not comparing apples and apples.
    Regarding your questions
    1) Do you mean the time it takes to start up the applet? Possible longer than ADF but not necessarily
    2) Each form runtime process will have its own database connection and each user has his own applet.
    3) "Considerable" is subjective - it will involve some work but we specifically built the JS api to help
    Your last point - are you refering to "evolve core business logic into a common layer" what I mean here is that if you have a business process (e.g. hire_employee) which involves creating a new record,ordering a laptop and getting a security pass - then you could take that code out of Forms and put it somewhere else. You could then call that code from Forms (your old apps that you still need) and also call it from your new apps (so calll that code rather than calling the Forms application to do the job). - Of course, there is effort involved there...
    One final point to make ADF is NOT Forms - its not the "new" Forms and it doesn't replace Forms - so any change between Forms and ADF is by no means "go to the next version" - they are different technologies with different sweet spots - moving one to the other will be a considerable effort, and I would say one which should also accompany business process changes (if possible) as well..
    Hope this helps
    Grant

  • Embedding chart in forms

    hello to all out there.
    can anybody tell me where I could find OG.PLL file ?
    its very urgent.
    thanks in advance...

    Hi.
    please check if you can find it in Forms 6i features and benefit demo posted on
    http://www.oracle.com/technology/sample_code/products/forms/6idemos.html
    Frank

  • How to run report that's embeded into my form

    My apps is r12, Could everyone help me run report thats included into form.
    it's show on HTML web, isn't it ?
    Thanks

    Can you describe your requirement in more detail? Reports in the Oracle Enterprise Business Suite (EBS) run through the Concurrent Manager. How is your report ebmedded in your Form? Are you following EBS guidelines for your Forms development? You might want to take a look at the Oracle Applications Documentation library. Select your EBS version and then scroll to the Standards section and review the following documents:
    <ul>
    <li>Oracle Applications Developer's Guide
    <li>Oracle Applications User Interface Standards for Forms-Based Products
    <li>Oracle Application Framework Personalization Guide
    </ul>
    Also, this forum is for general Oracle Forms questions. EBS related questions should be posted in the General EBS Discussion forum. If you have a general Forms question, by all means, ask it here! ;-)
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Excel embedded spreadsheet and form submit

    Hi guys,
    I've tried looking at forums everywhere to no avail on this answer, so was wondering if anyone could help.
    PART 1
    The solution I'm looking for is to create a simple HTML form that when they click submit, will export a text file of the fields in our network.
    That I've got a solution for already.
    PART 2
    However, I wanted the form to be display only and for the user to fill out the details in the interactive spreadsheet instead.
    When they fill out the interactive spreadsheet, it will fill out the HTML form, if that makes sense.
    http://blogs.office.com/2011/02/25/updated-interactive-excel-files-on-web-pages-an-excel-pm-explains
    I've been looking at this interactive spreadsheet example which is exactly what I want for PART 2, but just don't know how to combine the solutions together.
    Thanks!
    Edwin

    Hi,
    What is the “form” that you want to be displayed? VBA UserForms in Excel?
    As far as I know, VBA UserForms created in Visual Basic Editor can’t show in Web Page.

  • Wisdom of keeping PHP scripts embedded when submitting forms

    I was wondering if it would be more secure if the php scripts I'm using to insert user names and contact info into my database would be more secure if the code was moved to a new page called insrtRecord.php and the form action were changed from action="<?php echo $editFormAction; ?>" to action="/Scripts/insrtRecord.php"
    The page was constructed entirely with Dreamweavers built in behaviors so all the code is right there in the contact page for anyone to look at.
    I'd then password protect the Scripts directory that contained the insrtRecord.php file to keep it from prying eyes.
    Thanks for your advice.

    >He took a look at my site, checked the code, and I was sure that I saw some PHP tags pop up.
    Rick, if you did see a tag then it must have been due to a misconfigured script. Any valid php will be parsed on the server and not sent to the client.
    >My Connections folder with the database un and pw is in a protected directory
    >and there's never a call to put in a password when a page connects to the MySql database.
    >This leads me to believe that I can protect all my PHP scripts.
    But connection scripts are referenced using includes which is different than what you originally suggested. I'm not saying it won't work, I really don't know. But it's easy to test and if it works I don't see any harm in adding another layer of security.

Maybe you are looking for

  • How to Manage the Resource Master in Primavera Enterprise Version

    We are using P6 enterprise version in our company having a central database. We had created our own unique resources and standardised across the enterprise and is Admin protected. However we often have to import some schedules sent by our consultant/

  • Idoc DELVRY03/DESADV for Inbound delivery with serial number

    Hi, We have set up am EDI process between our vendors ERP system and our SAP. We will send purchase order Idocs to our vendor, once our vendor has shipped the goods (to our customer) he send an DESADV/DELVRY03 Idoc back to our system. This Idoc will

  • Batch file settings and import of jpgs

    I have a batch of 20 or so images which when i import them all set to 5seconds as a default I want to import them and have them set to 10 seconds (to allow for transition times) can anyone advise the method please? thanks j

  • International Travel Request Project Help..urgent..

    Hi, Our project is International travel request. Wat we planned to do is, to select from and to locations we are displaying 2 world maps one for selection of from field and the other is for to. So i have downloaded world map illustrater file... how c

  • Adding different tooltip for a column in table??

    Hi here, I have read the similar title "Adding ToolTip for individual cell in the table". The method that use "tableModel" and "override getToolTipText" for individual cell is useful for individual cell with tooltip that i have tried. How could i get