Changeset 1841 in josm


Ignore:
Timestamp:
Jul 25, 2009 5:36:42 PM (4 years ago)
Author:
Gubaer
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java

    r1838 r1841  
    2828 */ 
    2929public class ConditionalOptionPaneUtil { 
     30    static public final int DIALOG_DISABLED_OPTION = Integer.MIN_VALUE; 
    3031 
    3132    /** 
     
    5556    } 
    5657 
     58    /** 
     59     * Displays an confirmation dialog with some option buttons given by <code>optionType</code>. 
     60     * It is always on top even if there are other open windows like detached dialogs, 
     61     * relation editors, history browsers and the like. 
     62     *  
     63     * Set <code>optionType</code> to {@see JOptionPane#YES_NO_OPTION} for a dialog with a YES and 
     64     * a NO button. 
     65 
     66     * Set <code>optionType</code> to {@see JOptionPane#YES_NO_CANCEL_OPTION} for a dialog with a YES, 
     67     * a NO and a CANCEL button 
     68     *  
     69     * Replies true, if the selected option is equal to <code>trueOption</code>, otherwise false. 
     70     * Replies true, if the dialog is not displayed because the respective preference option 
     71     * <code>preferenceKey</code> is set to false. 
     72     *  
     73     * @param preferenceKey the preference key 
     74     * @param parent  the parent component 
     75     * @param message  the message 
     76     * @param title the title 
     77     * @param optionType  the option type 
     78     * @param messageType the message type 
     79     * @param options a list of options 
     80     * @param defaultOption the default option 
     81     *  
     82     *  
     83     * @return the index of the selected option. {@see JOptionPane#CLOSED_OPTION} if the dialog was closed. 
     84     * {@see ConditionalOptionPaneUtil#DIALOG_DISABLED_OPTION} if the dialog is disabled. 
     85     *  
     86     */ 
     87    static public int showOptionDialog(String preferenceKey, Component parent, Object message, String title, int optionType, int messageType, Object [] options, Object defaultOption) throws HeadlessException { 
     88        if (!getDialogShowingEnabled(preferenceKey)) 
     89            return DIALOG_DISABLED_OPTION; 
     90        MessagePanel pnl = new MessagePanel(preferenceKey, message); 
     91        int ret = OptionPaneUtil.showOptionDialog(parent, pnl, title, optionType, messageType, options,defaultOption); 
     92        pnl.remeberDialogShowingEnabled(); 
     93        return ret; 
     94    } 
    5795 
    5896    /** 
Note: See TracChangeset for help on using the changeset viewer.