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