Revision 309 org.gvsig.raster.osm/trunk/org.gvsig.raster.osm/org.gvsig.raster.osm.swing/org.gvsig.raster.osm.swing.impl/src/main/java/org/gvsig/raster/osm/swing/impl/AddOSMLayerPanelImpl.java
AddOSMLayerPanelImpl.java | ||
---|---|---|
44 | 44 |
import javax.swing.BorderFactory; |
45 | 45 |
import javax.swing.JButton; |
46 | 46 |
import javax.swing.JComponent; |
47 |
import javax.swing.JLabel; |
|
47 | 48 |
import javax.swing.JOptionPane; |
48 | 49 |
import javax.swing.JPanel; |
49 | 50 |
import javax.swing.JScrollPane; |
... | ... | |
54 | 55 |
|
55 | 56 |
import org.gvsig.i18n.Messages; |
56 | 57 |
import org.gvsig.raster.osm.swing.AddOSMLayerPanel; |
58 |
import org.gvsig.tools.ToolsLocator; |
|
59 |
import org.gvsig.tools.i18n.I18nManager; |
|
57 | 60 |
|
58 | 61 |
import org.slf4j.Logger; |
59 | 62 |
import org.slf4j.LoggerFactory; |
... | ... | |
71 | 74 |
private JTable tableServerList = null; |
72 | 75 |
private String propertiesFileName = "osmservers.properties"; |
73 | 76 |
private JPanel buttonsPanel = null; |
77 |
private JPanel crsWarningPanel = null; |
|
74 | 78 |
private JPanel selectedServerPanel = null; |
75 | 79 |
private String[] columnNames = null; |
76 | 80 |
private JButton addServerButton = null; |
... | ... | |
78 | 82 |
private JButton removeServerButton = null; |
79 | 83 |
private AddServerPanel serverPanel = null; |
80 | 84 |
private MouseListener mouseListener = null; |
85 |
private JLabel crsWarningLabel = null; |
|
86 |
private boolean showCrsWarning = false; |
|
81 | 87 |
|
82 |
public AddOSMLayerPanelImpl(File pathToServerList) { |
|
83 |
if(pathToServerList != null) |
|
84 |
this.pathToServerList = pathToServerList; |
|
85 |
else |
|
86 |
this.pathToServerList = new File(System.getProperty("user.home")); |
|
87 |
columnNames = new String[]{ |
|
88 |
Messages.getText("name"), |
|
89 |
Messages.getText("url"), |
|
90 |
Messages.getText("levels"), |
|
91 |
Messages.getText("format"),}; |
|
92 |
init(); |
|
93 |
} |
|
94 | 88 |
|
89 |
public AddOSMLayerPanelImpl(File pathToServerList) { |
|
90 |
this(pathToServerList, false); |
|
91 |
} |
|
92 |
|
|
93 |
public AddOSMLayerPanelImpl(File pathToServerList, boolean showCrsWarning) { |
|
94 |
if (pathToServerList != null) { |
|
95 |
this.pathToServerList = pathToServerList; |
|
96 |
} else { |
|
97 |
this.pathToServerList = new File(System.getProperty("user.home")); |
|
98 |
} |
|
99 |
this.showCrsWarning = showCrsWarning; |
|
100 |
columnNames = |
|
101 |
new String[] { |
|
102 |
Messages.getText("name"), |
|
103 |
Messages.getText("url"), |
|
104 |
Messages.getText("levels"), |
|
105 |
Messages.getText("format"), |
|
106 |
}; |
|
107 |
init(); |
|
108 |
} |
|
109 |
|
|
95 | 110 |
private void init() { |
96 | 111 |
GridBagConstraints gridBagConstraints; |
97 | 112 |
setLayout(new GridBagLayout()); |
... | ... | |
124 | 139 |
|
125 | 140 |
gridBagConstraints.gridy = 3; |
126 | 141 |
add(getJPanelButtonsPanel(), gridBagConstraints); |
142 |
if(this.showCrsWarning){ |
|
143 |
gridBagConstraints.gridy = 4; |
|
144 |
add(getJPanelCrsWarningPanel(), gridBagConstraints); |
|
145 |
} |
|
127 | 146 |
} |
128 | 147 |
|
129 | 148 |
private JPanel getJPanelButtonsPanel() { |
... | ... | |
143 | 162 |
return buttonsPanel; |
144 | 163 |
} |
145 | 164 |
|
165 |
private JPanel getJPanelCrsWarningPanel() { |
|
166 |
if (crsWarningPanel == null) { |
|
167 |
FlowLayout fl = new FlowLayout(); |
|
168 |
crsWarningPanel = new JPanel(fl); |
|
169 |
// if(this.showCrsWarning){ |
|
170 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
171 |
StringBuilder builder = new StringBuilder(); |
|
172 |
builder.append("<html><font color=\"red\">"); |
|
173 |
builder.append(i18nManager.getTranslation("_crs_warning")); |
|
174 |
builder.append("</font></body></html>"); |
|
175 |
crsWarningLabel = new JLabel(Messages.getText(builder.toString())); |
|
176 |
crsWarningPanel.add(crsWarningLabel, fl); |
|
177 |
// } |
|
178 |
} |
|
179 |
return crsWarningPanel; |
|
180 |
} |
|
181 |
|
|
146 | 182 |
private JPanel getJPanelSelectedServer() { |
147 | 183 |
if(selectedServerPanel == null) { |
148 | 184 |
selectedServerPanel = new JPanel(new BorderLayout()); |
Also available in: Unified diff