Programatically Hiding ADF component

Hi,
I have a requirement for which i am hiding a adf component using render=false or visible=false and move other existing component in screen to the place of hidden component. The screen is codded as below,
<?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:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:form id="f1">
<af:panelGroupLayout id="pgl1" layout="scroll">
<af:panelBox text="PanelBox1" id="pb1">
<f:facet name="toolbar"/>
<af:panelFormLayout id="pfl1" rows="1" maxColumns="2"
binding="#{StartPageBean.pfl1}">
<f:facet name="footer"/>
<af:outputText value="1" id="ot1" binding="#{StartPageBean.ot1}"/>
<af:outputText value="2" id="ot2" binding="#{StartPageBean.ot2}"/>
</af:panelFormLayout>
<af:panelFormLayout id="pfl2" rows="1" maxColumns="2"
binding="#{StartPageBean.pfl2}">
<f:facet name="footer"/>
<af:outputText value="3" id="ot3" binding="#{StartPageBean.ot3}"/>
<af:outputText value="4" id="ot4" binding="#{StartPageBean.ot4}"/>
</af:panelFormLayout>
<af:panelFormLayout id="pfl3" rows="1" maxColumns="2"
binding="#{StartPageBean.pfl3}">
<f:facet name="footer"/>
<af:outputText value="5" id="ot5" binding="#{StartPageBean.ot5}"/>
<af:outputText value="6" id="ot6" binding="#{StartPageBean.ot6}"/>
</af:panelFormLayout>
</af:panelBox>
</af:panelGroupLayout>
<af:commandToolbarButton text="commandToolbarButton 1" id="ctb1"
action="#{StartPageBean.hideComponents}"/>
</af:form>
</af:document>
</f:view>
</jsp:root>
This code render the out as,
1 2
3 4
5 6
As we can see that we have PanleGroupLayout than a PanelBox and than all the PanleGroupLayout with 1 row and 2 column.
Now if i make ot2 an ot3 as hidden using render false the output comes as below,
1
4
5 6
If i make ot2 and ot3 as hidden using visible false the output comes as,
1
4
5 6
can we get the output as
1 4
5 6
by using either of the approach? or is there any other approach to achiecve the same.
Let me know if some more information is required

Hi,
I have created an ADF tree using VO. its being displayed with several nodes (Drag and drop fo data control). Now I want to add dynamically created links into the created tree nodes. how to do that from inside my backing bean code.
for (int i = 0; i < assignedAuditLinksCount; i++) {
HashMap auditInfoMap = assignedAuditList.get(i);
RichCommandImageLink auditInfo = new RichCommandImageLink();
RichSpacer auditLinkSpacer = new RichSpacer();
auditInfo.setText(auditInfoMap.get(AuditOperationsConstants.AUDITID).toString());
auditInfo.setIcon("/images/navbullet.png");
String actionEL =
"#{backingBeanScope.backing_fragments_PerformAudit.setAuditInfo_action}";
MethodExpression action = actionMethodExpression(actionEL);
auditInfo.setId("AuditId" + (i + 1));
auditInfo.setActionExpression(action);
auditInfo.addActionListener(new PerformAuditActionListener());
auditInfo.setVisible(true);
auditInfo.setImmediate(true);
auditInfo.setInlineStyle("text-decoration:underline;");
auditLinkSpacer.setHeight("0");
auditLinkSpacer.setWidth("10");
How to add these auditInfo links in my tree nodes created using VO.
}

Similar Messages

  • How to initialize an adf component before a page loads

    Hi all
    I use JDeveloper 11.1.2.2.0
    I have two pages:
    first page has a link to a second page
    <af:document title="first.jspx" id="d1">
      <af:form id="f1">
        <af:commandLink text="Page 2" id="cl1" action="goToSecondPage" actionListener="#{Bean.handleLinkActionEvent}"/>
      </af:form>
    </af:document>and the second page has an inputText component:
    <af:document title="second.jspx" id="d1">
      <af:form id="f1">
        <af:inputText label="Text" id="it1" binding="#{Bean.inputText}" readOnly="true"/>
      </af:form>
    </af:document>First I load first.jspx and than I click the link. This event is handled in handleLinkActionEvent() method, in which I want to set a value to the inputText component of the second page. But I can't do it, because as expected I get NullPointerException.
    So the question is how to initialize an adf component before a page loads?
    Evgeny Michuk
    Edited by: Evgeny Michuk on Oct 4, 2012 11:30 PM

    Thanks a lot for your replies and links, it gives me some new knowledges.
    I got your approach and achieved the aim for the described situation with tag <f:setPropertyActionListener>:
    <af:commandLink text="Page 2" id="cl1" action="goToSecondPage"
                           actionListener="#{Bean.handleLinkActionEvent}" binding="#{Bean.firstPageLink}">
      <f:setPropertyActionListener target="#{pageFlowScope.text}" value="Hello, World!"/>
    </af:commandLink>and for the inputText component I set the value:
    <af:inputText label="Text" id="it1"  binding="#{Bean.inputText}"
                                  readOnly="true" value="#{pageFlowScope.text}"/>I used request scoped managed bean and it is shared for both pages.
    I understand that I can set a value of some attribute for managed bean
    and use it to set a value for inputText component of the second page,
    but as I understand it is almost the same way as usage of tag <f:setPropertyActionListener>.
    In my real situation on the second page I have a dynamic table, and it's field is read only.
    Structure of this table depends on a link clicked on the first page.
    So I define components for table columns in runtime, it may be outputText, inputDate, goLink and some others.
    And I have to get table through the UIComponent binding to set columns.
    Certainly I can define all needed components for all columns
    and render it according to the column types
    <af:table value="#{Bean.collectionModel}" var="row" id="t1" binding="#{Bean.mainTable}">
       <af:forEach items="#{Bean.columnDescriptionList}" var="column">
          <af:column headerText="#{column.caption}" id="c1">
             <af:outputText value="#{row[column.fieldName]}" id="ot1" rendered="#{column.type == '1'}"/>
             <af:inputDate value="#{row[column.fieldName]}" id="ot2" rendered="#{column.type == '2'}"/>
             <af:selectBooleanCheckbox id="sbc1" selected="#{row[column.fieldName] == '1'}" rendered="#{column.type == 'n'}"/>
          </af:column>
       </af:forEach>
    </af:table>but I think it is not very good.
    Have you any idea?
    P.S. I hope I clearly explained my situation =)
    Evgeny Michuk

  • Detecting ADFButton as ADF component in OpenScript

    Hello,
    I want to identify the ADFButton as an ADF component in OpenScript.
    In the Object Identification for Oracle ADF Functional there is the web:commandButton tag. But The commandButton component has been deprecated. So the developers are using the button component instead. When I record a script, it will identify the button as "/web:window[@index='0' or @title='title']/web:document[@index='0' or @name='w0']/web:a[@text='Save' or @href='website' or @index='17']" and not as an ADF component. I want to use the absolute_locator to identify the adf-objects.
    I have tried to change the name from web:ADFCommandButton to "web:ADFButton" and "web:Button", this didn't make the trick.
    Now I replace the path by "/web:window[@index='0' or @title='title']/web:document[@index='0' or @name='w0']/web:div[@id='pt1:r1:1:pt1:b1']". This can't be done by a non-technical person who only uses the recording button.
    Does anybody have an idea how to do this?
    Thank you for the answer.
    Extra-info
    OpenScript Version
    12.4.0.2 Build 129
    ADF Version
    Oracle-Version: 12.1.3.0.41.140521.1008
    Oracle-Label: JDEVADF_12.1.3.0.0_GENERIC_140521.1008.S
    Oracle-Label-JDEVADF: JDEVADF_12.1.3.0.0_GENERIC_140521.1008.S

    Anyone from Oracle, can you please confirm if BI Publisher Integration as mentioned in the document (http://download.oracle.com/docs/cd/E15586_01/fusionapps.1111/e20838/jdev.htm#CACGJFJF)
    is supported in 11.1.1.5 ?
    We have installed all the updates available but we are not getting the BI publisher in technology scope ?
    Jdeveloper 11.1.1.5
    Please help.
    Edited by: Chaitanya Vegesna on Jun 21, 2012 7:34 AM

  • Show Swing Container JPanel in ADF Component

    Hi ADF-Folk,
    I come out of the forms developer world. in forms i used pluggable java components to show graphical components in forms.
    Is it possible to use a show a Swing JPanel Class in a ADF Component like a PanelBox or something else?
    Application example: Colored tray configuration for a lean lift administration. On this tray are nearly 120 places to allocate. I don't want to use 120 adf labels in dynamic .jspx with backing bean to rebuild this function.
    How can I manage this?
    Thank you very much.
    Best regards.
    Gunnar

    Hi,
    Is it possible to use a show a Swing JPanel Class in a ADF Component like a PanelBox or something else?
    yes, use f:verbatim as a tag and add the JPanel as an Applet. Note that the Applet will not be integrated with ADF Faces and requires you to use JavaScript to get this working. See the following example
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/71-adf-to-applet-communication-307672.pdf
    Frank

  • How to use CSS to customise ADF component

    I'm not going into skin. However, I want to edit property of ADF component through CSS. How do we do this? Any url link that give complete documentation? (How to represent ADF Component in CSS)
    E.G. I want to set af:column noWrap=true to all table.
    Regards
    Eric H

    Hi,
    just a guess, but give it a try: customize the default Oracle skin as described in the blog post "Customizing BLAF for ADF Faces - easier than Skins for influencing colors and fonts by Lucas Jellema". You don't need to add custom skins, just edit the oracle-desktop.xss file.
    Then you can add a "white-space: nowrap;" property for the appropriate style, which very likely will be AFTableCellDataText. It will be something like this:
    <style name="AFTableCellDataText">
      <property name="white-space">nowrap</property>
    </style>HTH,
    Patrik

  • ADF component to display a grid with wrap around

    We need to create a grid of images on a page, such that maximum number of images that can fit in the viewable area are displayed in a row. The remaining images wrap to the next row. One should be able to select one or more images from the grid and drag-and-drop them in the same grid or outside the grid. Any suggestions about the best ADF component that can serve this purpose. Also, wonder if Collection drag-and-drop mechanism is available for components other than <table> and <tree>?. For example, can we use it with <panelList> or <panelForm>?

    this related to css instead of which component to use, following code should work:
    <af:panelGroupLayout id="pgl1" layout="vertical" inlineStyle="width:90%; border:1px solid black;float:left">
         <af:image source="#{resource['images:logo.png']}" shortDesc="Img 1" id="i1"
    inlineStyle="height:60px;float:left"/>
    <af:image source="#{resource['images:logo.png']}" shortDesc="Img 2" id="i2"
    inlineStyle="height:60px;float:left"/>
    </af:panelGroupLayout>
    if you remove af:panelGroupLayout and just use following inside your component
    <af:image source="#{resource['images:logo.png']}" shortDesc="Img 1" id="i1"
    inlineStyle="height:60px;float:left"/>
    <af:image source="#{resource['images:logo.png']}" shortDesc="Img 2" id="i2"
    inlineStyle="height:60px;float:left"/>
    it should still work

  • I wan to i visible/invisble Panel(Adf Component) on UI using ADS?

    HI,
    Following is my requirement
    I am having one panel which should be visible/invisible on UI based on event coming from Web services.
    I am consuming one web services which is sending me update which i suppose to read at specified interval.
    if there is any update from web services then i suppose to visible/invisible Pane(ADF component)l on UI.
    Active Data Service can be useful for this requirement?
    If Yes,
    Do i need to create Active Data Proxy for this?
    Your suggestion will be helpful.
    - Deepak Parmar

    Frank Nimphius,
    Thanks for your quick reply. :)
    This is really good article which has provided one good way how to trigger event from client whenever we get update from server.
    but i am still having some questions:
    1) based on post you have provided, if i can able to trigger event from client then do i need to use ADS anymore?
    2) Do you have source code for the same? , I want to see how ADS is playing role here.
    3) if i am getting update from web services then do i need to create Active Data Proxy?
    Regards,
    Deepak

  • ADF Component Guide 10.1.3

    Could someone please point me to a ADF component guide (preferably a sample app)? I see one for ADF UIX components but nothing for the 10.1.3 components. I'm looking for a documentation on how to use each of the components in the ADF Core set. I've reviewed what is in the developers guide already and am guessing there must be more somewhere.
    Thanks,
    Dan

    Hi,
    there is no component guide as it was in UIX. However, you may find this page useful
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/index.html
    Frank

  • Creating hiding drawer component (suggestions)

    I am attempting to create a hiding drawer component. This is basically a tabbed frame on the side of the container that will allow you to show and hide it. I am able to get the component to show up but the catch is I need to know how to add components such as JList etc.. to it and have them function properly. When I attempt to add a component to it the painting is not working properly. I'm currently extending JPanel should I be using something else? Thanks for the help guys.
    Code is below:
    package com.nashilnux.swing;
    import java.awt.AlphaComposite;
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Composite;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.GridLayout;
    import java.awt.Insets;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.font.FontRenderContext;
    import java.awt.font.TextLayout;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.PathIterator;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    import java.awt.geom.RoundRectangle2D;
    import javax.swing.BorderFactory;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextField;
    import javax.swing.RepaintManager;
    import javax.swing.text.AbstractDocument.Content;
    * @author me
    public class HidingDrawer extends JPanel
         Rectangle2D button = null;
         private boolean showing = false;
         private JList contentList = null;
         private String title = "";
         private boolean mouseOver = false;
         private JScrollPane listSP = null;
         private Color strokeColor = new Color(226, 242, 255);
         private Color backgroundColor = Color.white;
         private Color tabColor = new Color(226, 242, 255);
         private boolean transparent = false;
         private float transparencyLevel = 0.0f;
         private Dimension expandedDimension = new Dimension(300,200);
         public HidingDrawer()
              setOpaque(false);
              setPreferredSize(new Dimension(300, 200));
              addMouseListener(new MouseAdapter()
                   @Override
                   public void mousePressed(MouseEvent e)
                        hideDrawer(e);
         public HidingDrawer(boolean showDrawer)
              setOpaque(false);
              setPreferredSize(new Dimension(300, 200));
              setLayout(new FlowLayout());
              if (showDrawer)
                   showing = false;
              else
                   showing = true;
              addMouseListener(new MouseAdapter()
                   @Override
                   public void mousePressed(MouseEvent e)
                        hideDrawer(e);
                   @Override
                   public void mouseEntered(MouseEvent e)
                        if (button != null)
                             if (button.contains(new Point2D.Double(e.getX(), e.getY())))
                                  System.out.println("Mouse Over");
                                  mouseOver = true;
                                  repaint();
                   @Override
                   public void mouseExited(MouseEvent e)
                        System.out.println("Mouse exited");
                        mouseOver = false;
                        repaint();
              initalize();
          * @param args
         public static void main(String[] args)
              JFrame frame = new JFrame();
              frame.getContentPane().setBackground(Color.LIGHT_GRAY);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setTitle("UI Drawer Demo");
              // North Panel
              JPanel northPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
              northPanel.setBackground(Color.white);
              JLabel titleLbl = new JLabel("UI Drawer Demo");
              titleLbl.setFont(new Font("Helvectia", Font.BOLD, 18));
              northPanel.add(titleLbl);
              // End NorthPanel
              // West panel component
              HidingDrawer hd = new HidingDrawer(true);
              hd.setTitle("Testing");
              hd.setBackgroundColor(new Color(226, 242, 255));
              hd.setStrokeColor(Color.black);
              hd.setTransparent(true);
              hd.setTransparencyLevel(0.5f);
              frame.getContentPane().setBackground(hd.getBackgroundColor());
              // Add list to the drawer
    //          String[] values = new String[]{"Testing", "Testing 2", "Testing 3"};
    //          JList list = new JList(values);
    //          hd.add(list, BorderLayout.CENTER);
              frame.getContentPane().add(hd, BorderLayout.WEST);
              // Center Panel
              JPanel encapPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
              encapPanel.setBackground(hd.getBackgroundColor());
              JPanel centerPanel = new JPanel();
              centerPanel.setBackground(hd.getBackgroundColor());
              GridBagLayout gLayout = new GridBagLayout();
              int row = 0;
              centerPanel.setLayout(gLayout);
              GridBagConstraints c = new GridBagConstraints(0, 0,1,1,0, 0,GridBagConstraints.WEST,0, new Insets(5,5,5,5),0,0);
              JLabel freqLbl = new JLabel("Frequency");
              centerPanel.add(freqLbl, c);
              c.gridx = 1;
              JTextField freqTxt = new  JTextField(20);
              centerPanel.add(freqTxt, c);
              encapPanel.add(centerPanel);
              frame.getContentPane().add(northPanel, BorderLayout.NORTH);
              frame.getContentPane().add(encapPanel, BorderLayout.CENTER);
              frame.setSize(new Dimension(800, 600));
              frame.setVisible(true);
         public void initalize()
    //          String[] tmpListItems = { "Testing list item 1", "Testing 2", "Testing 3" };
    //          contentList = new JList(tmpListItems);
    //          contentList.setOpaque(true);
    //          contentList.setBackground(getBackgroundColor());
    //          Dimension dim = getPreferredSize();
    //          dim.setSize(dim.getWidth() - 70, dim.getHeight());
    //          listSP = new JScrollPane(contentList);
    //          listSP.setPreferredSize(dim);
    //          listSP.setOpaque(true);
    //          listSP.setBackground(getBackgroundColor());
    //          add(listSP);
              setBackground(getBackgroundColor());
              setBorder(BorderFactory.createLineBorder(Color.black));
          * (non-Javadoc)
          * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
         @Override
         protected void paintComponent(Graphics g)
              Dimension dim = getSize();
              Graphics2D g2d = (Graphics2D) g;
              if (!isShowing())
                   System.out.println("Showing: " + showing);
                   g2d.setPaint(getBackgroundColor());
                   RoundRectangle2D roundRectangle = new RoundRectangle2D.Double(getX() - 10, getY() + 5, dim.width - 20, dim.height - 10, 5, 15);
                   g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                   if(isTransparent())
                        Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getTransparencyLevel());
                        g2d.setComposite(alphaComp);
                   g2d.fill(roundRectangle);
                   BasicStroke stroke = new BasicStroke(3);
                   g2d.setStroke(stroke);
                   g2d.setPaint(getStrokeColor());
                   g2d.draw(roundRectangle);
                   // Draw a fake button
                   // Get the dimension of the current graphic
                   Graphics2D buttonArea = (Graphics2D) g2d.create(getX(), getY(), dim.width, dim.height);
                   buttonArea.setColor(getTabColor());
                   buttonArea.setFont(new Font("Helvetica", Font.BOLD, 16));
                   button = null;
                   button = new Rectangle2D.Double(roundRectangle.getBounds().getMaxX(), (roundRectangle.getMaxY() / 2) - 30, 25, 60);
                   buttonArea.fill(button);
                   buttonArea.draw(button);
                   // Draw the text
                   buttonArea.setStroke(new BasicStroke(3));
                   buttonArea.setPaint(getStrokeColor());
                   buttonArea.draw(button);
                   buttonArea.setClip(button);
                   buttonArea.setPaint(Color.black);
                   AffineTransform transformer = buttonArea.getTransform();
                   transformer.rotate(Math.toRadians(90));
                   buttonArea.transform(transformer);
                   Rectangle2D buttonBounds = button.getBounds2D();
                   Font buttonFont = new Font("Helvectica", Font.BOLD, 18);
                   FontRenderContext frc = buttonArea.getFontRenderContext();
                   TextLayout layout = new TextLayout("Hide", buttonFont, frc);
                   layout.draw(buttonArea, (float)buttonBounds.getY() + 10,(float)((buttonBounds.getX() - (buttonBounds.getX() *2)) -5));
              else
                   System.out.println("Showing: " + showing);
                   Graphics2D buttonArea = (Graphics2D) g2d.create(getX(), getY(), dim.width, dim.height);
                   buttonArea.setPaint(getTabColor());
                   button = null;
                   button = new Rectangle2D.Double(0, (dim.getHeight() / 2) - 30, 25, 60);
                   if (isTransparent())
                        // Set the Composite
                        Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getTransparencyLevel());
                        buttonArea.setComposite(alphaComp);
                   buttonArea.fill(button);
                   buttonArea.setStroke(new BasicStroke(3));
                   buttonArea.setPaint(getStrokeColor());
                   buttonArea.draw(button);
              super.paintComponents(g);
         public void hideDrawer(MouseEvent event)
              if (button != null)
                   if (button.contains(new Point2D.Double(event.getX(), event.getY())))
                        System.out.println("Button Pressed");
                        if (showing)
                             showing = false;
                             setPreferredSize(new Dimension(300, getSize().height));
                             setSize(new Dimension(300, getSize().height));
                             setVisible(true);
                             // Hide the list
    //                         contentList.setVisible(true);
    //                         listSP.setVisible(true);
                        else
                             showing = true;
                             setSize(28, getSize().height);
    //                         contentList.setVisible(false);
    //                         listSP.setVisible(false);
              Object parent = getParent();
              boolean foundParent = false;
              while (!foundParent)
                   Component parentsChild = (Component) parent;
                   Component fParent = ((Component) parent).getParent();
                   if (fParent == null)
                        foundParent = true;
                        parent = parentsChild;
                   else
                        parent = fParent;
              Component pComponent = (Component) parent;
              pComponent.repaint();
          * @param showing
          *            the showing to set
         public void showDrawer(boolean showing)
              this.showing = showing;
          * @return the showing
         public boolean isShowing()
              return showing;
          * @param title
          *            the title to set
         public void setTitle(String title)
              this.title = title;
          * @return the title
         public String getTitle()
              return title;
          * @param strokeColor
          *            the strokeColor to set
         public void setStrokeColor(Color strokeColor)
              this.strokeColor = strokeColor;
          * @return the strokeColor
         public Color getStrokeColor()
              return strokeColor;
          * @param backgroundColor
          *            the backgroundColor to set
         public void setBackgroundColor(Color backgroundColor)
              this.backgroundColor = backgroundColor;
          * @return the backgroundColor
         public Color getBackgroundColor()
              return backgroundColor;
          * @param tabColor
          *            the tabColor to set
         public void setTabColor(Color tabColor)
              this.tabColor = tabColor;
          * @return the tabColor
         public Color getTabColor()
              return tabColor;
          * @param transparent the transparent to set
         public void setTransparent(boolean transparent)
              this.transparent = transparent;
          * @return the transparent
         public boolean isTransparent()
              return transparent;
          * @param transparencyLevel the transparencyLevel to set
         public void setTransparencyLevel(float transparencyLevel)
              this.transparencyLevel = transparencyLevel;
          * @return the transparencyLevel
         public float getTransparencyLevel()
              return transparencyLevel;
    }

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class HD {
        TopCard    topCard;
        HostCard   hostCard;
        CardLayout cards;
        JPanel     cardPanel;
        private JPanel getContent() {
            Color stroke = UIManager.getColor("TabbedPane.foreground");
            Color bg     = UIManager.getColor("TabbedPane.background");
            Color tab    = UIManager.getColor("TabbedPane.contentAreaColor");
            Font font = //new Font("Helvetica", Font.BOLD, 18);
                        new Font("Dialog", Font.BOLD, 18);  // faster
            Dimension d = new Dimension(300,200);
            topCard = new TopCard(stroke, bg, tab, font, d);
            topCard.addMouseListener(mouser);
            hostCard = new HostCard(stroke, bg, tab, font, d);
            hostCard.addMouseListener(mouser);
            addComponents(hostCard);
            cards = new CardLayout();
            cardPanel = new JPanel(cards);
            cardPanel.add("top", topCard);
            cardPanel.add("host", hostCard);
            return cardPanel;
        private void addComponents(JComponent c) {
            String[] tmpListItems = { "Testing list item 1", "Testing 2", "Testing 3" };
            JList list = new JList(tmpListItems);
            int vm = hostCard.MARGIN;
            int right = 35;
            Dimension dim = c.getPreferredSize();
            dim.setSize(dim.width - 70, dim.height - 2*vm - 2*20);
            JScrollPane scrollPane = new JScrollPane(list);
            scrollPane.setPreferredSize(dim);
            c.setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(vm,0,vm,right);
            c.add(scrollPane, gbc);
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new HD().getContent());
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        private MouseListener mouser = new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                Object source = e.getSource();
                Point p = e.getPoint();
                if(source == topCard)
                    if(topCard.isControlTrigger(p))
                        cards.next(cardPanel);
                if(source == hostCard)
                    if(hostCard.isControlTrigger(p))
                        cards.next(cardPanel);
    class TopCard extends JPanel {
        Rectangle2D.Double rect;
        Color strokeColor;
        Color backgroundColor;
        Color tabColor;
        Font font;
        public TopCard(Color stroke, Color bg, Color tab, Font f, Dimension d) {
            strokeColor = stroke;
            backgroundColor = bg;
            tabColor = tab;
            font = f;
            setPreferredSize(d);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Dimension dim = getSize();
            g2.setPaint(Color.lightGray);
            g2.fillRect(0, 0, dim.width, dim.height);
            g2.setPaint(tabColor);
            rect = new Rectangle2D.Double(0, (dim.getHeight() / 2) - 30, 25, 60);
            g2.fill(rect);
            g2.setStroke(new BasicStroke(3));
            g2.setPaint(strokeColor);
            g2.draw(rect);
            // Draw label text.
            String s = "Show";
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            float width = (float)font.getStringBounds(s, frc).getWidth();
            LineMetrics lm = font.getLineMetrics(s, frc);
            float height = lm.getAscent() + lm.getDescent();
            double x = rect.getCenterX() - height/2 + lm.getDescent();
            double y = rect.getCenterY() - width/2;
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            at.rotate(Math.PI/2, 0, 0);
            g2.setFont(font.deriveFont(at));
            g2.drawString(s, 0, 0);
        public boolean isControlTrigger(Point p) {
            return rect.contains(p);
    class HostCard extends JPanel {
        Rectangle2D.Double rect;
        Color strokeColor;
        Color backgroundColor;
        Color tabColor;
        Font font;
        int MARGIN = 5;
        public HostCard(Color stroke, Color bg, Color tab, Font f, Dimension d) {
            strokeColor = stroke;
            backgroundColor = bg;
            tabColor = tab;
            font = f;
            setPreferredSize(d);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Dimension dim = getSize();
            g2.setPaint(Color.lightGray);
            g2.fillRect(0, 0, dim.width, dim.height);
            BasicStroke stroke = new BasicStroke(3);
            float lineWidth = stroke.getLineWidth();
            double x = getX() - MARGIN - lineWidth;
            double y = getY() + MARGIN;
            double w = dim.width - 20;
            double h = dim.height - 2*MARGIN - lineWidth/2;
            RoundRectangle2D roundRectangle =
                                 new RoundRectangle2D.Double(x, y, w, h, 5, 15);
            g2.setPaint(backgroundColor);
            g2.fill(roundRectangle);
            g2.setStroke(stroke);
            g2.setPaint(strokeColor);
            g2.draw(roundRectangle);
            rect = new Rectangle2D.Double(roundRectangle.getBounds().getMaxX(),
                                         (roundRectangle.getMaxY() / 2) - 30, 25, 60);
            g2.setPaint(tabColor);
            g2.fill(rect);
            g2.setPaint(strokeColor);
            g2.draw(rect);
            g2.setPaint(Color.black);
            // Draw label text.
            String s = "Hide";
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            float width = (float)font.getStringBounds(s, frc).getWidth();
            LineMetrics lm = font.getLineMetrics(s, frc);
            float height = lm.getAscent() + lm.getDescent();
            x = rect.getCenterX() - height/2 + lm.getDescent();
            y = rect.getCenterY() - width/2;
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            at.rotate(Math.PI/2, 0, 0);
            g2.setFont(font.deriveFont(at));
            g2.drawString(s, 0, 0);
        public boolean isControlTrigger(Point p) {
            return rect.contains(p);
    }

  • Programatically creating ADF Tree with nodes,child nodes & links?

    Hi,
    Currently I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Please provide me detailed code for programatically creating ADF Tree with nodes, child nodes and links in it.
    Thanks,
    Vik

    You need to create a model for the tree. ADF has a build in model that you can use to build your own tree.
    This is what you need to write in your JSPX:
    <af:tree summary="Navigation" id="treeNav" value="#{pageFlowScope.treeNavigationBackingBean.model}"
               var="node" contextMenuSelect="true" rowSelection="single" fetchSize="30">   
           <f:facet name="nodeStamp">
          <af:outputText id="txtText" value="#{node.text}"/>
        </f:facet>
    </af:tree>This is the code to retreive the model:
      public TreeModel getModel() {
        if(model == null)
            model = new ChildPropertyTreeModel(instance,"children");
        return model;
      }instance contains the actual tree. I build it in the constructor of my managed bean:
        public BeanTreeNavigation() {
          ArrayList<TreeItem> rootItems = new ArrayList<TreeItem>();
          TreeItem node1 = new TreeItem("Root node");
             ArrayList<TreeItem> level1 = new ArrayList<TreeItem>();
             TreeItem level1Node1 = new TreeItem("Level1 Node1");
              level1.add(level1Node1);
           node1.setChildren(level1);
           rootItems.setChildren(node1); 
          this.setListInstance(rootItems);
          root = rootItems;
      public void setListInstance(List instance) {
        this.instance = instance;
        model = null;
      }The TreeItem class is not a default one. I created it myself. You can make of it whatever you want:
        public class TreeItem {
          private String text;
           private List<TreeItem> children = null;
           public TreeItem(String text){
            this.text = text;
            public void setText(String text) {
                this.text = text;
            public String getText() {
                return text;
            public void setChildren(List<TreeItem> children) {
                this.children = children;
            public List<TreeItem> getChildren() {
                return children;
            }I wrote the TreeItem as an inner class of the managed bean.
    The most important part is the getModel methode. There you need to specify an Object and the name of the getter that will return a List of the children.
    Hope this helps.
    Edited by: Yannick Ongena on Feb 22, 2011 7:30 AM

  • Customizing ADF component rendering

    Hi,
    I'm trying to override some ADF component rendering in order to provide some clients with a simple application appearance. To do so, in faces-config.xml:
    <pre>
    <render-kit>
    <render-kit-id>oracle.adf.core</render-kit-id>
    <renderer>
    <component-family>oracle.adf.Panel</component-family>
    <renderer-type>oracle.adf.Page</renderer-type>
    <renderer-class>com.mycompany.web.faces.renderer.MyPanelPage</renderer-class>
    </renderer>
    </render-kit>
    </pre>
    I define MyPanelPage class that extends javax.faces.render.Renderer class. I override encodeBegin, encodeEnd, encodeChildren and getRendersChildren methods and it works fine. However, I run into a problem when I want to make the renderer work "in default mode" (the way it ussually works) under certain condition. I suppose that there might be a special render class used by "oracle.adf.core" render kit to render panelPage component, which determines the location of every facet. Anybody know which is this class.
    Thanks in advance.
    Luis Serrano.

    Hi,
    check PageLayoutRenderer
    Frank

  • Value Change Listener and field disable property in Ajax ADF component

    Hi. I have used the Ajax ADF component in my application. It is working fine but I am unable to implement the ValuechangeListener property and disable property for this component. Can someone please help and tell me how i can implement these properties for the component? Thanks in advance.

    Hi,
    I have no clue of what you are talking about.
    Frank

  • Detect absolute ID for an ADF component on the page

    Hi All,
    I need to locate an ADF component on the page using ADF Client javascript framework. I'm trying to locate it using following method AdfPage.PAGE.findComponentByAbsoluteId()
    The problem is this component is placed in a page fragment inside page template with several levels of nested naming containers. And I don't have access to the source code of the page template, hence it's quite hard for me to detect the correct absolute id for the component.
    So the question is: how can I know the final value for the absolute id of the component? Can I look it somewhere at runtime? Or if not, is there any alternative way to locate ADF component using just the design time id attribute set for the component?
    Thanks in advance.

    Hi Arun,
    Do you mean the id of the component in the final DOM? I tried to use that but didn't work. In my case, I need to find inputText component on the page. After page is loaded I can select it via Firebug and it has an id like 'pt1:USma:0:MAt1:0:pt1:reportXml::content'. If I then call following method:
    AdfPage.PAGE.findComponentByAbsoluteId('pt1:USma:0:MAt1:0:pt1:reportXml::content')
    I get null. Am I missing something?
    Thanks,
    Maksym

  • I want to get a adf component in managed bean with jsff. What can I do?

    I want to get a adf component using FacesContext.getCurrentInstance().getViewRoot().findComponent("my component id").
    It's ok in taskflow with jspx, but I can't get the component correctly in my managed bean in taskflow using page fragment.
    The error is "can not find view root".

    What features do you need in the discussion board and how big do you forecast the community to be?
    I gather that you really want a free solution.
    No software is perfect but when you pay for software you generally get features and the expectation of a certain minimum level of support.
    With open source, you get free, features and some support but you also get constant security fixes, regular update patches, plus lots of trawling through online forums looking for tweaks and workarounds. Expect to invest lots of time maintaining it.
    I've used phpBB in the past but never had issues with DW touching the coding. It served its purpose for me and the community at the time but the issues I dealt with regularly were the constant updates/bugfixes and never ending spam, spam, spam.

  • Creating a customized copy of an ADF component

    Hi,
    Is it possible to create a copy of a standard ADF component, and then customize the copy without changing the original?
    Using a skin, it is possible to change the look and feel etc. of standard ADF components. But I have a case where I need a customized version of a panel splitter AND an un-customized version, at the same time (on the same page). Any suggestions?
    Regards,
    Andreas

    Hi Arun,
    Sorry about the delay.
    I'm having some trouble making the style take effect.
    I have this in my skin css:
    af|panelSplitter.splitterHelp af|panelSplitter::horizontal-collapse-icon {content: url('/faces/images/Help-icon32x32.png');width:25px;height:25px;}
    af|panelSplitter.splitterHelp af|panelSplitter::horizontal-restore-icon {content: url('/faces/images/Help-book32x32.png');width:25px;height:25px;}
    and, on my page I have:
    <af:panelSplitter id="ps2" styleClass="splitterHelp">
    <f:facet name="first">
    <af:outputText value="Content" id="ot6"/>
    </f:facet>
    <f:facet name="second">
    <af:outputText value="Helptext" id="ot7"/>
    </f:facet>
    </af:panelSplitter>
    But this doesn't work (the splitter is displayed, but unstyled).
    I've tried using this syntax in the css file instead:
    .splitterHelp af|panelSplitter::horizontal-collapse-icon {content: url('/faces/images/Help-icon32x32.png');width:25px;height:25px;}
    .splitterHelp af|panelSplitter::horizontal-restore-icon {content: url('/faces/images/Help-book32x32.png');width:25px;height:25px;}
    But this does not work, either.
    Lastly, I've tried doing something simpler but similar:
    .styleTest af|inputText::content
    background-color: InfoBackground;
    (just to see if I could get ANY style from my skin to take effect). And this works fine.
    The definition of .styleTest seems to me to be very similar to the definition of .splitterHelp. Yet, .styleTest works, and .splitterHelp does not.
    Thinking that the problem might be the icon files, I've tried using some of my own icons instead (placed in an image folder in the skin workspace), but this does not seem to make any difference.
    Can you (or anyone else) please tell me what I'm doing wrong?
    Regards,
    Andreas

Maybe you are looking for

  • Can't Get JCO to work on my server

    hey guys, I'm trying to make the JCO work on my 6.40 J2E server. I started with a very simple jsp, but i get an error can anyone help me ? here is  the code : <%@ page language="java" contentType="text/xml" import="com.sap.mw.jco.JCO"      %><% JCO.C

  • I'm trying to upgrade ios 5.1.1 to ios 7 or higher.  When I try to update it says i have the latest update.

    I'm trying to upgrade ios5.1.1 to ios7 or higher as it is required to use facebook.  When I try to upgrade it says I have the latest version?

  • Error while calling "sql Type" in forms

    Hi all, I have created a SQL TYPE in user schema and call it through form.While compiling form following error message arise: Implementation restriction [may be temporary] ADT or schema level collection not supported at client side with non-OCI mode.

  • Ho can I generate a scheduler_job DDL?

    Hi All, Any ideas on how to extract DDL of scheduler_job? I am trying to migrate scheduler jobs from one test server to production and other multiple dev/test servers. I have already tried from OEM using create like option but seems a little cumberso

  • Help exporting 16:9 optimized for apple tv

    I am trying to export an SD anamorphic sequence optimized for apple tv. I have been going to File/ export/ use quicktime conversion/ apple tv, preset. But it exports it as 4:3 and the configure options are all grayed out. What is the best way to get