Changeset 9211 in josm


Ignore:
Timestamp:
2015-12-29T14:37:40+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #12252 - combine dialog: add minimum size and better initial divider location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java

    r9193 r9211  
    330330        getContentPane().add(pnlButtons, BorderLayout.SOUTH);
    331331        validate();
    332         int numTagDecisions = getTagConflictResolverModel().getNumDecisions();
    333         int numRelationDecisions = getRelationMemberConflictResolverModel().getNumDecisions();
    334         if (numTagDecisions > 0 && numRelationDecisions > 0) {
    335             spTagConflictTypes.setDividerLocation(0.5);
    336         }
     332        adjustDividerLocation();
    337333        pnlRelationMemberConflictResolver.prepareForEditing();
    338334    }
     
    354350        if (visible) {
    355351            prepareGUIBeforeConflictResolutionStarts();
     352            setMinimumSize(new Dimension(400, 400));
    356353            new WindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(Main.parent,
    357354                    new Dimension(800, 600))).applySafe(this);
     
    411408    }
    412409
     410    private void adjustDividerLocation() {
     411        int numTagDecisions = getTagConflictResolverModel().getNumDecisions();
     412        int numRelationDecisions = getRelationMemberConflictResolverModel().getNumDecisions();
     413        if (numTagDecisions > 0 && numRelationDecisions > 0) {
     414            double nTop = 1.0 + numTagDecisions;
     415            double nBottom = 2.5 + numRelationDecisions;
     416            spTagConflictTypes.setDividerLocation(nTop/(nTop+nBottom));
     417        }
     418    }
     419
    413420    class AdjustDividerLocationAction extends WindowAdapter {
    414421        @Override
    415422        public void windowOpened(WindowEvent e) {
    416             int numTagDecisions = getTagConflictResolverModel().getNumDecisions();
    417             int numRelationDecisions = getRelationMemberConflictResolverModel().getNumDecisions();
    418             if (numTagDecisions > 0 && numRelationDecisions > 0) {
    419                 spTagConflictTypes.setDividerLocation(0.5);
    420             }
     423            adjustDividerLocation();
    421424        }
    422425    }
Note: See TracChangeset for help on using the changeset viewer.