Programatically change JSF Components

Hi all,
I need to change "Disable" property of all components of a UIViewRoot based on calculated information. I can put an EL on Disable property to it, but i need to change all components once, and wouldn't like to put a EL on each component. I've tried to do it on Customized ViewHandlerImpl that extends oracle.adfinternal.view.faces.application.ViewHandlerImpl, method renderView
public void renderView(FacesContext facesContext,
UIViewRoot uiViewRoot) throws IOException,
FacesException {
// Try to get Children here, and change all editables components.
super.renderView(facesContext, uiViewRoot);
So, i've attempted get Children before super.renderView call, but in this moment Children is 0 length, only after super.renderView, i can get Children components.
Has anybody any tip about this?
Thanks

user9546730 wrote:
1. Do we loose any of the ADF faces (including Rich Client framework, partial rendering, Expression bindings, AJAX calls etc) feature by adding the component at runtime or programatically against the typical way of dragging and dropping the component to the screen at design time.(Except the drag and drop functionality and filling the component property at property window!)?No.
user9546730 wrote:
I am worried on the features part while taking programmatic approach bcoz i heard that there is no 100% guarantee on Postback features available and Adf component state feature in my scenario, if i take the programmatic approach.Should not be an issue if done correctly.
user9546730 wrote:
The scenrio in programatic approach:
There is one static yyy.jspx, where a declarative component(might be a layout kind of declarative component) is placed and binded to a bean, from the bean i am adding the ADF controls dynamically to the declarative component by parsing an xml.
Here if multiple users are accessing the yyy.jspx the content inside the declarative component can change user to user, So here the worry is whether the JSF/ADF lifecycle will work properly(the postback, ADF component state saving mechanism etc) for all the users.I would not use a declarative component nor the binding to initialize the component, else you'll calling for state issues that you fear about. Make a fully fledged component and initialize the component subtree in the tag file (or TagHandler if using Facelets, which I doubt you are), after creating the root component (the container).
Regards,
~ Simon

Similar Messages

  • Is JSF components changed in RAD 7.0?

    Hi,
    I see that some of the components like h:commandLink are missing in the RAD 7.0. Is that so?
    Also is there any documents which shows the usage of all the JSF components?
    Thanks,
    Elango

    Depends on the JSF implementation used in RAD. Consult the RAD manfacturer and its documentation.

  • JSF components within jsf components programatic

    I am using the java sun pane_tabbed component on a jsf page and I want another jsf page to be the tab body. I tried to include another jsp page but that doesn't work. The include in the example something like
    <h:panelGroup>
    <h:outputText value="here is some info to display on tab "/>
    </h:panelGroup>
    It seems I just can't say
    <h:panelGroup>
    here is some info to display on tab
    </h:panelGroup>
    This remind me of servlet days where everything was out.println and why we came up with jsp in the first place and I figure there's got to be a better way.
    So what's the way? I understand I could make the inner html another jsf tag but thats overkill for what I am trying to do. Also I need the inner html to be treated itself like an entirely different page (like a component) so just to put outputText around everything just wouldn't work.
    So what's the way

    In addition.... I understand that part of the JSF concept is that the client can be many different devices and depending on which client different widgets get displayed. A way that that could still be true is that I register a components in faces-config.xml by specifying that it is a jsp page (with jsf components). Then a jsf tree is built with the widgets I have included on the jsp page. Then I specify that the renderer is a jsp page renderer which would mean for my application it would display the jsf page like I wanted with the components where I wanted them. Then if I want to render on for instance a swing application I then need to program a renderer which says how to display these widgets there.
    I'm pretty new to JSF but I'm hoping that I am on the right track here. There should be some way for non java developers to help with the creation of components I would think.

  • Can I write Design-time for JSP custom tag(not JSF components)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • How to standardize the look & feel of different vendor JSF components?

    Hi,
    There are various JSF components created by different parties. For example, Tomahawk from Myfaces, ADF faces from Oracle, SUN components that provided in Java Studio creator. They look different.
    Can we standard the look and feel for these various components when we use them in a same project? so that it wouldn't look that different when the page is displayed to the end user.
    Please advise.
    Thank you.

    Hi,
    Can you be more specific how to achieve that using css? You mean the look and fee that we see is not an image?
    Have you seen how Oracle ADF face look & feel is like?
    How to change its look to what we have SUN offered in its Java studio creator 2?
    Please advise.
    Thank you.

  • Binding JSF components and servlets to eachother

    Hi, I have some JSF components in my jsp page like this one:
    <h:form rendered="true" id="myForm">
                   <h:selectOneListbox>
                        <f:selectItem itemdisabled="false" itemlabel="item1" itemvalue="1"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item2" itemvalue="2"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item3" itemvalue="3"></f:selectItem>
                   </h:selectOneListbox>
              </h:form>and I have this servlet:
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class myServlet extends HttpServlet {
         public myServlet() {
              super();
         public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void init() throws ServletException {
    }Could you please help me:
    *1.* How to populate my listbox using my servlet?
    and also
    *2.* How to get the selected item in my servlet every time that user change the selected option of list box?

    Please don't crosspost topics over all places. Stick to one topic.
    Continue here: [http://forum.java.sun.com/thread.jspa?threadID=5299291]

  • Af:forEach statement causing other jsf components to be repeated

    Hi,
    I am experiencing the same problems as recorded in the following log:
    JSF af:forEach is looping also tags outside of af:forEach
    I have replaced my af:forEach tag with af:iterator which works with the number of items coming back changing dynamically (and therefore does not cause the display issues), however I can't display the iterator results in the same way as for the forEach loop.
    I am trying to get the iterator output displayed in a 3 by 3 grid, but the panel grid does not seem to recognise the iterator output as separate cells but just one continual line.
    Does anyone have any ideas as to how I can achieve the above?
    Thanks,
    Dave

    Hi Frank,
    Thanks so much for replying.
    The code that is causing me problems is as follows:
    <h:panelGrid width="335" columns="3">
    <af:forEach var="row" items="#{bindings.WsWanalItemsView1.rangeSet}">
    <af:panelGroup layout="vertical">
    <af:commandLink action="#{backing_catalogue.selectProduct_action}">
    <af:objectImage
    source="http://#{res[\'filehandling.ip_address\']}/FileHandling/imageScale
    ?entity=STY&type=THUMB&image=#{row.Stycode}&pic=thumb&X=100&Y=100
    &subtype=NONE&subentity=NONE"
    height="137" width="104"/>
    <af:setActionListener from="#{row.Stycode}"
    to="#{processScope.ParamStyCode}"/>
    <af:setActionListener from='#{\"NONE\"}'
    to="#{processScope.ParamSubEntityType}"/>
    <af:setActionListener from='#{\"NONE\"}'
    to="#{processScope.ParamSubEntity}"/>
    </af:commandLink>
    <af:panelHorizontal>
    <af:commandLink text="#{row.Thumbcomment}"
    inlineStyle="font-size:9.0pt;"
    action="#{backing_catalogue.selectProduct_action}">
    <af:setActionListener from="#{row.Stycode}"
    to="#{processScope.ParamStyCode}"/>
    <af:setActionListener from='#{\"NONE\"}'
    to="#{processScope.ParamSubEntityType}"/>
    <af:setActionListener from='#{\"NONE\"}'
    to="#{processScope.ParamSubEntity}"/>
    </af:commandLink>
    <af:objectSpacer width="1" height="16"/>
    </af:panelHorizontal>
    </af:panelGroup>
    </af:forEach>
    </h:panelGrid>
    The forEach statement is bound to a table that brings back product Id's (9 at a time), which are then put into the source url for an object image to display the relevant image. There is also a caption hyperlink displayed underneath the image.
    The forEach statement is placed in a panelGrid so that the images are displayed as a 3x3 grid.
    The image itself is a link that when selected runs code that executes a query, displaying information related to the selected image.
    This all works really well, however if I select an image and display its details, then change another parameter on the page that means different product ids are returned, then select to see details for another image then multiple JSF components on the screen (they all seem to come after the forEach statement) are displayed twice.
    After much digging I found the following statements:
    "changes from one request to the next. It may be possible to work around this in some scenarios by manually deleting all the children of the parent component (e.g., af:selectOneListbox in the code sample below), but this has not yet been tested. "
    and
    "Unlike the af:forEach tag, the af:iterator tag implements an iteration that works with a JSF DataModel or CollectionModel, and can be bound to EL expressions that use EL variables created by components."
    Therefore I have tried to use an af:iterator instead. By changing my af:forEach for an af:iterator I no longer get the duplication issues mentioned above, but I'm having trouble displaying the output of the iterator in a panel grid. I.e. 3x3 images each with a label underneath. It's as if it treats the output of the iterator as a single component.
    This is causing me serious problems so your help on this issue would be greatly appreciated.
    Thanks,
    Dave

  • JSP 2.0 tag files for rendering JSF components

    Over the weekend I read up on new JSP 2.0 features (dunno why I waited this long??) ... I really liked the tag file feature ...
    I was wondering if it were a good idea to use these tag files as renderers for JSF components - ok, this ties us to a JSP only solution but how many in here would be using a non-JSP solution anyway?
    I was thinking along the foll. lines:
    <myComponent id="myComponent1" attr1="value1" attr2=value2">
        <myComponentRenderer var="myComponent1" />
    </myComponent>
    myComponentRenderer can be implemented as a tag file in myComponentRenderer.tag ... The myComponent tag delegates the business logic processing to its associated UIComponent and then sets this component as a pageContext attribute with the id "myComponent1" ... myComponentRenderer in turn gets a reference to this UIComponent and renders it ...
    Again, if one wants a different way of rendering, make another tag file myComponentRenderer2.tag or change myComponentRenderer.tag itself ...
    Indeed, this may not work for components with complicated rendering logic but I believe that's only the 20% case ...
    Comments?
    P.S.:
    I've picked this up from http://forums.java.sun.com/thread.jsp?forum=427&thread=381052&tstart=0&trange=15
    This also compliments another topic: http://forums.java.sun.com/thread.jsp?forum=427&thread=413515&tstart=0&trange=15

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • Programatically changing the id of a component

    Hi!
    I'm trying to solve the problem of duplicate id, without havind to manually give an id to all components.
    To accomplish this, i was trying to programatically change the id of all components that have the id null or that the id begun with _id with an PhaseListener.
    But i don't achive any results.
    Does anyone know how to do this?
    Thanks.

    Hi,
    Check View States.
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf63611-7ff1.html

  • Communication between JSF components and servlets

    Hi, I have some JSF components in my jsp page like this one:
    <h:form rendered="true" id="myForm">
                   <h:selectOneListbox>
                        <f:selectItem itemdisabled="false" itemlabel="item1" itemvalue="1"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item2" itemvalue="2"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item3" itemvalue="3"></f:selectItem>
                   </h:selectOneListbox>
              </h:form>and I have this servlet:
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class myServlet extends HttpServlet {
         public myServlet() {
              super();
         public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void init() throws ServletException {
    }Could you please help me:
    *1.* How to populate my listbox using my servlet?
    and also
    *2.* How to get the selected item in my servlet every time that user change the selected option of list box?

    Where did you learn about JSF components? That same book/tutorial/document should also cover backing beans.
    You may find under each the following tutorials useful to get some more insights in JSF:
    Java EE tutorial part II chapter 10: [http://java.sun.com/javaee/5/docs/tutorial/doc/bnaph.html]
    JSF + Eclipse + Tomcat: [http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html]
    Follow the JSF lifecycle: [http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html]

  • How do I programatically change the text in a listbox that is contained in a cluster?

    How do I programatically change the text in a listbox that is contained in a cluster?

    In the front panel, right click on the listbox object and select create>attribute node.
    In the diagram click on the attribute node and select "Item Names".
    Connect the desired array of string to the attribute node.
    BigBen

  • How to change the components of the planned order? (FM or BAPI)

    I need to change the storage(LGORT) in the components.
    I found only MD_PLDORD_CHANGE_COMP_ITEMS, but could not get the correct result.
    Has anyone used this FM to change the components of the planned order?
    Can you please tell how to use it. Or advise an alternative solution.

    Hi Anton,
    There's a BAPI to change planned orders - BAPI_PLANNEDORDER_CHANGE, but it allows to change only header data.
    Therefore you'll have to go a bit longer, and use a couple of other BAPIs:
    First read the order that you want to change - BAPI_PLANNEDORDER_GET_DETAIL
    Second, create a new planned order with the changed data, based on the read planned order - BAPI_PLANNEDORDER_CREATE.
    Third, delete the old planned order - BAPI_PLANNEDORDER_DELETE.
    Regards,
    Mario

  • How to change the components in a visible JPanel?

    How to change the components in a visible JPanel?
    Is there any way to change the components in a JPanel while it is already visible in a JFrame? I tried the na�ve approach of removing the components and adding new ones, but the effect is not the expected.
    For now I'm opening new frames with newly created panels.

    After adding/removing components to/from a panel try:
    panel.revalidate();
    panel.repaint() // sometimes this is also needed, I'm
    not sure whyI'm not certain, but I think that panel.revalidate() implicitly calls repaint() only if something actually changed in the layout. If nothing changed, it sees no reason to repaint; hence, if something changed in appearance but not in layout, you have to repaint it yourself.
    Or something like that. I'm no expert. ;)

  • Problem Adding Custom JSF Components to Oracle JDeveloper 10g (10.1.3) Prev

    I'm having a problem on Adding Custom JSF Components to Oracle JDeveloper 10g (10.1.3) Preview (http://www.oracle.com/technology/products/jdev/101/collateral/101/adffaces/howto_customcomponents.html)
    The step 1 of 5 isn't visible for me and I don't see the "Install from local file" option to select the adf-faces-bundle.zip from my file system. The OTN check for updates don't prove the ADF Faces...
    What may I do?

    And...
    If "Check for Updates Wizard" is not launched, you can try to set LANG.
    see: 10.1.3 Can't not launch Update Wizard in Japanese environment.
    10.1.3 Can't not launch Update Wizard in Japanese environment.
    Thanks.
    Takuya Ono

  • Programatically changing the common plot types

    Hi,
    Is it possibe to programatically change the plot type.
    ie,selecting line/bar..
    Its possibe by right clicking the plot legend,taking common plot and selecting the appropriate one.
    But i want to include it as an option in my application.
    I saw the property node of the graph namely,plot.linestyle,plot.barplotstyle...will it work in the desired way?
    Thanks in advance

    l1k wrote:
    I understand user_1's confusion.  I don't see a way to change the 'common plot type' in the property menu.  All the other options are pretty obvious in the list of properties.  If I want to program for example that under certain conditions the plot is just a line, and other conditions the plot is a line with points, I don't see how to do this.  I can change thickness, line style, etc, but not the common plot type.  Is this property not in the 'Plot' menu of the Properties?  I'll keep looking...
    If you want to change the icons that show up in common plot styles: You can't!
    That are simply shortcuts put in by the LabVIEW programmers that combine a certain setting for plot style, point style, line style, line width, etc under one simple user selectable icon.
    If you want to change any of the settings of a particular plot however, you certainly can do that with property nodes.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for