source: josm/trunk/src/org/openstreetmap/josm/gui/oauth/OsmPrivilegesPanel.java@ 6340

Last change on this file since 6340 was 6066, checked in by stoecker, 11 years ago

see #8875 - more oauth rights

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.oauth;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.GridBagConstraints;
7import java.awt.GridBagLayout;
8import java.awt.Insets;
9
10import javax.swing.BorderFactory;
11import javax.swing.JCheckBox;
12import javax.swing.JPanel;
13
14import org.openstreetmap.josm.data.oauth.OsmPrivileges;
15import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel;
16
17public class OsmPrivilegesPanel extends VerticallyScrollablePanel{
18
19 private JCheckBox cbWriteApi;
20 private JCheckBox cbWriteGpx;
21 private JCheckBox cbReadGpx;
22 private JCheckBox cbWritePrefs;
23 private JCheckBox cbReadPrefs;
24 private JCheckBox cbModifyNotes;
25
26 protected void build() {
27 setLayout(new GridBagLayout());
28 GridBagConstraints gc = new GridBagConstraints();
29 setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
30
31 // checkbox for "allow to upload map data"
32 //
33 gc.anchor = GridBagConstraints.NORTHWEST;
34 gc.fill = GridBagConstraints.HORIZONTAL;
35 gc.weightx = 1.0;
36 gc.insets = new Insets(0,0,3,3);
37 add(cbWriteApi = new JCheckBox(), gc);
38 cbWriteApi.setText(tr("Allow to upload map data"));
39 cbWriteApi.setToolTipText(tr("Select to grant JOSM the right to upload map data on your behalf"));
40 cbWriteApi.setSelected(true);
41
42 // checkbox for "allow to upload gps traces"
43 //
44 gc.gridy = 1;
45 add(cbWriteGpx = new JCheckBox(), gc);
46 cbWriteGpx.setText(tr("Allow to upload GPS traces"));
47 cbWriteGpx.setToolTipText(tr("Select to grant JOSM the right to upload GPS traces on your behalf"));
48 cbWriteGpx.setSelected(true);
49
50 // checkbox for "allow to download private gps traces"
51 //
52 gc.gridy = 2;
53 add(cbReadGpx = new JCheckBox(), gc);
54 cbReadGpx.setText(tr("Allow to download your private GPS traces"));
55 cbReadGpx.setToolTipText(tr("Select to grant JOSM the right to download your private GPS traces into JOSM layers"));
56 cbReadGpx.setSelected(true);
57
58 // checkbox for "allow to download private gps traces"
59 //
60 gc.gridy = 3;
61 add(cbReadPrefs = new JCheckBox(), gc);
62 cbReadPrefs.setText(tr("Allow to read your preferences"));
63 cbReadPrefs.setToolTipText(tr("Select to grant JOSM the right to read your server preferences"));
64 cbReadPrefs.setSelected(true);
65
66 // checkbox for "allow to download private gps traces"
67 //
68 gc.gridy = 4;
69 add(cbWritePrefs = new JCheckBox(), gc);
70 cbWritePrefs.setText(tr("Allow to write your preferences"));
71 cbWritePrefs.setToolTipText(tr("Select to grant JOSM the right to write your server preferences"));
72 cbWritePrefs.setSelected(true);
73
74 gc.gridy = 5;
75 add(cbModifyNotes = new JCheckBox(), gc);
76 cbModifyNotes.setText(tr("Allow modifications of notes"));
77 cbModifyNotes.setToolTipText(tr("Select to grant JOSM the right to modify notes on your behalf"));
78 cbModifyNotes.setSelected(true);
79
80 // filler - grab remaining space
81 gc.gridy = 6;
82 gc.fill = GridBagConstraints.BOTH;
83 gc.weightx = 1.0;
84 gc.weighty = 1.0;
85 add(new JPanel(), gc);
86 }
87
88 public OsmPrivilegesPanel() {
89 build();
90 }
91
92 /**
93 * Replies the currently entered privileges
94 *
95 * @return the privileges
96 */
97 public OsmPrivileges getPrivileges() {
98 OsmPrivileges privileges = new OsmPrivileges();
99 privileges.setAllowWriteApi(cbWriteApi.isSelected());
100 privileges.setAllowWriteGpx(cbWriteGpx.isSelected());
101 privileges.setAllowReadGpx(cbReadGpx.isSelected());
102 privileges.setAllowWritePrefs(cbWritePrefs.isSelected());
103 privileges.setAllowReadPrefs(cbReadPrefs.isSelected());
104 privileges.setAllowModifyNotes(cbModifyNotes.isSelected());
105 return privileges;
106 }
107}
Note: See TracBrowser for help on using the repository browser.