Changeset 7528 in josm for trunk/src


Ignore:
Timestamp:
2014-09-12T01:04:39+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #10462 - Include object type and id in history for undecorated windows

Location:
trunk/src/org/openstreetmap/josm/gui/history
Files:
2 edited

Legend:

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

    r6743 r7528  
    1616import javax.swing.JComponent;
    1717import javax.swing.JDialog;
     18import javax.swing.JLabel;
    1819import javax.swing.JOptionPane;
    1920import javax.swing.JPanel;
     
    4041    private HistoryBrowser browser;
    4142    private CloseAction closeAction;
     43    private JLabel titleLabel;
    4244
    4345    /**
     
    5961    }
    6062
     63    @Override
     64    public void setTitle(String title) {
     65        super.setTitle(title);
     66        if (titleLabel != null) {
     67            titleLabel.setText(title);
     68        }
     69    }
     70
    6171    /**
    6272     * builds the GUI
    63      *
    6473     */
    6574    protected void build() {
    6675        setLayout(new BorderLayout());
     76
     77        titleLabel = new JLabel();
     78        titleLabel.setHorizontalAlignment(JLabel.CENTER);
     79        add(titleLabel, BorderLayout.NORTH);
     80
    6781        browser = new HistoryBrowser();
    6882        add(browser, BorderLayout.CENTER);
     
    92106
    93107    /**
    94      * constructor
     108     * Constructs a new {@code HistoryBrowserDialog}.
    95109     *
    96      * @param history  the history to be displayed
     110     * @param history the history to be displayed
    97111     */
    98112    public HistoryBrowserDialog(History history) {
     
    101115        setHistory(history);
    102116        renderTitle(history);
     117        pack();
     118        if (getInsets().top > 0) {
     119            titleLabel.setVisible(false);
     120        }
    103121        HistoryDataSet.getInstance().addHistoryDataSetListener(this);
    104122        addWindowListener(new WindowClosingAdapter());
     
    106124
    107125    /**
    108      * sets the current history
     126     * Sets the current history.
    109127     * @param history
    110128     */
     
    113131    }
    114132
     133    /**
     134     * Removes this history browser model as listener for data change and layer change events.
     135     */
    115136    public void unlinkAsListener() {
    116137        getHistoryBrowser().getModel().unlinkAsListener();
     
    174195    }
    175196
     197    /**
     198     * Replies the history browser.
     199     * @return the history browser
     200     */
    176201    public HistoryBrowser getHistoryBrowser() {
    177202        return browser;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r7527 r7528  
    1212import java.util.Map;
    1313
    14 import javax.swing.JDialog;
    15 import javax.swing.JFrame;
    1614import javax.swing.JOptionPane;
    1715import javax.swing.SwingUtilities;
    18 import javax.swing.UIManager;
    1916
    2017import org.openstreetmap.josm.Main;
     
    7067            placeOnScreen(dialog);
    7168            dialog.setVisible(true);
    72             // Debug stuff for #10462
    73             if (Main.isDebugEnabled()) {
    74                 Main.debug("#10462 - JDialog.isDefaultLookAndFeelDecorated: "+JDialog.isDefaultLookAndFeelDecorated());
    75                 Main.debug("#10462 - JFrame.isDefaultLookAndFeelDecorated: "+JFrame.isDefaultLookAndFeelDecorated());
    76                 Main.debug("#10462 - dialog.isUndecorated: "+dialog.isUndecorated());
    77                 Main.debug("#10462 - UIManager.getLookAndFeel: "+UIManager.getLookAndFeel());
    78                 Main.debug("#10462 - LookAndFeel.getSupportsWindowDecorations: "+UIManager.getLookAndFeel().getSupportsWindowDecorations());
    79                 Main.debug("#10462 - JRootPane.getWindowDecorationStyle: "+dialog.getRootPane().getWindowDecorationStyle());
    80                 Main.debug("#10462 - Window.getIconImages: "+dialog.getIconImages());
    81                 Main.debug("#10462 - Dialog.getTitle: "+dialog.getTitle());
    82                 Main.debug("#10462 - Dialog.getInsets: "+dialog.getInsets());
    83             }
    8469            dialogs.put(id, dialog);
    8570        }
Note: See TracChangeset for help on using the changeset viewer.