I’ve been developing ADF projects at client sites for over 4 years now (wow, that went fast!). The purpose of this blog is to point out the first things I do on every project to make it run smoothly.  Two of these are JDeveloper configurations, but I sometimes miss them after I’ve installed a new version of JDeveloper or have a new laptop to work with.  The other are project level setups to customize projects specifically.  These recommendations are based on the 12c version of ADF, however these are applicable to 11g (although the instructions may vary).

Configure JDeveloper to Package Business Components

This is a JDeveloper configuration that automatically organizes business components into packages.  When business components are initially imported into a project it is nice to have them automatically organized.  The configuration only needs to be done once, and it will be used every time business components are created.

  1. In JDeveloper, select ‘Tools’ -> ‘Preferences’
  2. Expand ‘ADF Business Components’ and select Packages
  3. Create default package names for each component type

    Additionally you can set defaults for Object Naming, which will provide suffix’s for the different types of business components.  Make sure you consult Oracle’s ADF naming standards.

    Same Code Reformat Settings

    This setting ensures that every time the ‘Reformat’ functionality is run, that it will be consistent (especially in a multi-developer situation).  The reformat functionality should be used frequently to keep code clean and organized.  When using a version control system, when users use the reformat with different settings it appears that many lines have changed, when in reality it could have been no change at all.  Keeping these settings consistent makes it easier to track changes while customizing the coding style.

    One of the critical settings is the ‘Line Width’ property.  This will change long lines into multi lines so that its viewable on the screen.  This is used in all files, including Java and XML.   In 11g the default was set at 80 characters which is an inherited length from back in the day when code was on punch cards (ref. http://en.wikipedia.org/wiki/Characters_per_line).  JDeveloper 12c has defaulted this to 120, but if all developers have large monitors you may want it to be even larger.

    1. In JDeveloper, select ‘Tools’ -> ‘Preferences’
    2. Expand ‘Code Editor’ and select ‘Code Style’
    3. Click the ‘Edit’ button
    4. Expand ‘Line Wrapping’ and change the ‘Line Width’ property as desired

      Create an ADF Skin and Add Font-Awesome

      Having an ADF skin defined from the beginning makes it very easy for developers to add style classes.  As a best practice these should be used instead of inline styles.  

      To provide stylish UIs, icons are often used instead of text.  Many icons are standard and I end up wasting time manually to find a single nice looking icon.  Adding font-awesome provides a great way to add hundreds of icons easily to your ADF application.  No more searching for an image of a trashcan to replace ‘Delete’ text, or a plus sign to replace ‘Add’ text, or even a pencil for ‘Edit’.  Check out all the icons at: http://fortawesome.github.io/Font-Awesome/

      To create an ADF Skin (12c):

      1. Once your application is created, right click on the view project and select ‘New’ -> ‘From Gallery’
      2. Expand out ‘Web Tier’ then select ‘JSF/Facelets’
      3. Select ‘ADF Skin’ and hit ‘Ok’

        In your custom css class created above, add the css similar to:

        @import url('../font-awesome-4.3.0/css/font-awesome.min.css');
      4. Check out all of the icons and how to use them here: http://fortawesome.github.io/Font-Awesome/icons/ 

      Define the Context root

      The context root of an application defines what the base url will look like when accessing the contained pages.  By default, JDeveloper uses ‘<ApplicationName>-<ProjectName>-context-root’.  In most cases a shorter more detailed context root should be used ie. salesdashboard

      1. Right click on the View project, and select ‘Project Properties’
      2. Select ‘Java EE Application’
      3. Enter in the new Java EE Web Context Root

        Submit a Comment

        Your email address will not be published. Required fields are marked *