Ignore:
Timestamp:
2012-07-13T23:57:26+02:00 (12 years ago)
Author:
simon04
Message:

Change signature of method introduced in r5322 to avoid problems such as #7851

File:
1 edited

Legend:

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

    r5330 r5331  
    2525import java.awt.event.WindowEvent;
    2626import java.util.ArrayList;
     27import java.util.Arrays;
    2728import java.util.Collection;
    28 import java.util.Collections;
     29import java.util.LinkedList;
    2930import java.util.List;
    3031
     
    757758    }
    758759
    759     @SuppressWarnings("unchecked")
    760760    protected Component createLayout(Component data, boolean scroll, Collection<SideButton> buttons) {
    761         return createLayout(data, scroll, Collections.singletonList(buttons));
    762     }
    763 
    764     protected Component createLayout(Component data, boolean scroll, List<Collection<SideButton>> buttons) {
     761        return createLayout(data, scroll, buttons, (Collection<SideButton>[]) null);
     762    }
     763
     764    protected Component createLayout(Component data, boolean scroll, Collection<SideButton> firstButtons, Collection<SideButton>... nextButtons) {
    765765        if (scroll) {
    766766            data = new JScrollPane(data);
    767767        }
     768        LinkedList<Collection<SideButton>> buttons = new LinkedList<Collection<SideButton>>();
     769        buttons.addFirst(firstButtons);
     770        if (nextButtons != null) {
     771            buttons.addAll(Arrays.asList(nextButtons));
     772        }
    768773        add(data, BorderLayout.CENTER);
    769         if (buttons != null && buttons.size() > 0 && buttons.get(0) != null && !buttons.get(0).isEmpty()) {
     774        if (buttons.size() > 0 && buttons.get(0) != null && !buttons.get(0).isEmpty()) {
    770775            buttonsPanel = new JPanel(new GridLayout(buttons.size(), 1));
    771776            for (Collection<SideButton> buttonRow : buttons) {
     777                if (buttonRow == null) {
     778                    continue;
     779                }
    772780                final JPanel buttonRowPanel = new JPanel(Main.pref.getBoolean("dialog.align.left", false)
    773781                        ? new FlowLayout(FlowLayout.LEFT) : new GridLayout(1, buttonRow.size()));
Note: See TracChangeset for help on using the changeset viewer.