Ignore:
Timestamp:
2014-09-11T19:27:03+02:00 (5 years ago)
Author:
Don-vip
Message:

see #10462 - more debug stuff, improve javadoc

File:
1 edited

Legend:

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

    r7524 r7527  
    2929import org.openstreetmap.josm.tools.WindowGeometry;
    3030
     31/**
     32 * Manager allowing to show/hide history dialogs.
     33 * @since 2019
     34 */
    3135public class HistoryBrowserDialogManager implements MapView.LayerChangeListener {
     36
    3237    private static HistoryBrowserDialogManager instance;
     38
     39    /**
     40     * Replies the unique instance.
     41     * @return the unique instance
     42     */
    3343    public static HistoryBrowserDialogManager getInstance() {
    3444        if (instance == null) {
     
    4555    }
    4656
     57    /**
     58     * Determines if an history dialog exists for the given object id.
     59     * @param id the object id
     60     * @return {@code true} if an history dialog exists for the given object id, {@code false} otherwise
     61     */
    4762    public boolean existsDialog(long id) {
    4863        return dialogs.containsKey(id);
    4964    }
    5065
    51     public void show(long id, HistoryBrowserDialog dialog) {
     66    protected void show(long id, HistoryBrowserDialog dialog) {
    5267        if (dialogs.values().contains(dialog)) {
    5368            show(id);
     
    6075                Main.debug("#10462 - JFrame.isDefaultLookAndFeelDecorated: "+JFrame.isDefaultLookAndFeelDecorated());
    6176                Main.debug("#10462 - dialog.isUndecorated: "+dialog.isUndecorated());
     77                Main.debug("#10462 - UIManager.getLookAndFeel: "+UIManager.getLookAndFeel());
    6278                Main.debug("#10462 - LookAndFeel.getSupportsWindowDecorations: "+UIManager.getLookAndFeel().getSupportsWindowDecorations());
    6379                Main.debug("#10462 - JRootPane.getWindowDecorationStyle: "+dialog.getRootPane().getWindowDecorationStyle());
    6480                Main.debug("#10462 - Window.getIconImages: "+dialog.getIconImages());
    6581                Main.debug("#10462 - Dialog.getTitle: "+dialog.getTitle());
     82                Main.debug("#10462 - Dialog.getInsets: "+dialog.getInsets());
    6683            }
    6784            dialogs.put(id, dialog);
     
    6986    }
    7087
    71     public void show(long id) {
     88    protected void show(long id) {
    7289        if (dialogs.keySet().contains(id)) {
    7390            dialogs.get(id).toFront();
     
    87104    final String WINDOW_GEOMETRY_PREF = getClass().getName() + ".geometry";
    88105
    89     public void placeOnScreen(HistoryBrowserDialog dialog) {
     106    protected void placeOnScreen(HistoryBrowserDialog dialog) {
    90107        WindowGeometry geometry = new WindowGeometry(WINDOW_GEOMETRY_PREF, WindowGeometry.centerOnScreen(new Dimension(850, 500)));
    91108        geometry.applySafe(dialog);
    92109        Point p = dialog.getLocation();
    93         while(hasDialogWithCloseUpperLeftCorner(p)) {
     110        while (hasDialogWithCloseUpperLeftCorner(p)) {
    94111            p.x += 20;
    95112            p.y += 20;
     
    98115    }
    99116
     117    /**
     118     * Hides the specified history dialog and cleans associated resources.
     119     * @param dialog History dialog to hide
     120     */
    100121    public void hide(HistoryBrowserDialog dialog) {
    101122        long id = 0;
     
    129150    }
    130151
     152    /**
     153     * Show history dialog for the given history.
     154     * @param h History to show
     155     */
    131156    public void show(History h) {
    132157        if (h == null)
     
    151176    public void layerRemoved(Layer oldLayer) {
    152177        // remove all history browsers if the number of layers drops to 0
    153         //
    154178        if (Main.isDisplayingMapView() && Main.map.mapView.getNumLayers() == 0) {
    155179            hideAll();
     
    157181    }
    158182
     183    /**
     184     * Show history dialog(s) for the given primitive(s).
     185     * @param primitives The primitive(s) for which history will be displayed
     186     */
    159187    public void showHistory(final Collection<? extends PrimitiveId> primitives) {
    160188        final Collection<? extends PrimitiveId> notNewPrimitives = Utils.filter(primitives, notNewPredicate);
Note: See TracChangeset for help on using the changeset viewer.