Monday, 30 September 2013

ADF Basics: Refresh UIComponent within Manage Bean

ADF Basics: Refresh UIComponent within Manage Bean

This is a quick code tip:

     /**
*import javax.faces.component.UIComponent;
*
* PPR UIComponent
*
* @param UIComponent - The UIComponent wanting to be refreshed
*
*/
    public void refreshComponent(UIComponent component){
        AdfFacesContext.getCurrentInstance().addPartialTarget(component);  
    }

ADF Basics: Find UIComponent within Manage Bean

ADF Basics: Find UIComponent within Manage Bean

This is a quick code tip:

     /**
* FindUIComponent
*
* @param UIComponent - The UIComponent ID you are wanting to find
*
*/
private UIComponent findUIComponent(String name) {  
 FacesContext facesCtx = FacesContext.getCurrentInstance();  
 return facesCtx.getViewRoot().findComponent(name) ;  
}

#bearMan

Friday, 20 September 2013

ADF - Page Close Uncommitted Data Warning

ADF - Page Close Uncommitted Data Warning

Are you on a project where a user needs to be warned before closing a page when they have uncommitted Changes?

Yes?

Here is how to get a confirmation Box when the user wants to leave the page.

Go to the Page Structure, and then go to the af:document .

 In the property inspector Find "UncommittedDataWarning"

and turn that on.

Enjoy.

#bearMan

Thursday, 19 September 2013

ADF - Java Table Selection


ADF - Java Table Selection


This post is adding on to a previous post. Where I show you how to Overwrite the Table row selection

I will be using ADFUtils, and JSFUtils both of which are provided by Oracle.
(I have provided the Version I am working from, on a previous post)

The More advanced Row Selection Application can be found here.

Once you have created the method to select the Row, you can add:

    // get the current selected row
    Row selectedRow =
                (Row)JSFUtils.resolveExpression("#{bindings.EmployeesView1Iterator.currentRow}"); 
            //Set a pageFlowScope Variable
    JSFUtils.setExpressionValue("#{pageFlowScope.User}",
                                        selectedRow.getAttribute("FirstName") +
                                        " " +
                                        selectedRow.getAttribute("LastName"));



This will add the FirstName and Last Name go into the pageFlowScope.

have Fun!

#bearMan.

Wednesday, 18 September 2013

Cloud - The other side of it

Cloud - The other side of it.

In response to Tanya Langbein: Oracle’s Virtual Tenancy Model Will Help Us!

As Tanya said the one big thing with the cloud is the security aspect of it, all organizations have got operational data that is mission critical. Organizations thus are very skeptical to move their critical data to cloud, as a result of this mission critical data being somewhere out there.

This ability to access your data from anywhere in the world, is somewhat advantageous to an organization. A CIO can access any information from anywhere around the world with only a computer or smart-device and an internet Connection.

Although knowing that this "Sensitive" data is out there exposed online. I can see why people are worrying about the security around this data. Thus opting out from going towards cloud.

When you start using cloud you are not only exposing your companies private data to the internet but you are also giving this data to someone else who for all you know may go and take your information and abuse it without your knowledge.

In essence you are putting your Organization’s Profit Making Ability and Operational Data into the palm of some complete strangers hand. Ignoring any  Legal Obligations or Legally binding Contracts (lets be real, there are a few people around the world that don't really worry about that) you can say your data is "out of your control". There have been a few cases of this in the past few months, where large organizations lost data to employees giving said data to the public.

Having this thought in the back of your mind, you may be wondering why people migrate their data to the cloud; maybe its from a point of convenience or simplicity, or that the organization may not have the infrastructure or the skills required to maintain their own infrastructure or cloud service.

The thing about cloud, is if done through the right mediums,it can have greater security than if you were to implement it. Organizations that host cloud services generally have knowledgeable security teams. These teams work endlessly making sure their cloud services have the best known security measures.

So this went from a one paragraph response to this.

#bearMan.

Tuesday, 17 September 2013

ADF Basics: Printing Behavior

ADF Basics: Printing Behavior

Hi

I will be showing you how to use the ADF showPrintablePageBehavior Component, how to get what you want to display on the "Print Ready Page"

ADF Print Demo Application can be downloaded here

I Created two Pages, both of which have have the same Components (Nearly), both pages have a button either to "Print" the Table Alone, or the Whole Page.

On the page where it prints only the Table, I surrounded the table with a panelCollection, and in the toolbar Region, I put the button with the showPrintablePageBehavior.
<f:facet name="toolbar">
 <af:toolbar id="t2">
   <af:commandToolbarButton text="Print Table"
                            id="ctb1">
     <af:showPrintablePageBehavior/>
   </af:commandToolbarButton>
 </af:toolbar>
</f:facet>

ADF Before Printed
Before Printed

ADF Table Printed
Printed


With the Page Print, I surrounded the whole page with a panelHeader and within that toolbar Region I added the same Button.
<f:facet name="toolbar">
 <af:toolbar id="t2">
   <af:commandToolbarButton text="Print Table"
                            id="ctb1">
     <af:showPrintablePageBehavior/>
   </af:commandToolbarButton>
 </af:toolbar>
</f:facet>

Before Printed ADF panelHeader
Before Printed


Printed ADF panelHeader
Printed

Extra

If you don't want a component to show when in Printing mode
use this EL expression in the Applicable Property
"#{adfFacesContext.outputMode eq 'printable' ? false : true}

Panel Box, not to display header
showHeader="#{adfFacesContext.outputMode eq 'printable' ? 'never' : 'ifNeeded'}"


Regards
#bearMan.

ADF - Customizing Table Row Selection


ADF - Customizing Table Row Selection

If you want to do something cool when a user clicks on a row within a Table, or if you just want to customize what happens when the row is clicked.

I use the JSFUtils class, and I am assuming you have this class in your project.
The ADF Utils can be found in a previous Post here

The Custom Table Row Selection Application is here.

Firstly after you have created the af:Table in the Property Inspector find the Selection Listener. I created my table off the HR Schema.


In the Selection Listener there was
#{bindings.EmployeesView1.collectionModel.makeCurrent}
As the default Value.

and either create a managed Bean or use one of your existing ones, and the same with a method.



I called my method "employeeTableSelectionListener" it accepts one Parameter "SelectionEvent" this is created by Default.

public void employeeTableSelectionListener(SelectionEvent selectionEvent) {
    //#{bindings.EmployeesView1.collectionModel.makeCurrent}
    System.out.println("We are in the employeeTableSelectionListener");
    JSFUtils.resolveMethodExpression("#{bindings.EmployeesView1.collectionModel.makeCurrent}",
                                     Object.class,
                                     new Class[] { SelectionEvent.class },
                                     new Object[] { selectionEvent });
}

Just remember please, after you have finished debugging the application, you should take the println out.

#bearMan.

Monday, 16 September 2013

ADF - Tree Table Column Drop Down

ADF - Tree Table Column Drop Down

To use Drop Down Lists in ADF Tree Tables. There are a few things to keep in mind.

Assumptions: I am using the HR schema, and I'm going to be working with the Employees table. You have already created the Attributes LOV (List Of Values)

Firstly when using the drop down list, the #{node.ManagerId} is not correct.

Remember to make sure all your attributes that you want to work with are in the Bindings of the table.

When using the drop down list, there are two components you need namely:
af:selectOneChoice
f:selectItems
af:selectOneChoice: is the Actual Selected Item
f:selectItems: is the List Of Values

Also keep in mind, all your Sub Levels within the Table, might not have that same Columns as the parent, and thus it will Display an error when this happens.

To make a editabledrop down List, you need to have a submit Button on the page, and make the af:selectOneChoice, autoSubmit="true".

Lets get to the Code.
<af:selectOneChoice required="#{node.bindings.ManagerId.hints.mandatory}"
 id="selectOneChoice1"
 rendered="#{node.ManagerId == null ? false : true}"
 value="#{node.bindings.ManagerId.inputValue}"
 autoSubmit="true">
  <f:selectItems value="#{node.bindings.ManagerId.items}"
  id="selectItems1"/>
</af:selectOneChoice>
A Quick Explination rendered="#{node.ManagerId == null ? false : true}"  Basically checks to see if the row has something, otherwise it does not display the Drop Down Box.

Note: This does not work if your Item initially is null, but you want to display it, I will be updating this on how to do it.
Update: You could try something like
#{node.bindings.ManagerId == null or node.bindings.ManagerId.estimatedRowCount > 0 ? false : true}
in the rendered Property

Good Luck

#bearMan.

Thursday, 12 September 2013

ADF Basics - Utils

ADF Basics - Utils


One thing everyone should know about in ADF is the Utils Packages Oracle Offer.

ADFUtils and JSPUtils.

Both these Util Classes hold a bunch of functions that everyone should know about and use.
From Getting the App Module, to components these classes hold a vast range of knowledge one should use.

The main thing is getting the awareness out there about what these Utils can do.

They can be downloaded within an application from Oracles website
http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html

Or from

Wednesday, 11 September 2013

JDeveloper Basics - Resetting Integrated Weblogic Server

JDeveloper Basics - Resetting Integrated Weblogic Server

Have you every had a problem with JDevelopers Integrated Weblogic Server, or just want to reset your Integrated Weblogic Server. This is the guide for you.

Many Guides say you need to delete your whole "system11.1.1.6.38.62.29" / "system" folder. That makes you loose all your JDeveloper settings. Rather than doing that, go into your JDeveloper system folder, and delete the folder "DefaultDomain"

Windows:

Go to

This can be in two places namely run: 
%appdata%/jdeveloper/
Windows + r
 








or in the address bar within windows explorer.



Linux


You can:
cd ~/.jdeveloper/

OS-Done:

Once you are int hat folder, and you have multiple JDevelopers installed, you must go into the folder that is "system" + JDeveloper Version. (You can find that out in my previous post.

Go into that folder, and delete the DefaultDomain Folder.

Note:

This will not work if you are currently running JDeveloper

#bearMan.

Sunday, 1 September 2013

JDeveloper Basics - Role Change

JDeveloper Basics - Changing Your Role

When JDeveloper starts up you can select a Role. I like to select Studio Developer (All Features). Although there are some occations where you might only want to do Database "stuff" and thus use "Database Developer"

If for some reason you choose to Select the Database Developer, and in the middle of doing what needs to be done, you realise you need to do something else. You can change your role by selecting:
Tool > Switch Role
Then you can select the new Role.


Hope this saves a little bit of time.