JDialog box with room to type in a file name or browse files

Can anyone please tell me how to get a box with the message please choose a file to open, a strip for the user to type a file name into, with a browse button to the right for finding files, and then an ok button underneath.
Thanks tonnes

Here's the whole function in its current state:
public File getOutputFile() throws IOException {
int result = chooser.showSaveDialog(FileInputFrame.this);
if(result == JFileChooser.APPROVE_OPTION)
{ String fileName = new String();
System.out.println(chooser.getSelectedFile());
fileName = chooser.getSelectedFile().getAbsolutePath();
System.out.println(fileName);
File aFile = new File(fileName);
return aFile;
else
return null;
I'm using JBuilder, so it always says which line the exception is on, and it is always thrown at the first line where chooser.getSelectedFile() is dereferenced, so I'm pretty sure that it is returning null for whatever reason.
I have the default directory set to "~", so it comes up with a listing of everything in my home directory. Then I just type in a name that does not appear on that list, and poof, exceptions galore.
OK, here's a really wierd thing. If I use the name of a file that already exists in my home directory but save it in some random subdirectory, there is no problem. But, if I use the name of a file that exists nowhere in that same subdirectory, I get the exception.
I wonder if it is a system permissions problem, as I do not have admin permissions on this machine, although everything is running out of my home directory, so I should have write permissions. I wonder also if it could be system dependent-- I'm running redhat. I don't have a lot of experience trying to interface with the os/file system, that's why I was so happy to find the JFileChooser class in the first place.
Thanks for your thoughts on this!

Similar Messages

  • Check box with Boolean data type is not behaving properly

    Hi,
    I create a sample application with one entity driven view object with two attributes. One is of String data type [Value will be Y/N] and another (transient) attribute with Boolean data type. I planned to bind this boolean data type attribute to UI. I overridded the view row impl class and included setting of boolean attribute inside the setter of String attribute. Also in the getter of boolean attribute, added code to check the string attribute and return true/false based on that. Everything is working fine in application module tester. But when i test the same in view controller project in a page, it is not working. Always Check box component is not checked eventhough when i explicitly check it.
    [NOTE: I have given the control hint of Boolean attribute as check_box. Also i don't want selected/unselected entries in the page def file. That's why followed this approach]
    Have i missed out anything? Why this behaviour.
    Thanks in advance.
    Raguraman

    what is the value that is going in when u check it.. did u debug it.. is the viewRowimps setter and getter getting called.. and is it having the right value set and got.. and ur sure that ur using selectBooleanCheckBox..
    ur binding the checkbox to the transient value right??

  • I have a Text control string box with some initial text. I would like to highlight old text with click of mouse and type in new data from keyboard

    I have a text control string box with some initial text (says: Please enter Name). I would like the operator to click on the text control box and have it automatically highlight so that when new data is typed in the old erases (all at once) and the new data is now in the text box.
    I tried using the "Text.Selection" property node and when I run it and put the mouse inside the text box the initial text is highlighted and if I press "delete" on the keyboard or if I start to type in new data the initial data does delete but once I start to type new characters they erase each other. For example if I want to type in “Willi
    am” I type the “W” and then the “I” but the “I” erases the “W” and now I am only left with an “I” in the text box and so on. I appreciate any help

    It seems you are continuously setting the property node over and over again. This should only happen once if you mouse over it.
    Create a property node for your text control with the following three items:
    (1) KeyFocus (wire a "true" constant to it)
    (2) Text.SelStart (Wire a "zero" constant to it)
    (3) Text.SelEnd (Wire a constant containing the string length of the text).
    Put this property node inside an event structure, triggered by "Mouse enter" on the string control.
    (see if the attached example works for you)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Enter_Name.vi ‏23 KB

  • I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click. How do I get version 4 to do this? Thanks.

    I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click.
    How do I get version 4 to do this?
    Thanks.

    The new but not-ready-for-prime-time autocomplete method searches for matches that contain the entered text, not just ones that begin with the string. Your options are:
    1) type in longer strings that narrow the search
    2) use an add-on to search just the beginnings:
    https://support.mozilla.org/en-US/questions/1037469
    3) install an older version of TB:
    http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/

  • I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    Next, close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current user font cache files. After running the command, close Terminal and immediately restart your Mac.

  • BackgroundColor is only supported by type 'mx.containers.Box' with the theme 'halo, spark'

    Hello:
    I just upgrade from Flash Builder Burrito to 4.5. After importing my Burrito project into 4.5, I got like 30 errors saying the following:
    The style 'backgroundColor' is only supported by type 'mx.containers.Box' with the theme(s) 'halo, spark'.
    I have been using backgroundColor through the project to set colors ... Is there a new property name? Do I have to start using CSS?
    The only option I had for theme was "Mobile Theme".
    I would like to be able to use backgroundColor with out rewritting all that code. Is there a way?
    Thanks
    Paul

    I used to have the prerelease "burrito" which I coded all the background colors using the "backgroundColor" property. I just bought the release version from the store and after I unstalled it I started getting the compiler errors releated to "backgroundColor".
    Where do I locate the "use flex 3 compatability" box?

  • Problem with JDialog box

    Hi Guys,
    I have a problem with the JDialog box. The close button (Cross mark of the box) is not displayed when I was trying to use my custom LookAndFeel and Custom theme. I am pasting the code sample here.
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.Icon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.LookAndFeel;
    import javax.swing.SwingUtilities;
    import javax.swing.UIDefaults;
    import javax.swing.UIManager;
    import javax.swing.plaf.ColorUIResource;
    import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
    import com.jgoodies.looks.plastic.PlasticTheme;
    import com.medplexus.looks.plastic.theme.SkyGreen;
    public class TestTheDialog implements ActionListener {
    JFrame mainFrame = null;
    JButton myButton = null;
    public TestTheDialog() {
    mainFrame = new JFrame("TestTheDialog Tester");
    mainFrame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    try{
         MyLookAndFeel.setCurrentTheme(new CustomLaF());
         UIManager.setLookAndFeel(new MyLookAndFeel());
         SwingUtilities.updateComponentTreeUI(mainFrame);
         CustomDialog cd = new CustomDialog();
         cd.setDefaultLookAndFeelDecorated(true);
    catch(Exception e){
    myButton = new JButton("Test the dialog!");
    myButton.addActionListener(this);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.getContentPane().add(myButton);
    mainFrame.setSize(200, 150);
    //mainFrame.pack();
    mainFrame.setVisible(true);
    public void actionPerformed(ActionEvent e) {
    if(myButton == e.getSource()) {
    System.err.println("Opening dialog.");
    CustomDialog myDialog = new CustomDialog(mainFrame, true, "Do you like Java?");
    System.err.println("After opening dialog.");
    if(myDialog.getAnswer()) {
    System.err.println("The answer stored in CustomDialog is 'true' (i.e. user clicked yes button.)");
    else {
    System.err.println("The answer stored in CustomDialog is 'false' (i.e. user clicked no button.)");
    static class CustomLaF extends PlasticTheme {
    protected ColorUIResource getPrimary1() {
    return new ColorUIResource(255,128,0);
    public ColorUIResource getPrimary2() {
              return (new ColorUIResource(Color.white));
         public ColorUIResource getPrimary3() {
              return (new ColorUIResource(255,128,0));
    public ColorUIResource getPrimaryControl() {
    return new ColorUIResource(Color.GREEN);
    protected ColorUIResource getSecondary1() {
    return new ColorUIResource(Color.CYAN);
    protected ColorUIResource getSecondary2() {
              return (new ColorUIResource(Color.gray));
         protected ColorUIResource getSecondary3() {
              return (new ColorUIResource(235,235,235));
         protected ColorUIResource getBlack() {
              return BLACK;
         protected ColorUIResource getWhite() {
              return WHITE;
         private Object getIconResource(String s) {
    return LookAndFeel.makeIcon(getClass(), s);
    private Icon getHastenedIcon(String s, UIDefaults uidefaults) {
    Object obj = getIconResource(s);
    return (Icon) ((javax.swing.UIDefaults.LazyValue) obj).createValue(uidefaults);
    static class MyLookAndFeel extends Plastic3DLookAndFeel {
              protected void initClassDefaults(UIDefaults table) {
                   super.initClassDefaults(table);
              protected void initComponentDefaults(UIDefaults table) {
                   super.initComponentDefaults(table);
                   Object[] defaults = {
                             "MenuItem.foreground",new ColorUIResource(Color.white),
                             "MenuItem.background",new ColorUIResource(Color.gray),
                             "MenuItem.selectionForeground",new ColorUIResource(Color.gray),
                             "MenuItem.selectionBackground",new ColorUIResource(Color.white),
                             "Menu.selectionForeground", new ColorUIResource(Color.white),
                             "Menu.selectionBackground", new ColorUIResource(Color.gray),
                             "MenuBar.background", new ColorUIResource(235,235,235),
                             "Menu.background", new ColorUIResource(235,235,235),
                             "Desktop.background",new ColorUIResource(235,235,235),
                             "Button.select",new ColorUIResource(255,128,0),
                             "Button.focus",new ColorUIResource(255,128,0),
                             "TableHeader.background", new ColorUIResource(255,128,0),
                             "TableHeader.foreground", new ColorUIResource(Color.white),
                             "ScrollBar.background", new ColorUIResource(235,235,235),
                             "OptionPane.questionDialog.border.background", new ColorUIResource(Color.gray),
                             "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(Color.white),
                             "OptionPane.questionDialog.titlePane.background", new ColorUIResource(255,128,0),
                             "InternalFrame.borderColor", new ColorUIResource(Color.gray),
                             "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white),
                             "InternalFrame.activeTitleBackground", new ColorUIResource(Color.gray),
                             "InternalFrame.borderColor", new ColorUIResource(Color.white),
                             "Table.selectionBackground",new ColorUIResource(255,128,0)
                   table.putDefaults(defaults);
    public static void main(String argv[]) {
    TestTheDialog tester = new TestTheDialog();
    package CustomThemes;
    import javax.swing.JDialog;
    import java.awt.event.ActionListener;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JButton;
    import java.awt.event.ActionEvent;
    public class CustomDialog extends JDialog implements ActionListener {
    private JPanel myPanel = null;
    private JButton yesButton = null;
    private JButton noButton = null;
    private boolean answer = false;
    public boolean getAnswer() { return answer; }
    public CustomDialog(){
    public CustomDialog(JFrame frame, boolean modal, String myMessage) {
    super(frame, modal);
    setTitle("Guess?");
    myPanel = new JPanel();
    getContentPane().add(myPanel);
    myPanel.add(new JLabel(myMessage));
    yesButton = new JButton("Yes");
    yesButton.addActionListener(this);
    myPanel.add(yesButton);
    noButton = new JButton("No");
    noButton.addActionListener(this);
    myPanel.add(noButton);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    setLocationRelativeTo(frame);
    setVisible(true);
    public void actionPerformed(ActionEvent e) {
    if(yesButton == e.getSource()) {
    System.err.println("User chose yes.");
    answer = true;
    setVisible(false);
    else if(noButton == e.getSource()) {
    System.err.println("User chose no.");
    answer = false;
    setVisible(false);
    Thanks and Regards
    Kumar.

    Hi All,
    I am using the JGoodies Look and feel (looks2.0.1.jar). I wrote my own custom LookAndFeel and Theme , but the problem with this is the JDialog/JOptionPane dialog boxes are displayed with out the close button (cross button on the titlebar).
    I am pasting the code here.
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.Icon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.LookAndFeel;
    import javax.swing.SwingUtilities;
    import javax.swing.UIDefaults;
    import javax.swing.UIManager;
    import javax.swing.plaf.ColorUIResource;
    import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
    import com.jgoodies.looks.plastic.PlasticTheme;
    import com.medplexus.looks.plastic.theme.SkyGreen;
    public class TestTheDialog implements ActionListener {
        JFrame mainFrame = null;
        JButton myButton = null;
        public TestTheDialog() {
            mainFrame = new JFrame("TestTheDialog Tester");
            mainFrame.addWindowListener(new WindowAdapter() {
                    public void windowClosing(WindowEvent e) {System.exit(0);}
            try{
                 MyLookAndFeel.setCurrentTheme(new CustomLaF());
                 UIManager.setLookAndFeel(new MyLookAndFeel());
                 //Plastic3DLookAndFeel.setCurrentTheme(new SkyGreen());
                 //UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
                 SwingUtilities.updateComponentTreeUI(mainFrame);
                 CustomDialog cd = new CustomDialog();
                 cd.setDefaultLookAndFeelDecorated(true);
            catch(Exception e){
            myButton = new JButton("Test the dialog!");
            myButton.addActionListener(this);
            mainFrame.setLocationRelativeTo(null);
            mainFrame.getContentPane().add(myButton);
            mainFrame.setSize(200, 150);
            //mainFrame.pack();
            mainFrame.setVisible(true);
        public void actionPerformed(ActionEvent e) {
            if(myButton == e.getSource()) {
                System.err.println("Opening dialog.");
                CustomDialog myDialog = new CustomDialog(mainFrame, true, "Do you like Java?");
                System.err.println("After opening dialog.");
                if(myDialog.getAnswer()) {
                    System.err.println("The answer stored in CustomDialog is 'true' (i.e. user clicked yes button.)");
                else {
                    System.err.println("The answer stored in CustomDialog is 'false' (i.e. user clicked no button.)");
        static class CustomLaF extends PlasticTheme {
            protected ColorUIResource getPrimary1() {
              return new ColorUIResource(255,128,0);
            public ColorUIResource getPrimary2() {
                  return (new ColorUIResource(Color.white));
             public ColorUIResource getPrimary3() {
                  return (new ColorUIResource(255,128,0));
            public ColorUIResource getPrimaryControl() {
              return new ColorUIResource(Color.GREEN);
            protected ColorUIResource getSecondary1() {
              return new ColorUIResource(Color.CYAN);
            protected ColorUIResource getSecondary2() {
                  return (new ColorUIResource(Color.gray));
             protected ColorUIResource getSecondary3() {
                  return (new ColorUIResource(235,235,235));
             protected ColorUIResource getBlack() {
                  return BLACK;
             protected ColorUIResource getWhite() {
                  return WHITE;
             private Object getIconResource(String s) {
                return LookAndFeel.makeIcon(getClass(), s);
            private Icon getHastenedIcon(String s, UIDefaults uidefaults) {
                Object obj = getIconResource(s);
                return (Icon) ((javax.swing.UIDefaults.LazyValue) obj).createValue(uidefaults);
          static class MyLookAndFeel extends Plastic3DLookAndFeel {
                  protected void initClassDefaults(UIDefaults table) {
                       super.initClassDefaults(table);
                  protected void initComponentDefaults(UIDefaults table) {
                       super.initComponentDefaults(table);
                       Object[] defaults = {
                                 "MenuItem.foreground",new ColorUIResource(Color.white),
                                 "MenuItem.background",new ColorUIResource(Color.gray),
                                 "MenuItem.selectionForeground",new ColorUIResource(Color.gray),
                                 "MenuItem.selectionBackground",new ColorUIResource(Color.white),
                                 "Menu.selectionForeground", new ColorUIResource(Color.white),
                                 "Menu.selectionBackground", new ColorUIResource(Color.gray),
                                 "MenuBar.background", new ColorUIResource(235,235,235),
                                 "Menu.background", new ColorUIResource(235,235,235),
                                 "Desktop.background",new ColorUIResource(235,235,235),
                                 "Button.select",new ColorUIResource(255,128,0),
                                 "Button.focus",new ColorUIResource(255,128,0),
                                 "TableHeader.background", new ColorUIResource(255,128,0),
                                 "TableHeader.foreground", new ColorUIResource(Color.white),
                                 "ScrollBar.background",  new ColorUIResource(235,235,235),
                                 "OptionPane.questionDialog.border.background", new ColorUIResource(Color.gray),
                                 "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(Color.white),
                                 "OptionPane.questionDialog.titlePane.background", new ColorUIResource(255,128,0),
                                 "InternalFrame.borderColor", new ColorUIResource(Color.gray),
                                 "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white),
                                 "InternalFrame.activeTitleBackground", new ColorUIResource(Color.gray),
                                 "InternalFrame.borderColor", new ColorUIResource(Color.white),
                                 "Table.selectionBackground",new ColorUIResource(255,128,0)
                       table.putDefaults(defaults);
        public static void main(String argv[]) {
            TestTheDialog tester = new TestTheDialog();
    import javax.swing.JDialog;
    import java.awt.event.ActionListener;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JButton;
    import java.awt.event.ActionEvent;
    public class CustomDialog extends JDialog implements ActionListener {
        private JPanel myPanel = null;
        private JButton yesButton = null;
        private JButton noButton = null;
        private boolean answer = false;
        public boolean getAnswer() { return answer; }
        public CustomDialog(){
        public CustomDialog(JFrame frame, boolean modal, String myMessage) {
            super(frame, modal);
            setTitle("Guess?");
            myPanel = new JPanel();
            getContentPane().add(myPanel);
            myPanel.add(new JLabel(myMessage));
            yesButton = new JButton("Yes");
            yesButton.addActionListener(this);
            myPanel.add(yesButton);       
            noButton = new JButton("No");
            noButton.addActionListener(this);
            myPanel.add(noButton);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            pack();
            setLocationRelativeTo(frame);
            setVisible(true);
        public void actionPerformed(ActionEvent e) {
            if(yesButton == e.getSource()) {
                System.err.println("User chose yes.");
                answer = true;
                setVisible(false);
            else if(noButton == e.getSource()) {
                System.err.println("User chose no.");
                answer = false;
                setVisible(false);
    }Thanks and Regards
    Kumar.

  • How can i invoke a file chooser dialog box with out using input type=file

    how can i invoke a file chooser dialog box with out using <input type=file> can any one help me mail me to [email protected]

    You could use an applet...
    Or maybe Javascript has some way to do it.

  • Making a text box expand as you type into it?

    I was wondering if it is possible to make a text box (or any kind of box) expand as you type into it.  Currently the box does not have a caption, I simply want to allow the value box to expand as i type into it.  It would also be great if it would expand to another page...does anyone know if this is possible and if so how can i do it?

    Any help would be greatly appreciated and, yes, that is a mess x about 17.   The good news is I didn't design it -- the bad news is I got tagged to try and fix it.
    I'll try to answer in order:
    You haven't used any subforms so it's not going to work as-is.
                        I don't think whoever did the initial form knew about the subform issue so no provisions made for them.
    I won't have time to look at it closely until tonight. Some questions/comments in the meantime:
    Do you really need 2 master pages - does that block need to be at the bottom of each page? Or is it just supposed to follow everything else.
                         the information is to be on the bottom of every page -- clients/workers need to sign each page to prove they have read the information
    You've used tables to do a lot of the layout - probably not a good idea.
                                  if we need to dump the tables, that's fine -  I looked at the 7_Questions_Flowing.pdf from another thread and I can make it work
                                  the way it needs to with the information in a header but they WANT it as a footer.
    You've made the Content Area the full size of the page, better to size it what you want your margins to be.
                                    ok, that should be the easy fix of the batch
    You have no master subform (or any at all for that matter...)
                                 my problem was I couldn't find a way to add a master subform that didn't give me that message.  If I couldn't get that
                                  one to work without the error message then none contained within would either ??

  • Spry menu hover: How to get rid of white box with "false"?

    Hi--
    I'm encountering an IE issue with a Spry vertical menu bar. When the user hovers over the submenu, white frames appear behind the submenu with the word "false" in them. Of course this doesn't happen in Safari or Firefox.
    I was able to fix other similar problems with the menu by following tips posted on another forum. Namely, in the CSS, I disabled an IE hack that caused a white background to appear (menu background has to be transparent on this site). And in the JS, I disabled the following: this.removeIframeLayer(menu);
    Here's the URL: http://www.qic-ec.org
    Below are the css (1) and js (2).
    Any help would be DEEPLY appreciated.
    Thank you
    Jackie
    CSS:
    @charset "UTF-8";
    /* SpryMenuBarVertical.css - Revision: Spry Preview Release 1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, a fixed width box with no margin or padding */
    ul.MenuBarVertical
    margin: 0;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    cursor: default;
    width: 6.2em;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
    z-index: 1000;
    /* Menu item containers, position children relative to this container and are same fixed width as parent */
    ul.MenuBarVertical li
    margin: 0;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    position: relative;
    text-align: left;
    cursor: pointer;
    width: 6.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarVertical ul
    margin: -5% 0 0 95%;
    padding: 0;
    list-style-type: none;
    font-size: 100%;
    position: absolute;
    z-index: 1020;
    cursor: default;
    width: 6.2em;
    left: -1000em;
    top: 0;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarVertical ul.MenuBarSubmenuVisible
    left: 0;
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarVertical ul li
    width: 3em;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Outermost menu container has borders on all sides */
    ul.MenuBarVertical
    border: 0px solid #CCC;
    /* Submenu containers have borders on all sides */
    ul.MenuBarVertical ul
    border: 0px solid #CCC;
    /* Menu items are a transparent block with padding and no text decoration */
    ul.MenuBarVertical a
    display: block;
    cursor: pointer;
    padding: 0.5em 0.75em;
    color: #502977;
    text-decoration: none;
    border-bottom: 1px dotted #A88FC7;
    /* Menu items that have mouse over or focus have a transparent background and light purple text */
    ul.MenuBarVertical a:hover, ul.MenuBarVertical a:focus
    color: #A88FC7;
    /* Menu items that are open with submenus are set to MenuBarItemHover with a transparent background and light purple text */
    ul.MenuBarVertical a.MenuBarItemHover, ul.MenuBarVertical a.MenuBarItemSubmenuHover, ul.MenuBarVertical a.MenuBarSubmenuVisible
        color: #A88FC7;
    ul.MenuBarVertical ul li a
    border: 0px;
    color: #006600;
      SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarVertical a.MenuBarItemSubmenu
    background-image: url(SpryMenuBarRight.gif);
    background-repeat: no-repeat;
    background-position: 95% 50%;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarVertical ul a.MenuBarItemSubmenu
    background-image: url(SpryMenuBarRight.gif);
    background-repeat: no-repeat;
    background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarVertical a.MenuBarItemSubmenuHover
    background-image: url(SpryMenuBarRightHover.gif);
    background-repeat: no-repeat;
    background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarVertical ul a.MenuBarItemSubmenuHover
    background-image: url(SpryMenuBarRightHover.gif);
    background-repeat: no-repeat;
    background-position: 95% 50%;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    /*ul.MenuBarVertical iframe
    position: absolute;
    z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
    /* ul.MenuBarVertical li.MenuBarItemIE
    display: inline;
    f\loat: left;
            background: #fff;
    JS:
    /* SpryMenuBar.js - Revision: Spry Preview Release 1.4 */
    // Copyright (c) 2006. Adobe Systems Incorporated.
    // All rights reserved.
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions are met:
    //   * Redistributions of source code must retain the above copyright notice,
    //     this list of conditions and the following disclaimer.
    //   * Redistributions in binary form must reproduce the above copyright notice,
    //     this list of conditions and the following disclaimer in the documentation
    //     and/or other materials provided with the distribution.
    //   * Neither the name of Adobe Systems Incorporated nor the names of its
    //     contributors may be used to endorse or promote products derived from this
    //     software without specific prior written permission.
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    // POSSIBILITY OF SUCH DAMAGE.
    SpryMenuBar.js
    This file handles the JavaScript for Spry Menu Bar.  You should have no need
    to edit this file.  Some highlights of the MenuBar object is that timers are
    used to keep submenus from showing up until the user has hovered over the parent
    menu item for some time, as well as a timer for when they leave a submenu to keep
    showing that submenu until the timer fires.
    var Spry;
    if(!Spry)
    Spry = {};
    if(!Spry.Widget)
    Spry.Widget = {};
    // Constructor for Menu Bar
    // element should be an ID of an unordered list (<ul> tag)
    // preloadImage1 and preloadImage2 are images for the rollover state of a menu
    Spry.Widget.MenuBar = function(element, opts)
    this.init(element, opts);
    Spry.Widget.MenuBar.prototype.init = function(element, opts)
    this.element = this.getElement(element);
    // represents the current (sub)menu we are operating on
    this.currMenu = null;
    var isie = (typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE');
    if(typeof document.getElementById == 'undefined' || (navigator.vendor == 'Apple Computer, Inc.' && typeof window.XMLHttpRequest == 'undefined') || (isie && typeof document.uniqueID == 'undefined'))
    // bail on older unsupported browsers
    return;
    // load hover images now
    if(opts)
    for(var k in opts)
    var rollover = new Image;
    rollover.src = opts[k];
    if(this.element)
    this.currMenu = this.element;
    var items = this.element.getElementsByTagName('li');
    for(var i=0; i<items.length; i++)
    this.initialize(items[i], element, isie);
    if(isie)
    this.addClassName(items[i], "MenuBarItemIE");
    items[i].style.position = "static";
    if(isie)
    if(this.hasClassName(this.element, "MenuBarVertical"))
    this.element.style.position = "relative";
    var linkitems = this.element.getElementsByTagName('a');
    for(var i=0; i<linkitems.length; i++)
    linkitems[i].style.position = "relative";
    Spry.Widget.MenuBar.prototype.getElement = function(ele)
    if (ele && typeof ele == "string")
    return document.getElementById(ele);
    return ele;
    Spry.Widget.MenuBar.prototype.hasClassName = function(ele, className)
    if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
    return false;
    return true;
    Spry.Widget.MenuBar.prototype.addClassName = function(ele, className)
    if (!ele || !className || this.hasClassName(ele, className))
    return;
    ele.className += (ele.className ? " " : "") + className;
    Spry.Widget.MenuBar.prototype.removeClassName = function(ele, className)
    if (!ele || !className || !this.hasClassName(ele, className))
    return;
    ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
    // addEventListener for Menu Bar
    // attach an event to a tag without creating obtrusive HTML code
    Spry.Widget.MenuBar.prototype.addEventListener = function(element, eventType, handler, capture)
    try
    if (element.addEventListener)
    element.addEventListener(eventType, handler, capture);
    else if (element.attachEvent)
    element.attachEvent('on' + eventType, handler);
    catch (e) {}
    // createIframeLayer for Menu Bar
    // creates an IFRAME underneath a menu so that it will show above form controls and ActiveX
    Spry.Widget.MenuBar.prototype.createIframeLayer = function(menu)
    var layer = document.createElement('iframe');
    layer.tabIndex = '-1';
    layer.src = 'javascript:false;';
    menu.parentNode.appendChild(layer);
    layer.style.left = menu.offsetLeft + 'px';
    layer.style.top = menu.offsetTop + 'px';
    layer.style.width = menu.offsetWidth + 'px';
    layer.style.height = menu.offsetHeight + 'px';
    // removeIframeLayer for Menu Bar
    // removes an IFRAME underneath a menu to reveal any form controls and ActiveX
    Spry.Widget.MenuBar.prototype.removeIframeLayer =  function(menu)
    var layers = menu.parentNode.getElementsByTagName('iframe');
    while(layers.length > 0)
    layers[0].parentNode.removeChild(layers[0]);
    // clearMenus for Menu Bar
    // root is the top level unordered list (<ul> tag)
    Spry.Widget.MenuBar.prototype.clearMenus = function(root)
    var menus = root.getElementsByTagName('ul');
    for(var i=0; i<menus.length; i++)
    this.hideSubmenu(menus[i]);
    this.removeClassName(this.element, "MenuBarActive");
    // bubbledTextEvent for Menu Bar
    // identify bubbled up text events in Safari so we can ignore them
    Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
    return (navigator.vendor == 'Apple Computer, Inc.' && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget)));
    // showSubmenu for Menu Bar
    // set the proper CSS class on this menu to show it
    Spry.Widget.MenuBar.prototype.showSubmenu = function(menu)
    if(this.currMenu)
    this.clearMenus(this.currMenu);
    this.currMenu = null;
    if(menu)
    this.addClassName(menu, "MenuBarSubmenuVisible");
    if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
    if(!this.hasClassName(this.element, "MenuBarHorizontal") || menu.parentNode.parentNode != this.element)
    menu.style.top = menu.parentNode.offsetTop + 'px';
    if(typeof document.uniqueID != "undefined")
    this.createIframeLayer(menu);
    this.addClassName(this.element, "MenuBarActive");
    // hideSubmenu for Menu Bar
    // remove the proper CSS class on this menu to hide it
    Spry.Widget.MenuBar.prototype.hideSubmenu = function(menu)
    if(menu)
    this.removeClassName(menu, "MenuBarSubmenuVisible");
    if(typeof document.all != 'undefined' && typeof window.opera == 'undefined' && navigator.vendor != 'KDE')
    menu.style.top = '';
    menu.style.left = '';
    // this.removeIframeLayer(menu);
    // initialize for Menu Bar
    // create event listeners for the Menu Bar widget so we can properly
    // show and hide submenus
    Spry.Widget.MenuBar.prototype.initialize = function(listitem, element, isie)
    var opentime, closetime;
    var link = listitem.getElementsByTagName('a')[0];
    var submenus = listitem.getElementsByTagName('ul');
    var menu = (submenus.length > 0 ? submenus[0] : null);
    var hasSubMenu = false;
    if(menu)
    this.addClassName(link, "MenuBarItemSubmenu");
    hasSubMenu = true;
    if(!isie)
    // define a simple function that comes standard in IE to determine
    // if a node is within another node
    listitem.contains = function(testNode)
    // this refers to the list item
    if(testNode == null)
    return false;
    if(testNode == this)
    return true;
    else
    return this.contains(testNode.parentNode);
    // need to save this for scope further down
    var self = this;
    this.addEventListener(listitem, 'mouseover', function(e)
    if(self.bubbledTextEvent())
    // ignore bubbled text events
    return;
    clearTimeout(closetime);
    if(self.currMenu == listitem)
    self.currMenu = null;
    // show menu highlighting
    self.addClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
    if(menu && !self.hasClassName(menu, "MenuBarSubmenuVisible"))
    opentime = window.setTimeout(function(){self.showSubmenu(menu);}, 250);
    }, false);
    this.addEventListener(listitem, 'mouseout', function(e)
    if(self.bubbledTextEvent())
    // ignore bubbled text events
    return;
    var related = (typeof e.relatedTarget != 'undefined' ? e.relatedTarget : e.toElement);
    if(!listitem.contains(related))
    clearTimeout(opentime);
    self.currMenu = listitem;
    // remove menu highlighting
    self.removeClassName(link, hasSubMenu ? "MenuBarItemSubmenuHover" : "MenuBarItemHover");
    if(menu)
    closetime = window.setTimeout(function(){self.hideSubmenu(menu);}, 600);
    }, false);

    Do you have any suggestions for how to adjust the JS so that the menu functions properly in IE? As I said, I upgraded to Spry 1.6.1 and uploaded the new CSS and JS and the problem is still there. The CSS is the same as in the previous version. The new JS is:
    // SpryMenuBar.js - version 0.12 - Spry Pre-Release 1.6.1
    var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget = {};
    Spry.BrowserSniff = function()
    var b = navigator.appName.toString();
    var up = navigator.platform.toString();
    var ua = navigator.userAgent.toString();
    this.mozilla = this.ie = this.opera = this.safari = false;
    var re_opera = /Opera.([0-9\.]*)/i;
    var re_msie = /MSIE.([0-9\.]*)/i;
    var re_gecko = /gecko/i;
    var re_safari = /(applewebkit|safari)\/([\d\.]*)/i;
    var r = false;
    if ( (r = ua.match(re_opera))) {
    this.opera = true;
    this.version = parseFloat(r[1]);
    } else if ( (r = ua.match(re_msie))) {
    this.ie = true;
    this.version = parseFloat(r[1]);
    } else if ( (r = ua.match(re_safari))) {
    this.safari = true;
    this.version = parseFloat(r[2]);
    } else if (ua.match(re_gecko)) {
    var re_gecko_version = /rv:\s*([0-9\.]+)/i;
    r = ua.match(re_gecko_version);
    this.mozilla = true;
    this.version = parseFloat(r[1]);
    this.windows = this.mac = this.linux = false;
    this.Platform = ua.match(/windows/i) ? "windows" :
    (ua.match(/linux/i) ? "linux" :
    (ua.match(/mac/i) ? "mac" :
    ua.match(/unix/i)? "unix" : "unknown"));
    this[this.Platform] = true;
    this.v = this.version;
    if (this.safari && this.mac && this.mozilla) {
    this.mozilla = false;
    Spry.is = new Spry.BrowserSniff();
    // Constructor for Menu Bar
    // element should be an ID of an unordered list (<ul> tag)
    // preloadImage1 and preloadImage2 are images for the rollover state of a menu
    Spry.Widget.MenuBar = function(element, opts)
    this.init(element, opts);
    Spry.Widget.MenuBar.prototype.init = function(element, opts)
    this.element = this.getElement(element);
    // represents the current (sub)menu we are operating on
    this.currMenu = null;
    this.showDelay = 250;
    this.hideDelay = 600;
    if(typeof document.getElementById == 'undefined' || (navigator.vendor == 'Apple Computer, Inc.' && typeof window.XMLHttpRequest == 'undefined') || (Spry.is.ie && typeof document.uniqueID == 'undefined'))
    // bail on older unsupported browsers
    return;
    // Fix IE6 CSS images flicker
    if (Spry.is.ie && Spry.is.version < 7){
    try {
    document.execCommand("BackgroundImageCache", false, true);
    } catch(err) {}
    this.upKeyCode = Spry.Widget.MenuBar.KEY_UP;
    this.downKeyCode = Spry.Widget.MenuBar.KEY_DOWN;
    this.leftKeyCode = Spry.Widget.MenuBar.KEY_LEFT;
    this.rightKeyCode = Spry.Widget.MenuBar.KEY_RIGHT;
    this.escKeyCode = Spry.Widget.MenuBar.KEY_ESC;
    this.hoverClass = 'MenuBarItemHover';
    this.subHoverClass = 'MenuBarItemSubmenuHover';
    this.subVisibleClass ='MenuBarSubmenuVisible';
    this.hasSubClass = 'MenuBarItemSubmenu';
    this.activeClass = 'MenuBarActive';
    this.isieClass = 'MenuBarItemIE';
    this.verticalClass = 'MenuBarVertical';
    this.horizontalClass = 'MenuBarHorizontal';
    this.enableKeyboardNavigation = true;
    this.hasFocus = false;
    // load hover images now
    if(opts)
    for(var k in opts)
    if (typeof this[k] == 'undefined')
    var rollover = new Image;
    rollover.src = opts[k];
    Spry.Widget.MenuBar.setOptions(this, opts);
    // safari doesn't support tabindex
    if (Spry.is.safari)
    this.enableKeyboardNavigation = false;
    if(this.element)
    this.currMenu = this.element;
    var items = this.element.getElementsByTagName('li');
    for(var i=0; i<items.length; i++)
    if (i > 0 && this.enableKeyboardNavigation)
    items[i].getElementsByTagName('a')[0].tabIndex='-1';
    this.initialize(items[i], element);
    if(Spry.is.ie)
    this.addClassName(items[i], this.isieClass);
    items[i].style.position = "static";
    if (this.enableKeyboardNavigation)
    var self = this;
    this.addEventListener(document, 'keydown', function(e){self.keyDown(e); }, false);
    if(Spry.is.ie)
    if(this.hasClassName(this.element, this.verticalClass))
    this.element.style.position = "relative";
    var linkitems = this.element.getElementsByTagName('a');
    for(var i=0; i<linkitems.length; i++)
    linkitems[i].style.position = "relative";
    Spry.Widget.MenuBar.KEY_ESC = 27;
    Spry.Widget.MenuBar.KEY_UP = 38;
    Spry.Widget.MenuBar.KEY_DOWN = 40;
    Spry.Widget.MenuBar.KEY_LEFT = 37;
    Spry.Widget.MenuBar.KEY_RIGHT = 39;
    Spry.Widget.MenuBar.prototype.getElement = function(ele)
    if (ele && typeof ele == "string")
    return document.getElementById(ele);
    return ele;
    Spry.Widget.MenuBar.prototype.hasClassName = function(ele, className)
    if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
    return false;
    return true;
    Spry.Widget.MenuBar.prototype.addClassName = function(ele, className)
    if (!ele || !className || this.hasClassName(ele, className))
    return;
    ele.className += (ele.className ? " " : "") + className;
    Spry.Widget.MenuBar.prototype.removeClassName = function(ele, className)
    if (!ele || !className || !this.hasClassName(ele, className))
    return;
    ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
    // addEventListener for Menu Bar
    // attach an event to a tag without creating obtrusive HTML code
    Spry.Widget.MenuBar.prototype.addEventListener = function(element, eventType, handler, capture)
    try
    if (element.addEventListener)
    element.addEventListener(eventType, handler, capture);
    else if (element.attachEvent)
    element.attachEvent('on' + eventType, handler);
    catch (e) {}
    // createIframeLayer for Menu Bar
    // creates an IFRAME underneath a menu so that it will show above form controls and ActiveX
    Spry.Widget.MenuBar.prototype.createIframeLayer = function(menu)
    var layer = document.createElement('iframe');
    layer.tabIndex = '-1';
    layer.src = 'javascript:""';
    layer.frameBorder = '0';
    layer.scrolling = 'no';
    menu.parentNode.appendChild(layer);
    layer.style.left = menu.offsetLeft + 'px';
    layer.style.top = menu.offsetTop + 'px';
    layer.style.width = menu.offsetWidth + 'px';
    layer.style.height = menu.offsetHeight + 'px';
    // removeIframeLayer for Menu Bar
    // removes an IFRAME underneath a menu to reveal any form controls and ActiveX
    Spry.Widget.MenuBar.prototype.removeIframeLayer =  function(menu)
    var layers = ((menu == this.element) ? menu : menu.parentNode).getElementsByTagName('iframe');
    while(layers.length > 0)
    layers[0].parentNode.removeChild(layers[0]);
    // clearMenus for Menu Bar
    // root is the top level unordered list (<ul> tag)
    Spry.Widget.MenuBar.prototype.clearMenus = function(root)
    var menus = root.getElementsByTagName('ul');
    for(var i=0; i<menus.length; i++)
    this.hideSubmenu(menus[i]);
    this.removeClassName(this.element, this.activeClass);
    // bubbledTextEvent for Menu Bar
    // identify bubbled up text events in Safari so we can ignore them
    Spry.Widget.MenuBar.prototype.bubbledTextEvent = function()
    return Spry.is.safari && (event.target == event.relatedTarget.parentNode || (event.eventPhase == 3 && event.target.parentNode == event.relatedTarget));
    // showSubmenu for Menu Bar
    // set the proper CSS class on this menu to show it
    Spry.Widget.MenuBar.prototype.showSubmenu = function(menu)
    if(this.currMenu)
    this.clearMenus(this.currMenu);
    this.currMenu = null;
    if(menu)
    this.addClassName(menu, this.subVisibleClass);
    if(typeof document.all != 'undefined' && !Spry.is.opera && navigator.vendor != 'KDE')
    if(!this.hasClassName(this.element, this.horizontalClass) || menu.parentNode.parentNode != this.element)
    menu.style.top = menu.parentNode.offsetTop + 'px';
    if(Spry.is.ie && Spry.is.version < 7)
    this.createIframeLayer(menu);
    this.addClassName(this.element, this.activeClass);
    // hideSubmenu for Menu Bar
    // remove the proper CSS class on this menu to hide it
    Spry.Widget.MenuBar.prototype.hideSubmenu = function(menu)
    if(menu)
    this.removeClassName(menu, this.subVisibleClass);
    if(typeof document.all != 'undefined' && !Spry.is.opera && navigator.vendor != 'KDE')
    menu.style.top = '';
    menu.style.left = '';
    if(Spry.is.ie && Spry.is.version < 7)
    this.removeIframeLayer(menu);
    // initialize for Menu Bar
    // create event listeners for the Menu Bar widget so we can properly
    // show and hide submenus
    Spry.Widget.MenuBar.prototype.initialize = function(listitem, element)
    var opentime, closetime;
    var link = listitem.getElementsByTagName('a')[0];
    var submenus = listitem.getElementsByTagName('ul');
    var menu = (submenus.length > 0 ? submenus[0] : null);
    if(menu)
    this.addClassName(link, this.hasSubClass);
    if(!Spry.is.ie)
    // define a simple function that comes standard in IE to determine
    // if a node is within another node
    listitem.contains = function(testNode)
    // this refers to the list item
    if(testNode == null)
    return false;
    if(testNode == this)
    return true;
    else
    return this.contains(testNode.parentNode);
    // need to save this for scope further down
    var self = this;
    this.addEventListener(listitem, 'mouseover', function(e){self.mouseOver(listitem, e);}, false);
    this.addEventListener(listitem, 'mouseout', function(e){if (self.enableKeyboardNavigation) self.clearSelection(); self.mouseOut(listitem, e);}, false);
    if (this.enableKeyboardNavigation)
    this.addEventListener(link, 'blur', function(e){self.onBlur(listitem);}, false);
    this.addEventListener(link, 'focus', function(e){self.keyFocus(listitem, e);}, false);
    Spry.Widget.MenuBar.prototype.keyFocus = function (listitem, e)
    this.lastOpen = listitem.getElementsByTagName('a')[0];
    this.addClassName(this.lastOpen, listitem.getElementsByTagName('ul').length > 0 ? this.subHoverClass : this.hoverClass);
    this.hasFocus = true;
    Spry.Widget.MenuBar.prototype.onBlur = function (listitem)
    this.clearSelection(listitem);
    Spry.Widget.MenuBar.prototype.clearSelection = function(el){
    //search any intersection with the current open element
    if (!this.lastOpen)
    return;
    if (el)
    el = el.getElementsByTagName('a')[0];
    // check children
    var item = this.lastOpen;
    while (item != this.element)
    var tmp = el;
    while (tmp != this.element)
    if (tmp == item)
    return;
    try{
    tmp = tmp.parentNode;
    }catch(err){break;}
    item = item.parentNode;
    var item = this.lastOpen;
    while (item != this.element)
    this.hideSubmenu(item.parentNode);
    var link = item.getElementsByTagName('a')[0];
    this.removeClassName(link, this.hoverClass);
    this.removeClassName(link, this.subHoverClass);
    item = item.parentNode;
    this.lastOpen = false;
    Spry.Widget.MenuBar.prototype.keyDown = function (e)
    if (!this.hasFocus)
    return;
    if (!this.lastOpen)
    this.hasFocus = false;
    return;
    var e = e|| event;
    var listitem = this.lastOpen.parentNode;
    var link = this.lastOpen;
    var submenus = listitem.getElementsByTagName('ul');
    var menu = (submenus.length > 0 ? submenus[0] : null);
    var hasSubMenu = (menu) ? true : false;
    var opts = [listitem, menu, null, this.getSibling(listitem, 'previousSibling'), this.getSibling(listitem, 'nextSibling')];
    if (!opts[3])
    opts[2] = (listitem.parentNode.parentNode.nodeName.toLowerCase() == 'li')?listitem.parentNode.parentNode:null;
    var found = 0;
    switch (e.keyCode){
    case this.upKeyCode:
    found = this.getElementForKey(opts, 'y', 1);
    break;
    case this.downKeyCode:
    found = this.getElementForKey(opts, 'y', -1);
    break;
    case this.leftKeyCode:
    found = this.getElementForKey(opts, 'x', 1);
    break;
    case this.rightKeyCode:
    found = this.getElementForKey(opts, 'x', -1);
    break;
    case this.escKeyCode:
    case 9:
    this.clearSelection();
    this.hasFocus = false;
    default: return;
    switch (found)
    case 0: return;
    case 1:
    //subopts
    this.mouseOver(listitem, e);
    break;
    case 2:
    //parent
    this.mouseOut(opts[2], e);
    break;
    case 3:
    case 4:
    // left - right
    this.removeClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
    break;
    var link = opts[found].getElementsByTagName('a')[0];
    if (opts[found].nodeName.toLowerCase() == 'ul')
    opts[found] = opts[found].getElementsByTagName('li')[0];
    this.addClassName(link, opts[found].getElementsByTagName('ul').length > 0 ? this.subHoverClass : this.hoverClass);
    this.lastOpen = link;
    opts[found].getElementsByTagName('a')[0].focus();
            //stop further event handling by the browser
    return Spry.Widget.MenuBar.stopPropagation(e);
    Spry.Widget.MenuBar.prototype.mouseOver = function (listitem, e)
    var link = listitem.getElementsByTagName('a')[0];
    var submenus = listitem.getElementsByTagName('ul');
    var menu = (submenus.length > 0 ? submenus[0] : null);
    var hasSubMenu = (menu) ? true : false;
    if (this.enableKeyboardNavigation)
    this.clearSelection(listitem);
    if(this.bubbledTextEvent())
    // ignore bubbled text events
    return;
    if (listitem.closetime)
    clearTimeout(listitem.closetime);
    if(this.currMenu == listitem)
    this.currMenu = null;
    // move the focus too
    if (this.hasFocus)
    link.focus();
    // show menu highlighting
    this.addClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
    this.lastOpen = link;
    if(menu && !this.hasClassName(menu, this.subHoverClass))
    var self = this;
    listitem.opentime = window.setTimeout(function(){self.showSubmenu(menu);}, this.showDelay);
    Spry.Widget.MenuBar.prototype.mouseOut = function (listitem, e)
    var link = listitem.getElementsByTagName('a')[0];
    var submenus = listitem.getElementsByTagName('ul');
    var menu = (submenus.length > 0 ? submenus[0] : null);
    var hasSubMenu = (menu) ? true : false;
    if(this.bubbledTextEvent())
    // ignore bubbled text events
    return;
    var related = (typeof e.relatedTarget != 'undefined' ? e.relatedTarget : e.toElement);
    if(!listitem.contains(related))
    if (listitem.opentime)
    clearTimeout(listitem.opentime);
    this.currMenu = listitem;
    // remove menu highlighting
    this.removeClassName(link, hasSubMenu ? this.subHoverClass : this.hoverClass);
    if(menu)
    var self = this;
    listitem.closetime = window.setTimeout(function(){self.hideSubmenu(menu);}, this.hideDelay);
    if (this.hasFocus)
    link.blur();
    Spry.Widget.MenuBar.prototype.getSibling = function(element, sibling)
    var child = element[sibling];
    while (child && child.nodeName.toLowerCase() !='li')
    child = child[sibling];
    return child;
    Spry.Widget.MenuBar.prototype.getElementForKey = function(els, prop, dir)
    var found = 0;
    var rect = Spry.Widget.MenuBar.getPosition;
    var ref = rect(els[found]);
    var hideSubmenu = false;
    //make the subelement visible to compute the position
    if (els[1] && !this.hasClassName(els[1], this.MenuBarSubmenuVisible))
    els[1].style.visibility = 'hidden';
    this.showSubmenu(els[1]);
    hideSubmenu = true;
    var isVert = this.hasClassName(this.element, this.verticalClass);
    var hasParent = els[0].parentNode.parentNode.nodeName.toLowerCase() == 'li' ? true : false;
    for (var i = 1; i < els.length; i++){
    //when navigating on the y axis in vertical menus, ignore children and parents
    if(prop=='y' && isVert && (i==1 || i==2))
    continue;
    //when navigationg on the x axis in the FIRST LEVEL of horizontal menus, ignore children and parents
    if(prop=='x' && !isVert && !hasParent && (i==1 || i==2))
    continue;
    if (els[i])
    var tmp = rect(els[i]);
    if ( (dir * tmp[prop]) < (dir * ref[prop]))
    ref = tmp;
    found = i;
    // hide back the submenu
    if (els[1] && hideSubmenu){
    this.hideSubmenu(els[1]);
    els[1].style.visibility =  '';
    return found;
    Spry.Widget.MenuBar.camelize = function(str)
    if (str.indexOf('-') == -1){
    return str;
    var oStringList = str.split('-');
    var isFirstEntry = true;
    var camelizedString = '';
    for(var i=0; i < oStringList.length; i++)
    if(oStringList[i].length>0)
    if(isFirstEntry)
    camelizedString = oStringList[i];
    isFirstEntry = false;
    else
    var s = oStringList[i];
    camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
    return camelizedString;
    Spry.Widget.MenuBar.getStyleProp = function(element, prop)
    var value;
    try
    if (element.style)
    value = element.style[Spry.Widget.MenuBar.camelize(prop)];
    if (!value)
    if (document.defaultView && document.defaultView.getComputedStyle)
    var css = document.defaultView.getComputedStyle(element, null);
    value = css ? css.getPropertyValue(prop) : null;
    else if (element.currentStyle)
    value = element.currentStyle[Spry.Widget.MenuBar.camelize(prop)];
    catch (e) {}
    return value == 'auto' ? null : value;
    Spry.Widget.MenuBar.getIntProp = function(element, prop)
    var a = parseInt(Spry.Widget.MenuBar.getStyleProp(element, prop),10);
    if (isNaN(a))
    return 0;
    return a;
    Spry.Widget.MenuBar.getPosition = function(el, doc)
    doc = doc || document;
    if (typeof(el) == 'string') {
    el = doc.getElementById(el);
    if (!el) {
    return false;
    if (el.parentNode === null || Spry.Widget.MenuBar.getStyleProp(el, 'display') == 'none') {
    //element must be visible to have a box
    return false;
    var ret = {x:0, y:0};
    var parent = null;
    var box;
    if (el.getBoundingClientRect) { // IE
    box = el.getBoundingClientRect();
    var scrollTop = doc.documentElement.scrollTop || doc.body.scrollTop;
    var scrollLeft = doc.documentElement.scrollLeft || doc.body.scrollLeft;
    ret.x = box.left + scrollLeft;
    ret.y = box.top + scrollTop;
    } else if (doc.getBoxObjectFor) { // gecko
    box = doc.getBoxObjectFor(el);
    ret.x = box.x;
    ret.y = box.y;
    } else { // safari/opera
    ret.x = el.offsetLeft;
    ret.y = el.offsetTop;
    parent = el.offsetParent;
    if (parent != el) {
    while (parent) {
    ret.x += parent.offsetLeft;
    ret.y += parent.offsetTop;
    parent = parent.offsetParent;
    // opera & (safari absolute) incorrectly account for body offsetTop
    if (Spry.is.opera || Spry.is.safari && Spry.Widget.MenuBar.getStyleProp(el, 'position') == 'absolute')
    ret.y -= doc.body.offsetTop;
    if (el.parentNode)
    parent = el.parentNode;
    else
    parent = null;
    if (parent.nodeName){
    var cas = parent.nodeName.toUpperCase();
    while (parent && cas != 'BODY' && cas != 'HTML') {
    cas = parent.nodeName.toUpperCase();
    ret.x -= parent.scrollLeft;
    ret.y -= parent.scrollTop;
    if (parent.parentNode)
    parent = parent.parentNode;
    else
    parent = null;
    return ret;
    Spry.Widget.MenuBar.stopPropagation = function(ev)
    if (ev.stopPropagation)
    ev.stopPropagation();
    else
    ev.cancelBubble = true;
    if (ev.preventDefault)
    ev.preventDefault();
    else
    ev.returnValue = false;
    Spry.Widget.MenuBar.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
    if (!optionsObj)
    return;
    for (var optionName in optionsObj)
    if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
    continue;
    obj[optionName] = optionsObj[optionName];

  • How do I create an input box with a cancel button that will end a loop in my script?

    I have been working on a script for my client and I am having trouble getting it to work properly. I stole most of the code from the PowerShell Tip of the Week "Creating a Custom Input Box". I also took someone's code for the Show-MessageBox function.
    I have slightly modified the original code with two parameters and an additional text box. The first field is for an e-mail address and the second is for an employee number.
    I need to know how I can get a Do Until loop to recognize when the cancel button is pushed and break the loop and effectively end the script. The work happens at the end but perhaps I need something added/modified in the InputBox function.
    I want the script to check to see if anything has been entered in the second text box. If empty it displays a message and calls the InputBox function again. Then if there is something I use elseif to check to see if it matches my RegEx (digits only). If
    it doesn't match it will loop and call the InputBox function again.
    This all works fine. The problem I am having is that I cannot cancel out of the form. I'd like the loop to continue until the second box matches my RegEx or Cancel is clicked. Clicking cancel doesn't break the loop. I need to know how I can stop the loop
    when cancel is pressed. I've seen Stack "Overflow: PowerShell Cancel Button Stop Script" but I don't think this will work in a loop.
    Any help would be awesome. As a note, I DO NOT want to use the VB Interaction stuff.
    function InputBox {
    param ($Name,$EN)
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Text = "Data Entry Form"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
    {$x=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
    {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click({$objForm.Close()})
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Employee Email Address:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    if ($Name) {
    $objTextBox.Text = $Name
    else {
    $objTextBox.Text = "@domain.com"
    $objLabel2 = New-Object System.Windows.Forms.Label
    $objLabel2.Location = New-Object System.Drawing.Size(10,70)
    $objLabel2.Size = New-Object System.Drawing.Size(280,20)
    $objLabel2.Text = "Employee Number:"
    $objForm.Controls.Add($objLabel2)
    $objTextBox2 = New-Object System.Windows.Forms.TextBox
    $objTextBox2.Location = New-Object System.Drawing.Size(10,90)
    $objTextBox2.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Controls.Add($objTextBox2)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate()})
    [void] $objForm.ShowDialog()
    $Script:ButtonName = $objTextBox.Text
    $script:ButtonEN =$objTextBox2.Text
    $ButtonName; $ButtonEN
    Function Show-MessageBox{
    Param(
    [Parameter(Mandatory=$True)][Alias('M')][String]$Msg,
    [Parameter(Mandatory=$False)][Alias('T')][String]$Title = "",
    [Parameter(Mandatory=$False)][Alias('OC')][Switch]$OkCancel,
    [Parameter(Mandatory=$False)][Alias('OCI')][Switch]$AbortRetryIgnore,
    [Parameter(Mandatory=$False)][Alias('YNC')][Switch]$YesNoCancel,
    [Parameter(Mandatory=$False)][Alias('YN')][Switch]$YesNo,
    [Parameter(Mandatory=$False)][Alias('RC')][Switch]$RetryCancel,
    [Parameter(Mandatory=$False)][Alias('C')][Switch]$Critical,
    [Parameter(Mandatory=$False)][Alias('Q')][Switch]$Question,
    [Parameter(Mandatory=$False)][Alias('W')][Switch]$Warning,
    [Parameter(Mandatory=$False)][Alias('I')][Switch]$Informational)
    #Set Message Box Style
    IF($OkCancel){$Type = 1}
    Elseif($AbortRetryIgnore){$Type = 2}
    Elseif($YesNoCancel){$Type = 3}
    Elseif($YesNo){$Type = 4}
    Elseif($RetryCancel){$Type = 5}
    Else{$Type = 0}
    #Set Message box Icon
    If($Critical){$Icon = 16}
    ElseIf($Question){$Icon = 32}
    Elseif($Warning){$Icon = 48}
    Elseif($Informational){$Icon = 64}
    Else{$Icon = 0}
    #Loads the WinForm Assembly, Out-Null hides the message while loading.
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
    #Display the message with input
    $Answer = [System.Windows.Forms.MessageBox]::Show($MSG , $TITLE, $Type, $Icon)
    #Return Answer
    Return $Answer
    $num = "^\d+$"
    do {
    if (!($ButtonEN)) {
    Show-MessageBox -Msg "You must enter a numeric value for the employee number." -Title "Employee Number Missing" -Critical
    InputBox -Name $ButtonName
    elseif ($ButtonEN -notmatch $num) {
    Show-MessageBox -Msg "The employee number must contain numbers only!" -Title "Non-numerical characters found" -Critical
    InputBox -Name $ButtonName
    until ( ($ButtonEN -match $num) -or (<this is where I want to be able to use the cancel button>)

    Here is a simple validation method.
    function New-InputBox{
    param(
    $EmailAddress='',
    $EmployeeNumber=''
    Add-Type -AssemblyName System.Windows.Forms
    $Form=New-Object System.Windows.Forms.Form
    $Form.Text='Data Entry Form'
    $Form.Size='300,200'
    $Form.StartPosition='CenterScreen'
    $OKButton=New-Object System.Windows.Forms.Button
    $OKButton.Location='75,120'
    $OKButton.Size='75,23'
    $OKButton.Text='OK'
    $OKButton.DialogResult='Ok'
    $OKButton.CausesValidation=$true
    $Form.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text ='Cancel'
    $CancelButton.DialogResult='Cancel'
    $CancelButton.CausesValidation=$false
    $Form.Controls.Add($CancelButton)
    $Label1=New-Object System.Windows.Forms.Label
    $Label1.Location='10,20'
    $Label1.Size='280,20'
    $Label1.Text='Employee Email Address:'
    $Form.Controls.Add($Label1)
    $TextBox1=New-Object System.Windows.Forms.TextBox
    $TextBox1.Location='10,40'
    $TextBox1.Size='260,20'
    $textbox1.Name='EmailAddress'
    $textbox1.Text=$EmailAddress
    $Form.Controls.Add($textbox1)
    $Label2=New-Object System.Windows.Forms.Label
    $Label2.Location='10,70'
    $Label2.Size='280,20'
    $Label2.Text='Employee Number:'
    $Form.Controls.Add($Label2)
    $TextBox2=New-Object System.Windows.Forms.TextBox
    $TextBox2.Location='10,90'
    $TextBox2.Size='260,20'
    $TextBox2.Name='EmployeeNumber'
    $TextBox2.Text=$EmployeeNumber
    $Form.Controls.Add($TextBox2)
    $Form.AcceptButton=$OKButton
    $Form.CancelButton=$CancelButton
    $Form.Topmost = $True
    $form1_FormClosing=[System.Windows.Forms.FormClosingEventHandler]{
    if($Form.DialogResult -eq 'OK'){
    if($textbox1.Text -eq ''){
    [void][System.Windows.Forms.MessageBox]::Show('please enter an email address','Validation Error')
    $_.Cancel=$true
    }else{
    # Check empno is all digits
    if("$($TextBox2.Text)" -notmatch '^\d+$'){
    [void][System.Windows.Forms.MessageBox]::Show('please enter a number "999999"','Validation Error')
    $_.Cancel=$true
    $form.add_FormClosing($form1_FormClosing)
    $Form.Add_Shown({$Form.Activate()})
    if($Form.ShowDialog() -eq 'Ok'){
    # return the form contents
    $Form
    if($f=New-InputBox -EmailAddress [email protected]){
    'Email is:{0} for Employee:{1}' -f $f.Controls['EmailAddress'].Text,$f.Controls['EmployeeNumber'].Text
    }else{
    Write-Host 'From cancelled!' -ForegroundColor red
    ¯\_(ツ)_/¯

  • How can I create a box with the option of either a check or "N/A"?

    Hi there guys, just a quick question which has been bugging me for days now!
    I have a form in which I need to have a check box, but when the box is not checked I need it to show up as "N/A", is that possible?
    I have tried using a dropdown box instead. Making one of the options a capital "P" and setting the font to Wingdings 2 makes it appear as a check. This however makes it impossible for me to type in "N/A" as the other option because the font is set to Wingdings 2!
    Any help would be greatly appreciated
    I am using Adobe Acrobat X Pro on Windows 7
    Thank you
    Clint

    Have you ever seen a paper form work this way?
    Have you ever seen an electronic form work this way?
    You can have a text field next to the check box that show "N/A" when the check box is not selected.
    Or if you like to do a lot of coding, use a check box and then overlay the check box with a text box to display the "N/A" and you can work out how switch between the 2 fields if one wants to uncheck the item.

  • Is there any hope of apple adding a 're-link with media folder'-type function to iTunes?

    Is there any hope of apple adding a 're-link with media folder'-type function to iTunes?
    I have 1000s of broken links after installing the latest version of iTunes and updating some files in my media folder. The location of my itunes library has not changed, and all the files are there (I know because I've just waited several hours for the files to be updated by my ultra-slow computer) - by my logic, there should be some menu option that simply re-synchronises with the media folder, just like itunes would do with an ipod - it can't be that hard can it? The only way I can restore a link is by clicking every song (I have over 28,000) and locating the file in the folder that iTunes claims to use as its media folder - the new version 10 option of then using this location to restore all broken links doesn't work because it only looks in the specific album file, and after a couple of times this dialog box no longer even comes up, so I couldn't ask it to do this even if I wanted to. At the moment the only option I can see is to completely wipe iTunes and re-load all my music from scratch - using my tired and over-worked computer this will realistically take around 15 hours that I don't have, and my computer will melt in the process. I wish I'd never tried to 'tidy up' my iTunes library...
    PLEASE Apple, how hard can it be to have a function that searches for and restores broken links by itself????? I've told you where the music is - just flipping look for it yourself instead of getting me to do it!

    You don't have to re-rip, re-import or re-download all your content. You can clear the iTunes library, either by selecting all in the libary and pressing the Delete key, saying "no" when it asks if you want to remove the files themselves, and then use the Add To Library command, selecting the iTunes Media folder (or iTunes Music folder, as applicable to your situation), and that will add back all your content. It shouldn't take more than a few minutes; if it does, something may be amiss with your hard drive or the library file is corrupted (in which case just delete the library file and re-do the Add To Library command).
    Regards.

  • Manual WSDL creation with Complex data types

    I'm trying to manually generate a WSDL, for a bpel workflow, so the wsdl constructs do not come from a Java class file, or any of the other normal ways you might generate a WSDL.
    I have successfully created a Definition object from the WSDLFactory, with the code shown below, that appears to be correct, based on reverse engineering of a WS compliant WSDL. The reversed engineered WSDL was created by IONA Artix.
    When I use file WSDLFactoryImpl.WSDLWriterImpl.writeWSDL() to write the WSDL file I get the wsdl:types and wsdl:service definition objectsin the file, but not the wsdl:message, wsdl:portType or wsdl:binding objects.
    The reverse engineered WSDL file has been imported into objects via WSDLReaderImpl, and the resulting Definition object appears correct (based on all system.outs). This definition can be successfully written to file via the same WSDLFactoryImpl.WSDLWriterImpl.writeWSDL(). which results in a correct WSDL file.
    I'm hoping someone can spot my problem.
    Chris Yoerg
    WSDLFactory.java************************************************************************************************
    package com.dralasoft.bpel.util;
    import java.util.*;
    import java.io.*;
    import javax.xml.namespace.QName;
    import javax.xml.parsers.*;
    import javax.wsdl.WSDLException;
    import javax.wsdl.extensions.UnknownExtensibilityElement;
    import org.w3c.dom.*;
    import com.ibm.wsdl.*;
    import com.ibm.wsdl.factory.WSDLFactoryImpl;
    import com.ibm.wsdl.extensions.soap.*;
    /** This class generates a wsdl from scratch
    * the way the namespaces have been left seem to be correct in that the individual
    * porttype, binding and service objects pick up the message parts as seen in the
    * individual system.outs and in the system.out of the definition
    * if you use the tns prefix iteration as seen in the comment out "trial" code
    * you get an error that the tns namespace does not exist in the definition
    * even though it is definitely there
    * the non namespace "trial" code also behaves the same way as this iteration,
    * aka the stuff shows in the definition outputs, but never ends up outputed to
    * file */
    //import com.dralasoft.bpel.BPELWorkflow;
    public class WSDLFactory {
    public WSDLFactory() {
    public void makeWorkflowWSDL(){
    WSDLFactoryImpl factory = null;
    Constants constants = new Constants();
    SOAPConstants soapconstants = new SOAPConstants();
    try {
    factory = (WSDLFactoryImpl) WSDLFactoryImpl.newInstance();
    catch (WSDLException we) {
    System.out.println("wsdl excepiotn " + we.getMessage());
    // get a new definition from the factory
    DefinitionImpl definition = (DefinitionImpl) factory.newDefinition();
    // add target namespace and additional namespaces that might be there
    definition.setTargetNamespace("http://www.yoerg.net");
    definition.addNamespace("tns", "http://www.yoerg.net");
    definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
    definition.addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
    definition.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
    // added for generic purposes
    definition.addNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    // specify the service name
    QName qname = new QName("http://www.yoerg.net",
    "PurchaseOrderProcess");
    definition.setQName(qname);
    // create types **********************************************************
    TypesImpl types = (TypesImpl) definition.createTypes();
    // generate a schema in DOM to set into the types object
    javax.xml.parsers.DocumentBuilderFactory domfactory =
    javax.xml.parsers.DocumentBuilderFactory.newInstance();
    javax.xml.parsers.DocumentBuilder builder = null;
    try {
    builder = domfactory.newDocumentBuilder();
    catch (javax.xml.parsers.ParserConfigurationException pce) {
    System.out.println("parser config exception " + pce.getMessage());
    DOMImplementation dImpl = builder.getDOMImplementation();
    // namespace for the schema
    String namespaceURI = "http://www.w3.org/2001/XMLSchema";
    Document doc = dImpl.createDocument(namespaceURI, "schema", null);
    Element schema = doc.getDocumentElement();
    //schema.setPrefix("xsd");
    schema.setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");
    schema.setAttribute("targetNamespace", "http://www.yoerg.net");
    //set other namespaces on schema
    // this doesn't make it into the schema at final save, because there
    // are no wsdl elements inside the box
    schema.setAttribute("xmlns:wsdl", "http://schemas.xmlsoap.org/wsdl/");
    // this is not needed
    schema.setAttribute("tns", "http://www.yoerg.net");
    Element first = doc.createElement("element");
    first.setAttribute("name", "sendPurchaseOrder");
    first.setAttribute("type", "tns:sendPORequest");
    schema.appendChild(first);
    Element fourth = doc.createElement("element");
    fourth.setAttribute("name", "sendSchedule");
    fourth.setAttribute("type", "tns:sendScheduleRequest");
    schema.appendChild(fourth);
    Element fifth = doc.createElement("element");
    fifth.setAttribute("name", "sendInvoice");
    fifth.setAttribute("type", "tns:sendInvoiceRequest");
    schema.appendChild(fifth);
    // now add correlations
    Element corfirst = doc.createElement("element");
    corfirst.setAttribute("name", "correlations");
    corfirst.setAttribute("type", "tns:correlationset");
    schema.appendChild(corfirst);
    Element second = doc.createElement("element");
    second.setAttribute("name", "portType");
    second.setAttribute("type", "xsd:string");
    schema.appendChild(second);
    Element third = doc.createElement("element");
    third.setAttribute("name", "partnerLink");
    third.setAttribute("type", "xsd:string");
    schema.appendChild(third);
    // sequence element thats used over and over
    Element sequence = null;
    Element sixth = doc.createElement("complexType");
    sixth.setAttribute("name", "sendPORequest");
    sequence = doc.createElement("sequence");
    Element part1 = doc.createElement("element");
    part1.setAttribute("name", "customerId");
    part1.setAttribute("type", "xsd:long");
    sequence.appendChild(part1);
    Element part2 = doc.createElement("element");
    part2.setAttribute("name", "purchaseOrderNumber");
    part2.setAttribute("type", "xsd:long");
    sequence.appendChild(part2);
    Element part3 = doc.createElement("element");
    part3.setAttribute("name", "productId");
    part3.setAttribute("type", "xsd:long");
    sequence.appendChild(part3);
    Element part4 = doc.createElement("element");
    part4.setAttribute("name", "quantity");
    part4.setAttribute("type", "xsd:int");
    sequence.appendChild(part4);
    sixth.appendChild(sequence);
    schema.appendChild(sixth);
    Element seventh = doc.createElement("complexType");
    seventh.setAttribute("name", "sendScheduleRequest");
    sequence = doc.createElement("sequence");
    Element part6 = doc.createElement("element");
    part6.setAttribute("name", "shipDate");
    part6.setAttribute("type", "xsd:dateTime");
    sequence.appendChild(part6);
    Element part7 = doc.createElement("element");
    part7.setAttribute("name", "customerId");
    part7.setAttribute("type", "xsd:long");
    sequence.appendChild(part7);
    Element part8 = doc.createElement("element");
    part8.setAttribute("name", "purchaseOrderNumber");
    part8.setAttribute("type", "xsd:long");
    sequence.appendChild(part8);
    seventh.appendChild(sequence);
    schema.appendChild(seventh);
    Element eighth = doc.createElement("complexType");
    eighth.setAttribute("name", "sendInvoiceRequest");
    sequence = doc.createElement("sequence");
    Element part5 = doc.createElement("element");
    part5.setAttribute("name", "price");
    part5.setAttribute("type", "xsd:double");
    sequence.appendChild(part5);
    Element part9 = doc.createElement("element");
    part9.setAttribute("name", "customerId");
    part9.setAttribute("type", "xsd:long");
    sequence.appendChild(part9);
    Element part10 = doc.createElement("element");
    part10.setAttribute("name", "purchaseOrderNumber");
    part10.setAttribute("type", "xsd:long");
    sequence.appendChild(part10);
    eighth.appendChild(sequence);
    schema.appendChild(eighth);
    Element ninth = doc.createElement("complexType");
    ninth.setAttribute("name", "correlationset");
    sequence = doc.createElement("sequence");
    Element part11 = doc.createElement("element");
    part11.setAttribute("name", "PurchaseOrder");
    part11.setAttribute("type", "tns:correlationsetvalues");
    sequence.appendChild(part11);
    ninth.appendChild(sequence);
    schema.appendChild(ninth);
    Element tenth = doc.createElement("complexType");
    tenth.setAttribute("name", "correlationsetvalues");
    sequence = doc.createElement("sequence");
    Element part12 = doc.createElement("element");
    part12.setAttribute("name", "PurchaseOrderNumber");
    part12.setAttribute("type", "xsd:string");
    sequence.appendChild(part12);
    Element part13 = doc.createElement("element");
    part13.setAttribute("name", "customerID");
    part13.setAttribute("type", "xsd:string");
    sequence.appendChild(part13);
    tenth.appendChild(sequence);
    schema.appendChild(tenth);
    // show the schema w3c element via conversion JDOM Element and coversion to string
    org.jdom.input.DOMBuilder jdbuilder = new org.jdom.input.DOMBuilder();
    org.jdom.Element jelement = jdbuilder.build(schema);
    //System.out.println("\njelement " + jelement);
    org.jdom.output.XMLOutputter xmloutput = new org.jdom.output.XMLOutputter();
    xmloutput.setIndent(" ");
    xmloutput.setNewlines(true);
    xmloutput.setTrimAllWhite(true);
    xmloutput.setTextTrim(true);
    xmloutput.setEncoding("ISO-8859-1");
    String strelement = xmloutput.outputString(jelement);
    System.out.println("schema in jdom = \n " + strelement);
    UnknownExtensibilityElement extel = new UnknownExtensibilityElement();
    extel.setElement(schema);
    extel.setElementType(new QName(Constants.Q_ELEM_XSD_2001.getNamespaceURI(),
    schema.getLocalName()));
    types.addExtensibilityElement(extel);
    // the above is preferrable to this
    //types.setDocumentationElement(schema);
    //System.out.println("schema " + schema);
    // and set the types definiton back to the definition object
    definition.setTypes(types);
    // these lines all show null or empty on system.out.println
    //System.out.println("\ntypes " + types);
    // end of setting the types
    // add the messages*******************************************************
    MessageImpl message1 = (MessageImpl)definition.createMessage();
    QName messageqname= new QName("http://www.yoerg.net", "newMessage");
    message1.setQName(messageqname);
    PartImpl partma = (PartImpl)definition.createPart();
    partma.setName("sendPurchaseOrderBody");
    partma.setElementName(new QName("http://www.yoerg.net", "sendPurchaseOrder"));
    message1.addPart(partma);
    partma = (PartImpl)definition.createPart();
    partma.setName("correlationsBody");
    partma.setElementName(new QName("http://www.yoerg.net", "correlations"));
    message1.addPart(partma);
    partma = (PartImpl)definition.createPart();
    partma.setName("portTypeBody");
    partma.setElementName(new QName("http://www.yoerg.net", "portType"));
    message1.addPart(partma);
    partma = (PartImpl)definition.createPart();
    partma.setName("partnerLinkBody");
    partma.setElementName(new QName("http://www.yoerg.net", "partnerLink"));
    message1.addPart(partma);
    definition.addMessage(message1);
    // create new blank message for response, with no parts
    MessageImpl message2 = (MessageImpl)definition.createMessage();
    QName messageqname2= new QName("http://www.yoerg.net", "sendPurchaseOrderResponseMessage");
    message2.setQName(messageqname2);
    definition.addMessage(message2);
    System.out.println("\nmessage1 " + message1);
    System.out.println("\nmessage2 " + message2);
    //Map map = message.getParts();
    //Element mes = message.getDocumentationElement();
    //System.out.println("\nmessage map = " + map);
    // done adding messages
    // add the porttypes******************************************************
    PortTypeImpl porttype = (PortTypeImpl)definition.createPortType();
    porttype.setQName(new QName("http://www.yoerg.net", "purchaseOrderPortType"));
    OperationImpl operation = (OperationImpl)definition.createOperation();
    operation.setName("sendMyPurchaseOrder");
    operation.setStyle(javax.wsdl.OperationType.REQUEST_RESPONSE);
    InputImpl input = (InputImpl)definition.createInput();
    input.setName("sendPurchaseOrderRequest");
    input.setMessage(message1);
    operation.setInput(input);
    OutputImpl output = (OutputImpl)definition.createOutput();
    output.setName("sendPurchaseOrderResponse");
    output.setMessage(message2);
    operation.setOutput(output);
    porttype.addOperation(operation);
    System.out.println("\nporttype " + porttype);
    definition.addPortType(porttype);
    // done adding the porttypes
    // add the bindings*******************************************************
    BindingImpl binding = (BindingImpl)definition.createBinding();
    binding.setQName(new QName("http://www.yoerg.net",
    "purchaseOrderSOAPBinding"));
    binding.setPortType(porttype);
    SOAPBindingImpl bindingextension = new SOAPBindingImpl();
    bindingextension.setStyle("document");
    bindingextension.setTransportURI("http://schemas.xmlsoap.org/soap/http");
    //System.out.println("binding extension " + bindingextension);
    binding.addExtensibilityElement(bindingextension);
    BindingOperationImpl bindingoperation
    = (BindingOperationImpl)definition.createBindingOperation();
    bindingoperation.setName("sendMyPurchaseOrder");
    bindingoperation.setOperation(operation);
    // this is not present in the Imported correct version, and these lines of code
    // are not necessary, but they also do not hurt or help
    //SOAPOperationImpl operationextension = new SOAPOperationImpl();
    //operationextension.setStyle("document");
    //operationextension.setSoapActionURI("");
    ///////operationextension.setElementType(new QName("http://www.yoerg.net", "ListenerService"));
    //operationextension.setRequired(new Boolean(true));
    //bindingoperation.addExtensibilityElement(operationextension);
    BindingInputImpl bindinginput
    = (BindingInputImpl)definition.createBindingInput();
    bindinginput.setName("sendPurchaseOrderRequest");
    SOAPBodyImpl inputextension = new SOAPBodyImpl();
    inputextension.setUse("literal");
    inputextension.setRequired(new Boolean(true));
    inputextension.setNamespaceURI("http://www.yoerg.net");
    bindinginput.addExtensibilityElement(inputextension);
    //System.out.println("\ninputextension " + inputextension);
    bindingoperation.setBindingInput(bindinginput);
    BindingOutputImpl bindingoutput
    = (BindingOutputImpl)definition.createBindingOutput();
    bindingoutput.setName("sendPurchaseOrderResponse");
    SOAPBodyImpl outputextension = new SOAPBodyImpl();
    outputextension.setUse("literal");
    outputextension.setRequired(new Boolean(true));
    outputextension.setNamespaceURI("http://www.yoerg.net");
    bindingoutput.addExtensibilityElement(outputextension);
    //System.out.println("\noutputextension " + outputextension);
    bindingoperation.setBindingOutput(bindingoutput);
    binding.addBindingOperation(bindingoperation);
    System.out.println("\nbinding " + binding);
    definition.addBinding(binding);
    // done adding binding
    // adding service*********************************************************
    ServiceImpl service = (ServiceImpl)definition.createService();
    service.setQName(new QName("http://www.yoerg.net",
    "ListenerServiceService"));
    PortImpl port = (PortImpl)definition.createPort();
    port.setBinding(binding);
    port.setName("ListenerService");
    SOAPAddressImpl soapaddress = new SOAPAddressImpl();
    soapaddress
    .setLocationURI("http://localhost:8080/axis/services/ListenerService");
    port.addExtensibilityElement(soapaddress);
    service.addPort(port);
    definition.addService(service);
    System.out.println("\nService " + service);
    // done adding service
    // print def object, and you will see all objects, except types
    System.out.println("\ndefinition \n" + definition);
    // output to file, just like we would in bpel workflow environment
    com.ibm.wsdl.xml.WSDLWriterImpl writer
    = (com.ibm.wsdl.xml.WSDLWriterImpl)factory.newWSDLWriter();
    File file = new File("c:\\chris\\w.wsdl");
    FileOutputStream out = null;
    // this has been proven to be correct
    try{
    out = new FileOutputStream(file);
    writer.writeWSDL(definition, out);
    catch(FileNotFoundException fnfe){
    System.out.println("file not found " + fnfe.getMessage());
    catch(IOException ioe){
    System.out.println("file not found " + ioe.getMessage());
    catch(javax.wsdl.WSDLException we){
    System.out.println("wsdl exception " + we.getMessage());
    // now bring it back in just for fun
    FileInputStream in = null;
    byte[] inputfile = null;
    org.jdom.Document jdocument = null;
    try{
    in = new FileInputStream(file);
    inputfile = new byte[in.available()];
    in.read(inputfile, 0, in.available());
    org.jdom.input.SAXBuilder jdombuilder = new org.jdom.input.SAXBuilder();
    ByteArrayInputStream byteinput = new ByteArrayInputStream(inputfile);
    jdocument = jdombuilder.build(byteinput);
    catch(FileNotFoundException fnfe){
    System.out.println("file not found " + fnfe.getMessage());
    catch(org.jdom.JDOMException jde){
    System.out.println("jdom exception " + jde.getMessage());
    catch(IOException ioe){
    System.out.println("io exception " + ioe.getMessage());
    String strdocument = xmloutput.outputString(jdocument);
    System.out.println("\nJDOM beautified version \n" + strdocument);
    public static void main(String[] args){
    WSDLFactory factory = new WSDLFactory();
    factory.makeWorkflowWSDL();
    End ofWSDLFactory.java*********************************************************************
    Desired WSDL output to file******************************************************************
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions name="PurchaseOrderProcess" targetNamespace="http://www.yoerg.net"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:http-conf="http://schemas.iona.com/transports/http/configuration"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://www.yoerg.net" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <types>
    <schema targetNamespace="http://www.yoerg.net"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <element name="sendPurchaseOrder" type="tns:sendPORequest"/>
    <element name="correlations" type="tns:correlationset"/>
    <element name="portType" type="xsd:string"/>
    <element name="partnerLink" type="xsd:string"/>
    <element name="sendSchedule" type="tns:sendScheduleRequest"/>
    <element name="sendInvoice" type="tns:sendInvoiceRequest"/>
    <complexType name="correlationsetvalues">
    <sequence>
    <element name="PurchaseOrderNumber" type="xsd:string"/>
    <element name="customerID" type="xsd:string"/>
    </sequence>
    </complexType>
    <complexType name="correlationset">
    <sequence>
    <element name="PurchaseOrder" type="tns:correlationsetvalues"/>
    </sequence>
    </complexType>
    <complexType name="sendPORequest">
    <sequence>
    <element name="customerId" type="xsd:long"/>
    <element name="purchaseOrderNumber" type="xsd:long"/>
    <element name="productId" type="xsd:long"/>
    <element name="quantity" type="xsd:int"/>
    </sequence>
    </complexType>
    <complexType name="sendScheduleRequest">
    <sequence>
    <element name="shipDate" type="xsd:dateTime"/>
    <element name="customerId" type="xsd:long"/>
    <element name="purchaseOrderNumber" type="xsd:long"/>
    </sequence>
    </complexType>
    <complexType name="sendInvoiceRequest">
    <sequence>
    <element name="price" type="xsd:double"/>
    <element name="customerId" type="xsd:long"/>
    <element name="purchaseOrderNumber" type="xsd:long"/>
    </sequence>
    </complexType>
    </schema>
    </types>
    <message name="newMessage">
    <part element="tns:sendPurchaseOrder" name="sendPurchaseOrderBody"/>
    <part element="tns:correlations" name="correlationsBody"/>
    <part element="tns:portType" name="portTypeBody"/>
    <part element="tns:partnerLink" name="partnerLinkBody"/>
    </message>
    <message name="sendPurchaseOrderResponseMessage"/>
    <message name="sendScheduleRequestMessage">
    <part element="tns:sendSchedule" name="sendScheduleBody"/>
    <part element="tns:correlations" name="correlationBody"/>
    <part element="tns:portType" name="portTypeBody"/>
    <part element="tns:partnerLink" name="partnerLinkBody"/>
    </message>
    <message name="sendInvoiceRequestMessage">
    <part element="tns:sendInvoice" name="sendInvoiceBody"/>
    <part element="tns:correlations" name="correlationsBody"/>
    <part element="tns:portType" name="portTypeBody"/>
    <part element="tns:partnerLink" name="partnerLinkBody"/>
    </message>
    <portType name="purchaseOrderPortType">
    <operation name="sendMyPurchaseOrder">
    <input message="tns:newMessage" name="sendPurchaseOrderRequest"/>
    <output message="tns:sendPurchaseOrderResponseMessage"
    name="sendPurchaseOrderResponse"/>
    </operation>
    <operation name="sendMySchedule">
    <input message="tns:sendScheduleRequestMessage" name="sendMySchedule"/>
    </operation>
    <operation name="sendInvoice">
    <input message="tns:sendInvoiceRequestMessage" name="sendInvoice"/>
    </operation>
    </portType>
    <binding name="purchaseOrderSOAPBinding" type="tns:purchaseOrderPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="sendMyPurchaseOrder">
    <soap:operation soapAction="" style="document"/>
    <input name="sendPurchaseOrderRequest">
    <soap:body use="literal"/>
    </input>
    <output name="sendPurchaseOrderResponse">
    <soap:body use="literal"/>
    </output>
    </operation>
    <operation name="sendMySchedule">
    <soap:operation soapAction="" style="document"/>
    <input name="sendMySchedule">
    <soap:body use="literal"/>
    </input>
    </operation>
    <operation name="sendInvoice">
    <soap:operation soapAction="" style="document"/>
    <input name="sendInvoice">
    <soap:body use="literal"/>
    </input>
    </operation>
    </binding>
    <service name="ListenerServiceService">
    <port binding="tns:purchaseOrderSOAPBinding" name="ListenerService">
    <soap:address location="http://localhost:8080/axis/services/ListenerService"/>
    <http-conf:client/>
    <http-conf:server/>
    </port>
    </service>
    </definitions>
    End of desired WSDL*************************************************************************************

    Adding these statements solved the problem
    message1.setUndefined(false);
    message2.setUndefined(false);
    binding.setUndefined(false);
    operation.setUndefined(false);
    porttype.setUndefined(false);
    This is kind of weird because you explicitly define them thru API calls, and this call seems redundant.
    Chris Yoerg

  • How to add a list box with values for a ztable in SM30

    Hello Gurus,
                    I had created a table maintenance for Ztable and added many extra functionality to that. Now i would like to add a list box or check table for a field. Can i do that with out Regenerating my table maintenance. Please help me its..very urgent.

    Have referred this domain to the data element, this should be the Field type in ur table for the particular field.
    Eg: <b>SE11 > table name > fields-ZTEST > fieldtype-ZZTEST</b>
    ZZTEST in the data element > create a domain for this data element and in that specify teh value range.
    Save and activate it.
    Make sure that u regenerate teh table maintenance generator else u cant see the changes.
    Now if u press F4 u can see only thevalues specified, also u will see only the list box with values in SM30.
    Try this,please let me know if u face any difficulties.

Maybe you are looking for

  • 60 gb video vibration

    can anyone tell me if my video ipod should vibrate in my hand while playing? I assume its from the hard drive there is no indication of any malfunction other than the vibration. My concern is that this may be a precurser to a underlying problem. this

  • Sync'ing Files Between Computers

    I've just invested in a MacBook Pro to go along with my iMac in my daily workflow. I have one folder where I save all my work files (graphic designer). What I'm trying to do is find a way where I can have a copy of this folder on each Mac, and it wil

  • Is it ok to leave your iphone plugged in all day even if the battery is fully charged?

    The icon over the battery changes to a plug after it has been fully charged so to me it seems as though the phone is running off of power from the cable. Am I right in this assumption or am I damaging my battery?

  • Feature request - document security

    - Add touchid support and/or a passcode - Allow documents to be removed from the recent documents list, including those opened via mobile link (and/or require touchid/passcode to open)

  • Slow IP based printing

    Has anyone had/fixed a problem with slow printing from IP based printers? When we installed the printers (various printer makes and models too, it's not just related to one brand) they all worked just fine and responded normally. It seems that over t