Dynamic Buttons in Action Sheet?

Once an action sheet is initialized and configured, I cannot seem to find a way to remove/disable buttons for that action sheet depending on the context. I see that you can add buttons and change titles but nothing to remove or disable buttons.
Is there a way to do this, or would I have to create an action sheet on the fly depending on context (right now I configure it and keep it around)?
Thanks for any help.

You might be able to loop through the objects of your ActionSheet in the willPresentActionSheet method, checking for instances of UIButton(s), and disable them that way. I've used a similar procedure for adding/altering labels on an AlertView.
Otherwise you'd probably have to create a new action sheet each time for your context.

Similar Messages

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • How to create dynamic elements in action of a view?

    hi all,
    I created 2 buttons dynamically in WdDoModifyView(). I created  action1, and parameter for that action i.e, id of type string.
    when i click on button1, some ui elements must be displayed.....
    can anyone tell me how to dynamically add UI elements in onAction() of view.....
    i wrote the following code to create & map dynamically in WdDoModifyView()........
    if(firstTime)
        IWDButton b1=(IWDButton)view.createElement(IWDButton.class,"button1");
        b1.setText("Button1");
        IWDButton b2=(IWDButton)view.createElement(IWDButton.class,"button2");
        b2.setText("Button2");
        IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("RootUIElementContainer");
        tc.addChild(b1);
        tc.addChild(b2);
         IWDButton butt1 = (IWDButton)view.getElement("button1");
         IWDParameterMapping pm1a = butt1.mappingOfOnAction();
         pm1a.addParameter("id1","link1a");
         IWDButton butt2 = (IWDButton)view.getElement("button2");
         IWDParameterMapping pm1b = butt2.mappingOfOnAction();
         pm1b.addParameter("id1","link1b");
    after writing this..... in onAction().........of view... i wrote like this...
    if (id1.equals("link1a"))
    else{
    in the if & else condition, i have to create UI elements dynamically.
    when i am trying to create Ui elements dynamically, but i am unable to create dynamically here.
    pls give me suggestion how to proceed this
    regards,
    vila

    Hi Vila,
    Are you trying to create UI elements dynamically in the action? If yes then you won't be able to do so because you can only create UI elements dynamically in WDDoModifyView().
    Always WDDoModifyView() would be called after your action. So, you can handle it as you want in your WDDoModifyView() itself.
    But if you want that those elements should be created everytime when you fire an event then don't write it within if(firstTime) clause as this would be true only when WDDoModifyView() is called for the first time when the page intially loads.
    Regards,
    Murtuza

  • Creation of satic and dynamic buttons in a view

    Hi,
    I have created a dynamic button using the code..
    DATA: lr_container TYPE REF TO cl_wd_uielement_container,
            lr_button TYPE REF TO cl_wd_button.
      CHECK first_time = abap_true.
      lr_container ?= view->get_element( id = 'ROOTUIELEMENTCONTAINER' ).
      cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
      lr_button = cl_wd_button=>new_button( id         = 'BUTTON'
                                            text       = 'My Button'
                                            on_action  = 'ACTION' ).
      cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_button ).
      lr_container->add_child( the_child = lr_button ).
    its working fine and iam able to see the button .....but when i create another button thorugh layout design its going for dump....whats the reason .?
    Cant we create static and dynamic buttons at a time?
    Thanks,.
    Shailaja Ainala.

    Hi Shailaja,
    Yes you can add static and dynamic ui elements together in the same view.
    The possible problem here could be the way in which the ui elements are added.
    You have created the dynamic button under the root container uielement.
    What about you static button ? Check your layout and layout data property.
    Thank You,
    Radhika.

  • APEX:How to put dynamic buttons in a Report.

    Hello all,
    I am creating one application in which i want two buttons in every record. I can't put it manually because it should change according to records in a table So Can anyone tell me how to put dynamic buttons in a report.
    Thanks & Regards,
    Jiten Pansara

    Hi Jiten,
    you cannot create buttons in the report, but you can always create link columns with some css class to show it as button.
    So in the both link column report attributes you will have class="button1" and class="button2"
    And in dynamic actions you need to bind the events based on your link column's jquery selector like:
    .button1
    .button2Thanks

  • Dynamic buttons and itemlisteners????

    I'm trying to do something that might not be possible. I would like to create some buttons and actions for those buttons on the fly. For example:
    1) read some files from a directory (these file store settings)
    2) Create buttons using the filenames as the button labels
    3) Create associated actionPerformed section related to those buttons
    I want to do this because the amount of files and there names could change all the time. Basically I want to create a button for each file, and essentially launch an application using the settings file as part of a process.
    So far I've read a filename into a string. The first problem, how do I use that filename as the name of a button?
    JButton "string value" = new JButton();
    Then, subsequently, how to you set up the action? See code snipet below.
    Hope that made some sense. Can anything like this be done?
    Thanks,
    James
    //this loads the buttons
    for (int i=0; i < main.size(); i++)
         Vector temp = new Vector();
         temp = (Vector)main.elementAt(i);
         JButton buttonName = new JButton((String)temp.elementAt(0));
         buttonName.addActionListener(this);
         northFlow.add(buttonName);
    //this is in the actionPerformed section
    for (int i=0; i < main.size(); i++)
         Vector temp = new Vector();
         temp = (Vector)main.elementAt(i);
         if (source == (String)temp.elementAt(0))
                loadProgram((String)temp.elementAt(0));

    There is a way to give a button a variable name equal to the file name but it involves extremely advanced Java programming involving creating dynamic class instances. I would strongly discourage this approach because debugging it when it doesn't work, can be a nightmare.
    There is a much easier way to do this however. Create an array of JButtons. Call it, oh say, "MyButtons". Then at the appropriate places, you can do:
    JButton[] MyButtons;
    MyButtons = new JButton[ main.size ];
    for ( int i = 0; i < main.size(); i++ ) {
       Vector temp = new Vector();
       temp = (Vector)main.elementAt(i);
       MyButtons[i] = new JButton( (String)temp.elementAt(0) );
       MyButtons.addAction...
    Incidently, you may also want to re-think your data structure. From what I understand, you have an array where each element is a vector (another array of zero or more elements). This results in code that is difficult to read and write. Consider making your own objects instead of using vectors, then you could write something like...
    for ( int i = 0; i < main.size(); i++ ) {
       if ( source == main.getProgramName() ) {
    loadProgram( main[i].getProgramName() );
    The nice thing about this approach is that you can mix and match objects within the array, or add elements to each object in any particular order and it won't break the rest of your code.
    P.S., use the square brackets to indicate arrays. For some reason, this board is converting them into angle brackets.

  • Problems adding  url link to buttons in action Script 3

    each time I added it link 1 to the button on file i get these error messages-  
    1046: Type was not found or was not a compile-time constant: link1.
    1180: Call to a possibly undefined method link1.
    Warning: 3594: exec is not a recognized method of the dynamic class RegExp. var r:Object = p.exec(s);  
    This is the code I am using:   import flash.net.navigateToURL; import flash.net.URLRequest;  var link_one:link1;  link_one = new link1(); stage.addChild(link_one);  link_one.addEventListener(MouseEvent.CLICK, buttonClickHandler);  function buttonClickHandler(event:MouseEvent):void { var url:String = "http://www.masterpiececorp.com/ARMREF.htm"; var request:URLRequest = new URLRequest(url); navigateToURL(request); }    I have no other problems with link 3 or 4, just link 1  I still cannot get my urls link to movie clips on the flash  
    Can you upload flash here? if not I have a image capture I can use to have you look at my buttons  and action script code. i have been to every forum I know and not any have been helpful at all. This is my last hope.
    Very frustrated newbie  Gina T
    Message was edited by: gtaylor0406

    The way you had your code originally would be correct...
    var link_one:link1;
    link_one = new link1();
    addChild(link_one);
    The 1046 error is indicating it doesn't recognize the link1 class.  So the first thing you need to make sure of is that you have assigned the link1 class designation to whatever symbol that is in the library.

  • How to use a back button in action pages?

    Hi all,
    I have created a user login page,home page and user profile page.
    If the user provide correct username and password in the login page he will be taken to home page.
    In the home page he will be having his username and a link to view his profile.
    When the user click on the link "My Profile(user profile)" he wil be taken to that page.
    In my profile page the user can edit only his firstname,lastname and password .
    On the user profile page i have placed a Back Button(using javascript: on onclick event i have used history.back()) to go back to home page after editing his profile.
    If the user edit his profile for n-number of times then atlast if he wants to go back to home page-then he wil cilck the back button.
    Now the problem occurs like the back button not going to home page and it simply going back with the edited history.
    How to use a back button in action pages; without repeating the actions done on the page; how to redirect to the users home page?
    I simply used the hyperlink in userprofile page to go to home page but when i click onit it is displaying blank home page.
    I'm using hibernate orm mapping; cflogin and cflogout tags.
    Any help appreciated,
    Chandru P

    chandrup wrote:
    Hi Dan,
    Dan Bracuk wrote:
    Use an anchor tag.
    I simply used the hyperlink(<a href="home.cfm">Home</a>) in userprofile page to go to home page but when i click onit it is displaying blank home page.
    I can see your problem. You may use javascript:history.go(-1), javascript:history.go(-2), ..., to go back one page, two pages, and so on. But how does one go back an arbitrary n pages? The link href="home.cfm" isn't a good solution for the browser. It makes a new call to the server which, as you may have discovered, can overwrite all the changes made at the browser. 
    You should use the Javascript variable history.length. If you open n links in succession, starting from page0.cfm, then the browser holds the value of history.length as n. So, experiment with something like
    <a href="javascript:history.go(-history.length)">Go home</a>
    or
    <a href="javascript:history.go(-history.length+1)">Go home</a>

  • Make the Dynamic button to be invisible in srm

    Hi Guys,
    Am working in the current requirement where i need to delete the dynamic buttons in the shopping cart screen in SRM 7,i have mentioned the button names below ...Please help me out.
    Buttons;
    1)System info
    2)Export
    3)Memory snapshot
    Thanks,
    Vignesh.

    Hi Vignesh ,
    go to tcode 80 in webdynpro /component : FPM_OIF_COMPONENT expand thei webdynpro component go to component  configuration folder -->go this configuration  : /SAPSRM/WDCC_FPM_OIF_PO_PURCH
    click on the start configurator
    on screen will open in browser
    in this screen
    click on  other function button
    click on this and create the enhancement , after creating enhancement then click on change  button
    in the screen you can find the export button click onit
    here you cab set the visibility as  invisible .
    Thanks & Regards
    Pradeep Kumar Dondeti

  • 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>

  • Create Dynamic button

    can anyone guide me to create dynamic button? Thank you,

    Hi Pankaj,
    This is what you need:
      public static void wdDoModifyView(IPrivateStamappView wdThis, IPrivateStamappView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
        if (firstTime){
             IWDButton button = (IWDButton) view.createElement(IWDButton.class,"myButtomid");
                 IWDTransparentContainer myCont = (IWDTransparentContainer) view.getRootElement();      
             myCont.createLayout(IWDMatrixLayout.class);
             myCont.addChild(button,0);
        //@@end
    Regards
    Nir

  • Dynamic Button Creation in list toolbar

    Hi all,
    I have a requirement to add dynamic button in list guibb.
    I have a ovp floorplan in which I used tabbed uibb. In tabbed uibb I used list uibb.
    Now I want dynamic button in list toolbar.
    Please give some suggestion which help me in achieving this.
    Thanks & Regards,
    Jitendra Sahu

    Hi Julia,
    Thanks alot for the reply.Currently the toolbar is configured in the configuration and i'm generating the buttons from the method. Is there any way possible in case i want to over write the toolbar from the configuration and create a static toolbar with necessary grouping? Please let me know in case there is any work around i can try.
    Thanks again.
    Regards,
    Ravi.

  • Button without action listener

    I wanto to know if somebody will create
    a button without action listener???.
    JC

    but.. Buttons are created without ActionLiteners, you have to add them yourself...
    and.. without ActionListener, whats going to happen when you click the Button?
    you could use awt.Button.processEvent() in a subclass of Button, but then you would have to give that subclass some sort of access to the program class or its methods anyway

  • Help creating buttons with actions

    I am looking for a way to program buttons with actions and conditional outputs. As an example: After populating a set number of cells, I would like to be able to program a button to copy the contents of those cellsto another set of cells. Also, a button programmed to clear the contents of the cellswould be nice.
    anyone?

    Buttons are typically associated to macros (VBA or other). As Numbers 1.0 does not support any macros, I am afraid that you are out of look.
    To copy values is very simple with formulas of course (=a1 and so on), but you probably know that, and need something more powerful.

  • Why can't a button have 'actions applied to it' in Flash CS3?

    Why can't a button have 'actions applied to it' in Flash CS3?
    I'm used to working with buttons in Flash MX and Flash 8 but
    after creating a button in Flash CS3, I'm getting text that reads
    'Current Selection Cannot Have Actions Applied To It' and so the
    actions menus are greyed out.
    What's the problem?

    There is nothing stopping you from producing files in the old
    ways. Go to the publish settings and select to publish as AS2. You
    can then use the techniques you are familiar with.
    However as dzedward points out, Actionscript has come a long
    way. The technique of putting the code directly on instances really
    went out with Flash MX in 2001 and for a long time now that wasn't
    the best way to do it. See this article by the very excellent David
    Stiller about it:
    http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent
    So even if you aren't ready to take the plunge into AS3, I
    would recommend learning this style for all your AS2/1
    needs.

Maybe you are looking for

  • Checkbox item: How to get all values checked?

    See http://htmldb.oracle.com/pls/otn/f?p=24317:46 The report query is simply select 'One' one, 'Two' two, 'Three' three, 'Four' four from dualThe checkbox item is a named static LOV with STATIC2:ONE,TWO,THREE,FOUR and a Source value of ONE:TWO:THREE:

  • G/L Account against Vendor

    Hi, I have a FICO report and want some fields related to it.. Field are: Profit Center, G/L Account, Purchasing document Number ...........against Vendor Number I found in BSEG, but due to cluster table, join not possible... Plz tell me other table f

  • Expdp full=y shows 'fatal error '

    Hi all,        any body, please help, I tried to take a full database export using expdp, with the schema name 'x' and password 'x', it is showing error  as follows, [oracle@oracleoel5 ~]$ expdp x/x directory=dpumpdir dumpfile=ramu.dmp full=y  parall

  • T520 500GB 7200RPM Hard Drive Noisy?

    My employer gave me a T520 and the keyboard is the best I have ever used. I also own a Thinkpad Edge and like the Accutype keyboard, but I think T520 keyboard is far better. I noticed that the T520 in the configuration I want is under $1000 now and a

  • Billing during Intracompany stock transfer

    Hi, I tried  to create proforman invoice in intracompany stock transfer but while transction following error has came "Item is not releveant for billing" We have already mantained billing relevance in Itenm category NLN. Still error is thr.. awaiting