After the loading of the page table to display an another componet

I have use cases

A table of the ADF is bordered to read only the object view and table a toolbar that

< f: facet name = "toolbar" >
< af:toolbar binding = "#{MyBean.downloadTableToolBar} '"
Visible = "false" >
< af:commandToolbarButton shortDesc = 'delete '.
Icon="/images/icon_delete.gif".
action = "#{MyBean.deleteFile} '"
Binding = "#{MyBean.deleteFileButton} '"
Visible = "false" >
< af:showPopupBehavior popupId = "p1" / >
< / af:commandToolbarButton >
< / af:toolbar >
< / f: facet >

What I want to do is loading the page and table is also get filled and first line of the table is selected automatically, the visibility of the commandToolbarButton 'delete' is available depending on some condition check as if the user is the owner of the line (there is no ADF in place security), I am able to do when the line is changed after loading using RowSelectionListener , but how to handle when the initial page loading?

Published by: shibi.ns on June 22, 2012 09:52

You can have a phase listener method that is called when the page is loaded. Set the visible property for the button according to your logic & do the logic needed by this method.

TestPage.jspx:



    
    
        
            
                
                    
                    
                    
                        
                    
                    
                    
                
            
        
    

TestPageBean.java:

package com.samples.view;

import javax.faces.event.PhaseEvent;

import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
import oracle.adf.view.rich.context.AdfFacesContext;

public class TestPageBean {
    private RichCommandButton deleteButton;

    public TestPageBean() {
    }

    public void setDeleteButton(RichCommandButton deleteButton) {
        this.deleteButton = deleteButton;
    }

    public RichCommandButton getDeleteButton() {
        return deleteButton;
    }

    // METHOD THAT IS INVOKED WHEN THE PAGE IS LOADED
    public void phaseListener(PhaseEvent phaseEvent) {
        if (phaseEvent.getPhaseId().equals(phaseEvent.getPhaseId().RENDER_RESPONSE)) {
            if (!AdfFacesContext.getCurrentInstance().isPostback()) {
                // DO THE NECESSARY LOGIC AND POPULATE THE VARIABLE isDeleteButtonVisible
                Boolean isDeleteButtonVisible = false;
                if(this.deleteButton != null){
                    this.deleteButton.setVisible(isDeleteButtonVisible);
                }
            }
        }
    }
}

Thank you
Nini

Tags: Java

Similar Questions

  • Tomcat server is running but the page cannot be displayed

    Hello
    I installed the tomcat server and it runs fine in the Windows platform. But I'm not able to launch the http://localhost: 8080 / page. It's showing that the page cannot be displayed. What could be the reason?

    Thank you
    MILADI

    Now is woriking. Only, I changed the port to 84. http://localhost:84 /.

    Thank you

  • Java object - internal error, the Page cannot be displayed

    Hello!
    I'm trying to define an instance of my own Java class, but whenever I call the page, in which I make the instance I get this error "HTTP 500 Internal Server Error." - the Page cannot be displayed
    I use the following code:
    ---------------------------------------------------------
    Java file, I put the class file in the folder "CFusionMX7\wwwroot\WEB-INF\classes".
    public class SimpleMath {}

    public int addNumbers (int num1, int num2) {}

    Return num1 + num2;
    }
    }
    -----------------------------------------
    I use the following code in my web page

    < cfset MyObject = createObject ("java", "SimpleMath") >
    < cfset myObject.addNumbers = result (25,25) >
    < cfoutput > the result is: #result # < / cfoutput >

    We consider a computer where Java is installed. The goal is to start from scratch with just the basics.

    (1) delete or backup the files of current test SimpleMath.* in CFusionMX7\wwwroot\WEB-INF\classes;
    (2) restart Coldfusion;
    (3) open an editor, for example Notepad and type public class SimpleMath {public int addNumbers (int num1, int num2) {return num1 + num2 ;}} .}} Using the file => record under and select the all files option for Save As Type:, save the file as SimpleMath.java in the CFusionMX7\wwwroot\WEB-INF\classes\ directory.
    (4) open the command prompt and navigate to the directory until the cursor is located at:
    C:\CFusionMX7\wwwroot\WEB-INF\classes >;
    Type 5) javac-source 1.4 - target 1.4 SimpleMath.java and press ENTER to compile the file. The options of the source and the target to ensure that the file is compiled into Java version 1.4, which is compatible with Coldfusion. (A review, for example, when there is also Java 1.5 on the machine);
    (6) open the web page containing your code.

  • Redirect the loading of the page (table-driven rules)

    ADF 11 GR 1 material PS1

    Hi all

    On some pages, I need to redirect the user based on a table, based on rules (for example the page is live only between dates x and y, etc.). Because there will be many pages with this feature, as well as configuration of table in which concerns rules (for example what page is affected, what dates are valid, the user, the what url should be redirected to), and because this can happen for both consolidated and submitted tasks, I do not know if you are using a router is the best way to do it.

    By this thread
    Redirect in adfc

    I would try to do it via a bean method that is called when the page is loaded. Here's what I can't understand:

    (1) is there a way that the method of beans can include the name of the calling page?
    (2) how to call the method of bean on loading the page that would allow a redirect.

    About #2, in the previously mentioned thread, someone said a PhaseListener on RESTORE_VIEW, but I do not understand how to do that.

    Thank you.

    Hello

    the phase RESTORE_VIEW after can be listened to in a PhaeListener that you configure in the file faces - config.Xml. This phase RESTORE_VIEW has access to the FacesContext and so the ViewRoot, which provides information on the requested viewId. You can then change the this ViewRoot ViewId depending on your needs of redirection.

    A router activity is recommended here because the use case you describe is conditional navigation. So if you need to have the logic in a managed bean, then why don't you point the case of the router?

    Frank

  • Hide filter interactive report dynamically after the page load

    Hello

    I try to hide the section of interactive report filters (hide/show the area with +/-sign on the top of the report) the loading of the page

    I have the reference to the thread after http://apex-at-work.blogspot.com/2011/02/hide-interactive-report-filter.html posted by Tobias Arnhold...

    According to the expert, all I have to do is post the following code the code JS "page loading" within a dynamic action...


    / * Hide filter IRR after page load * /.
    If ($('#apexir_CONTROLS_IMAGE').attr ("src") == ' / i/minus.gif ') {}
    gReport.toggle_controls ($x ('apexir_CONTROL_PANEL_CONTROL'));
    }

    I did, but apparently it does not work for me...

    I posted a sample on APEX. Oracle.com for review and comment

    Thank you

    Edited by: qwe12654 may 3, 2011 19:15

    Hello

    01. in the report Footer region put this

    
    

    * This will hide your filters, highlight conditions

    02. then Goto 'Report attributes' => 'Search Bar' => for 'Include search bar' select 'no '.
    * This will hide the full search bar (do this only if you want to hide this part)

    * If you get the answer then mark as 'Correct '.

  • JavaScript in JSPX and run after the page loads?

    I want to insert some JavaScript to my file jspx, but his does not work... I did this way:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:trh="http://myfaces.apache.org/trinidad/html">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view locale="#{actionAvailable.userLocale}">
        <af:document id="d1" title="#{bindings.title.inputValue}">    
          <f:loadBundle basename="oracle.bpel.services.workflow.worklist.resources.worklist"
                        var="resources"/>
          <trh:script source="/jsLibs/taskDetails.js" id="s1"></trh:script>
    
        <!-- //I ADDED THIS -->
        <f:facet name="metaContainer">
            <af:group>
                <trh:script>
                   function myFunction()
                   {
                    alert("function called");
                   }
                </trh:script>
            </af:group>
        </f:facet>
        <!-- //END OF SCRIPT -->
    
    
        <!-- //I WANT TO RUN MY FUNCTION AFTER PAGE IS LOADED -->
          <BODY onload="myFunction();">
          <af:form id="f1" usesUpload="true">
            <af:panelGroupLayout layout="vertical" inlineStyle="padding:5px;"
                                 id="pgl5">
              <af:panelLabelAndMessage id="id12" label="">
                <af:goLink text="Click here" id="link"
                           destination="#{LinkCreator.link}#{bindings.taskNumber.inputValue}"
                           targetFrame="_self"/>
              </af:panelLabelAndMessage>
            </af:panelGroupLayout>
          </af:form>
          </BODY>
    
    
    
        </af:document>
      </f:view>
    </jsp:root>
    As you can see, I just very simple jspx file and all I want to do is to run myFunction() after loading the page.
    So I inserted a very simple script with 1 function that handles the simple alert (I followed this instructions http://adfcodebits.blogspot.com/2010/03/bit-3-adding-javascript-to-jspx-page.html).
    I also added BODY onLoad, but nothing happens...

    What's wrong?

    Published by: user1175491 on November 11, 2010 11:55

    Try this:



    function someFunction() {}
    Alert ("OnLoad");
    }


    you don't have to use the body tag

    Published by: Nikhil Gokhale on November 11, 2010 19:18

  • Repeat all the page tables

    I have four tables in the model.

    I want to display the first three pages and the fourth table (which also has lines of repeatng) to be displayed after three early paintings.

    I don't want to use the concept of the header.

    This is possible.

    AJ

    Send me the model to [email protected] and I'll take a look.

    Thank you!

  • Do not forget the values in the form after the page

    Hello

    IM absolutely new to APEX (as you can see this is my first post ;)), I've read the documentation, I found on the oracle Web site and know at least the basics...
    So I started building my first application and already have my first problem :D Maybe you can tell me if I want to do is possible and how to do it.

    I have several pages by a form on the left side as well as a report of sql on the right side.
    The form contains fields that are the list of values (fields that contain foreign keys so that the user can select only a valid value). I have a button next to each list in the value field. When the user clicks on the button I have a branch to the same page and the sql report is updated. Depending on which button next to the list values with foreign keys was pressed, it shows the complete table list the values of references to (so the user can see that contains the foreign key, it is to select). After I finally made this work.

    But the problem is: when the user enters values in the form and then click on a button to see what the foreign keys contain values that it has already entered disappeared. But I want the values that he went in to stay in shape after he pressed the button. is there an easy way to do this? the only thing I could imagine is to create a variable for each form field, save current in variable values before the page is sent and write the values of the variables in the form when the page reloads. but it seems kind of the beast... I must do this for each page of this kind (which are many). so is there a better way?

    thx a lot :)

    I think you're talking about the region 'filter' on the left side as 'form '.

    Try this... Open the setting page , click on the item to change (to that values stay after submit), goto SOURCE region, here the source value * "only when the current value in session state is null" * this will fix the problem.

    See you soon,.
    Hari

  • JavaScript: box always invalid after the page

    Hello

    In a region, I have a check box that must be disabled by default. After clicking on a button that applies a MRU/present (and verification of certain conditions) the box should switch to on.

    What I did:
    -The Javascript of the enableCheckbox() and disableCheckbox() functions are defined in the HTML page header (they work).
    -In the foot of the region with the box I call the function disableCheckbox ('myCheckbox'); to get the default value.
    -The optional URL redirection of the button says:
    JavaScript:doSubmit('SUBMIT'); to submit
    JavaScript:enableCheckbox('myCheckbox'); to activate the checkbox

    The problem is that the box will switch on, because submit/reload the page to disable the checkbox through the foot of the region. Think of other solutions, I realized that each top up will set the default again...

    How can that be resolved?
    Thanks in advance,

    Roger

    Hi Roger,

    You must have somewhere a logic that determines if the checkbox should be disabled/enabled.

    Generally speaking, it would be the value of one or more fields and the box should be checked whenever the field related (s) is / are updated using the onchange event.

    There are several ways to check for this, but the principles would be the same. For example:

    function check()
    {
     var x = document.getElementById("P1_PAGEITEM");
     var c = document.getElementById("P1_CHECKBOX");
     if (x.value == 'XXX')
     {
      c.disabled = false;
     }
     else
     {
      c.disabled = true;
     }
    }
    

    This function can be used on the page loading - by adding a call to it in Footer region region - and the attributes of the P1_PAGEITEM using:

    onchange="javascript:check();"
    

    Andy

  • If necessary, scroll to the same position after the page navigation

    Hello

    I have a use case where I have an af:table and a full line. Now, when rolls the user down to a particular rank and click on to access the different page (DrillDown). Now when the user returns to the page, the scroll of the table position must be kept. As if I clicked on the 5th row in a range displays, it should be displayed as the 5th in the user interface.

    I use Jdev 11.1.1.7

    Please let me know if you need more details.

    Kind regards

    Chick.

    You can't possibly maintain accurate scrolling position (if I understand your question)

    As an alternative, you can modify your table to use paging: https://blogs.oracle.com/jdevotnharvest/entry/table_pagination_with_jdeveloper_11

    Dario

  • Document will not be saved after the page rotation

    After that I turn a page, it will not save it.  I have a hunch, it's safety because the latter document leave a military installation, but it let me extract pages.  I don't understand. I moved the file copied in different places...

    You probably change the display option, which is temporary and cannot be

    has saved. You need to rotate the real pages if you want that it stick.

  • Conditional branch after the page

    Hi all

    I have a page where I have to present and process elements and page (insert and update the database) then branch to a specific page that the button has been pressed. I have 4 buttons and each button has to go to another page, each button must also submit page and process data (thanks to a process of Apex DML and passing 'SAVE' demand to each button). the problem I have is no matter what button I press the "app to the first domestic branches. I have 4 branches set to run after the process. Each branch should go to a different page depending on the button. In each branch I made the conditional branch based on the key.

    APEX seems to ignore the condition (in Debug) button it says unconditional, even if the button is definitely conditional.

    I'm under Apex 4.2.2

    It seems that when passing to a request to 'SAVE' Apex all the buttons to this request in the same way? Whatever the button has been activated?

    Any ideas or alternatives?

    Thank you

    Andrew

    Hi Andy,.

    I didn't know all of your buttons send the same request, so it is normal that your different branches spoil, because your process and your branches looks like demand that sends your button and not the label of your button. You will need to make sure that each gives a different request.

    Kind regards

    Joni

  • video reset to start the point - after the page transition

    I'm looking for a way to make sure a flash video reset at startup after a page transition. For the moment that the video starts just to the place, it ended after the initial page is displayed. I found some info in the FAQ that enabkes reset components but not for Flash Video elements.

    Anyone know how?

    Did the video come from? I suspect, it has been imported into SWF using Flash Professional. This is the original file, you need to bring in Flash Catalyst.

    Chris

  • BPEL process stopped polling after the displaced Table

    Hello

    Oracle 10.1.2
    SOA Suite 10.1.3.4

    We have a process BPEL has been deployed and working for a while. This process is defined to query a table in every 5 seconds and set the State on BPEL_POLLED once found. It was working fine until I dropped and re - recreates the table that was questioned. (No changes have been made to the structure of the table - I was mearly testing a build script).

    This table was recreated, the BPEL process stopped polling. I have re-deployed service, stopped and started the server and it is not the voting table.

    May I take it that drop and recreate the table being queried have an impact on the electoral process and I looked through the forums, but I don't really know what I'm looking for?

    I'm not a developer, BPEL, however I was left the task of working through this, any help would be appreciated.

    Concerning

    JB

    Hi James,
    This is an expected default behavior (in 10.1.3.4 MLR #7 from at least). The State of the process is set to 'stop' if the vote fails with a SQL error. If you look at the log file, after you turn on debugging, you'd be able to see an explicit message that indicates that the process is currently disabled.

    If you simply change the status of the process to 'On' even once, it would begin returning.
    Or to be on the safer side, if you want to change the structure etc. of the voting table, its best to withdraw from the process, modify the table and then activate the process.

    Hope this helps,
    Kind regards
    Yohanna.
    http://www.prshanmu.com/articles

  • create a backing bean after the page created - 11g


    Is there a way to JDev 11 g create a backing bean (bb) for a page fragment after you have created the page fragment?
    I know that you can create the bb a moment of creation of the page, but what happened after then?

    Hello

    Try to add a resetActionListener to your button to create instead. Bean of support should not be taken for that use case.

    Kind regards

    ~ Simon

Maybe you are looking for