Ignore:
Timestamp:
2014-01-17T01:49:03+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #8417 - info GPX layer window not resizeable

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

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

    r6380 r6708  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
     7import java.awt.Component;
     8import java.awt.Dimension;
    79import java.awt.event.ActionEvent;
    810import java.util.ArrayList;
     
    1719
    1820import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.gui.ExtendedDialog;
    1922import org.openstreetmap.josm.gui.layer.Layer;
    2023import org.openstreetmap.josm.gui.layer.Layer.LayerAction;
     
    3033    public final static class InfoAction extends AbstractAction {
    3134        private final Layer layer;
     35       
     36        /**
     37         * Constructs a new {@code InfoAction} for the given layer.
     38         * @param layer The layer
     39         */
    3240        public InfoAction(Layer layer) {
    3341            super(tr("Info"), ImageProvider.get("info"));
     
    3543            this.layer = layer;
    3644        }
     45       
    3746        @Override
    3847        public void actionPerformed(ActionEvent e) {
    39             JOptionPane.showMessageDialog(
    40                     Main.parent,
    41                     layer.getInfoComponent(),
    42                     tr("Information about layer"),
    43                     JOptionPane.INFORMATION_MESSAGE
    44             );
     48            Object object = layer.getInfoComponent();
     49            if (object instanceof Component) {
     50                ExtendedDialog ed = new ExtendedDialog(
     51                        Main.parent, tr("Information about layer"),
     52                        new String[] {tr("OK")});
     53                ed.setButtonIcons(new String[] {"ok"});
     54                ed.setIcon(JOptionPane.INFORMATION_MESSAGE);
     55                ed.setContent((Component) object);
     56                ed.setResizable(layer.isInfoResizable());
     57                ed.setMinimumSize(new Dimension(270, 170));
     58                ed.showDialog();
     59            } else {
     60                JOptionPane.showMessageDialog(
     61                        Main.parent, object,
     62                        tr("Information about layer"),
     63                        JOptionPane.INFORMATION_MESSAGE
     64                        );
     65            }
    4566        }
    4667    }
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r6666 r6708  
    221221
    222222        final JScrollPane sp = new JScrollPane(new HtmlPanel(info.toString()));
    223         sp.setPreferredSize(new Dimension(sp.getPreferredSize().width, 350));
     223        sp.setPreferredSize(new Dimension(sp.getPreferredSize().width+20, 370));
    224224        SwingUtilities.invokeLater(new Runnable() {
    225225            @Override
     
    229229        });
    230230        return sp;
     231    }
     232   
     233    @Override
     234    public boolean isInfoResizable() {
     235        return true;
    231236    }
    232237
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r6084 r6708  
    184184
    185185    /**
     186     * Determines if info dialog can be resized (false by default).
     187     * @return {@code true} if the info dialog can be resized, {@code false} otherwise
     188     * @since 6708
     189     */
     190    public boolean isInfoResizable() {
     191        return false;
     192    }
     193
     194    /**
    186195     * Returns list of actions. Action can implement LayerAction interface when it needs to be represented by other
    187196     * menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also
Note: See TracChangeset for help on using the changeset viewer.