Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Saturday, September 12, 2015

ADF ListView Component

ADF ListView Component

ADF ListView component displays a List of Items based on rows of a collection model.If you are working in Jdeveloper11g(11.1.1.7) version then you would notice that when you try to drop in a collection onto a page then the same does not show List View component to select from.Same is available from the component palette for selection seems to be an issue with Jdeveloper.

Jdeveloper11g(11.1.1.7)
















Do not see an issue with Jdeveloper12c.

Jdeveloper12c












This component works pretty much like a Table component when it comes to the binding level.How to use this component in 11g as we need to drop this component from the component palette and then provide the property values manually.Easy way for the same is to first drop your collection as a table component (would prefer a read only table component) then drop in the list view component.Now add a list item component into the list view as shown below










Now copy the value available in Table component value property and provide the same into the list view components value property as below,also provide the selection listener value as similar to Table component value to the list view component.Also make the selection property for list view component as Single.















Similarly provide the binding values for the list item component as the value is available in the output text component under column of the table component value would be something like this - #{row.EmployeeId} i have copied it to the output text as #{item.EmployeeId} just to differentiate that this is a list items value the way it happens in 12c.












Now it show a warning in the output text component as the variable item is yet to be defined.Define the same at the listview level var property














Delete the table component which was used as basis for setting the properties of the list view component.After all the property are set list view item is now ready to use which will be rendered as below















Reference - https://www.youtube.com/watch?v=9aLLn_NIrZI

Tuesday, April 21, 2015

Exporting Data from ADF Table

Exporting Data from ADF Table


In this post we shall look at how to export data from an ADF table.To export data from an ADF table we shall use an export collection action listener from the operations component panel of ADF Faces.

General steps which i followed to export data from ADF Table declaratively.

  • Inside a Layout container had a panel collection component
  • Under this layout container have a panel collection component used
  • Inside the panel collection dropped an read only ADF table
  • Now we can either use the toolbar facet or menu facet of panel collection component
  • In the current example have used toolbar facet have tried it with menu facet also the steps are the same.
  • Toolbar facet of panel collection drop a toolbar and drop a button into the toolbar, give the button an appropriate text
Inside the button drop an export collection action listener a dialog opens up asking for two mandatory attributes for this listener which are as mentioned below:

i) ExportedId - ID of the component to be exported
ii) type - export type. The only currently supported value is 'excelHTML'

Other optional parameters are
iii) filename - file name for the exported content
iv) title - the title of the worksheet of the exported content
v) exportedRows - rows to include in the exported content

specific reason to use panel collection is to wrap my collection component which is the table as it provides toolbar and menu facets

Note:
Only the following can be exported:

Value of value holder components (such as input and output components).

Value of selectItem components used in selelctOneChoice and selectOneListbox components (the value of selectItem components in other selection components are not exported).

Value of the text attribute of a command component.


Value of the shortDesc attribute on image and icon components.

Following is the sample code snippet of my demo app.

<af:panelStretchLayout id="psl1">
          <f:facet name="center">
            <af:panelCollection id="pc1">
              <f:facet name="menus"/>
              <f:facet name="toolbar">
                <af:toolbar id="t1">
                  <af:commandToolbarButton text="ExporttoExcel"
                                           id="ctb1">
                    <af:exportCollectionActionListener type="excelHTML"
                                                       exportedId="datatoexport"
                                                       filename="Employee"
                                                       title="EmployeeExport"/>
                  </af:commandToolbarButton>
                </af:toolbar>
              </f:facet>
              <f:facet name="statusbar"/>
              <af:table value="#{bindings.ExportEmp.collectionModel}" var="row"
                        rows="#{bindings.ExportEmp.rangeSize}"
                        emptyText="#{bindings.ExportEmp.viewable ? 'No data to display.' : 'Access Denied.'}"
                        fetchSize="#{bindings.ExportEmp.rangeSize}"
                        rowBandingInterval="0"
                        selectionListener="#{bindings.ExportEmp.collectionModel.makeCurrent}"

                        rowSelection="multiple" id="datatoexport">

This is how the application looks when it is run




Once you click the export excel button a dialog appears on whether to save the data




Saved excel file worksheet title has the title as given in the export collection action listener title property





Uploaded is the sample app here

References:

  1.  Export data from Tables,Trees
  2.  Export Collection Action Listener









Sunday, April 12, 2015

Deleting a Jdeveloper Extension

DELETING A JDEVELOPER EXTENSION


As per checks done looks like there is no user interface to delete an extension from Jdeveloper.But we can go ahead with disabling an extension from Jdeveloper.

1) Go to Tools -> Preferences -> Extensions from Jdeveloper and then uncheck the extesions which you want to disable as shown below 




 But if we want to really delete an extension from Jdeveloper then the only option looks to be do it manually.Prior to executing this manual step first stop any Jdeveloper running instances and then do the manual activity of deleting an extension.

Go to your <MiddlewareHome>/jdeveloper/jdev/extensions directory and then take a back up of this directory before deleting any specific extensions.

Say i want to delete BPM extension from Jdeveloper then search for JAR files with name like oracle.bpm.* as shown below

Now run Jdeveloper and see whether it is working fine after the deletion of the JAR files from the extension directory.If it is working fine then you can clean up your extension directory back up accordingly.

Saturday, April 11, 2015

Changing JDeveloper Font Size

CHANGING JDEVELOPER FONT SIZE

Ever wondered on how to change the font size of JDeveloper as we might me working on different screens may be on laptop or big desktop monitor.So people would really like to customize the font size as per their wish the JDeveloper font size then that would be really useful.

Came across this setting as part of my search and efforts to change the Jdeveloper font size as per my wishes.

In order to set the font size for the Jdeveloper IDE you need to modify the ide.properties file to set the font size.

It is typically available under 

Windows:

C:\Users\{user_name}\AppData\Roaming\JDeveloper\system11.<Versiopn>\o.jdeveloper\ide.properties

Linux:

For Linux just do a find for ide.properties file under your Jdeveloper home and set the font size as per your wish.

Value which i have set the font size is 15 as below in the file.

Ide.FontSize=15

In fact the ide.properties file is so self explanatory it has lot of comments documented in it on how to set the font sizes for a specific locale and look and feel etc.

Tested the same with a larger font size of 45 on my laptop below are the images for the same.

Ide.FontSize=15





Ide.FontSize=45























Reference:https://community.oracle.com/thread/2282785

Sunday, February 22, 2015

View Link Consistency and Association Consistency

View Link Consistency and Association Consistency


View link consistency is a feature that allows view object instances with entity usages to immediately see rows based on new entity object instances as they get created.

For example, suppose you create a row using CreateEmployeeVO based on Enitity Object definition of Employees.This would create an instance of the entity object definition Employees. View link consistency will allow that employee to appear as a row in SearchEmployeeVO (a different view object instance) without a database post and requery.

For simple view object definitions with only one updatable entity, this happens automatically unless you make manual changes to your application module by setting jbo.viewlink.consistent=false configuration property at the AM level.

However, by default, view object definitions with multiple updatable entities do not have instances with view link consistency.This is because, if an instance of each entity usage is created, it may not be clear how many new view rows to base on them (one row with both, or two separate view rows, one with each).

However, in some cases, you are creating both entity object instances by creating a single view row appropriate to a particular view object instance. In that case, you can manually set view row consistency on the view object instance by passing a value of true ViewObjectImpl.setAssociationConsistent().

Example: ViewObjectImpl.setAssociationConsistent(true);



Saturday, February 14, 2015

ADF Dynamic Region issue faced in managed bean usage

ADF Dynamic Region issue faced in managed bean usage


Following is a generic issue which many of you may come across while trying to use a task flow as a Dynamic Region on a page.

These are the steps after which you can come across this issue may not be exactly as it is

1. In a task flow1 you register a Managed Bean with a name of your choice and the scope of the same is View Scope.

2. In a page in this specific task flow1 you want to use another taskflow,  for using the same you try dropping the task flow as a region and while dropping as a region you select Dynamic Region

3. When you drop as a Dynamic Region you need to provide the Managed Bean name which is already available or create a new Managed Bean as we already have a registered Managed Bean we will use the same.

4. Now for some reason we feel the region is not created properly so we go ahead and delete the region dropped on the page and again we try dropping the task flow as a Dynamic Region on the page.

5. Now when we try to choose the managed bean name our registered managed bean name is not available in the Managed Bean drop down list what happened.

6. Reason for non availability is because a dynamic region dropped on a page will create the following method and private variable as below

private String taskFlowId = "<task flow path>";

public TaskFlowId getDynamicTaskFlowId() {
        return TaskFlowId.parse(taskFlowId);
    }
7. During the prior dropping of the taskflow as a dynamic region has already created these methods in the managed bean class and hence currently when we try to drop the dynamic region again it shows only those managed bean names in the drop down which do not have the getDynamicTaskFlowId() method in the bean java class.

8. How to then show our managed bean in the drop down simply go to the managed bean java class and remove the variable and the method try dropping the task flow as dynamic region now and you will be able to see your expected managed bean in the drop down again.

Happy Coding in ADF

Monday, December 29, 2014

ADF UI Label Property Settings

ADF UI Label Property Settings


Every Web developer who is working at an ADF UI level would faced this dilemma,question of whether to set UI-oriented property values on the Model (entity object or view object definition) level or the UI View (component) level.This is the most common question faced often when developing
with these frameworks.

A useful rule-of-thumb which i have followed and was suggested as best practice during my development cycle is given below:
i) Property values that are likely to serve most purposes should be defined on the entity object definition level. 

ii) By the above way, all view object definitions and UI components based on that entity object definition will inherit the properties. 

iii) You can then specialize (override) those properties, if needed, in the view object
definition level. The view object definition can serve many UI components, so a single view
object definition setting can affect many places in the UI. 

iv) The last place to override these properties is on the UI component level.

Hope this rule of thumb helps you while developing your ADF application :-)

Sunday, December 7, 2014

ADF af:popup contentDelivery attribute

ADF af:popup contentDelivery attribute


This component is available in JDeveloper 11g ADF Faces Rich Client, I personally like how it works and how it looks. In this post I will discuss on how the contentDelivery Property determines the contents of Popup.

Actually, pop-up functionality is created in two steps:


1) First we set up the contents of af:popup component
















2) Put af:showPopupBehavior component on whatever action component where you want to show a popup.












Important - af:popup should have the same Id value as af:showPopupBehavior component, this will allow to open pop-up when action component is pressed.

The contentDelivery attribute of an af:popup component controls the popup initialization time and how does the data get refreshed within the popup.


How does the contentDelivery property on af:popup works,contentDelivery defines when data on the page are refreshed from the Model layer. The default value is “lazy,” which means that the contents will be refreshed only when the popup first displays. The value “lazyUncached” signifies that the data should not be stored between displays; the values will be refreshed each time.Another value, “immediate,” causes the popup to be loaded when the base page is loaded even before the popup is displayed.


Typical Use Case which we use to test this property is to have a Table with a view menu on the top.When a specific record in the table is selected and the view menu is pressed then the popup will show the specific details of the record selected in the table.


i) contentDelivery - lazy


During contentDelivery lazy the contents will be refreshed only when the popup first displays, so first the record selected in the table was of Lex and even after David was selected the contents of the popup is still not refreshed and only shows Lex.




















ii) contentDelivery - lazyUncached

During contentDelivery - lazyUncached the data should not be stored between displays; the values will be refreshed each time.So every time the record is selected in table the content of popup is refreshed.

















iii) contentDelivery - immediate

During contentDelivery - immediately the popup data is loaded when the base page is loaded even before the popup is displayed.So the popup always shows the first record of the table in the popup and it does not get refreshed during multiple selections of records in table.