01: /*
02: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
03: * for visualizing and manipulating spatial features with geometry and attributes.
04: *
05: * Copyright (C) 2003 Vivid Solutions
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: *
21: * For more information, contact:
22: *
23: * Vivid Solutions
24: * Suite #1A
25: * 2328 Government Street
26: * Victoria BC V8T 5G5
27: * Canada
28: *
29: * (250)385-6040
30: * www.vividsolutions.com
31: */
32:
33: package com.vividsolutions.jump.workbench.ui;
34:
35: import java.awt.BorderLayout;
36: import java.awt.GridBagConstraints;
37: import java.awt.GridBagLayout;
38: import java.awt.Insets;
39:
40: import javax.swing.JCheckBox;
41: import javax.swing.JPanel;
42:
43: import com.vividsolutions.jts.util.Assert;
44: import com.vividsolutions.jump.I18N;
45: import com.vividsolutions.jump.util.Blackboard;
46: import com.vividsolutions.jump.workbench.ui.cursortool.editing.SnapVerticesOp;
47:
48: public class SnapVerticesToolsOptionsPanel extends JPanel implements
49: OptionsPanel {
50: private BorderLayout borderLayout1 = new BorderLayout();
51: private JPanel jPanel1 = new JPanel();
52: private GridBagLayout gridBagLayout1 = new GridBagLayout();
53: private JCheckBox insertVerticesCheckBox = new JCheckBox();
54: private JPanel jPanel2 = new JPanel();
55: private Blackboard blackboard;
56:
57: public SnapVerticesToolsOptionsPanel(Blackboard blackboard) {
58: this .blackboard = blackboard;
59:
60: try {
61: jbInit();
62: } catch (Exception e) {
63: Assert.shouldNeverReachHere(e.toString());
64: }
65: }
66:
67: public String validateInput() {
68: return null;
69: }
70:
71: public void okPressed() {
72: blackboard.put(SnapVerticesOp.INSERT_VERTICES_IF_NECESSARY_KEY,
73: insertVerticesCheckBox.isSelected());
74: }
75:
76: public void init() {
77: insertVerticesCheckBox.setSelected(blackboard.get(
78: SnapVerticesOp.INSERT_VERTICES_IF_NECESSARY_KEY, true));
79: }
80:
81: private void jbInit() throws Exception {
82: this .setLayout(borderLayout1);
83: jPanel1.setLayout(gridBagLayout1);
84: insertVerticesCheckBox
85: .setText(I18N
86: .get("ui.SnapVerticeToolsOptionsPanel.insert-vertex-if-none-in-segment"));
87: this .add(jPanel1, BorderLayout.CENTER);
88: jPanel1.add(insertVerticesCheckBox, new GridBagConstraints(0,
89: 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
90: GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0,
91: 0));
92: jPanel1.add(jPanel2, new GridBagConstraints(1, 1, 1, 1, 1.0,
93: 1.0, GridBagConstraints.CENTER,
94: GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
95: }
96: }
|