Wednesday 7 August 2013

JDeveloper 12c POM Files


In the earlier post, we saw how to create POM files from the Application Wizard. In this post, I will talk more about the POM files created by the Application Wizard.

Application POM

Expand the 'Application Resources' panel in the Application Navigator and you will find 'Build Files' folder. Expand the 'Build Files' folder and you will see the pom.xml. This is the Application level POM. In earlier release (11g), the application pom file was not inside the 'Build Files' folder, but was under 'Maven POMs' folder. In 12c, we use 'Build Files' folder to list all build related files (pom.xml in case of Maven or build.xml in case of Ant)


Application POM file is stored in the same directory location as the Application's .jws file is.



Project POM

Project level POMs are located inside the 'Resources' folder of the projects. See the snapshot below.





Let's double click on the Application POM and see what happens. JDeveloper has an Overview Editor to visualize and edit POM's content.


Now, open the two pom files related to Model and ViewController projects.

Few interesting things to observe:

- There is an OverView Editor to visualize and edit pom's content
- There is an 'Effective POM' tab to view the effective pom content
- More interestingly, if you look at the Child Modules section of the Application POM, you will notice two entries, which are Model and ViewController. The two projects are child modules of Application POM
- The packaging type of Application POM is 'pom' (since it's multi-module project)
- If you look at the POM file content of Model and ViewController projects, you will observe that the parent of the POM is *not* set (to Application POM).

Why did JDeveloper go with the multi-module (aggregation) approach rather than inheritance approach? Let's explore this question in the next blog.

JDeveloper Used: 12.1.2.0.0
Maven Version Used: 3.0.4

Hope you find this blog useful!.

Wednesday 31 July 2013

JDeveloper 12c: Creating POM From Application Wizard


This blogs explains the creation of pom files for Application and Project from the Application Wizard.
Note: Readers are expected to have basic understanding of Maven.

Before 12c, Users can create pom file for the Application and Project from the New Gallery as shown in the snapshot below:

Users would create the POM for Application or Project *after* the application and/or project is created.

In 12c (12.1.2.0.0), we have integrated the option of creating POM file in the Application Wizard itself.
The snapshot below shows a new page called 'Build Tool' in the Application Wizard.


User can choose Maven or ANT option in this page.  If Maven option is selected, the Wizard will create the Application and Project POM files. If ANT option is selected, Wizard will create the build.xml file.

If you have trouble locating the Application POM in JDeveloper, please comment on your experience.

Would you like to see any thing more or less in the 'Build Tool' page? Let us know.

Hope you find this blog useful!

JDeveloper 12c Release


JDeveloper 12c release is out. Check out all the new features that have gone into this release. In coming weeks, I plan to blog about some of the features that we (my team) worked on. Stay tuned...

Friday 1 July 2011

JSF Visual Editor: Inline Editing Support


JSF Visual Editor in JDeveloper provides support for inline editing. Using this feature you can edit the ADF Component's 'text' attribute directly in the visual editor.

This blogs explains how to use the inline editing feature.

Step 1: Go ahead and create a 'Fusion Web Application (ADF)' from the New->Gallery

Step 2: Create a JSF page from New->Gallery->Web Tier->JSF/Facelets->Page (in JDev 11.1.2.0.0)


Step 3: Once the Visual Editor shows up, drag and drop a PanelStretchLaytout from the palette onto the visual editor. Then drop a  PanelBox onto the 'Center' facet of the PanelStretchLayout and a PanelAccordion on to the 'Start' facet of the PanelStretchLayout

The Visual Editor will look like the following:



Step 4: Say, you want to edit the PanelBox 'text' property (header text of PanelBox) whose default value shown in the visual editor is "panelBox1"
 
Click the panelBox to select the PanelBox component. See the figure below where the panelBox is selected  (red dotted border around the component).



Step 5: Now, click again on the area where the PanelBox header text is displayed.



You will see a thick red border around the header text of the PanelBox with a blinking cursor.
Note: First click selects the component and second click puts visual editor in inline editing mode.



Step 6:  Now you can move the cursor or double click to select the whole text. You can also press F2 to select the whole text.





Step 7: Type "My PanelBox" and hit Enter. This updates the 'text' property of the PanelBox with the entered value.  Note: You don't have to go to Property Inspector to edit the 'text' property, you can do it in the visual editor itself.

Using this feature, you can edit the 'text' property of ADF Faces components like ShowDetailItem, PanelHeader, ShowDetailHeader, CommandButton, CommandLink, CommandImageLink, CommandNavigationItem, CommandToolbarButton, etc.,. You can also edit the 'headerText' property of table Column using this feature.

Step 8: If you go to the source view, you will realize that the value entered is hard coded into the jsf page. What if you want to externalize the value.
 
Right click on the panel box header text area and select 'Select Text Resource for->Text (from the Context Menu) as shown the diagram below:


This brings up the 'Select Text Resource' dialog. Click 'Save and Select' to save the key-value pair in the properties file. 

Note: You can see the 'ViewControllerBundle.properties' file created in the View Controller project.
 
Take a look at the source view and observe the code change related to PanelBox tag. The hard coded value is changed to an EL expression.
 
    <af:panelBox text="#{viewcontrollerBundle.MYPANELBOX}" id="pb1">
          <f:facet name="toolbar"/>
    </af:panelBox>
 

Step 9: Now, you may want to edit the EL expression for the 'text' property in the visual editor itself.  In order to edit the expression, click once to select the PanelBox component and click again on the header text area. Instead of the red border with blinking cursor (as you observed in Step 5), visual editor brings up a small dialog which shows the expression and two options (Select Text Resource... and Expression Builder...).





You can click inside the text area which shows the expression and start editing. Code Insight is also supported in that text area. So, if you have more keys defined in the properties file, you can see the other keys and select them through code insight.

Note: Try clicking the 'Select Text Resource...' and 'Expression Builder...' links and see what happens!.

JDeveloper Version Used: 11.1.2.0.0

Enjoy!

Monday 27 June 2011

JDeveloper Project-POM Synchronization

As part of JDeveloper 11.1.2.0.0 release, we have improved  Maven support in the IDE. One of the Maven features is the automatic synchronization between the JDeveloper Project (jpr) and Maven POM. This blog illustrates this features.

Step 1: Go ahead and create a custom project in JDeveloper.

Step 2: Next, create a POM for this project from the New->Gallery->General->Maven->Maven POM For Project option.

Step 3: Let's add a library to the project. Go to 'Project Properties->Libraries and ClassPath' and add 'Apache Ant' to the project by clicking the 'Add Library' button and choosing Apache Ant from the libraries list.


Step 4: Select Maven->Dependencies in the Project Properties dialog and you will see the Apache Ant added to the pom.

Step 5: Let's add a dependency to the POM and see what happens!. In Maven->Dependencies dialog, click 'Add Library'. Let's choose jstl and add it to the pom. You will see a dialog letting you know that JDeveloper will install the jstl library to the local Maven repository. Say ok in the dialog.


Note: Would be nice to have the export option automatically selected (which is the default in case of adding libraries from 'Libraries and ClassPath' page).

Step 6: Now, select 'Libraries and Classpath' in Project Properties and you will see the jstl library added to JDeveloper project (jpr file) as well.


Click 'OK' in the Project Properties diaog.

So, with this release JDeveloper automatically keeps the jpr and pom in sync whenever dependencies are added to jpr or pom.

Step 7: What if you directly add a dependency to the pom file through Source editor? Let's see what happens in this case. Add the following to pom.xml (from the Source Editor of pom.xml)

        
        <dependency>
          <groupId>oracle.jdeveloper.library</groupId>
          <artifactId>EJB</artifactId>
          <version>3.0</version>
          <type>pom</type>
          <scope>compile</scope>
        </dependency> 

After adding this, go to Project Properties->Maven->Dependencies page and you will see a message in red color
        "The project POM has dependencies that are not in this list. Use 'Add From POM' to add them"


JDeveloper recognized that there is a dependency entry in pom which needs to be added to this list, so project and pom can be kept in sync.
        
Click "Add from POM" button and the EJB library will show up in the Maven Dependency panel and the library will get added to the project as well. Go to 'Libraries and Classpath' to see this entry.




Note:  
If you select the newly added dependency (EJB) and click on 'View' button, you will notice that the Class Path is pointing to the maven local repository. Click some other library (say Apache Ant) and check its Class Path (it will be pointing to your oracle JDeveloper install).
        
Would be a nice if JDeveloper had set the Class Path to JDeveloper install rather than the maven local repository (since the library is already there in the JDeveloper install).
        
Currently, JDeveloper is constructing the description by cancatenating groupId:artifactId:version:type
from the dependency section of the pom. JDeveloper could have used the artifactId "EJB" in the description
column rather than 'oracle.jdeveloper.library:EJB:3.0:pom'. 

JDeveloper: 11.1.2.0.0

Enjoy!. Hope you find this blog useful!.