Changeset 7586 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-09-26T13:10:26+02:00 (10 years ago)
Author:
Don-vip
Message:

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

File:
1 edited

Legend:

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

    r6084 r7586  
    1818import javax.swing.JButton;
    1919import javax.swing.JDialog;
     20import javax.swing.JLabel;
    2021import javax.swing.JOptionPane;
    2122import javax.swing.JPanel;
     
    3435/**
    3536 * This is an extended dialog for resolving conflict between {@link OsmPrimitive}s.
    36  *
     37 * @since 1622
    3738 */
    3839public class ConflictResolutionDialog extends JDialog implements PropertyChangeListener {
    3940    /** the conflict resolver component */
    4041    private ConflictResolver resolver;
     42    private JLabel titleLabel;
    4143
    4244    private ApplyResolutionAction applyResolutionAction;
     
    109111    protected void build() {
    110112        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     113        getContentPane().setLayout(new BorderLayout());
     114
     115        titleLabel = new JLabel();
     116        titleLabel.setHorizontalAlignment(JLabel.CENTER);
     117        getContentPane().add(titleLabel, BorderLayout.NORTH);
     118
    111119        updateTitle();
    112         getContentPane().setLayout(new BorderLayout());
    113120
    114121        resolver = new ConflictResolver();
     
    123130    }
    124131
     132    /**
     133     * Constructs a new {@code ConflictResolutionDialog}.
     134     * @param parent parent component
     135     */
    125136    public ConflictResolutionDialog(Component parent) {
    126137        super(JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);
    127138        build();
    128     }
    129 
     139        pack();
     140        if (getInsets().top > 0) {
     141            titleLabel.setVisible(false);
     142        }
     143    }
     144
     145    /**
     146     * Replies the conflict resolver component.
     147     * @return the conflict resolver component
     148     */
    130149    public ConflictResolver getConflictResolver() {
    131150        return resolver;
     
    238257
    239258    @Override
     259    public void setTitle(String title) {
     260        super.setTitle(title);
     261        if (titleLabel != null) {
     262            titleLabel.setText(title);
     263        }
     264    }
     265
     266    @Override
    240267    public void propertyChange(PropertyChangeEvent evt) {
    241268        if (evt.getPropertyName().equals(ConflictResolver.MY_PRIMITIVE_PROP)) {
Note: See TracChangeset for help on using the changeset viewer.