Skip to content

Commit

Permalink
Fix layout of MapillaryChangesetDialog
Browse files Browse the repository at this point in the history
Previously the title bar of the ToggleDialog wasn't displayed, this is now fixed.
  • Loading branch information
floscher committed Feb 2, 2017
1 parent 7fc10af commit a872571
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
Expand Down Expand Up @@ -52,12 +53,14 @@ public final class MapillaryChangesetDialog extends ToggleDialog implements Mapi
private final JSeparator separator = new JSeparator();
private final Component spacer = Box.createRigidArea(new Dimension(0, 3));

private final JScrollPane mainPane;
private final SideButton submitButton = new SideButton(new MapillarySubmitCurrentChangesetAction(this));
private final JPanel uploadPendingPanel = new JPanel();
private final JProgressBar uploadPendingProgress = new JProgressBar();

private final ConcurrentHashMap<Object, MapillaryAbstractImage> map;

private final Container rootComponent = new JPanel(new BorderLayout());

/**
* Destroys the unique instance of the class.
*/
Expand All @@ -75,6 +78,7 @@ private MapillaryChangesetDialog() {
),
200
);
createLayout(rootComponent, false, Collections.singletonList(submitButton));

this.map = new ConcurrentHashMap<>();

Expand All @@ -86,12 +90,10 @@ private MapillaryChangesetDialog() {

JPanel treesPanel = new JPanel(new GridBagLayout());
treesPanel.add(this.spacer, GBC.eol());
this.spacer.setVisible(false);
treesPanel.add(this.changesetTree, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
this.separator.setVisible(false);
treesPanel.add(this.separator, GBC.eol().fill(GridBagConstraints.HORIZONTAL));
treesPanel.add(Box.createRigidArea(new Dimension(0, 0)), GBC.std().weight(0, 1));
mainPane = new JScrollPane(treesPanel);
rootComponent.add(new JScrollPane(treesPanel), BorderLayout.CENTER);

uploadPendingProgress.setIndeterminate(true);
uploadPendingProgress.setString(tr("Submitting changeset to server…"));
Expand Down Expand Up @@ -130,16 +132,14 @@ private void buildTree() {
}

public void setUploadPending(final boolean isUploadPending) {
removeAll();
if (isUploadPending) {
setLayout(new BorderLayout());
add(mainPane, BorderLayout.CENTER);
add(uploadPendingProgress, BorderLayout.SOUTH);
rootComponent.add(uploadPendingProgress, BorderLayout.SOUTH);
} else {
createLayout(mainPane, false, Collections.singletonList(this.submitButton));
rootComponent.remove(uploadPendingProgress);
}
revalidate();
repaint();
submitButton.setEnabled(!isUploadPending && !MapillaryLayer.getInstance().getLocationChangeset().isEmpty());
rootComponent.revalidate();
rootComponent.repaint();
}

@Override
Expand Down

0 comments on commit a872571

Please sign in to comment.