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 |
|
---|
33 | protected JPanel buildControlPanel() {
|
---|
34 | JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
---|
35 | pnl.add(new JLabel("Num objects:"));
|
---|
36 | final JTextField tf;
|
---|
37 | pnl.add(tf = new JTextField(8));
|
---|
38 | tf.addActionListener(
|
---|
39 | new ActionListener() {
|
---|
40 | public void actionPerformed(ActionEvent arg0) {
|
---|
41 | int n = 0;
|
---|
42 | try {
|
---|
43 | n = Integer.parseInt(tf.getText());
|
---|
44 | } catch(NumberFormatException e) {
|
---|
45 | Main.error(e);
|
---|
46 | return;
|
---|
47 | }
|
---|
48 | uploadStrategySelectionPanel.setNumUploadedObjects(n);
|
---|
49 | }
|
---|
50 | }
|
---|
51 | );
|
---|
52 | return pnl;
|
---|
53 | }
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Constructs a new {@code UploadStrategySelectionPanelTest}.
|
---|
57 | */
|
---|
58 | public UploadStrategySelectionPanelTest() {
|
---|
59 | build();
|
---|
60 | uploadStrategySelectionPanel.setNumUploadedObjects(51000);
|
---|
61 | }
|
---|
62 |
|
---|
63 | public static void main(String args[]) throws OsmApiInitializationException, OsmTransferCanceledException{
|
---|
64 | OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE);
|
---|
65 | new UploadStrategySelectionPanelTest().setVisible(true);
|
---|
66 | }
|
---|
67 | }
|
---|