1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | import java.awt.BorderLayout;
|
---|
5 | import java.awt.FlowLayout;
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.ActionListener;
|
---|
8 |
|
---|
9 | import javax.swing.JFrame;
|
---|
10 | import javax.swing.JLabel;
|
---|
11 | import javax.swing.JPanel;
|
---|
12 | import javax.swing.JTextField;
|
---|
13 |
|
---|
14 | import org.junit.Ignore;
|
---|
15 | import org.openstreetmap.josm.Main;
|
---|
16 | import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
|
---|
17 | import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
|
---|
18 |
|
---|
19 | @Ignore
|
---|
20 | public class UploadStrategySelectionPanelTest extends JFrame {
|
---|
21 |
|
---|
22 | private UploadStrategySelectionPanel uploadStrategySelectionPanel;
|
---|
23 |
|
---|
24 | protected void build() {
|
---|
25 | getContentPane().setLayout(new BorderLayout());
|
---|
26 | uploadStrategySelectionPanel = new UploadStrategySelectionPanel();
|
---|
27 | getContentPane().add(uploadStrategySelectionPanel, BorderLayout.CENTER);
|
---|
28 | getContentPane().add(buildControlPanel(), BorderLayout.SOUTH);
|
---|
29 | setSize(400, 400);
|
---|
30 | }
|
---|
31 |
|
---|
32 | protected JPanel buildControlPanel() {
|
---|
33 | JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
---|
34 | pnl.add(new JLabel("Num objects:"));
|
---|
35 | final JTextField tf;
|
---|
36 | pnl.add(tf = new JTextField(8));
|
---|
37 | tf.addActionListener(
|
---|
38 | new ActionListener() {
|
---|
39 | public void actionPerformed(ActionEvent arg0) {
|
---|
40 | int n = 0;
|
---|
41 | try {
|
---|
42 | n = Integer.parseInt(tf.getText());
|
---|
43 | } catch (NumberFormatException e) {
|
---|
44 | Main.error(e);
|
---|
45 | return;
|
---|
46 | }
|
---|
47 | uploadStrategySelectionPanel.setNumUploadedObjects(n);
|
---|
48 | }
|
---|
49 | }
|
---|
50 | );
|
---|
51 | return pnl;
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Constructs a new {@code UploadStrategySelectionPanelTest}.
|
---|
56 | */
|
---|
57 | public UploadStrategySelectionPanelTest() {
|
---|
58 | build();
|
---|
59 | uploadStrategySelectionPanel.setNumUploadedObjects(51000);
|
---|
60 | }
|
---|
61 |
|
---|
62 | public static void main(String[] args) throws OsmApiInitializationException, OsmTransferCanceledException {
|
---|
63 | OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE);
|
---|
64 | new UploadStrategySelectionPanelTest().setVisible(true);
|
---|
65 | }
|
---|
66 | }
|
---|