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