Button's actionlistener is invoked by unkown source

Hello,
Normaly when a button has focus its actionlistener will be invoked when pressing the space bar. It will not react on the ENTER keyevent.
My problem now is, when pressing ENTER, the actionlistener WILL be invoked and this is not what I want..
I've tryed everything I know but can not find the problem. When I catch the keyevent, its source is the button. The inputMap of the button contains no enter code.
Can somebody please help me? Where can I search for the solution??
Thanks,
Daniel

This is where I make some buttons. To each button I add a ActionListener.
          Set producten = _kassa.getHuidigeProducten();
          for ( Iterator i = producten.iterator() ; i.hasNext() ; )
               Product product = (Product)i.next();
               if ( product.getNummer() <= aantalButtons )
                    JButton button = new JButton( KassaTools.getNummerString( product.getNummer() ) + " - " + product.getNaam() );
                    button.setFont( new Font( "Verdana" , 0 , 11 ) );
                    button.setToolTipText( KassaTools.getNummerString( product.getNummer() ) + " - " + product.getNaam() );
                    button.setForeground( product.getGroep().getKleur() );
                    button.setHorizontalAlignment( SwingConstants.LEFT );
                    button.setActionCommand( Integer.toString( product.getNummer() ) );
                    button.addActionListener( this );
                    buttons.set( product.getNummer() - 1 , button );
          for ( int x = 0 ; x < aantalButtons ; x = x + 1 )
               getPanel().add( (JButton)buttons.get( x ) );
     public void actionPerformed( ActionEvent e )
          int nummer = Integer.parseInt( e.getActionCommand() );
          controller.productGeklikt( kassa.getProduct( nummer , false ) );

Similar Messages

  • ActionListener not invoked

    Hi all,
    I have a problem developping a custom component by aggregation and using action listener.
    In the restore state phase, the action listener I have previously add to a child button of my component is null and so not invoked.
    My custom component look like this :
    public class SnpsUIEditPanel extends UIPanel implements NamingContainer
    /** inner classes listeners */
    public class SnpsEditActionHandler implements ActionListener, StateHolder
         * Defines visible the updater footer panel and invisible the editer footer panel.
         * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
         public void processAction(ActionEvent pEvent) throws AbortProcessingException
         if( pEvent.getComponent() == getEditCommand())
              getEditCommand().setRendered(false);
              getUpdateCommand().setRendered(true);
              getResetCommand().setRendered(true);
         public Object saveState(FacesContext pContext)
         return null;
         public void restoreState(FacesContext pContext, Object pState)
         public boolean isTransient()
         return true;
         public void setTransient(boolean pNewTransientValue)
    public class SnpsUpdateActionHandler implements ActionListener, StateHolder
         * Defines visible the editor footer panel and invisible the updater footer panel.
         * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
         public void processAction(ActionEvent pEvent) throws AbortProcessingException
         if( pEvent.getComponent() == getUpdateCommand())
              getEditCommand().setRendered(true);
              getUpdateCommand().setRendered(false);
              getResetCommand().setRendered(false);
    /** called by the tag to define this property. It aggregates components for this custom component*/
    public void setEditable(boolean pEditable)
    Editable = new Boolean(pEditable);
    if( Editable.booleanValue())
    UIPanel footer = new UIPanel();
         footer.setRendererType("javax.faces.Group");
         footer.setId("footer");
         UICommand edit = new UICommand();
         edit.setId("edit");
         edit.setValue("Edit");
         edit.getAttributes().put("type", "submit");
    // register the action lsitener
         edit.addActionListener( new SnpsEditActionHandler());
         UICommand update = new UICommand();
         update.setId("update");
         update.setValue("Update Change");
         update.setRendered(false);
    // register the action listener
         update.addActionListener( new SnpsUpdateActionHandler());
         if( UpdateAction != null)
         update.setAction(UpdateAction);
         update.getAttributes().put("type", "submit");
         UICommand reset = new UICommand();
         reset.setId("reset");
         reset.setValue("Reset Change");
         reset.setImmediate(true);
         reset.setRendered(false);
         reset.getAttributes().put("type", "reset");
         footer.getChildren().add(edit);
         footer.getChildren().add(update);
         footer.getChildren().add(reset);
         getFacets().put("footer", footer);
    else
         getFacets().remove("footer");
    protected UICommand getEditCommand()
         return (UICommand)findComponent("edit");
    protected UICommand getUpdateCommand()
         return (UICommand)findComponent("update");
    protected UICommand getResetCommand()
         return (UICommand)findComponent("reset");
    What is going wrong ?
    Thanks a lot for your help

    Well, not a lot of response.... ; )
    So I will explain a bit more my requirement :
    I want to create a custom component extending the basic fonctionnality of UIPanel in this way :
    My custom panel could automatically add a header and a footer according to its property.
    Here is an example :
    Normally to do what I want to do I have to code :
    <h:panelGrid>
          <f:facet name="header">
               <h:panelGroup>
                    <h:outputText id="title" value="My Title"/>
               </h:panelGroup>
          </f:facet>
          .... possible content...
          <f:facet name="footer">
             <h:panelGroup>
                  <h:commandButton id="edit" value="Edit" actionListener="myActionListener" rendered="true"/>
                  <h:commandButton id="update" value="Update" action="myBusinessAction" actionListener="myActionListener" rendered="false"/>
                  <h:commandButton id="reset" value="Reset" rendered="false"/>
             </h:panelGroup>
         </facet>
    </h:panelGrid>myActionListener is an ActionListener that makes rendered the buttons following the performed button : if Edit is performed then it is not rendered and the other are rendered. If Update is performed this is Edit that is rendered.
    So, I want a custom component and/or tag to perform like this :
    <x:editPanel title="My Title" updateAction="myBusinessAction" editable="true" ....>
        ... Possible content....
    </x:editPanel>How to do that ? What is the best way ?
    I have created a custom component, shortly described above that creates its children components dynamically (composite pattern) and adds listener programmatically to the buttons that require one.
    The component itself works well event I don't khow if the implementation is correct (I don't like adding attribute/value pair (like "type" for button) for component that are not part of its own API. Because it give me the feeling that it is HTML attribute and not component specific. If I change the rendering for another device will my component work yet or these attributes will be ignored ?).
    But the ActionListeners are not invoked. It seems this is because there are inner classes. There are not restored correctly during the restor view phase. With standard classes it works well.
    So, is there a manner to defined inner class as listener for a cleaner implementation ?
    Is my implementation of the component correct ? Or I'm going in a wrong direction ?
    Thanks in advence.

  • Buttons and actionlistener help.

    the following code has 2 buttons, how would i use a button to get me differnt graphics but inside the same window,
    say i clicked next the graphics would be slightly altered which I will do but it wont open a new window it will be in the same window, but different shapes.
    I am having trouble with action listeners and really need help in how they work iv read up but dont understand, and how this would be implemented for this.
    much help would be appreciated.
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.geom.Ellipse2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class square extends JPanel
        public square()
            setPreferredSize(new Dimension(800, 700));
            int eb = 80;
            setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
            setLayout(new BorderLayout(5, 10));
           JPanel buttonPanel = createButtonPanel();
             add(buttonPanel, BorderLayout.SOUTH);
        private JPanel createButtonPanel()
            JPanel bp = new JPanel();
            bp.setOpaque(false);
                   JButton btn2 = new JButton("<-  Back Step ");
                    JButton btn = new JButton("Next Step   ->");
                    bp.add(btn2);
                    bp.add(btn);
            return bp;
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            Rectangle2D rect = new Rectangle2D.Double(250, 150, 100, 100);
            Rectangle2D     rect2 = new Rectangle2D.Double(400, 150, 100, 100);
             Rectangle2D     rect3 = new Rectangle2D.Double(550, 150, 100, 100);
             Rectangle2D     rect4 = new Rectangle2D.Double(250, 300, 100, 100);
             Rectangle2D     rect5 = new Rectangle2D.Double(400, 300, 100, 100);
             Rectangle2D     rect6 = new Rectangle2D.Double(550, 300, 100, 100);
             Rectangle2D     rect7 = new Rectangle2D.Double(250, 450, 100, 100);
             Rectangle2D     rect8 = new Rectangle2D.Double(400, 450, 100, 100);
             Rectangle2D     rect9 = new Rectangle2D.Double(550, 450, 100, 100);
             g.drawString("b0,0", 300, 130);
            g.drawString("b1,0", 300, 110);
             g.drawString("b2,0", 300, 90);
                 g.drawString("b0,1", 450, 110);
            g.drawString("b1,1", 450, 90);
            g.drawString("b2,1", 450, 70);
                 g.drawString("b0,2", 600, 90);
            g.drawString("b1,2", 600, 70);
            g.drawString("b2,2", 600, 50);
             g.drawString("a0,0", 200, 200);
            g.drawString("a1,0", 150, 200);
             g.drawString("a2,0", 100, 200);
                 g.drawString("a0,1", 150, 350);
            g.drawString("a1,1", 100, 350);
            g.drawString("a2,1", 50, 350);
                   g.drawString("a0,2", 100, 500);
            g.drawString("a1,2", 50, 500);
            g.drawString("a2,2", 15, 500);
            g2.setPaint(Color.black);
            g2.draw(rect);
            g2.draw(rect);
              g2.draw(rect2);
             g2.draw(rect3);
              g2.draw(rect4);
             g2.draw(rect5);
              g2.draw(rect6);
             g2.draw(rect7);
              g2.draw(rect8);
              g2.draw(rect9);
            Stroke oldStroke = g2.getStroke();
            g2.setStroke(new BasicStroke(5));
            g2.setStroke(oldStroke);
        private static void createAndShowUI()
            JFrame frame = new JFrame("Matrix Multiplication - Step by Step ");
            frame.getContentPane().add(new square());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }

    ok I had a look over it, I got this
    import java.awt.BasicStroke;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.RenderingHints;
    import java.awt.Stroke;
    import java.awt.geom.Ellipse2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class square extends JPanel implements ActionListener
        public square()
            setPreferredSize(new Dimension(800, 700));
            int eb = 80;
            setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
            setLayout(new BorderLayout(5, 10));
           JPanel buttonPanel = createButtonPanel();
             add(buttonPanel, BorderLayout.SOUTH);
      public void actionPerformed(ActionEvent e) {
            System.out.println("hello");
        private JPanel createButtonPanel()
            JPanel bp = new JPanel();
            bp.setOpaque(false);
                   JButton btn2 = new JButton("<-  Back Step ");
                    JButton btn = new JButton("Next Step   ->");
                    bp.add(btn2);
                    bp.add(btn);
             btn.addActionListener(this);
            return bp;
        @Override
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            Rectangle2D rect = new Rectangle2D.Double(250, 150, 100, 100);
            Rectangle2D     rect2 = new Rectangle2D.Double(400, 150, 100, 100);
             Rectangle2D     rect3 = new Rectangle2D.Double(550, 150, 100, 100);
             Rectangle2D     rect4 = new Rectangle2D.Double(250, 300, 100, 100);
             Rectangle2D     rect5 = new Rectangle2D.Double(400, 300, 100, 100);
             Rectangle2D     rect6 = new Rectangle2D.Double(550, 300, 100, 100);
             Rectangle2D     rect7 = new Rectangle2D.Double(250, 450, 100, 100);
             Rectangle2D     rect8 = new Rectangle2D.Double(400, 450, 100, 100);
             Rectangle2D     rect9 = new Rectangle2D.Double(550, 450, 100, 100);
             g.drawString("b0,0", 300, 130);
            g.drawString("b1,0", 300, 110);
             g.drawString("b2,0", 300, 90);
                 g.drawString("b0,1", 450, 110);
            g.drawString("b1,1", 450, 90);
            g.drawString("b2,1", 450, 70);
                 g.drawString("b0,2", 600, 90);
            g.drawString("b1,2", 600, 70);
            g.drawString("b2,2", 600, 50);
             g.drawString("a0,0", 200, 200);
            g.drawString("a1,0", 150, 200);
             g.drawString("a2,0", 100, 200);
                 g.drawString("a0,1", 150, 350);
            g.drawString("a1,1", 100, 350);
            g.drawString("a2,1", 50, 350);
                   g.drawString("a0,2", 100, 500);
            g.drawString("a1,2", 50, 500);
            g.drawString("a2,2", 15, 500);
            g2.setPaint(Color.black);
            g2.draw(rect);
            g2.draw(rect);
              g2.draw(rect2);
             g2.draw(rect3);
              g2.draw(rect4);
             g2.draw(rect5);
              g2.draw(rect6);
             g2.draw(rect7);
              g2.draw(rect8);
              g2.draw(rect9);
            Stroke oldStroke = g2.getStroke();
            g2.setStroke(new BasicStroke(5));
            g2.setStroke(oldStroke);
        private static void createAndShowUI()
            JFrame frame = new JFrame("Matrix Multiplication - Step by Step ");
            frame.getContentPane().add(new square());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }it produces hello once I click the button, but how would I produce the same frame once the button is clicked, not a new frame, the same one iv got with slight adjustments inside it..which i will do.

  • I just downloaded Yosemite OS for mac and Premier pro play buttons don't work in the Program, Source and timeline and no audio HELP?

    Yosemite OS seem so not allow me to use premier pro. Specifically the play buttons don't work in the source, program and Timeline. Any one have this problem?

    Hey,
    I´ve got the same problem, that since i upgrade to Yosemite, my R3D Video Files are not longer supported, sometimes it works but most of time it says "not supported File format".. Hope Adobe will fix it.
    Play button works. Try installing the latest Java 8 update. This might fix some problems.

  • How to access a button inside a MovieClip which is the source of a scrollpane?

    Hi Everyone,
    I have created a crollpane in my flash file and the source of the scrollpane is a movieclip which contains a buttons.
    Now I want to add a gotoAndStop function to that button to link to a frame on the main timeline.
    Could anyone tell me what is the right as3 code to access this button?
    Thank you!

    Hi Ned,
    I'm still getting a error message. This is my code:
    MovieClip(spane8.content).AppsOptimizerBtn.addEventListener(MouseEvent.CLICK, gotoApp1);
    function gotoApp1(event:MouseEvent):void
              gotoAndStop(21);
    This is the error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
              at MyAssests_Scene2_fla::MainTimeline/frame11()
              at flash.display::MovieClip/gotoAndStop()
              at MyAssests_Scene2_fla::MainTimeline/gotoAppStore()
    Frame 11 is where my scrollpane is.
    "gotoAppStore" is a function that I used at frame 1 to link to frame 11.
    Any idea what is wrong?

  • MacBook pro one week in San Salvador. Will not start at all. Power cord has green light on but nothing happens when power button is pushed. Ideas?  Any source of service in El Salvador?

    My Mac book pro will not power up at all.  Owed cord green light is lit up fine. What to try?  Any support in ElSalvadr?

    Compugrafica, S.A. DE C.V.
    2252-3075
    San Salvador
    Equipos Electronicos Valdes, S.A. de C.V.
    503-2209-2217
    San Salvador, San Salvador
    GBM DE EL SALVADOR S.A. DE CV
    (503) 22505600
    San Salvador
    MACHON Y VEJARANO, S.A.
    2243-9090  2224-6406
    San Salvador
    SERVITOTAL
    231-7000
    San Salvador, Zz

  • Custom button with action listener - will not invoke action listener

    Hi
    For whatever reason, I cannot find a concise example of a simple custom component that can invoke an action listener. The tutorials I've read so far either ignore this fundamental topic or only make the slightest make reference to it.
    The best I have come up with - in terms of a simple prototype is below... but, the action listener is never invoked.... Can someone tell me what I am missing (full code below). Hopefully, what is missing or incorrect will be obvious to you JSF experts out there.
    Thanks for any help!!
    -f
    tld
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>0.01</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>jsfcustomcomponent</short-name>
      <uri>http://jsfcustomcomponent/</uri>
      <description><![CDATA[jsf custom component tags]]>  </description>
      <tag>
        <name>specialBtnTag</name>
        <tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
        <attribute>
          <name>value</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[button value]]></description>
        </attribute>
        <attribute>
          <name>actionListener</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[action listener]]> </description>
        </attribute>
      </tag>
    </taglib>
    SpecialBtnComponent
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.el.*;
    import javax.faces.event.*;
    public class SpecialBtnComponent
        extends UIComponentBase implements ActionSource
        public static final String COMPONENT_TYPE = "SpecialBtnComponent";
        public static final String RENDERER_TYPE = "SpecialBtnRenderer";
        public String getFamily()
            return COMPONENT_TYPE;
        public SpecialBtnComponent()
            super();
            setRendererType(SpecialBtnComponent.RENDERER_TYPE);
        private String value;
        public void setValue(String value, FacesContext facesContext)
            this.value = value;
        public String getValue()
            if (null != value)
                return value;
            ValueBinding _vb = getValueBinding("value");
            if (_vb != null)
                return (String) _vb.getValue(getFacesContext());
            else
                return null;
        private MethodBinding action = null;
        public MethodBinding getAction()
            return action;
        public void setAction(MethodBinding methodBinding)
            this.action = action;
        private MethodBinding actionListener = null;
        public MethodBinding getActionListener()
            return (this.actionListener);
        public void setActionListener(MethodBinding methodBinding)
            this.actionListener = actionListener;
        public boolean isImmediate()
            return false;
        public void setImmediate(boolean _boolean)
            //this.immediate = immediate;
        public void addActionListener(ActionListener actionListener)
            addFacesListener(actionListener);
        public ActionListener[] getActionListeners()
            return (ActionListener[]) getFacesListeners(ActionListener.class);
        public void removeActionListener(ActionListener actionListener)
            removeFacesListener(actionListener);
        public Object saveState(FacesContext context)
            Object values[] = new Object[5];
            values[0] = super.saveState(context);
            values[1] = value;
            values[2] = saveAttachedState(context, action);
            values[3] = saveAttachedState(context, actionListener);
            return ( (Object) (values));
        public void restoreState(FacesContext context, Object state)
            Object values[] = (Object[]) state;
            super.restoreState(context, values[0]);
            value = (String) values[1];
            action = (MethodBinding) restoreAttachedState(context, values[2]);
            actionListener = (MethodBinding) restoreAttachedState(context, values[3]);
        public void broadcast(FacesEvent event) throws AbortProcessingException
            super.broadcast(event);
            if (event instanceof ActionEvent)
                FacesContext context = getFacesContext();
                MethodBinding mb = getActionListener();
                if (mb != null)
                    mb.invoke(context, new Object[]
                              {event});
                ActionListener listener = context.getApplication().getActionListener();
                if (listener != null)
                    listener.processAction( (ActionEvent) event);
        public void queueEvent(FacesEvent e)
            if (e instanceof ActionEvent)
                if (isImmediate())
                    e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                else
                    e.setPhaseId(PhaseId.INVOKE_APPLICATION);
            super.queueEvent(e);
    SpecialBtnRenderer
    package jsfcustomcomponent;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.event.*;
    import javax.faces.render.*;
    public class SpecialBtnRenderer
        extends Renderer
        String value;
        public SpecialBtnRenderer()
        public void decode(FacesContext context, UIComponent component)
            Map requestMap = context.getExternalContext().getRequestParameterMap();
            String clientId = component.getClientId(context);
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            String value = (String) requestMap.get(clientId);
            if (null != value)
                specialBtnComponent.setValue(value, context);
            ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
            specialBtnComponent.queueEvent(actionEvent);
        public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            ResponseWriter writer = context.getResponseWriter();
            String clientId = component.getClientId(context);
            value = (String) component.getAttributes().get("value");
            if (value == null)
                value = "defaultValue";
            buildSpecialBtn(writer, value, clientId, specialBtnComponent);
        private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
            writer.startElement("table", component);
            writer.startElement("tbody", component);
            writer.startElement("tr", component);
            writer.startElement("td", component);
            value = String.valueOf(value);
            writer.startElement("input", component);
            writer.writeAttribute("type", "submit", null);
            writer.writeAttribute("name", clientId, "clientId");
            writer.writeAttribute("value", value, null);
            writer.endElement("input");
            writer.endElement("td");
            writer.endElement("tr");
            writer.endElement("tbody");
            writer.endElement("table");
    SpecialBtnTag
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.el.*;
    import javax.faces.webapp.*;
    import com.sun.faces.util.*;
    public class SpecialBtnTag
        extends UIComponentTag
        public String value = null;
        public String actionListener = null;
        public String getComponentType()
            return SpecialBtnComponent.COMPONENT_TYPE;
        public String getRendererType()
            return SpecialBtnComponent.RENDERER_TYPE;
        protected void setProperties(UIComponent component)
            super.setProperties(component);
            if (! (component instanceof SpecialBtnComponent))
                throw new IllegalStateException("Component " + component.toString() +
                                                " not expected type.  Expected: jsfcustomcomponent.SpecialBtnComponent.  Perhaps you�re missing a tag?");
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            if (value != null)
                if (isValueReference(value))
                    ValueBinding vb = Util.getValueBinding(value);
                    specialBtnComponent.setValueBinding("value", vb);
                else
                    throw new IllegalStateException("The value for �value� must be a ValueBinding.");
            if (actionListener != null)
                if (isValueReference(actionListener))
                    ValueBinding vb = Util.getValueBinding(actionListener);
                    specialBtnComponent.setValueBinding("actionListener", vb);
                else
                    throw new IllegalStateException("The value for �actionListener� must be a ValueBinding.");
        public void release()
            super.release();
            value = null;
            actionListener = null;
        public void setValue(String value)
            this.value = value;
        public String getValue()
            return this.value;
        public void setActionListener(String actionListener)
            this.actionListener = actionListener;
        public String getActionListener()
            return this.actionListener;
    jsp1.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
    </head>
    <body>
    <f:view>
      <h:form id="form01">
        <h:outputText value="test special button with action listener"/>
        <j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" actionListener="#{specialBtnBacking.specialBtnActionListener}"/>
        <h:messages/>
        <h:outputText value="#{specialBtnBacking.outcome}"/>
      </h:form>
    </f:view>
    </body>
    </html>
    SpecialBtnBacking
    package specialbtn;
    import javax.faces.context.*;
    import javax.faces.event.*;
    public class SpecialBtnBacking
        private FacesContext context;
        public SpecialBtnBacking()
            this.setSpecialBtnValue("Special Button with action listener");
        private String specialBtnValue;
        public String getSpecialBtnValue()
            return this.specialBtnValue;
        public void setSpecialBtnValue(String specialBtnValue)
            this.specialBtnValue = specialBtnValue;
        private String outcome="actionlistener NOT invoked: click specialBtn above to test";
        public String getOutcome()
            return outcome;
        public void setOutcome(String outcome)
            this.outcome = outcome;
        public void specialBtnActionListener(ActionEvent evt)
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            this.outcome="***action listener invoked!!!***";
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <managed-bean>
        <managed-bean-name>specialBtnBacking</managed-bean-name>
        <managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      <component>
        <component-type>SpecialBtnComponent</component-type>
        <component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
        <component-extension>
          <renderer-type>SpecialBtnRenderer</renderer-type>
        </component-extension>
      </component>
      <render-kit>
        <renderer>
          <component-family>SpecialBtnComponent</component-family>
          <renderer-type>SpecialBtnRenderer</renderer-type>
          <renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
        </renderer>
      </render-kit>
    </faces-config>
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <display-name>pagerWEB</display-name>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
      <jsp-config>
        <taglib>
          <taglib-uri>http://jsfcustomcomponent/</taglib-uri>
          <taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
        </taglib>
      </jsp-config>
      <servlet>
        <description>Added by JBuilder to compile JSPs with debug info</description>
        <servlet-name>debugjsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
          <param-name>classdebuginfo</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>debugjsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
      </servlet-mapping>
    </web-app>

    got it working....
    The changes were:
    in "SpecialBtnRenderer"...
    --new--
                        mb.invoke(context, new Object[1]);
    --old--
                        mb.invoke(context, new Object[0]);
    in "SpecialBtnTag"...
    --new--
    import javax.faces.event.ActionEvent;
    --new--
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
    --old--
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, null);
    -Below is the entire application, again -- for those (like myself) who need concrete examples...
    I hope this helps someone else! --f
    jsp1.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
    </head>
    <body>
    <f:view>
        <h:messages/>
      <h:form id="form01">
        <h:outputText value="test special button with action listener"/>
        <j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" specialBtnListener="#{specialBtnBacking.specialBtnActionListener}"/>
        <h:outputText value="#{specialBtnBacking.outcome}"/>
      </h:form>
    </f:view>
    </body>
    </html>
    SpecialBtnBacking
    package specialbtn;
    import javax.faces.context.*;
    import javax.faces.event.*;
    public class SpecialBtnBacking
        private FacesContext context;
        public SpecialBtnBacking()
            this.setSpecialBtnValue("Special Button with action listener");
        private String specialBtnValue;
        public String getSpecialBtnValue()
            return this.specialBtnValue;
        public void setSpecialBtnValue(String specialBtnValue)
            this.specialBtnValue = specialBtnValue;
        private String outcome = "actionlistener NOT invoked: click specialBtn above to test";
        public String getOutcome()
            return outcome;
        public void setOutcome(String outcome)
            this.outcome = outcome;
        public void specialBtnActionListener(ActionEvent evt)
            System.out.println("\n\n");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");
            this.outcome = "***action listener invoked!!!***";
    jsfcustomcomponent.tld
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>0.01</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>jsfcustomcomponent</short-name>
      <uri>http://jsfcustomcomponent/</uri>
      <description><![CDATA[jsf custom component tags]]>  </description>
      <tag>
        <name>specialBtnTag</name>
        <tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
        <attribute>
          <name>value</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[button value]]></description>
        </attribute>
        <attribute>
          <name>specialBtnListener</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[action listener]]> </description>
        </attribute>
      </tag>
    </taglib>
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <managed-bean>
        <managed-bean-name>specialBtnBacking</managed-bean-name>
        <managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      <component>
        <component-type>SpecialBtnComponent</component-type>
        <component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
        <component-extension>
          <renderer-type>SpecialBtnRenderer</renderer-type>
        </component-extension>
      </component>
      <render-kit>
        <renderer>
          <component-family>SpecialBtnComponent</component-family>
          <renderer-type>SpecialBtnRenderer</renderer-type>
          <renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
        </renderer>
      </render-kit>
    </faces-config>
    SpecialBtnComponent.java
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.el.*;
    import javax.faces.event.*;
    public class SpecialBtnComponent
        extends UIComponentBase implements ActionSource
        public static final String COMPONENT_TYPE = "SpecialBtnComponent";
        public static final String RENDERER_TYPE = "SpecialBtnRenderer";
        public String getFamily()
            return COMPONENT_TYPE;
        public SpecialBtnComponent()
            super();
            setRendererType(SpecialBtnComponent.RENDERER_TYPE);
        private String value;
        public void setValue(String value, FacesContext facesContext)
            this.value = value;
        public String getValue()
            if (null != this.value)
                return this.value;
            ValueBinding _vb = getValueBinding("value");
            if (_vb != null)
                return (String) _vb.getValue(getFacesContext());
            else
                return null;
        private MethodBinding specialBtnListener = null;
        public MethodBinding getActionListener()
            return (this.specialBtnListener);
        public void setActionListener(MethodBinding actionListener)
            this.specialBtnListener = actionListener;
        public Object saveState(FacesContext context)
            Object values[] = new Object[3];
            values[0] = super.saveState(context);
            values[1] = saveAttachedState(context, this.specialBtnListener);
            values[2] = this.value;
            return (values);
        public void restoreState(FacesContext context, Object state)
            Object values[] = (Object[]) state;
            super.restoreState(context, values[0]);
            this.specialBtnListener = (MethodBinding) restoreAttachedState(context, values[1]);
            this.value = (String) restoreAttachedState(context, values[2]);
        public void broadcast(FacesEvent event) throws AbortProcessingException
            super.broadcast(event);
            if (event instanceof ActionEvent)
                FacesContext context = getFacesContext();
                MethodBinding mb = this.getActionListener();
                if (mb != null)
                    try
                        mb.invoke(context, new Object[]
                                  {event});
                    catch (EvaluationException ex)
                        System.out.println("SpecialBtnComponent/broadcast(FacesEvent event)...EvaluationException encountered - ex.getMessage()=" + ex.getMessage());
                        ex.printStackTrace();
                ActionListener actionListener = context.getApplication().getActionListener();
                if (actionListener != null)
                    actionListener.processAction( (ActionEvent) event);
        public void queueEvent(FacesEvent e)
            if (e instanceof ActionEvent)
                e.setPhaseId(PhaseId.INVOKE_APPLICATION);
            super.queueEvent(e);
        public MethodBinding getAction()
            return null;
        public void setAction(MethodBinding methodBinding)
        public boolean isImmediate()
            return false;
        public void setImmediate(boolean _boolean)
        public void addActionListener(ActionListener actionListener)
            addFacesListener(actionListener);
        public ActionListener[] getActionListeners()
            return (ActionListener[]) getFacesListeners(ActionListener.class);
        public void removeActionListener(ActionListener actionListener)
            removeFacesListener(actionListener);
    SpecialBtnTag.java
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.el.*;
    import javax.faces.webapp.*;
    import com.sun.faces.util.*;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    public class SpecialBtnTag
        extends UIComponentTag
        public String value = null;
        public String specialBtnListener = null;
        private SpecialBtnComponent specialBtnComponent;
        public SpecialBtnTag()
            super();
        public String getComponentType()
            return SpecialBtnComponent.COMPONENT_TYPE;
        public String getRendererType()
            return SpecialBtnComponent.RENDERER_TYPE;
        protected void setProperties(UIComponent component)
            super.setProperties(component);
            if (! (component instanceof SpecialBtnComponent))
                throw new IllegalStateException("Component " + component.toString() +
                                                " not expected type.  Expected: jsfcustomcomponent.SpecialBtnComponent.  Perhaps you�re missing a tag?");
            specialBtnComponent = (SpecialBtnComponent) component;
            if (value != null)
                if (isValueReference(value))
                    ValueBinding vb = Util.getValueBinding(value);
                    specialBtnComponent.setValueBinding("value", vb);
                else
                    throw new IllegalStateException("The value for �value� must be a ValueBinding.");
            if (specialBtnListener != null)
                if (isValueReference(specialBtnListener))
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
                    ( (SpecialBtnComponent) component).setActionListener(mb);
                else
                    MethodBinding mb = Util.createConstantMethodBinding(specialBtnListener);
                    ( (SpecialBtnComponent) component).setActionListener(mb);
        public void release()
            super.release();
            value = null;
            specialBtnListener = null;
        public void setValue(String value)
            this.value = value;
        public String getValue()
            return this.value;
        public void setSpecialBtnListener(String specialBtnListener)
            this.specialBtnListener = specialBtnListener;
        public String getSpecialBtnListener()
            return this.specialBtnListener;
    SpecialBtnRenderer
    package jsfcustomcomponent;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.event.*;
    import javax.faces.render.*;
    import javax.faces.el.MethodBinding;
    import javax.faces.el.*;
    public class SpecialBtnRenderer
        extends Renderer
        String value;
        public SpecialBtnRenderer()
            super();
        public void decode(FacesContext context, UIComponent component)
            try
                Map requestMap = context.getExternalContext().getRequestParameterMap();
                String clientId = component.getClientId(context);
                SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
                String value = (String) requestMap.get(clientId);
                if (null != value)
                    specialBtnComponent.setValue(value, context);
                    MethodBinding mb = specialBtnComponent.getActionListener();
                    if (mb != null)
                        System.out.println("SpecialBtnRenderer/decode...mb.getExpressionString()=" + mb.getExpressionString());
                        //mb.invoke(context, new Object[0]);
                        mb.invoke(context, new Object[1]);
                    ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
                    specialBtnComponent.queueEvent(actionEvent);
            catch (EvaluationException ex)
                ex.printStackTrace();
        public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            ResponseWriter writer = context.getResponseWriter();
            String clientId = component.getClientId(context);
            value = (String) component.getAttributes().get("value");
            if (value == null)
                value = "defaultValue";
            buildSpecialBtn(writer, value, clientId, specialBtnComponent);
        private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
            writer.startElement("table", component);
            writer.startElement("tbody", component);
            writer.startElement("tr", component);
            writer.startElement("td", component);
            value = String.valueOf(value);
            writer.startElement("input", component);
            writer.writeAttribute("type", "submit", null);
            writer.writeAttribute("name", clientId, "clientId");
            writer.writeAttribute("value", value, null);
            writer.endElement("input");
            writer.endElement("td");
            writer.endElement("tr");
            writer.endElement("tbody");
            writer.endElement("table");
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <display-name>pagerWEB</display-name>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
      <jsp-config>
        <taglib>
          <taglib-uri>http://jsfcustomcomponent/</taglib-uri>
          <taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
        </taglib>
      </jsp-config>
    </web-app>

  • SharePoint PPS 2013 Dashboard Designer error "Please check the data source for any unsaved changes and click on Test Data Source button"

    Hi,
    I am getting below error in SharePoint PPS 2013 Dashboard Designer. While create the Analysis Service by using "PROVIDER="MSOLAP";DATA SOURCE="http://testpivot2013:9090/Source%20Documents/TestSSource.xlsx"
    "An error occurred connecting to this data source. Please check the data source for any unsaved changes and click on Test Data Source button to confirm connection to the data source. "
    I have checked all the Sites and done all the steps also. But still getting the error.Its frustrating like anything. Everything is configured correctly but still getting this error.
    Thanks in advance.
    Poomani Sankaran

    Hi Poomani,
    Thanks for posting your issue,
    you must have to Install SQL Server 2012 ADOMD.Net  on your machine and find the browse the below mentioned URL to create SharePoint Dashboard with Analysis service step by step.
    http://www.c-sharpcorner.com/UploadFile/a9d961/create-an-analysis-service-data-source-connection-using-shar/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • How to invoke plsql block when press a button

    new to htmldb,
    let's say i have a form with some items , after i press a button, i want to invoke a plsql block, how can i do that?
    Cheers,

    I have only played a bit with this. I had a region with search criteria’s and a region based on a procedure. I created a page button on the first region that branched to the same page. When I press the button the page is refreshed and the procedure is re-executed with what ever search criteria’s the user has keyed in. That is as far as I have come :-)

  • Invoking another command button while clicking on the other

    Hi All,
    I have an add form where I have 2 buttons, one is ADD and othe is SAVE. Each one of them will call different backing bean methods. When I Click on Add my save button should also be invoked. How can I do that?

    You can do that using javascript. But note that only one action method would be executed on submit.
    function submitSave(){
        var save = document.getElementById(//id for ur save button);
        save.click();
    <h:commandButton value="Add" action="#{Bean.xyz}" onclick="submitSave()"/>
    <h:commandButton value="Save" action="#{Bean.abc}"/>If both the buttons are in the same form, then only one action can be invoked on click of a button. If you want to execute both actions, you can handle the same on server side. After completing the action for your add button, from the same method you can invoke the action method for save button.

  • ActionListener in ADF button

    Hi,
    I have a button with actionlistener property as "#{bindings.CreateInsert3.execute}". How can i call the same from backingbean? i need this becausei want to set some values before this operation when someone clicks the button.Can someone give me code snippet please..
    my bean method {
    -- need to
    -- execute createinsert
    Thanks,
    Lakshmi.

           public BindingContainer getBindings() {
            return BindingContext.getCurrent().getCurrentBindingsEntry();
        public String createInsert() {
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding =
                bindings.getOperationBinding("CreateInsert3");
            Object result = operationBinding.execute();
            if (!operationBinding.getErrors().isEmpty()) {
                return null;
            return null;
        }

  • ActionListener invoked multiple times Issue

    Hi,
    I have defined a CommandLink with ActionListener and ShowPopupBehaviour (onclick)
    Inline Popup box has a Editable Table.
    I would like to perform the ExecuteQuery() on the VO with ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES when CommandLink is pressed to refresh the data in the table that is shown in popup.
    When I click on the CommandLink VO query is executed as expected.
    I can see the results on the Popup refreshed from the database tables.
    When I try to change the value in the popup table the ActionListener of CommandLink is executed again. (I have ran this project in Debug Mode. I have set a breakpoint in ActionListener method).
    What could be the Reason. Any ideas how to go over this.
    Thanks,
    Satya
    code snippet:
    <af:commandLink id="UpdateWIPCL"
    partialSubmit="true"
    text="Edit WIP"
    rendered="#{pageFlowScope.pRevenueProjectId !=null }"
    actionListener="#{ProjectSelection.EditWIPLink}">
    <af:image source="/adf/images/update_ena.png"
    shortDesc="Edit Work In Progress for all Sellers"
    id="UpdateWIPImg"/>
    <af:showPopupBehavior popupId="WIPUpdatePopup"
    triggerType="click"/>
    <af:popup id="WIPUpdatePopup"
    contentDelivery="lazyUncached"
    binding="#{ProjectSelection.wiPUpdatePopup}">

    I have pasted part of it.
    Now pasted complete commandLink
    <af:commandLink id="UpdateWIPCL"
    partialSubmit="true"
    text="Edit WIP"
    rendered="#{pageFlowScope.pRevenueProjectId !=null }">
    <af:image source="/adf/images/update_ena.png"
    shortDesc="Edit Work In Progress for all Sellers"
    id="UpdateWIPImg"/>
    <af:showPopupBehavior popupId="WIPUpdatePopup"
    triggerType="click"/>
    <af:popup id="WIPUpdatePopup"
    contentDelivery="lazyUncached"
    binding="#{ProjectSelection.wiPUpdatePopup}">
    <af:dialog id="dialog2"
    closeIconVisible="false"
    title="Edit Work In Progress"
    dialogListener="#{ProjectSelection.EditWIPDialogListener}"
    clientComponent="true"
    resize="on"
    stretchChildren="first"
    contentWidth="650"
    contentHeight="250">
    <af:table value="#{bindings.SellersWIPVO1.collectionModel}"
    var="row"
    rows="#{bindings.SellersWIPVO1.rangeSize}"
    emptyText="#{bindings.SellersWIPVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.SellersWIPVO1.rangeSize}"
    rowBandingInterval="0"
    id="t7"
    columnStretching="column:c35">
    <af:column sortProperty="SellingRegionName"
    sortable="false"
    headerText="Seller"
    id="c36"
    rowHeader="true"
    align="center">
    <af:outputFormatted value="#{row.bindings.SellingRegionName.inputValue}"
    id="of6"
    inlineStyle="text-align:right;"/>
    </af:column>
    <af:column sortProperty="Elm"
    sortable="false"
    headerText="ELM"
    id="c35"
    align="right">
    <af:outputFormatted value="#{row.bindings.Elm.inputValue}"
    id="of5"
    inlineStyle="text-align:right;">
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.SellersWIPVO1.hints.Elm.format}"
    minFractionDigits="4"
    maxFractionDigits="4"/>
    </af:outputFormatted>
    </af:column>
    <af:column sortProperty="Revenue"
    sortable="false"
    headerText="#{bindings.SellersWIPVO1.hints.Revenue.label}"
    id="c39"
    align="right">
    <af:outputFormatted value="#{row.bindings.Revenue.inputValue}"
    id="of7"
    inlineStyle="text-align:right;">
    <af:convertNumber groupingUsed="true"
    pattern="#{bindings.SellersWIPVO1.hints.Revenue.format}"
    minFractionDigits="0"
    maxFractionDigits="0"
    integerOnly="true"/>
    </af:outputFormatted>
    </af:column>
    <af:column sortProperty="Labor"
    sortable="false"
    headerText="#{bindings.SellersWIPVO1.hints.Labor.label}"
    id="c38"
    align="right">
    <af:inputText value="#{row.bindings.Labor.inputValue}"
    label="#{bindings.SellersWIPVO1.hints.Labor.label}"
    required="#{bindings.SellersWIPVO1.hints.Labor.mandatory}"
    columns="#{bindings.SellersWIPVO1.hints.Labor.displayWidth}"
    maximumLength="#{bindings.SellersWIPVO1.hints.Labor.precision}"
    shortDesc="#{bindings.SellersWIPVO1.hints.Labor.tooltip}"
    id="it28"
    contentStyle="text-align:right;">
    <f:validator binding="#{row.bindings.Labor.validator}"/>
    <af:convertNumber
    pattern="#{bindings.SellersWIPVO1.hints.Labor.format}"
    integerOnly="true"
    minFractionDigits="0"
    maxFractionDigits="0"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="Odc"
    sortable="false"
    headerText="Other Direct Costs"
    id="c37"
    align="right">
    <af:inputText value="#{row.bindings.Odc.inputValue}"
    label="#{bindings.SellersWIPVO1.hints.Odc.label}"
    required="#{bindings.SellersWIPVO1.hints.Odc.mandatory}"
    columns="#{bindings.SellersWIPVO1.hints.Odc.displayWidth}"
    maximumLength="#{bindings.SellersWIPVO1.hints.Odc.precision}"
    shortDesc="#{bindings.SellersWIPVO1.hints.Odc.tooltip}"
    id="it30"
    contentStyle="text-align:right;">
    <f:validator binding="#{row.bindings.Odc.validator}"/>
    <af:convertNumber
    pattern="#{bindings.SellersWIPVO1.hints.Odc.format}"
    integerOnly="true"
    minFractionDigits="0"
    maxFractionDigits="0"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="Ops"
    sortable="false"
    headerText="Outside Professionals"
    id="c40"
    align="right">
    <af:inputText value="#{row.bindings.Ops.inputValue}"
    label="#{bindings.SellersWIPVO1.hints.Ops.label}"
    required="#{bindings.SellersWIPVO1.hints.Ops.mandatory}"
    columns="#{bindings.SellersWIPVO1.hints.Ops.displayWidth}"
    maximumLength="#{bindings.SellersWIPVO1.hints.Ops.precision}"
    shortDesc="#{bindings.SellersWIPVO1.hints.Ops.tooltip}"
    id="it18"
    contentStyle="text-align:right;">
    <f:validator binding="#{row.bindings.Ops.validator}"/>
    <af:convertNumber
    pattern="#{bindings.SellersWIPVO1.hints.Ops.format}"
    integerOnly="true"
    minFractionDigits="0"
    maxFractionDigits="0"/>
    </af:inputText>
    </af:column>
    </af:table>
    </af:dialog>
    </af:popup>
    </af:commandLink>

  • Using a button and a textfield in the same cell of a table

    I have been struggling with this problem for ages, please someone help...
    I am trying to implement a table similar to NetBeans property sheet editor where you have a textfield and a button with "..." in the same table cell. The button is used to invoke a custom editor.
    I have most things working, custom renderers, custom editors and such.
    However, the focus interactions on the table seem completely screwed. Clicking in the editor causes the cell to switch to editing mode as expected. Pressing cursor down or tab, which should close the editor and move focus to the next cell down does not work - the editor closes but the focus disappears to a completely different component elsewhere on my GUI.
    My textfield and button are on a JPanel, and I return that JPanel when getTableCellEditorComponent is called.
    If I switch out the JPanel and instead return the textfield, the focus works as normal.
    I've even looked at the NetBeans source but I can't work out what their trick is.
    Any tips would be gratefully received.
    TIA.

    Thanks for your time, Jeanette...
    Here is a bare-bones example of the problem I'm having. I'm running on JDK1.4 and JDK1.3.1_02.
    I've tried some tricks (hacks) with getNextFocusableComponent and requestDefautFocus and such but with no success.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    * This example shows a keyboard/focus navigation problem when using a JPanel
    * as a table cell editor. The JPanel contains a textfield and a button.
    * Click in the editor to invoke it, and tab-off (or press cursor down). The
    * edit ends, but the focus disappears rather than moving to the next cell in
    * the table.
    * Change the line that returns the panel to return a text field instead, and
    * all is well.
    public class Test
      public static void main( String[] args )
        new Test();
      public Test()
        JFrame f = new JFrame();
        f.setContentPane( new TablePanel() );
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        f.setSize( 800, 600 );
        f.setVisible( true );
      class TablePanel extends JPanel
        TablePanel()
          setLayout( new BorderLayout() );
          JTable table = new JTable();
          table.setDefaultEditor( Object.class, new MyEditor() );
          table.setModel(
            new DefaultTableModel(
              new Object[][]
                {null, null},
                {null, null},
                {null, null},
                {null, null}
              new String[] { "A", "B" } ) );
          add( table, BorderLayout.CENTER );
      class MyEditor extends AbstractCellEditor implements TableCellEditor
        private JComponent myEditorPanel;
        private JTextField myTextField;
        MyEditor()
          myEditorPanel = new MyEditorPanel();
          myTextField = new JTextField();
        public Object getCellEditorValue()
          return null;
        public Component getTableCellEditorComponent( JTable table, Object value,
                                                      boolean isSelected,
                                                      int row, int column )
          return myEditorPanel;   // Problems...
    //      return myTextField;   // Keyboard and focus as expected
      class MyEditorPanel extends JPanel
        JTextField tf;
        MyEditorPanel()
          setLayout( new BorderLayout() );
          tf = new JTextField();
          add( tf, BorderLayout.CENTER );
          add( new JButton( "edit" ), BorderLayout.EAST );

  • Calling action listener for a BUTTON component in java bean page

    Hi,
    I have made it like this.
    public void handleButtonPressed(ActionEvent event){
    System.out.println("success!!!!!");
    //code for calling actionlistener
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    Application application = fctx.getApplication();
    ExpressionFactory exprFactory = application.getExpressionFactory();
    MethodExpression methodExpr = null;
    methodExpr = exprFactory.createMethodExpression(elctx, "#{exbean.handleButtonPressed}",null,new Class[] { ActionEvent.class });
    MethodExpressionActionListener actionListener = null;
    actionListener = new MethodExpressionActionListener(methodExpr);
    button.addActionListener(actionListener);
    Even after making the listener Function as Void wHen i click the button i m getting the error saying."ARGUMENTS MISMATCH,ADF_FACES60097"??
    can you help me out?
    and in the msg log i m getting this
    "SkinFactoryImpl> <getSkin> Cannot find a skin that matches family portal and version v1.1. We will use the skin portal.desktop.
    <MethodExpressionActionListener> <processAction> Received 'javax.el.PropertyNotFoundException' when invoking action listener '#{exbean.handleButtonPressed}' for component 'null'
    <MethodExpressionActionListener> <processAction> javax.el.PropertyNotFoundException: Target Unreachable, identifier 'custombean' resolved to null"
    I Have tried with this giving Void TYPE as an argument
    methodExpr = exprFactory.createMethodExpression(elctx, "#{exbean.handleButtonPressed},Void.TYPE,new Class[] { ActionEvent.class });
    I M getting the same error.
    Edited by: chaya on Dec 22, 2011 2:47 PM

    yeah but i m creating button itself dynamically by java code....
    //code
    UIComponent button;
    button = findComponentInRoot("cb1");
    RichPanelGroupLayout pgl;
    pgl = (RichPanelGroupLayout)button.getParent();
    List<UIComponent> children;
    children = pgl.getChildren();
    RichPanelGroupLayout pgll;
    pgll = new RichPanelGroupLayout();
    RichInputText it;
    it = new RichInputText();
    it.setLabel("New textbox " + (children.size()));
    RichCommandButton but = new RichCommandButton();
    but.setPartialSubmit(true);
    but.setText("Delete");
    /*calling actionevent*/
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    Application application = fctx.getApplication();
    ExpressionFactory exprFactory = application.getExpressionFactory();
    MethodExpression methodExpr = null;
    methodExpr = exprFactory.createMethodExpression( elctx,"#{inbean.actionPerformed}",null, new Class[] {ActionEvent.class});
    MethodExpressionActionListener actionListener = null;
    actionListener = new MethodExpressionActionListener(methodExpr);
    but.addActionListener(actionListener);
    /*end of call*/
    children.add(pgll);
    children.add(it);
    children.add(but);
    AdfFacesContext.getCurrentInstance().addPartialTarget(pgl);
    //code to call method
    public void actionPerformed(ActionEvent event) {
    System.out.println("entered sec bean");
    return " ";}
    this way i m trying to create a button programatically and tryin to add actionlistener which is not working.
    the actionlistener is throwing error.... with the line
    methodExpr = exprFactory.createMethodExpression( elctx,"#{inbean.actionPerformed}",null, new Class[] {ActionEvent.class});

  • How do I get the GidBagLayout location from my buttons?

    How could I get the location of my JButtons (or JLabels) in my GridBoxLayout?
    I've tried all that I could think of..
    here some code sample
    JButton button;
        GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
            c.weightx = 0.5;
            c.weighty = 0.5;
            c.insets = new Insets(20,20,20,20);
            button = new JButton("Button 1");
            c.gridx = 0;
            c.gridy = 0;
              button.addActionListener(this);
            centerPanel.add(button, c);
            button = new JButton("Button 2");
            c.gridx = 1;
            c.gridy = 0;
              button.addActionListener(this);
            centerPanel.add(button, c);
              System.out.println(((JButton)e.getSource()).getText());
              System.out.println(layout.getLayoutOrigin());
              //System.out.println(((JButton)e.getSource()).);
              //System.out.println(((JButton)e.getSource()).location());
              System.out.println(e.getSource().toString());
              System.out.println(layout.getLayoutDimensions());
    //          System.out.println(layout.lookupConstraints(((JButton)e.getSource())));
              System.out.println(layout.getLayoutOrigin());I think that's all you experts would need..
    what I'm trying to do is when I click on one of them buttons then fetch where that buttons is (in the GridBagLayout, not absolute) and be able to add a new button to the side or under the clicked button..
    the System.out.println(layout.getLayoutOrigin()); does seem to give me x=0 and y=0 but that's the same with all buttons so it isn't good enough

    I think that's all you experts would need..You would think wrong. We need a SSCCE to see exactly
    what you are doing.
    see http://homepage1.nifty.com/algafield/sscce.html,
    In general component don't have a size or location
    until the GUI is visible. That is the layout manager
    isn't invoked until the component is displayed.
    If you want to add a component after the component
    you click on then you would probably need to use the
    add(...) method that takes a position variable as a
    parameter.yes I think I need to use the add(..) and a position variable
    the problem is that I need to get the position variable from the other component so I could put the new component at the right position
    as for the SSCCE I do think that I do that..
    but for some extra information
    I'm writing an applet.. and I use a borderlayout for some component.. in the center panel I've placed a GridBagLayout and some buttons.. I've given the buttons an ActionListener and now I want to get the location in the GridBag of the Button I've pressed
    so when I click one of them buttons I want to know it's location.. as in X=1, Y=2 or something
    so I could place the new button on X=1, Y=3

Maybe you are looking for