Changeset 16034 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r15902 r16034 118 118 119 119 // Only return cached size, item is not shown 120 if (!list.isShowing() && item.pref feredWidth != -1 && item.prefferedHeight != -1) {120 if (!list.isShowing() && item.preferredWidth != -1 && item.preferredHeight != -1) { 121 121 if (index == -1) { 122 lbl.setPreferredSize(new Dimension(item.pref feredWidth, 10));122 lbl.setPreferredSize(new Dimension(item.preferredWidth, 10)); 123 123 } else { 124 lbl.setPreferredSize(new Dimension(item.pref feredWidth, item.prefferedHeight));124 lbl.setPreferredSize(new Dimension(item.preferredWidth, item.preferredHeight)); 125 125 } 126 126 return lbl; … … 144 144 145 145 // Cache size 146 item.pref feredWidth = lbl.getPreferredSize().width;147 item.pref feredHeight = lbl.getPreferredSize().height;146 item.preferredWidth = lbl.getPreferredSize().width; 147 item.preferredHeight = lbl.getPreferredSize().height; 148 148 149 149 // We do not want the editor to have the maximum height of all … … 229 229 230 230 /** Cached width (currently only for Combo) to speed up preset dialog initialization */ 231 public int pref feredWidth = -1; // NOSONAR231 public int preferredWidth = -1; // NOSONAR 232 232 /** Cached height (currently only for Combo) to speed up preset dialog initialization */ 233 public int pref feredHeight = -1; // NOSONAR233 public int preferredHeight = -1; // NOSONAR 234 234 235 235 /** -
trunk/src/org/openstreetmap/josm/gui/util/MultiLineFlowLayout.java
r12799 r16034 10 10 11 11 /** 12 * This is an extension of the flow layout that prefer es wrapping the text instead of increasing the component width12 * This is an extension of the flow layout that prefers wrapping the text instead of increasing the component width 13 13 * when there is not enough space. 14 14 * <p> 15 * This allows for a better pref fered size computation.15 * This allows for a better preferred size computation. 16 16 * It should be used in all places where a flow layout fills the full width of the parent container. 17 17 * <p> -
trunk/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java
r12800 r16034 52 52 53 53 container.invalidate(); 54 Dimension pref fered= container.getPreferredSize();55 assertEquals(TEST_WIDHT, pref fered.width);56 assertEquals(100, pref fered.height);54 Dimension preferredSize = container.getPreferredSize(); 55 assertEquals(TEST_WIDHT, preferredSize.width); 56 assertEquals(100, preferredSize.height); 57 57 58 58 Dimension minimum = container.getMinimumSize(); … … 70 70 container.setBorder(BorderFactory.createEmptyBorder(3, 0, 7, 0)); 71 71 container.invalidate(); 72 Dimension pref fered= container.getPreferredSize();73 assertEquals(TEST_WIDHT, pref fered.width);74 assertEquals(110, pref fered.height);72 Dimension preferredSize = container.getPreferredSize(); 73 assertEquals(TEST_WIDHT, preferredSize.width); 74 assertEquals(110, preferredSize.height); 75 75 76 76 // This should force wrapping 77 77 container.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 40)); 78 78 container.invalidate(); 79 pref fered= container.getPreferredSize();80 assertEquals(TEST_WIDHT, pref fered.width);81 assertEquals(200, pref fered.height);79 preferredSize = container.getPreferredSize(); 80 assertEquals(TEST_WIDHT, preferredSize.width); 81 assertEquals(200, preferredSize.height); 82 82 } 83 83 … … 91 91 container.setLayout(new MultiLineFlowLayout(FlowLayout.LEADING, 20, 10)); 92 92 container.invalidate(); 93 Dimension pref fered= container.getPreferredSize();94 assertEquals(TEST_WIDHT, pref fered.width);95 assertEquals(230, pref fered.height);93 Dimension preferredSize = container.getPreferredSize(); 94 assertEquals(TEST_WIDHT, preferredSize.width); 95 assertEquals(230, preferredSize.height); 96 96 } 97 97
Note:
See TracChangeset
for help on using the changeset viewer.