001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032:
033: package com.vividsolutions.jump.workbench.ui.plugin.wms;
034:
035: import java.awt.Color;
036: import java.awt.Dimension;
037: import java.awt.GridBagConstraints;
038: import java.awt.GridBagLayout;
039: import java.awt.Insets;
040: import java.util.List;
041: import java.util.Map;
042:
043: import javax.swing.JLabel;
044: import javax.swing.JPanel;
045: import javax.swing.JTextField;
046:
047: import com.vividsolutions.jts.util.Assert;
048: import com.vividsolutions.jump.I18N;
049: import com.vividsolutions.jump.workbench.ui.InputChangedListener;
050: import com.vividsolutions.jump.workbench.ui.wizard.WizardPanel;
051: import com.vividsolutions.jump.coordsys.CoordinateSystem;
052: import com.vividsolutions.jump.coordsys.impl.PredefinedCoordinateSystems;
053:
054: public class OneSRSWizardPanel extends JPanel implements WizardPanel {
055: private Map dataMap;
056: private GridBagLayout gridBagLayout1 = new GridBagLayout();
057: private JLabel srsLabel = new JLabel();
058: private JPanel fillerPanel = new JPanel();
059: private JTextField textField = new JTextField();
060:
061: public OneSRSWizardPanel() {
062: try {
063: jbInit();
064: textField.setFont(new JLabel().getFont());
065: } catch (Exception ex) {
066: ex.printStackTrace();
067: }
068: }
069:
070: public void add(InputChangedListener listener) {
071: }
072:
073: public void remove(InputChangedListener listener) {
074: }
075:
076: public String getInstructions() {
077: return I18N
078: .get("ui.plugin.wms.OneSRSWizardPanel.the-layers-you-have-chosen-support-only-one-coordinate-system");
079: }
080:
081: void jbInit() throws Exception {
082: srsLabel
083: .setText(I18N
084: .get("ui.plugin.wms.OneSRSWizardPanel.select-coordinate-reference-system"));
085: this .setLayout(gridBagLayout1);
086: textField.setEnabled(false);
087: textField.setOpaque(false);
088: textField.setPreferredSize(new Dimension(125, 21));
089: textField.setDisabledTextColor(Color.black);
090: textField.setEditable(false);
091: textField.setText("jTextField1");
092: this .add(srsLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
093: GridBagConstraints.CENTER, GridBagConstraints.NONE,
094: new Insets(0, 0, 0, 4), 0, 0));
095: this .add(fillerPanel, new GridBagConstraints(2, 10, 1, 1, 1.0,
096: 1.0, GridBagConstraints.CENTER,
097: GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
098: this .add(textField, new GridBagConstraints(1, 1, 1, 1, 0.0,
099: 0.0, GridBagConstraints.CENTER,
100: GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
101: }
102:
103: public void exitingToRight() {
104: }
105:
106: public void enteredFromLeft(Map dataMap) {
107: this .dataMap = dataMap;
108:
109: List commonSRSList = (List) dataMap
110: .get(MapLayerWizardPanel.COMMON_SRS_LIST_KEY);
111: Assert.isTrue(commonSRSList.size() == 1);
112: String srs = (String) commonSRSList.get(0);
113: dataMap.put(SRSWizardPanel.SRS_KEY, srs);
114:
115: String stringToShow = SRSUtils.getName(srs);
116: textField.setText(stringToShow);
117: }
118:
119: public String getTitle() {
120: return I18N
121: .get("ui.plugin.wms.OneSRSWizardPanel.select-coordinate-reference-system");
122: }
123:
124: public String getID() {
125: return getClass().getName();
126: }
127:
128: public boolean isInputValid() {
129: return true;
130: }
131:
132: public String getNextID() {
133: return null;
134: }
135: }
|