Custom button UI Problem

Hi all,
I have written CustomButtonUI for JButton.
But, it results into error.please suggest me.
Here is the code:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.metal.MetalButtonUI;
* CustomButtonUI.java
* Created on March 4, 2010, 5:13 PM
* @author  mourya
public class CustomButtonUI extends javax.swing.JDialog {
    /** Creates new form CustomButtonUI */
    public CustomButtonUI(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        String DEFAULTCLASSID="Mybutton";
        UIManager.put(DEFAULTCLASSID, "Mybutton");
        UIManager.put("ButtonUI",DEFAULTCLASSID);
        initComponents();
        JButton jbutton = new JButton("Custom");
        jbutton.setBounds(10,10,100,20);
        add(jbutton);
        this.addWindowListener(new WindowAdapter()
            public void windowClosing(WindowEvent event)
                System.exit(0);
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents() {
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 400, Short.MAX_VALUE)
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 300, Short.MAX_VALUE)
        pack();
    }// </editor-fold>                       
     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CustomButtonUI(new javax.swing.JFrame(), true).setVisible(true);
    // Variables declaration - do not modify                    
    // End of variables declaration                  
class Mybutton extends MetalButtonUI
     private final static Mybutton
      mMybutton = new Mybutton();
    public static ComponentUI createUI(JComponent c)
      return mMybutton;
    protected void clearTextShiftOffset()
        super.clearTextShiftOffset();
    protected void finalize() throws Throwable
        super.finalize();
    protected BasicButtonListener createButtonListener(AbstractButton b)
        return super.createButtonListener(b);
    protected Color getDisabledTextColor()
        return super.getDisabledTextColor();
    protected Color getFocusColor()
        return super.getFocusColor();
    protected String getPropertyPrefix()
        return super.getPropertyPrefix();
    protected Color getSelectColor()
        return super.getSelectColor();
    protected int getTextShiftOffset() {
        return super.getTextShiftOffset();
    protected void installKeyboardActions(AbstractButton b)
        super.installKeyboardActions(b);
    protected void installListeners(AbstractButton b) {
        super.installListeners(b);
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    protected void paintButtonPressed(Graphics g, AbstractButton b)
        super.paintButtonPressed(g,b);
    protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
        super.paintFocus(g,b,viewRect,textRect,iconRect);
    protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) {
        super.paintIcon(g,c,iconRect);
    protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
        g.setColor(Color.GRAY);
        super.paintText(g,b,textRect,text);
    protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
        g.setColor(Color.GRAY);
        super.paintText(g,c,textRect,text);
    protected void setTextShiftOffset() {
        super.setTextShiftOffset();
    protected void uninstallKeyboardActions(AbstractButton b) {
        super.uninstallKeyboardActions(b);
    protected void uninstallListeners(AbstractButton b) {
        super.uninstallListeners(b);
    public boolean contains(JComponent c, int x, int y)
        return super.contains(c,x,y);
    public boolean equals(Object obj)
        return super.equals(obj);
    public Accessible getAccessibleChild(JComponent c, int i) {
        return super.getAccessibleChild(c,i);
    public int getAccessibleChildrenCount(JComponent c) {
        return super.getAccessibleChildrenCount(c);
    public int getDefaultTextIconGap(AbstractButton b) {
        return super.getDefaultTextIconGap(b);
    public Dimension getMaximumSize(JComponent c) {
        return super.getMaximumSize(c);
    public Dimension getMinimumSize(JComponent c) {
        return super.getMinimumSize(c);
    public Dimension getPreferredSize(JComponent c) {
        return super.getPreferredSize(c);
    public void installDefaults(AbstractButton b) {
        super.installDefaults(b);
    public void installUI(JComponent c) {
        super.installUI(c);
    public int hashCode() {
        return super.hashCode();
    public void paint(Graphics g, JComponent c) {
        super.paint(g,c);
    public String toString() {
        return super.toString();
    public void uninstallDefaults(AbstractButton b)
        super.uninstallDefaults(b);
    public void uninstallUI(JComponent c)
        super.uninstallUI(c);
    public void update(Graphics g, JComponent c)
        super.update(g,c);
}Thank You

Hi DarrylBurke,
Sure i will.
But i have posted that code after trying all the possibilities.
I thought that getUI() failed exception may have the resulkt for not implementing any method or any registration problem with UIManager.
So, that is my test code not exactly i have posted that in hurry.
Here is the code :
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.accessibility.Accessible;
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.metal.MetalButtonUI;
* CustomButtonUI.java
* Created on March 4, 2010, 5:13 PM
* @author  mourya
public class CustomButtonUI extends javax.swing.JDialog {
    /** Creates new form CustomButtonUI */
    public CustomButtonUI(java.awt.Frame parent, boolean modal) {
       super(parent, modal);
        String DEFAULTCLASSID="Mybutton";
        UIManager.put(DEFAULTCLASSID, "Mybutton");
        UIManager.put("ButtonUI",DEFAULTCLASSID);
        initComponents();
        JButton jbutton = new JButton("Custom");
        jbutton.setBounds(10,10,100,20);
        add(jbutton);
        this.addWindowListener(new WindowAdapter()
            public void windowClosing(WindowEvent event)
                System.exit(0);
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents() {
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 400, Short.MAX_VALUE)
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 300, Short.MAX_VALUE)
        pack();
    }// </editor-fold>                       
     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CustomButtonUI(new javax.swing.JFrame(), true).setVisible(true);
    // Variables declaration - do not modify                    
    // End of variables declaration                  
class Mybutton extends MetalButtonUI
     private final static Mybutton
      mMybutton = new Mybutton();
    public static ComponentUI createUI(JComponent c)
      return mMybutton;
    protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
        g.setColor(Color.RED);
        super.paintText(g,b,textRect,text);
}Can you please suggest me the possible solution for this problem.
Thank You DarrylBurke

Similar Messages

  • Custom RH9 WebHelp skin: Problem opening PDF file from custom button

    Hi, I've been troubleshooting and checking forums trying to figure out how to get a PDF file to open from a custom button on my WebHelp skin. It worked for me once upon a time, but I changed something in the document and tried to upload the new version and it has errored out ever since.
    I want to have the ability to open the PDF in a new window from the custom button (called 'Printable PDF' on my skin), so I am using the following custom JavaScript in the 'Click On' field of the the custom button's components: window.open('print_test.pdf','printWindow','menubar=0,resizable=0,width=900,height=500,scr ollbars=1');  I know the script is good because I have the same script for the Support custom button and it works great. The only difference between those scripts is the Support script calls an .html file instead of a PDF and the window names says 'supportWindow' instead of 'printWindow'.
    I've tried deleting and recreating the custom button, changing the JavaScript with a developer's help, generating the help on another machine thinking it was a glitch with my browser (using IE8) or RoboHelp license, and combing the help files numerous times. I've also ensured that the PDF file is stored in the skin and project folders along with the other project files/folders. I've used previous versions of RoboHelp and had no problems attaching a Word document and PDF, so I'm wondering if this is a bug in RH9?? Especially since it worked for me initially. Any assistance and/or fresh ideas are welcomed! Thank you!

    Hello again
    Happy I was able to help.
    MOTW is only present and affects things when you are running content off your local C drive. It's value is in preventing that Yellow Information Bar and all that from appearing when you are using IE. Once you publish content to a server and access it that way you are in a different security zone and MOTW has no influence either way. So there would be no adantage to enabling it before publishing to a server. The only reason you might want to consider enabling it would be if you were copying the WebHelp to everyone's hard drive and having them run it from their hard drives.
    Make sense?
    Hope so... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Problems with custom buttons

    I have problems with custom buttons in Captivate 5. The button is not switching from the _up stage to _over stage, but when I click on it the _down stage works fine. It is not a problem with the naming of the buttons. They are all with the same name and in lower case. I have tried with various custom buttons and the problem is the same. There is no problems with the standard buttons from the Adobe Gallery, so it is a bit strange, also strange that it is only the _over stage that causes problems.
    The buttons I have made in Adobe Illustrator. Have tried both exporting in png and bmp format. It is the same problem.
    Hope someone has some idea as to what can be wrong.

    Hi Manish,
    I have uploaded the zip file with the button files to Acrobat and mailed you the link.
    Look forward to hear if you find a reason or more importantly a solution :-)
    Kind regards
    Rene

  • Add a custom button on notification page and open a oaf page after button

    Hi All,
    My Requirement is add a custom button on notification page and after button click with take some parameter from notification page like supplier_id and org_id then open a new oaf page and show supplier credit and debit balance but problem is that button is only enable to a ap invoices notification not for other type of notification.
    how to take approach/action i don't know.
    it is possible through OAF personalization/customization or it is part of work flow customization.
    Navigation path - payable->worklist->open notification and Type of notification also there
    Type should be matched with AP_Invoices type notification then custom button enable.
    Please Let me know is it possible or not. If possible how to achieve this. ...................................it's argent...plz help me
    Edited by: 815572 on Nov 25, 2010 1:15 AM

    Hi Irk,
    My notification came in given below format (in table) but my custom button only enable for Contract Approval Type not for others..........i hv attach a button on notification page (subject-Contract 21969-R17......)
    From Type Subject Sent
    Taylor, Phillip Contract Approval Contract 21969 - R17-AUG-07 06:19:27 has been approved by Taylor, Phillip 22-Aug-2007
    Taylor, Phillip OKS Contract Process Contract 21975 - R17-AUG-07 06:22:18 for AT&T Universal Card (52,500.00 USD) has been published online 19-Aug-2007
    Taylor, Phillip OKS Contract Process Contract 21969 - R17-AUG-07 06:19:27 for AT&T Universal Card (15,000.00 USD) has been published online 19-Aug-2007
    If I just put a button SHOW BALANCE just like notification button APPROVE, REJECT, REASSIGN but this button shows all types of notification and my req. is this button show only for Contract Approval type notification. how to handled this issuesss ?
    if extend the co of notification page then how to handle TYPE value from worklist page ....please write proper code if u hv any idea...........
    Thanks,

  • Opening a popup from custom button in a Form

    I have a requirement to open a popup from a custom button of a portal form and once the value is selected from the popup the control should return to the main form with the value selected and set it to some display only field in that same form. It can be done thru' popup of a field directly but how can I do this thru'a button ?.
    Help would be appreciated.
    Thanks
    -Krishnamurthy

    Works for me if I middle-click a bookmark on the Bookmarks Toolbar and browser.tabs.loadBookmarksInBackground is set to true.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How do you make a custom button that is Invisible When not selected

    Im just recently switching over to using a mac for authoring. I really like all the features in DVD Studio more than what i was using on a PC for the past 6 years. Which was ulead DVD Workshop 2.
    The only problem im having (For Now) is that i cant make my custom buttons invisible. I made this little black shape thing in photoshop and i want to use it in DVDSP for selecting different tracks.
    I thought all i had to do was just save the black shape with a transparent background in photoshop as a .psd and import it. But that didnt work.
    When i change episodes it just stays black the whole time. I want something that will be invisible when it is not selected.
    please help
    I can send someone my little shape if they can make it a usable button that i can make invisible in dvdsp. I really need to see the layers done with a shape as a button to see how they were able to make it invisible.
    i tried a few tutorials but instead of being invisible all i got was a shape that was stuck white the whole time. this is even when i put the opacity to 0 on normal.
    I want to make this into a button
    http://img694.imageshack.us/i/custonbutton.png/

    Ok, what you want to do is also in the same tutorial. See the section on "Advanced Highlights" (again, avoid the sections on layered menus), You can create an overlay that does have two colors. The bad news is that there will be absolutely no anti-aliasing at all. This means your graphic will be extremely pixelated. This is just the way the DVD specs are set up, so there is no way around it.
    Given that I would highly recommend redesigning your overlay. Take a look at variety of DVDs from Hollywood. See what they are doing in their menus. You can do anything they are doing, but you will notice that the overlay is very simple because of the limited anti-aliasing of DVDs. In all the years that I've been watching DVDs I've only see one DVD use two colors in the overlay, and that was the Jim Carey "The Grinch who Stole Christmas."

  • Customized Button code not working on selection screen.

    Hello Experts,
    I have a button on the selection screen next to Execute button on the Application Tool Bar.
    I have written some validations on the button.It was defined on the PF-Status and its funtion text i have given as 'Show'.
    But the problem is that the code is not working.When I execute the button,the screen just remains their.
    The sy-comm always returns the value of 'UCOM' for whatever even takes place on the screen.The execution of the program does not stops their in debugger.
    Can anyone help me with some sample code and also provide the value of sy-ucomm which i should use for the customized button.
    Good points will be rewarded.

    Here is the short program which will show how to do it. You are simply checking for the USER-COMMAND value CHK and changing it to ONLI which is the F8 button, then the START-OF-SELECTION will be fired and you can output the list.
    REPORT zyou_0001.
    TABLES:  sscrfields.
    SELECTION-SCREEN PUSHBUTTON 2(10)  pbut1 USER-COMMAND chk.
    AT SELECTION-SCREEN OUTPUT.
      pbut1 = 'Test This'.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'CHK'.
        sscrfields-ucomm = 'ONLI'.
      ENDIF.
    START-OF-SELECTION.
      DO 10 TIMES.
        WRITE:/ sy-index.
      ENDDO.
    Regards,.
    Mohammed

  • WCEM:clicking on custom button(Excel Downlaod) giving message "An error occurred; please try again. If the error persists, please contact technical support."

    Hi Expert,
    I need help.
    I created a custom button to download data to an excel sheet. after clicking the button I am getting message
    "An error occurred; please try again. If the error persists, please contact technical support.".
    I tried debugging WCEM, but it is not even reaching that point.
    Your help will be highly appreciated.
    here is the code.
    BitContentview.XHTML
    <wec:commandButton  id="bdtexcel" immediate="true" actionListener="#{cc.vch.DownloadBITData}" type="submit" value="#{i18n['invoices.ui.openitems.printSelected']}"/>
    UI-repository.xml
      <ViewComponent name="BITContentView"  componentHandlerClassName="com.cpr.cprwec.app.comm.module.ebpp.ui.handler.impl.BITDetailViewVCHandler"/>
    BITDetailViewVCHnadler.java
    package com.cpr.cprwec.app.comm.module.ebpp.ui.handler.impl;
    import com.cpr.cprwec.app.comm.module.ebpp.backendobject.interf.EbppBackend;
    import java.io.IOException;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.List;
    import javax.faces.context.FacesContext;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletResponse;
    import com.cpr.cprwec.app.comm.module.ebpp.modulemgmt.impl.EbppModuleAccessImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.modulemgmt.interf.EbppModuleAccess;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.DisputeDataDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.OpenItemDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.DisputeDataDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.OpenItemDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.BITDataDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.BITDataDTO;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.impl.BITDetailDTOImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.ui.dto.interf.BITDetailDTO;
    import com.sap.wec.app.common.module.common.attachment.businessobject.interf.Attachment;
    import com.sap.wec.tc.core.backend.sp.jco.JCoConnection;
    import com.sap.wec.tc.core.businessobject.BusinessObjectException;
    import com.sap.wec.tc.core.common.exceptions.ApplicationBaseRuntimeException;
    import com.sap.wec.tc.core.common.logging.WCFLocation;
    import com.sap.wec.tc.core.common.searching.businessobject.impl.GenericSearch;
    import com.sap.wec.tc.core.common.searching.businessobject.interf.GenericSearchReturnResultData;
    import com.sap.wec.tc.core.common.util.GenericFactory;
    import com.sap.wec.tc.core.common.util.Message;
    import com.sap.wec.tc.core.common.util.MessageList;
    import com.sap.wec.tc.core.common.util.table.Table;
    import com.sap.wec.tc.core.common.util.table.TableRow;
    import com.sap.wec.tc.core.modulemgmt.ForeignModuleAccess;
    import com.sap.wec.tc.core.modulemgmt.ModuleAccess;
    import com.sap.wec.tc.core.modulemgmt.exceptions.ModuleInactiveException;
    import com.sap.wec.tc.core.modulemgmt.exceptions.ModuleLifecycleException;
    import com.sap.wec.tc.core.runtime.WecFrameworkRuntime;
    import com.sap.wec.tc.core.runtime.WecSession;
    import com.sap.wec.tc.core.runtime.jsf.WecFrameworkRuntimeJSF;
    import com.sap.wec.tc.core.runtime.jsf.composition.PageManagerBean;
    import com.sap.wec.tc.core.runtime.navigation.NavigationCondition;
    import com.sap.wec.tc.core.ui.composition.menu.MenuManager;
    import com.sap.wec.tc.core.ui.composition.menu.MenuMetadataException;
    import com.sap.wec.tc.core.ui.vc.BuildTime;
    import com.sap.wec.tc.core.ui.vc.NavigationParameterBinding;
    import com.sap.wec.tc.core.ui.vc.RequestParameterBinding;
    import com.sap.wec.tc.core.ui.vc.impl.ViewComponentHandlerBaseImpl;
    import com.cpr.cprwec.app.comm.module.ebpp.businessobject.interf.BIT;
    import com.cpr.cprwec.app.comm.module.ebpp.businessobject.impl.BITImpl;
    public class BITDetailViewVCHandler extends
            ViewComponentHandlerBaseImpl<EbppModuleAccess> {
        protected static final WCFLocation LOCATION = WCFLocation
                .getInstance(BITDetailViewVCHandler.class.getName());
        public BITDataDTO bitDataDTO;
        public BITDetailDTO bitDetailDTO;
        public List<BITDataDTO> BITDataDTOList;
        public List<BITDetailDTO> BITDetailDTOList;
        public boolean noBITData;
        public boolean noBITDetail;
        public boolean renderPanel = true;
        public boolean isDownloadBITData;
        public boolean isDownloadBITDetail;
        public boolean downloadStarted=false;
        public boolean BITFound =false;
        public boolean isBITFound() {
            return BITFound;
        public void setDownloadStarted( boolean downloadStarted ){
            this.downloadStarted = downloadStarted;
        public boolean getDownloadStarted(){
            return this.downloadStarted;
        public void setBITFound(boolean BITFound) {
            this.BITFound = BITFound;
        public String getObjectID() {
            return objectID;
        public void setObjectID(String objectID) {
            this.objectID = objectID;
        public List<BITDataDTO> getBITDataDTOList() {
            return BITDataDTOList;
        public List<BITDetailDTO> getBITDetailDTOList() {
            return BITDetailDTOList;
        public Boolean getNoBITData() {
            return noBITData;
        public Boolean getNoBITDetail() {
            return noBITDetail;
        public Boolean getRenderPanel() {
            return renderPanel;
        private static final int DEFAULT_BUFFER_SIZE = 1024000;
        public Attachment attachmentData;
        public Attachment getAttachmentData() {
            return attachmentData;
        @RequestParameterBinding(maxLength = 1024)
        protected String objectID;
        @BuildTime
        public String processBuildTime() throws BusinessObjectException {
            BIT BIT = null;
            noBITData = noBITDetail = false;
            renderPanel = true;
            if (isLoggedIn()) {
                if ( isDownloadBITData == true ){
                    this.downloadBITDataExcel();
                else {
                this.getModuleAccess().getBITBO().clearMessages();
                BIT = this.moduleAccess.getBITBO().getBITFromBackend(objectID);
                BITDataDTOList = BIT.getBITDataDTOList();
                BITDetailDTOList = BIT.getBITDetailDTOList();
                MessageList objectData = this.getModuleAccess().getBITBO()
                        .getMessageList();
                if (objectData.size() > 0) {
                    noBITData = noBITDetail = true;
                    renderPanel = false;
                    this.addMessageList(objectData);
            return checkLoginCondition();
        private boolean isLoggedIn() {
            return checkLoginCondition() == null;
        private String checkLoginCondition() {
            NavigationCondition navCondition = getNavigationCondition("login");
            if (!navCondition.isFullfiled()) {
                navCondition.addToNavigationStack();
                return navCondition.getOutcome();
            return null;
        public String downloadBITData(){
            downloadStarted = true;
            isDownloadBITData = true;
            downloadBITDataExcel();
            return checkLoginCondition();
        public void downloadBITDataExcel() {
        //    dummyDebug("downloadBITDataExcel", BITDataDTOList.size(), "", "" );
            if (BITDataDTOList.size() > 0) {
                try {
                    attachmentData = this.getModuleAccess().getDownloadBO()
                            .getBITDataExcel(BITDataDTOList);
                    if (attachmentData != null) {
                        FacesContext faces = FacesContext.getCurrentInstance();
                        HttpServletResponse response = (HttpServletResponse) faces
                                .getExternalContext().getResponse();
                        response.reset();
                        response.setContentType(attachmentData
                                .getAttachmentMimeType());
                        response.setContentLength(attachmentData
                                .getAttachmentContent().length);
                        response.setHeader("Content-disposition",
                                "attachment;filename="
                                        + attachmentData.getAttachmentName());
                        response.setBufferSize(DEFAULT_BUFFER_SIZE);
                        ServletOutputStream out;
                        try {
                            out = response.getOutputStream();
                            out.write(attachmentData.getAttachmentContent());
                            out.flush();
                            faces.responseComplete();
                        } catch (IOException e) {
                            throw new ApplicationBaseRuntimeException(
                                    "Problem opening file", e);
                        } finally {
                            attachmentData = null;
                } catch (BusinessObjectException e) {
                    e.printStackTrace();
            isDownloadBITData = false;

    Thanks Hamendra for checking the issue.
    I am setting up breakpoints in WCEM, tab JAVA EE then from menu RUN->Toggle brekpoints and then debug configuration.
    the breakpoints are in several places in  handler class BITDetailviewVCHandler class including method  downloadBITData.
    this method I am calling from BitContentview.XHTML
    <wec:commandButton  id="bdtexcel" immediate="true" actionListener="#{cc.vch.DownloadBITData}" type="submit" value="#{i18n['invoices.ui.openitems.printSelected']}"/>
    When the BIT page is loading the control stops at the breakpoint.
    but it is not stopping there  when i click the 'Excel Download' button.
    How do I get the log file. I am very new to WCEM, please guide me.
    I tried to debug the UI using Google chrome. it is giving me the following error.
    POST https://<>/<>/<>/<>HomePage.jsf?wec-appid=<>MAINAPP6&wec-locale=en_US 500 (Internal Server Error)
    when I expand the node
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:54
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:54
    c.event.trigger:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:66
    (anonymous function):<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:30
    c.extend.each:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:24 c.fn.c.each:<>/<>/javax.faces.resource/sap/comp.theme/templates/jquery/lib/jquery-1.4.2.min.js.jsf:66 c.fn.extend.trigger:<>/<>/javax.faces.resource/<>dev/comp.theme/templates/jquery/js/commandButton.js.jsf:31
    com.sap.wec.commandButton.submitForm:<>/<>/main/<>HomePage.jsf?wec-appid=<>MAINAPP6&objectID=500000233&page=D61CFFF8E75D48A1B348F315D209EFF9&wec-locale=en_US:48 onclick
    Navigated to https://wsapdjd803.<>.ca:<>/<>/main/<>HomePage.jsf?wec-appid=<>MAINAPP6&wec-locale=en_US
    Seems to be it is failing somewhere commandButton-related JavaScript functions
    Thanks
    Subassish

  • Htp.p( )/htp.script( ) in plsql for custom button

    Hi All,
    I am trying to display an ALERT after doing some validations in the PL/SQL Code of a "Custom Button" on a FORM:
    htp.p('<script language="JavaScript">
    alert("No values found");
    </script>');
    But, looks like the whole statement is being ignored.
    On the other hand i can execute the same code in the Additional PL/SQL Code section for "After displaying the Form".
    Appreciate if anybody could help.
    Thanks,
    Gopi.

    I noticed when you enter Java Script code for some field events in Portal the custom code does not show up in the generated web page. This is probably the same kind of problem.

  • Is this a bug or am I doing something wrong? (Custom Buttons)

    I have a project where I've created a custom buttonbase which has a custom skin.
    Create a button that uses the custom skin which extends the custom button base the first time the button is used it doesn't work the way I would expect.
    Here's what happens. The first time the app is loaded the button's up state shows up just fine. If I mouse over the button it flashes black for a second while it loads the mouse over state. If I mouse out and over again it works normally. Now if I click on the button it flashes black again while it loads the selected state and then the selected over state. After the first time the button functions correctly. But naturally I don't want the button to flash black the first time it's used. I want it to show my custom skin the first time not the second and subsequent times.
    I've included a project that demonstrates the problem. I have added some for loops in the part of the code that determines the custom colors for the button, just so that the black flash is really obvious.
    If you look at it there are three classes. The ButtonSkinBase which defines the base look for all skinned buttons. The ButtonSkin which is a specific skin to use. And the ButtonGraphic which is just a custom definition for a button.
    I think the problem is in the SDK in that it isn't loading the ButtonGraphics in the ButtonSkinBase class before they are used. It loads them when they are used. However, I'm not that experienced with the way the SDK functions under the covers so it could be that I'm not doing something I need to do.
    Any help with this would be great.
    Thanks,
    cdman

    >When you use the includeIn command, by default the object will only be created when it is needed. Hence, you will execute a creationComplete
    >event, and therefore atleast 100 million (sometimes 400 million) loops, when each required Button state is needed. Obviously, once each button
    >state has been created the creationComplete handler (invalidateDisplayList) will not usually be called again.
    So are you saying there is a better way or another way to do that? Or are you just telling me that's how it works? Because I know that the includeIn isn't creating the other buttons untill they are needed. I need them created when the button is created. That is my question, how do I get the other states to be created when the button is created so that I don't see the button flash black?
    >As written, bioStyleChanged will always remain true
    >if(!bioStyleChanged) {
    >       bioStyleChanged = false;
    >}    
    >this code does nothing for you.
    Sorry, I missed that when cleaning up the code to ask for help.
    Thanks,
    cdman52

  • Error when Calling a BAPI in ALV custom button "could not ascertain code"

    Hi,
    I am getting the error "Could not ascertain code page" when i try to call my BAPI (to export to excel sheet) on click of a custom button in ALV.
    I have done the creation and event handling etc for the custom button.
    Kindly help if anybody knows this error.
    Thanks
    Roshan

    I am creating a custom export button(after disabling the standard export button) to download the data into an excel sheet in my own format. I have created the new button. The code is given here.
    data lr_buttonui2 type ref to cl_salv_wd_fe_button.
    data input2 type ref to cl_salv_wd_function.
    data: lr_column_settings type ref to   if_salv_wd_column_settings,
    lr_input_field type ref to cl_salv_wd_uie_input_field.
    create object lr_buttonui2.
    call method lr_buttonui2->set_text
      exporting
        value  = 'Export'
      input2 = lo_value->if_salv_wd_function_settings~create_function( id = 'EXPORT' ).
      input2->set_editor( lr_buttonui2 ).
    data lr_ref3 type ref to cl_salv_wd_fe.
      call method input2->get_editor
        receiving
          value  = lr_ref3
    I have also created the event handler for my button and written the below code thr. I am caling a BAPI to download the data into my excel format. The problem is coming here only.
    data: lt_return type table of bapiret2.
    data lo_nd_methcode type ref to if_wd_context_node.
      data lo_el_methcode type ref to if_wd_context_element.
      data ls_methcode type wd_this->element_methcode.
      data lv_methcode like ls_methcode-methcode.
    navigate from <CONTEXT> to <METHCODE> via lead selection
      lo_nd_methcode = wd_context->get_child_node( name = wd_this->wdctx_methcode ).
    get element via lead selection
      lo_el_methcode = lo_nd_methcode->get_element(  ).
    get single attribute
      lo_el_methcode->get_attribute(
        exporting
          name =  `METHCODE`
        importing
          value = lv_methcode ).
    call function 'ZBAPI_EXCEL_DLOAD_METHODOLOGY'
      exporting
        i_methcode       = lv_methcode
      tables
        et_return        = lt_return
    Plz give me a solution

  • ALV  issue - capturing user changes in editable fields using custom button?

    Hi,
    I created a custom button in ALV tool bar.   And also in my ALV grid I have couple of fields Editable option. User can change values for these 2 fields.
    My question is -
    After changing values for these editable fields(more than 1 record)  , user will click on custom button and then I have to update all the user changed values in to my internal table(lt_tab)  and then I have to process logic.
    Problem is when user click on Custom button in ALV tool bar it is not having the changed values in lt_tab table.
    Only when user clicks  some thing on ALV grid records or fields then it is getting all the changed values in to lt_tab.
    Can any one tell me how I can get changed values when user clicks on custom button?
    1. Can we place custom button in ALV Grid? instead of ALV tool bar? 
    or
    How I can capture user changes when they click on custom button?
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    TABLES
          T_OUTTAB                          = lt_tab
    Please check this logic-
    CASE r_ucomm.
        WHEN '&IC1'.
    - It_tab  having all changed field values
      WHEN 'custom button'.
          lt_tab  - not having any changed values - showing all initial lt_tab values.
    I highly appreciate your answers on this.
    Thanks.
    Rajesh.

    Hi,
    Use this code, its working:-
    *&      Form  ALV_DISPLAY
    *       SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
    *       FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
    *       AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
    *       DISPLAYED IN THE GRID FORMAT
    FORM alv_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
    *     I_CALLBACK_TOP_OF_PAGE            = ' '
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
    *     I_STRUCTURE_NAME                  =
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
         it_sort                           = it_sort        " sort info
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
    *     I_DEFAULT                         = 'X'
         i_save                            = 'A'
         is_variant                        = wa_variant     " variant name
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    *     I_SCREEN_START_LINE               = 0
    *     I_SCREEN_END_COLUMN               = 0
    *     I_SCREEN_END_LINE                 = 0
    *     I_HTML_HEIGHT_TOP                 = 0
    *     I_HTML_HEIGHT_END                 = 0
    *     IT_ALV_GRAPHICS                   =
    *     IT_HYPERLINK                      =
    *     IT_ADD_FIELDCAT                   =
    *     IT_EXCEPT_QINFO                   =
    *     IR_SALV_FULLSCREEN_ADAPTER        =
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final      " internal table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
    * when the function code is EXECUTE then process the selected records
        WHEN 'EXECUTE'. "user-defined button
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          IF ref_grid IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = ref_grid.
          ENDIF.
          IF NOT ref_grid IS INITIAL.
            CALL METHOD ref_grid->check_changed_data.
          ENDIF.
    * refresh the ALV Grid output from internal table
          l_selfield-refresh = c_check.
      ENDCASE.
    ENDFORM.
    This will reflect all the changes in the internal table. Now you can include your logic as per your requirement.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • Custom button in IE

    We have a custom button created in plugin and it works fine in reader and acrobat. Now we want to make it available when the pdf opened in IE. The problem is when the pdf opened in IE the Extended tab is not displayed(the custom button is under this tab). Please if someone here can help me on this issue. Thanks a lot in advance.

    Thanks for the reply. So, the custom button created in adobe plugin can't be used in browser? Is there any other way around?

  • SharePoint Ribbon custom button "enablescript"

    Hi,
    I want to set  permission for  all selected items in library.
    I 've added custom button   to ribbon.
    My custom button{  find all selected items and redirect to "mypage.aspx?ids=12,25,45" } .
    In them there is no problem....
    But..
    if curentuser  does not have  full control  permissions  then  mybutton must be disable..
    EnableScript not working:((
    I 'have tried this and like this  examples.
    I inserted alert('') between rows..
     and this row not working.
    context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod))
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/f21ad6b1-445a-497d-a286-d3ba8c2928a6/how-to-get-the-current-user-permission-level-on-a-list-item-with-ecmascript

    Hi,
    This enablescript  not working.
    function ItemhasPermissions() 
     {    var buttonState= true;
          var selectedItems = SP.ListOperation.Selection.getSelectedItems();
          var count = CountDictionary(selectedItems);
          if (count > 0)
               var i;
               for (i in selectedItems)
    if( !selectedItems[i].get_effectiveBasePermissions().has(SP.PermissionKind.editListItems))
      buttonState=false;
    return buttonState;

  • Desactivate custom buttons

    I have a form with a lot of Custom Buttons;
    I want to hide/desactivate them based on the value of one field 'GROUP'.
    Does anybody have an idea / sample code on this problem ?
    Thanks
    Lawrence

    I built a form on a table which has one of the columns to indicate the group.
    The name of the column (hence, name of the form field) is GROUP1 that holds
    values like g1, g2, g3 etc.
    The form has 2 custom buttoms named ITEM18 and ITEM19. When I query the form,
    buttons ITEM18 and ITEM19 get disabled when the group is g1.
    In order to achieve the above, I used the code given below in the
    Additional PL/SQL Section "...after displaying the page" area.
    NOTE: To suit your requiements, you need to change the following :-
    1> value of l_block_name;
    for forms on table/view value should be=.DEFAULT.
    for master-detail forms value should be=.MASTER_BLOCK. (For buttons in master block)
    should be=.DETAIL_BLOCK. (For buttons in detail block)
    2> value of l_button_list;
    value should be a colon separated string of button names in upper case
    3> value of l_disa_group;
    value should be the name of the group for which you need to disable the
    buttons
    /************* Start of Code **************/
    declare
    l_item_prefix varchar2(2000);
    l_item_suffix varchar2(10) := '.01';
    l_button_list varchar2(32767);
    l_group varchar2(100);
    l_disa_group varchar2(100);
    l_form_sid integer;
    l_block_name varchar2(100);
    begin
    l_form_sid := p_session.get_id;
    -- Change this to .MASTER_BLOCK. or .DETAIL_BLOCK. for Master-Detail forms
    l_block_name := '.DEFAULT.';
    l_item_prefix := p_session."_module".name || l_block_name;
    -- Change the button names to the ones you have on the form
    l_button_list := 'ITEM18:ITEM19';
    -- Change the name of the group to suit your requirements
    l_disa_group := 'g1';
    -- Change the name of the attribute according to what you have on the form.
    -- e.g. if the name of the table column that represents group is MYGROUP,
    -- the value for p_attribute_name would be A_MYGROUP.
    l_group := p_session.get_value_as_varchar2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_GROUP1'
    if l_group is null
    or l_group != l_disa_group
    then
    return;
    end if;
    -- generate javascript to disable buttons
    htp.p('<script>');
    htp.p('
    function disableButtonsWWVM' || l_form_sid || '(fobj){
    var itemPrefix = "' || l_item_prefix || '";
    var itemSuffix = "' || l_item_suffix || '";
    var buttonStr = "' || l_button_list || '";
    var buttonArr = buttonStr.split(":");
    for (var i = 0; i < fobj.length; i++) {
    if (fobj.elements.type == "button"){
    for (var j = 0; j < buttonArr.length ; j++){
    if (fobj.elements[i].name == itemPrefix + buttonArr[j] + itemSuffix){
    fobj.elements[i].disabled = true;
    htp.p('disableButtonsWWVM' || l_form_sid || '(document.WWVM' || l_form_sid ||');');
    htp.p('</script>');
    exception
    when others then
    htp.p('ERROR:' || sqlerrm);
    end;
    /************* End of Code **************/

Maybe you are looking for

  • Stacks for implementing back command!

    This here is my Game class, everything works, but im trying to implement a back command by using stacks. I have imported stacks in and all that...The problem im having is that when i go into another room it adds the room in, but im trying to pop it f

  • "Unique Key" in an array of elements

    Hi all. I'm attaching here a piece of an XSD I'm writing:           <xs:element name="main_element" maxOccurs="unbounded">        <xs:complexType>           <xs:sequence>                <xs:element name="key_element" type="xs:string"/>               

  • "signatures" in Mail acting funny...

    In Mail... since my last update, the "signatures" have been acting funny... The default comes up, but when I change the signature, the default stays there too!

  • Unable to overwrite course published on Adobe Connect

    Just in the past week, I've attempted to overwrite a couple of courses published in Captivate7 to Adobe Connect.  I usally get a communication error, then have to  begin the publishing process over.  Then Captivate displays that the course has publis

  • New Browser Window in Muse

    In the current version of Muse, how do I set an external link to open in a new browser window? In the previous version of Muse, there was a check box to do that.