| 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package panels;
|
|---|
| 3 |
|
|---|
| 4 | import java.awt.Rectangle;
|
|---|
| 5 | import java.awt.event.ActionEvent;
|
|---|
| 6 | import java.awt.event.ActionListener;
|
|---|
| 7 | import java.awt.event.FocusAdapter;
|
|---|
| 8 | import java.awt.event.FocusEvent;
|
|---|
| 9 | import java.awt.event.FocusListener;
|
|---|
| 10 | import java.util.EnumMap;
|
|---|
| 11 |
|
|---|
| 12 | import javax.swing.BorderFactory;
|
|---|
| 13 | import javax.swing.ButtonGroup;
|
|---|
| 14 | import javax.swing.ImageIcon;
|
|---|
| 15 | import javax.swing.JComboBox;
|
|---|
| 16 | import javax.swing.JLabel;
|
|---|
| 17 | import javax.swing.JPanel;
|
|---|
| 18 | import javax.swing.JRadioButton;
|
|---|
| 19 | import javax.swing.JTextField;
|
|---|
| 20 | import javax.swing.SwingConstants;
|
|---|
| 21 |
|
|---|
| 22 | import messages.Messages;
|
|---|
| 23 | import seamarks.SeaMark.Cat;
|
|---|
| 24 | import seamarks.SeaMark.Fnc;
|
|---|
| 25 | import seamarks.SeaMark.Obj;
|
|---|
| 26 | import seamarks.SeaMark.Shp;
|
|---|
| 27 | import smed.SmedAction;
|
|---|
| 28 |
|
|---|
| 29 | public class PanelLights extends JPanel {
|
|---|
| 30 |
|
|---|
| 31 | private SmedAction dlg;
|
|---|
| 32 |
|
|---|
| 33 | public JLabel categoryLabel;
|
|---|
| 34 |
|
|---|
| 35 | public JComboBox<String> landCatBox;
|
|---|
| 36 | public EnumMap<Cat, Integer> landCats = new EnumMap<>(Cat.class);
|
|---|
| 37 | private ActionListener alLandCatBox = new ActionListener() {
|
|---|
| 38 | @Override
|
|---|
| 39 | public void actionPerformed(ActionEvent e) {
|
|---|
| 40 | for (Cat cat : landCats.keySet()) {
|
|---|
| 41 | int idx = landCats.get(cat);
|
|---|
| 42 | if (dlg.node != null && (idx == landCatBox.getSelectedIndex())) {
|
|---|
| 43 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 44 | SmedAction.panelMain.mark.testValid();
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|
| 48 | };
|
|---|
| 49 | public JComboBox<String> trafficCatBox;
|
|---|
| 50 | public EnumMap<Cat, Integer> trafficCats = new EnumMap<>(Cat.class);
|
|---|
| 51 | private ActionListener alTrafficCatBox = new ActionListener() {
|
|---|
| 52 | @Override
|
|---|
| 53 | public void actionPerformed(ActionEvent e) {
|
|---|
| 54 | for (Cat cat : trafficCats.keySet()) {
|
|---|
| 55 | int idx = trafficCats.get(cat);
|
|---|
| 56 | if (dlg.node != null && (idx == trafficCatBox.getSelectedIndex())) {
|
|---|
| 57 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 58 | SmedAction.panelMain.mark.testValid();
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|
| 62 | };
|
|---|
| 63 | public JComboBox<String> warningCatBox;
|
|---|
| 64 | public EnumMap<Cat, Integer> warningCats = new EnumMap<>(Cat.class);
|
|---|
| 65 | private ActionListener alWarningCatBox = new ActionListener() {
|
|---|
| 66 | @Override
|
|---|
| 67 | public void actionPerformed(ActionEvent e) {
|
|---|
| 68 | for (Cat cat : warningCats.keySet()) {
|
|---|
| 69 | int idx = warningCats.get(cat);
|
|---|
| 70 | if (dlg.node != null && (idx == warningCatBox.getSelectedIndex())) {
|
|---|
| 71 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 72 | SmedAction.panelMain.mark.testValid();
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 | }
|
|---|
| 76 | };
|
|---|
| 77 | public JComboBox<String> platformCatBox;
|
|---|
| 78 | public EnumMap<Cat, Integer> platformCats = new EnumMap<>(Cat.class);
|
|---|
| 79 | private ActionListener alPlatformCatBox = new ActionListener() {
|
|---|
| 80 | @Override
|
|---|
| 81 | public void actionPerformed(ActionEvent e) {
|
|---|
| 82 | for (Cat cat : platformCats.keySet()) {
|
|---|
| 83 | int idx = platformCats.get(cat);
|
|---|
| 84 | if (dlg.node != null && (idx == platformCatBox.getSelectedIndex())) {
|
|---|
| 85 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 86 | SmedAction.panelMain.mark.testValid();
|
|---|
| 87 | }
|
|---|
| 88 | }
|
|---|
| 89 | }
|
|---|
| 90 | };
|
|---|
| 91 | public JComboBox<String> pilotCatBox;
|
|---|
| 92 | public EnumMap<Cat, Integer> pilotCats = new EnumMap<>(Cat.class);
|
|---|
| 93 | private ActionListener alPilotCatBox = new ActionListener() {
|
|---|
| 94 | @Override
|
|---|
| 95 | public void actionPerformed(ActionEvent e) {
|
|---|
| 96 | for (Cat cat : pilotCats.keySet()) {
|
|---|
| 97 | int idx = pilotCats.get(cat);
|
|---|
| 98 | if (dlg.node != null && (idx == pilotCatBox.getSelectedIndex())) {
|
|---|
| 99 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 100 | SmedAction.panelMain.mark.testValid();
|
|---|
| 101 | }
|
|---|
| 102 | }
|
|---|
| 103 | }
|
|---|
| 104 | };
|
|---|
| 105 | public JComboBox<String> rescueCatBox;
|
|---|
| 106 | public EnumMap<Cat, Integer> rescueCats = new EnumMap<>(Cat.class);
|
|---|
| 107 | private ActionListener alRescueCatBox = new ActionListener() {
|
|---|
| 108 | @Override
|
|---|
| 109 | public void actionPerformed(ActionEvent e) {
|
|---|
| 110 | for (Cat cat : rescueCats.keySet()) {
|
|---|
| 111 | int idx = rescueCats.get(cat);
|
|---|
| 112 | if (dlg.node != null && (idx == rescueCatBox.getSelectedIndex())) {
|
|---|
| 113 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 114 | SmedAction.panelMain.mark.testValid();
|
|---|
| 115 | }
|
|---|
| 116 | }
|
|---|
| 117 | }
|
|---|
| 118 | };
|
|---|
| 119 | public JComboBox<String> radioCatBox;
|
|---|
| 120 | public EnumMap<Cat, Integer> radioCats = new EnumMap<>(Cat.class);
|
|---|
| 121 | private ActionListener alRadioCatBox = new ActionListener() {
|
|---|
| 122 | @Override
|
|---|
| 123 | public void actionPerformed(ActionEvent e) {
|
|---|
| 124 | for (Cat cat : radioCats.keySet()) {
|
|---|
| 125 | int idx = radioCats.get(cat);
|
|---|
| 126 | if (dlg.node != null && (idx == radioCatBox.getSelectedIndex())) {
|
|---|
| 127 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 128 | SmedAction.panelMain.mark.testValid();
|
|---|
| 129 | }
|
|---|
| 130 | }
|
|---|
| 131 | }
|
|---|
| 132 | };
|
|---|
| 133 | public JComboBox<String> radarCatBox;
|
|---|
| 134 | public EnumMap<Cat, Integer> radarCats = new EnumMap<>(Cat.class);
|
|---|
| 135 | private ActionListener alRadarCatBox = new ActionListener() {
|
|---|
| 136 | @Override
|
|---|
| 137 | public void actionPerformed(ActionEvent e) {
|
|---|
| 138 | for (Cat cat : radarCats.keySet()) {
|
|---|
| 139 | int idx = radarCats.get(cat);
|
|---|
| 140 | if (dlg.node != null && (idx == radarCatBox.getSelectedIndex())) {
|
|---|
| 141 | SmedAction.panelMain.mark.setCategory(cat);
|
|---|
| 142 | SmedAction.panelMain.mark.testValid();
|
|---|
| 143 | }
|
|---|
| 144 | }
|
|---|
| 145 | }
|
|---|
| 146 | };
|
|---|
| 147 | public JLabel functionLabel;
|
|---|
| 148 | public JComboBox<String> functionBox;
|
|---|
| 149 | public EnumMap<Fnc, Integer> functions = new EnumMap<>(Fnc.class);
|
|---|
| 150 | private ActionListener alfunctionBox = new ActionListener() {
|
|---|
| 151 | @Override
|
|---|
| 152 | public void actionPerformed(ActionEvent e) {
|
|---|
| 153 | for (Fnc fnc : functions.keySet()) {
|
|---|
| 154 | int idx = functions.get(fnc);
|
|---|
| 155 | if (dlg.node != null && (idx == functionBox.getSelectedIndex())) {
|
|---|
| 156 | SmedAction.panelMain.mark.setFunc(fnc);
|
|---|
| 157 | SmedAction.panelMain.mark.testValid();
|
|---|
| 158 | }
|
|---|
| 159 | }
|
|---|
| 160 | }
|
|---|
| 161 | };
|
|---|
| 162 | private ButtonGroup objButtons = new ButtonGroup();
|
|---|
| 163 | public JRadioButton houseButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LighthouseButton.png")));
|
|---|
| 164 | public JRadioButton majorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMajorButton.png")));
|
|---|
| 165 | public JRadioButton minorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMinorButton.png")));
|
|---|
| 166 | public JRadioButton vesselButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightVesselButton.png")));
|
|---|
| 167 | public JRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightFloatButton.png")));
|
|---|
| 168 | public JRadioButton landButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LandmarkButton.png")));
|
|---|
| 169 | public JRadioButton trafficButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TrafficButton.png")));
|
|---|
| 170 | public JRadioButton warningButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/WarningButton.png")));
|
|---|
| 171 | public JRadioButton platformButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PlatformButton.png")));
|
|---|
| 172 | public JRadioButton coastguardButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/CoastguardButton.png")));
|
|---|
| 173 | public JRadioButton pilotButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PilotButton.png")));
|
|---|
| 174 | public JRadioButton rescueButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RescueButton.png")));
|
|---|
| 175 | public JRadioButton radioButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RadioStationButton.png")));
|
|---|
| 176 | public JRadioButton radarButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RadarStationButton.png")));
|
|---|
| 177 | public EnumMap<Obj, JRadioButton> objects = new EnumMap<>(Obj.class);
|
|---|
| 178 | private ActionListener alObj = new ActionListener() {
|
|---|
| 179 | @Override
|
|---|
| 180 | public void actionPerformed(ActionEvent e) {
|
|---|
| 181 | for (Obj obj : objects.keySet()) {
|
|---|
| 182 | JRadioButton button = objects.get(obj);
|
|---|
| 183 | if (button.isSelected()) {
|
|---|
| 184 | SmedAction.panelMain.mark.setObject(obj);
|
|---|
| 185 | button.setBorderPainted(true);
|
|---|
| 186 | } else {
|
|---|
| 187 | button.setBorderPainted(false);
|
|---|
| 188 | }
|
|---|
| 189 | }
|
|---|
| 190 | if (SmedAction.panelMain.mark.getObject() == Obj.LITVES) {
|
|---|
| 191 | SmedAction.panelMain.mark.setShape(Shp.SUPER);
|
|---|
| 192 | } else if (SmedAction.panelMain.mark.getObject() == Obj.LITFLT) {
|
|---|
| 193 | SmedAction.panelMain.mark.setShape(Shp.FLOAT);
|
|---|
| 194 | } else {
|
|---|
| 195 | SmedAction.panelMain.mark.setShape(Shp.UNKSHP);
|
|---|
| 196 | }
|
|---|
| 197 | functionLabel.setVisible(false);
|
|---|
| 198 | categoryLabel.setVisible(false);
|
|---|
| 199 | functionLabel.setVisible(false);
|
|---|
| 200 | functionBox.setVisible(false);
|
|---|
| 201 | landCatBox.setVisible(false);
|
|---|
| 202 | trafficCatBox.setVisible(false);
|
|---|
| 203 | warningCatBox.setVisible(false);
|
|---|
| 204 | platformCatBox.setVisible(false);
|
|---|
| 205 | pilotCatBox.setVisible(false);
|
|---|
| 206 | rescueCatBox.setVisible(false);
|
|---|
| 207 | radioCatBox.setVisible(false);
|
|---|
| 208 | radarCatBox.setVisible(false);
|
|---|
| 209 | chLabel.setVisible(false);
|
|---|
| 210 | chBox.setVisible(false);
|
|---|
| 211 | SmedAction.panelMain.mark.setCategory(Cat.NOCAT);
|
|---|
| 212 | if (landButton.isSelected()) {
|
|---|
| 213 | functionLabel.setVisible(true);
|
|---|
| 214 | categoryLabel.setVisible(true);
|
|---|
| 215 | functionBox.setVisible(true);
|
|---|
| 216 | landCatBox.setVisible(true);
|
|---|
| 217 | alLandCatBox.actionPerformed(null);
|
|---|
| 218 | } else if (trafficButton.isSelected()) {
|
|---|
| 219 | categoryLabel.setVisible(true);
|
|---|
| 220 | trafficCatBox.setVisible(true);
|
|---|
| 221 | chLabel.setVisible(true);
|
|---|
| 222 | chBox.setVisible(true);
|
|---|
| 223 | alTrafficCatBox.actionPerformed(null);
|
|---|
| 224 | } else if (warningButton.isSelected()) {
|
|---|
| 225 | categoryLabel.setVisible(true);
|
|---|
| 226 | warningCatBox.setVisible(true);
|
|---|
| 227 | chLabel.setVisible(true);
|
|---|
| 228 | chBox.setVisible(true);
|
|---|
| 229 | alWarningCatBox.actionPerformed(null);
|
|---|
| 230 | } else if (platformButton.isSelected()) {
|
|---|
| 231 | categoryLabel.setVisible(true);
|
|---|
| 232 | platformCatBox.setVisible(true);
|
|---|
| 233 | alPlatformCatBox.actionPerformed(null);
|
|---|
| 234 | } else if (pilotButton.isSelected()) {
|
|---|
| 235 | categoryLabel.setVisible(true);
|
|---|
| 236 | pilotCatBox.setVisible(true);
|
|---|
| 237 | chLabel.setVisible(true);
|
|---|
| 238 | chBox.setVisible(true);
|
|---|
| 239 | alPilotCatBox.actionPerformed(null);
|
|---|
| 240 | } else if (rescueButton.isSelected()) {
|
|---|
| 241 | categoryLabel.setVisible(true);
|
|---|
| 242 | rescueCatBox.setVisible(true);
|
|---|
| 243 | alRescueCatBox.actionPerformed(null);
|
|---|
| 244 | } else if (radioButton.isSelected()) {
|
|---|
| 245 | categoryLabel.setVisible(true);
|
|---|
| 246 | radioCatBox.setVisible(true);
|
|---|
| 247 | chLabel.setVisible(true);
|
|---|
| 248 | chBox.setVisible(true);
|
|---|
| 249 | alRadioCatBox.actionPerformed(null);
|
|---|
| 250 | } else if (radarButton.isSelected()) {
|
|---|
| 251 | categoryLabel.setVisible(true);
|
|---|
| 252 | radarCatBox.setVisible(true);
|
|---|
| 253 | chLabel.setVisible(true);
|
|---|
| 254 | chBox.setVisible(true);
|
|---|
| 255 | alRadarCatBox.actionPerformed(null);
|
|---|
| 256 | }
|
|---|
| 257 | SmedAction.panelMain.mark.testValid();
|
|---|
| 258 | }
|
|---|
| 259 | };
|
|---|
| 260 | public JLabel chLabel;
|
|---|
| 261 | public JTextField chBox;
|
|---|
| 262 | private FocusListener flCh = new FocusAdapter() {
|
|---|
| 263 | @Override
|
|---|
| 264 | public void focusLost(FocusEvent e) {
|
|---|
| 265 | SmedAction.panelMain.mark.setChannel(chBox.getText());
|
|---|
| 266 | }
|
|---|
| 267 | };
|
|---|
| 268 |
|
|---|
| 269 | public PanelLights(SmedAction dia) {
|
|---|
| 270 | dlg = dia;
|
|---|
| 271 | setLayout(null);
|
|---|
| 272 | add(getObjButton(houseButton, 0, 0, 34, 32, "Lighthouse", Obj.LITHSE));
|
|---|
| 273 | add(getObjButton(majorButton, 34, 0, 34, 32, "MajorLight", Obj.LITMAJ));
|
|---|
| 274 | add(getObjButton(minorButton, 68, 0, 34, 32, "MinorLight", Obj.LITMIN));
|
|---|
| 275 | add(getObjButton(landButton, 102, 0, 34, 32, "Landmark", Obj.LNDMRK));
|
|---|
| 276 | add(getObjButton(platformButton, 136, 0, 34, 32, "Platform", Obj.OFSPLF));
|
|---|
| 277 | add(getObjButton(vesselButton, 0, 32, 34, 32, "LightVessel", Obj.LITVES));
|
|---|
| 278 | add(getObjButton(floatButton, 34, 32, 34, 32, "LightFloat", Obj.LITFLT));
|
|---|
| 279 | add(getObjButton(trafficButton, 68, 32, 34, 32, "SSTraffic", Obj.SISTAT));
|
|---|
| 280 | add(getObjButton(warningButton, 102, 32, 34, 32, "SSWarning", Obj.SISTAW));
|
|---|
| 281 | add(getObjButton(coastguardButton, 0, 64, 34, 32, "CoastguardStation", Obj.CGUSTA));
|
|---|
| 282 | add(getObjButton(pilotButton, 34, 64, 34, 32, "PilotBoarding", Obj.PILBOP));
|
|---|
| 283 | add(getObjButton(rescueButton, 68, 64, 34, 32, "RescueStation", Obj.RSCSTA));
|
|---|
| 284 | add(getObjButton(radioButton, 102, 64, 34, 32, "RadioStation", Obj.RDOSTA));
|
|---|
| 285 | add(getObjButton(radarButton, 136, 64, 34, 32, "RadarStation", Obj.RADSTA));
|
|---|
| 286 |
|
|---|
| 287 | functionLabel = new JLabel(Messages.getString("Function"), SwingConstants.CENTER);
|
|---|
| 288 | functionLabel.setBounds(new Rectangle(5, 94, 160, 18));
|
|---|
| 289 | add(functionLabel);
|
|---|
| 290 | functionLabel.setVisible(false);
|
|---|
| 291 |
|
|---|
| 292 | functionBox = new JComboBox<>();
|
|---|
| 293 | functionBox.setBounds(new Rectangle(5, 110, 160, 18));
|
|---|
| 294 | add(functionBox);
|
|---|
| 295 | functionBox.addActionListener(alfunctionBox);
|
|---|
| 296 | addLFItem("", Fnc.UNKFNC);
|
|---|
| 297 | addLFItem(Messages.getString("Church"), Fnc.CHCH);
|
|---|
| 298 | addLFItem(Messages.getString("Chapel"), Fnc.CHPL);
|
|---|
| 299 | addLFItem(Messages.getString("Temple"), Fnc.TMPL);
|
|---|
| 300 | addLFItem(Messages.getString("Pagoda"), Fnc.PGDA);
|
|---|
| 301 | addLFItem(Messages.getString("ShintoShrine"), Fnc.SHSH);
|
|---|
| 302 | addLFItem(Messages.getString("BuddhistTemple"), Fnc.BTMP);
|
|---|
| 303 | addLFItem(Messages.getString("Mosque"), Fnc.MOSQ);
|
|---|
| 304 | addLFItem(Messages.getString("Marabout"), Fnc.MRBT);
|
|---|
| 305 | functionBox.setVisible(false);
|
|---|
| 306 |
|
|---|
| 307 | categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
|
|---|
| 308 | categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
|
|---|
| 309 | add(categoryLabel);
|
|---|
| 310 | categoryLabel.setVisible(false);
|
|---|
| 311 |
|
|---|
| 312 | landCatBox = new JComboBox<>();
|
|---|
| 313 | landCatBox.setBounds(new Rectangle(5, 142, 160, 18));
|
|---|
| 314 | add(landCatBox);
|
|---|
| 315 | landCatBox.addActionListener(alLandCatBox);
|
|---|
| 316 | addLCItem("", Cat.NOCAT);
|
|---|
| 317 | addLCItem(Messages.getString("Tower"), Cat.LMK_TOWR);
|
|---|
| 318 | addLCItem(Messages.getString("WaterTower"), Cat.LMK_WTRT);
|
|---|
| 319 | addLCItem(Messages.getString("Chimney"), Cat.LMK_CHMY);
|
|---|
| 320 | addLCItem(Messages.getString("Mast"), Cat.LMK_MAST);
|
|---|
| 321 | addLCItem(Messages.getString("Column"), Cat.LMK_CLMN);
|
|---|
| 322 | addLCItem(Messages.getString("DishAerial"), Cat.LMK_DSHA);
|
|---|
| 323 | addLCItem(Messages.getString("Flagstaff"), Cat.LMK_FLGS);
|
|---|
| 324 | addLCItem(Messages.getString("FlareStack"), Cat.LMK_FLRS);
|
|---|
| 325 | addLCItem(Messages.getString("Monument"), Cat.LMK_MNMT);
|
|---|
| 326 | addLCItem(Messages.getString("WindMotor"), Cat.LMK_WNDM);
|
|---|
| 327 | addLCItem(Messages.getString("WindSock"), Cat.LMK_WNDS);
|
|---|
| 328 | addLCItem(Messages.getString("Obelisk"), Cat.LMK_OBLK);
|
|---|
| 329 | addLCItem(Messages.getString("Statue"), Cat.LMK_STAT);
|
|---|
| 330 | addLCItem(Messages.getString("Cross"), Cat.LMK_CROS);
|
|---|
| 331 | addLCItem(Messages.getString("Dome"), Cat.LMK_DOME);
|
|---|
| 332 | addLCItem(Messages.getString("RadarScanner"), Cat.LMK_SCNR);
|
|---|
| 333 | addLCItem(Messages.getString("Windmill"), Cat.LMK_WNDL);
|
|---|
| 334 | addLCItem(Messages.getString("Spire"), Cat.LMK_SPIR);
|
|---|
| 335 | addLCItem(Messages.getString("Minaret"), Cat.LMK_MNRT);
|
|---|
| 336 | addLCItem(Messages.getString("Cairn"), Cat.LMK_CARN);
|
|---|
| 337 | landCatBox.setVisible(false);
|
|---|
| 338 |
|
|---|
| 339 | trafficCatBox = new JComboBox<>();
|
|---|
| 340 | trafficCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 341 | add(trafficCatBox);
|
|---|
| 342 | trafficCatBox.addActionListener(alTrafficCatBox);
|
|---|
| 343 | addTCItem("", Cat.NOCAT);
|
|---|
| 344 | addTCItem(Messages.getString("Traffic"), Cat.SIS_TRFC);
|
|---|
| 345 | addTCItem(Messages.getString("PortControl"), Cat.SIS_PTCL);
|
|---|
| 346 | addTCItem(Messages.getString("PortEntry"), Cat.SIS_PTED);
|
|---|
| 347 | addTCItem(Messages.getString("IPT"), Cat.SIS_IPT);
|
|---|
| 348 | addTCItem(Messages.getString("Berthing"), Cat.SIS_BRTH);
|
|---|
| 349 | addTCItem(Messages.getString("Dock"), Cat.SIS_DOCK);
|
|---|
| 350 | addTCItem(Messages.getString("Lock"), Cat.SIS_LOCK);
|
|---|
| 351 | addTCItem(Messages.getString("Barrage"), Cat.SIS_FBAR);
|
|---|
| 352 | addTCItem(Messages.getString("Bridge"), Cat.SIS_BRDG);
|
|---|
| 353 | addTCItem(Messages.getString("Dredging"), Cat.SIS_DRDG);
|
|---|
| 354 | trafficCatBox.setVisible(false);
|
|---|
| 355 |
|
|---|
| 356 | warningCatBox = new JComboBox<>();
|
|---|
| 357 | warningCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 358 | add(warningCatBox);
|
|---|
| 359 | warningCatBox.addActionListener(alWarningCatBox);
|
|---|
| 360 | addWCItem("", Cat.NOCAT);
|
|---|
| 361 | addWCItem(Messages.getString("Danger"), Cat.SIS_DNGR);
|
|---|
| 362 | addWCItem(Messages.getString("Storm"), Cat.SIS_STRM);
|
|---|
| 363 | addWCItem(Messages.getString("Weather"), Cat.SIS_WTHR);
|
|---|
| 364 | addWCItem(Messages.getString("Obstruction"), Cat.SIS_OBST);
|
|---|
| 365 | addWCItem(Messages.getString("Cable"), Cat.SIS_CABL);
|
|---|
| 366 | addWCItem(Messages.getString("Distress"), Cat.SIS_DSTR);
|
|---|
| 367 | addWCItem(Messages.getString("Time"), Cat.SIS_TIME);
|
|---|
| 368 | addWCItem(Messages.getString("Tide"), Cat.SIS_TIDE);
|
|---|
| 369 | addWCItem(Messages.getString("TidalStream"), Cat.SIS_TSTM);
|
|---|
| 370 | addWCItem(Messages.getString("TideGauge"), Cat.SIS_TGAG);
|
|---|
| 371 | addWCItem(Messages.getString("TideScale"), Cat.SIS_TSCL);
|
|---|
| 372 | addWCItem(Messages.getString("Diving"), Cat.SIS_DIVE);
|
|---|
| 373 | addWCItem(Messages.getString("Ice"), Cat.SIS_ICE);
|
|---|
| 374 | addWCItem(Messages.getString("LevelGauge"), Cat.SIS_LGAG);
|
|---|
| 375 | addWCItem(Messages.getString("Military"), Cat.SIS_MILY);
|
|---|
| 376 | warningCatBox.setVisible(false);
|
|---|
| 377 |
|
|---|
| 378 | platformCatBox = new JComboBox<>();
|
|---|
| 379 | platformCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 380 | add(platformCatBox);
|
|---|
| 381 | platformCatBox.addActionListener(alPlatformCatBox);
|
|---|
| 382 | addPLItem("", Cat.NOCAT);
|
|---|
| 383 | addPLItem(Messages.getString("Oil"), Cat.OFP_OIL);
|
|---|
| 384 | addPLItem(Messages.getString("Production"), Cat.OFP_PRD);
|
|---|
| 385 | addPLItem(Messages.getString("Observation"), Cat.OFP_OBS);
|
|---|
| 386 | addPLItem(Messages.getString("ALP"), Cat.OFP_ALP);
|
|---|
| 387 | addPLItem(Messages.getString("SALM"), Cat.OFP_SALM);
|
|---|
| 388 | addPLItem(Messages.getString("MooringTower"), Cat.OFP_MOR);
|
|---|
| 389 | addPLItem(Messages.getString("ArtificialIsland"), Cat.OFP_ISL);
|
|---|
| 390 | addPLItem(Messages.getString("FPSO"), Cat.OFP_FPSO);
|
|---|
| 391 | addPLItem(Messages.getString("Accommodation"), Cat.OFP_ACC);
|
|---|
| 392 | addPLItem(Messages.getString("NCCB"), Cat.OFP_NCCB);
|
|---|
| 393 | platformCatBox.setVisible(false);
|
|---|
| 394 |
|
|---|
| 395 | pilotCatBox = new JComboBox<>();
|
|---|
| 396 | pilotCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 397 | add(pilotCatBox);
|
|---|
| 398 | pilotCatBox.addActionListener(alPilotCatBox);
|
|---|
| 399 | addPTItem("", Cat.NOCAT);
|
|---|
| 400 | addPTItem(Messages.getString("CruisingVessel"), Cat.PIL_VESS);
|
|---|
| 401 | addPTItem(Messages.getString("Helicopter"), Cat.PIL_HELI);
|
|---|
| 402 | addPTItem(Messages.getString("FromShore"), Cat.PIL_SHORE);
|
|---|
| 403 | pilotCatBox.setVisible(false);
|
|---|
| 404 |
|
|---|
| 405 | rescueCatBox = new JComboBox<>();
|
|---|
| 406 | rescueCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 407 | add(rescueCatBox);
|
|---|
| 408 | rescueCatBox.addActionListener(alRescueCatBox);
|
|---|
| 409 | addRSItem("", Cat.NOCAT);
|
|---|
| 410 | addRSItem(Messages.getString("Lifeboat"), Cat.RSC_LFB);
|
|---|
| 411 | addRSItem(Messages.getString("Rocket"), Cat.RSC_RKT);
|
|---|
| 412 | addRSItem(Messages.getString("ShipwreckedRefuge"), Cat.RSC_RSW);
|
|---|
| 413 | addRSItem(Messages.getString("IntertidalRefuge"), Cat.RSC_RIT);
|
|---|
| 414 | addRSItem(Messages.getString("MooredLifeboat"), Cat.RSC_MLB);
|
|---|
| 415 | addRSItem(Messages.getString("Radio"), Cat.RSC_RAD);
|
|---|
| 416 | addRSItem(Messages.getString("FirstAid"), Cat.RSC_FAE);
|
|---|
| 417 | addRSItem(Messages.getString("Seaplane"), Cat.RSC_SPL);
|
|---|
| 418 | addRSItem(Messages.getString("Aircraft"), Cat.RSC_AIR);
|
|---|
| 419 | addRSItem(Messages.getString("Tug"), Cat.RSC_TUG);
|
|---|
| 420 | rescueCatBox.setVisible(false);
|
|---|
| 421 |
|
|---|
| 422 | radioCatBox = new JComboBox<>();
|
|---|
| 423 | radioCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 424 | add(radioCatBox);
|
|---|
| 425 | radioCatBox.addActionListener(alRadioCatBox);
|
|---|
| 426 | addROItem("", Cat.NOCAT);
|
|---|
| 427 | addROItem(Messages.getString("CircularBeacon"), Cat.ROS_OMNI);
|
|---|
| 428 | addROItem(Messages.getString("DirectionalBeacon"), Cat.ROS_DIRL);
|
|---|
| 429 | addROItem(Messages.getString("RotatingBeacon"), Cat.ROS_ROTP);
|
|---|
| 430 | addROItem(Messages.getString("ConsolBeacon"), Cat.ROS_CNSL);
|
|---|
| 431 | addROItem(Messages.getString("DirectionFinding"), Cat.ROS_RDF);
|
|---|
| 432 | addROItem(Messages.getString("QTGService"), Cat.ROS_QTG);
|
|---|
| 433 | addROItem(Messages.getString("AeronaticalBeacon"), Cat.ROS_AERO);
|
|---|
| 434 | addROItem(Messages.getString("Decca"), Cat.ROS_DECA);
|
|---|
| 435 | addROItem(Messages.getString("LoranC"), Cat.ROS_LORN);
|
|---|
| 436 | addROItem(Messages.getString("DGPS"), Cat.ROS_DGPS);
|
|---|
| 437 | addROItem(Messages.getString("Toran"), Cat.ROS_TORN);
|
|---|
| 438 | addROItem(Messages.getString("Omega"), Cat.ROS_OMGA);
|
|---|
| 439 | addROItem(Messages.getString("Syledis"), Cat.ROS_SYLD);
|
|---|
| 440 | addROItem(Messages.getString("Chiaka"), Cat.ROS_CHKA);
|
|---|
| 441 | addROItem(Messages.getString("PublicCommunication"), Cat.ROS_PCOM);
|
|---|
| 442 | addROItem(Messages.getString("CommercialBroadcast"), Cat.ROS_COMB);
|
|---|
| 443 | addROItem(Messages.getString("Facsimile"), Cat.ROS_FACS);
|
|---|
| 444 | addROItem(Messages.getString("TimeSignal"), Cat.ROS_TIME);
|
|---|
| 445 | addROItem(Messages.getString("AIS"), Cat.ROS_PAIS);
|
|---|
| 446 | addROItem(Messages.getString("S-AIS"), Cat.ROS_SAIS);
|
|---|
| 447 | addROItem(Messages.getString("V-AIS"), Cat.ROS_VAIS);
|
|---|
| 448 | addROItem(Messages.getString("V-AISNC"), Cat.ROS_VANC);
|
|---|
| 449 | addROItem(Messages.getString("V-AISSC"), Cat.ROS_VASC);
|
|---|
| 450 | addROItem(Messages.getString("V-AISEC"), Cat.ROS_VAEC);
|
|---|
| 451 | addROItem(Messages.getString("V-AISWC"), Cat.ROS_VAWC);
|
|---|
| 452 | addROItem(Messages.getString("V-AISPL"), Cat.ROS_VAPL);
|
|---|
| 453 | addROItem(Messages.getString("V-AISSL"), Cat.ROS_VASL);
|
|---|
| 454 | addROItem(Messages.getString("V-AISID"), Cat.ROS_VAID);
|
|---|
| 455 | addROItem(Messages.getString("V-AISSW"), Cat.ROS_VASW);
|
|---|
| 456 | addROItem(Messages.getString("V-AISSP"), Cat.ROS_VASP);
|
|---|
| 457 | addROItem(Messages.getString("V-AISWK"), Cat.ROS_VAWK);
|
|---|
| 458 | radioCatBox.setVisible(false);
|
|---|
| 459 |
|
|---|
| 460 | radarCatBox = new JComboBox<>();
|
|---|
| 461 | radarCatBox.setBounds(new Rectangle(5, 140, 160, 20));
|
|---|
| 462 | add(radarCatBox);
|
|---|
| 463 | radarCatBox.addActionListener(alRadarCatBox);
|
|---|
| 464 | addRAItem("", Cat.NOCAT);
|
|---|
| 465 | addRAItem(Messages.getString("Surveillance"), Cat.RAS_SRV);
|
|---|
| 466 | addRAItem(Messages.getString("CoastRadar"), Cat.RAS_CST);
|
|---|
| 467 | radarCatBox.setVisible(false);
|
|---|
| 468 |
|
|---|
| 469 | chLabel = new JLabel("Ch:", SwingConstants.CENTER);
|
|---|
| 470 | chLabel.setBounds(new Rectangle(140, 32, 30, 15));
|
|---|
| 471 | add(chLabel);
|
|---|
| 472 | chBox = new JTextField();
|
|---|
| 473 | chBox.setBounds(new Rectangle(140, 45, 30, 20));
|
|---|
| 474 | chBox.setHorizontalAlignment(SwingConstants.CENTER);
|
|---|
| 475 | add(chBox);
|
|---|
| 476 | chBox.addFocusListener(flCh);
|
|---|
| 477 | }
|
|---|
| 478 |
|
|---|
| 479 | public void syncPanel() {
|
|---|
| 480 | functionLabel.setVisible(false);
|
|---|
| 481 | functionBox.setVisible(false);
|
|---|
| 482 | categoryLabel.setVisible(false);
|
|---|
| 483 | landCatBox.setVisible(false);
|
|---|
| 484 | trafficCatBox.setVisible(false);
|
|---|
| 485 | warningCatBox.setVisible(false);
|
|---|
| 486 | platformCatBox.setVisible(false);
|
|---|
| 487 | pilotCatBox.setVisible(false);
|
|---|
| 488 | rescueCatBox.setVisible(false);
|
|---|
| 489 | radioCatBox.setVisible(false);
|
|---|
| 490 | radarCatBox.setVisible(false);
|
|---|
| 491 | chLabel.setVisible(false);
|
|---|
| 492 | chBox.setVisible(false);
|
|---|
| 493 | chBox.setText(SmedAction.panelMain.mark.getChannel());
|
|---|
| 494 | if ((SmedAction.panelMain.mark.getObject() == Obj.LNDMRK)
|
|---|
| 495 | && ((SmedAction.panelMain.mark.getCategory() != Cat.NOCAT) || (SmedAction.panelMain.mark.getFunc() != Fnc.UNKFNC))) {
|
|---|
| 496 | functionLabel.setVisible(true);
|
|---|
| 497 | categoryLabel.setVisible(true);
|
|---|
| 498 | functionBox.setVisible(true);
|
|---|
| 499 | landCatBox.setVisible(true);
|
|---|
| 500 | for (Fnc fnc : functions.keySet()) {
|
|---|
| 501 | int item = functions.get(fnc);
|
|---|
| 502 | if (SmedAction.panelMain.mark.getFunc() == fnc) {
|
|---|
| 503 | functionBox.setSelectedIndex(item);
|
|---|
| 504 | }
|
|---|
| 505 | }
|
|---|
| 506 | for (Cat cat : landCats.keySet()) {
|
|---|
| 507 | int item = landCats.get(cat);
|
|---|
| 508 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 509 | landCatBox.setSelectedIndex(item);
|
|---|
| 510 | }
|
|---|
| 511 | }
|
|---|
| 512 | } else if (SmedAction.panelMain.mark.getObject() == Obj.SISTAT) {
|
|---|
| 513 | categoryLabel.setVisible(true);
|
|---|
| 514 | trafficCatBox.setVisible(true);
|
|---|
| 515 | for (Cat cat : trafficCats.keySet()) {
|
|---|
| 516 | int item = trafficCats.get(cat);
|
|---|
| 517 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 518 | trafficCatBox.setSelectedIndex(item);
|
|---|
| 519 | }
|
|---|
| 520 | }
|
|---|
| 521 | chLabel.setVisible(true);
|
|---|
| 522 | chBox.setVisible(true);
|
|---|
| 523 | } else if (SmedAction.panelMain.mark.getObject() == Obj.SISTAW) {
|
|---|
| 524 | categoryLabel.setVisible(true);
|
|---|
| 525 | warningCatBox.setVisible(true);
|
|---|
| 526 | for (Cat cat : warningCats.keySet()) {
|
|---|
| 527 | int item = warningCats.get(cat);
|
|---|
| 528 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 529 | warningCatBox.setSelectedIndex(item);
|
|---|
| 530 | }
|
|---|
| 531 | }
|
|---|
| 532 | chLabel.setVisible(true);
|
|---|
| 533 | chBox.setVisible(true);
|
|---|
| 534 | } else if (SmedAction.panelMain.mark.getObject() == Obj.OFSPLF) {
|
|---|
| 535 | categoryLabel.setVisible(true);
|
|---|
| 536 | platformCatBox.setVisible(true);
|
|---|
| 537 | for (Cat cat : platformCats.keySet()) {
|
|---|
| 538 | int item = platformCats.get(cat);
|
|---|
| 539 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 540 | platformCatBox.setSelectedIndex(item);
|
|---|
| 541 | }
|
|---|
| 542 | }
|
|---|
| 543 | } else if (SmedAction.panelMain.mark.getObject() == Obj.PILBOP) {
|
|---|
| 544 | categoryLabel.setVisible(true);
|
|---|
| 545 | pilotCatBox.setVisible(true);
|
|---|
| 546 | for (Cat cat : pilotCats.keySet()) {
|
|---|
| 547 | int item = pilotCats.get(cat);
|
|---|
| 548 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 549 | pilotCatBox.setSelectedIndex(item);
|
|---|
| 550 | }
|
|---|
| 551 | }
|
|---|
| 552 | chLabel.setVisible(true);
|
|---|
| 553 | chBox.setVisible(true);
|
|---|
| 554 | } else if (SmedAction.panelMain.mark.getObject() == Obj.RSCSTA) {
|
|---|
| 555 | categoryLabel.setVisible(true);
|
|---|
| 556 | rescueCatBox.setVisible(true);
|
|---|
| 557 | for (Cat cat : rescueCats.keySet()) {
|
|---|
| 558 | int item = rescueCats.get(cat);
|
|---|
| 559 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 560 | rescueCatBox.setSelectedIndex(item);
|
|---|
| 561 | }
|
|---|
| 562 | }
|
|---|
| 563 | } else if (SmedAction.panelMain.mark.getObject() == Obj.RDOSTA) {
|
|---|
| 564 | categoryLabel.setVisible(true);
|
|---|
| 565 | radioCatBox.setVisible(true);
|
|---|
| 566 | for (Cat cat : radioCats.keySet()) {
|
|---|
| 567 | int item = radioCats.get(cat);
|
|---|
| 568 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 569 | radioCatBox.setSelectedIndex(item);
|
|---|
| 570 | }
|
|---|
| 571 | }
|
|---|
| 572 | chLabel.setVisible(true);
|
|---|
| 573 | chBox.setVisible(true);
|
|---|
| 574 | } else if (SmedAction.panelMain.mark.getObject() == Obj.RADSTA) {
|
|---|
| 575 | categoryLabel.setVisible(true);
|
|---|
| 576 | radarCatBox.setVisible(true);
|
|---|
| 577 | for (Cat cat : radarCats.keySet()) {
|
|---|
| 578 | int item = radarCats.get(cat);
|
|---|
| 579 | if (SmedAction.panelMain.mark.getCategory() == cat) {
|
|---|
| 580 | radarCatBox.setSelectedIndex(item);
|
|---|
| 581 | }
|
|---|
| 582 | }
|
|---|
| 583 | chLabel.setVisible(true);
|
|---|
| 584 | chBox.setVisible(true);
|
|---|
| 585 | }
|
|---|
| 586 | for (Obj obj : objects.keySet()) {
|
|---|
| 587 | JRadioButton button = objects.get(obj);
|
|---|
| 588 | button.setBorderPainted(SmedAction.panelMain.mark.getObject() == obj);
|
|---|
| 589 | }
|
|---|
| 590 | SmedAction.panelMain.mark.testValid();
|
|---|
| 591 | }
|
|---|
| 592 |
|
|---|
| 593 | private void addLCItem(String str, Cat cat) {
|
|---|
| 594 | landCats.put(cat, landCatBox.getItemCount());
|
|---|
| 595 | landCatBox.addItem(str);
|
|---|
| 596 | }
|
|---|
| 597 |
|
|---|
| 598 | private void addTCItem(String str, Cat cat) {
|
|---|
| 599 | trafficCats.put(cat, trafficCatBox.getItemCount());
|
|---|
| 600 | trafficCatBox.addItem(str);
|
|---|
| 601 | }
|
|---|
| 602 |
|
|---|
| 603 | private void addWCItem(String str, Cat cat) {
|
|---|
| 604 | warningCats.put(cat, warningCatBox.getItemCount());
|
|---|
| 605 | warningCatBox.addItem(str);
|
|---|
| 606 | }
|
|---|
| 607 |
|
|---|
| 608 | private void addPLItem(String str, Cat cat) {
|
|---|
| 609 | platformCats.put(cat, platformCatBox.getItemCount());
|
|---|
| 610 | platformCatBox.addItem(str);
|
|---|
| 611 | }
|
|---|
| 612 |
|
|---|
| 613 | private void addPTItem(String str, Cat cat) {
|
|---|
| 614 | pilotCats.put(cat, pilotCatBox.getItemCount());
|
|---|
| 615 | pilotCatBox.addItem(str);
|
|---|
| 616 | }
|
|---|
| 617 |
|
|---|
| 618 | private void addRSItem(String str, Cat cat) {
|
|---|
| 619 | rescueCats.put(cat, rescueCatBox.getItemCount());
|
|---|
| 620 | rescueCatBox.addItem(str);
|
|---|
| 621 | }
|
|---|
| 622 |
|
|---|
| 623 | private void addROItem(String str, Cat cat) {
|
|---|
| 624 | radioCats.put(cat, radioCatBox.getItemCount());
|
|---|
| 625 | radioCatBox.addItem(str);
|
|---|
| 626 | }
|
|---|
| 627 |
|
|---|
| 628 | private void addRAItem(String str, Cat cat) {
|
|---|
| 629 | radarCats.put(cat, radarCatBox.getItemCount());
|
|---|
| 630 | radarCatBox.addItem(str);
|
|---|
| 631 | }
|
|---|
| 632 |
|
|---|
| 633 | private void addLFItem(String str, Fnc fnc) {
|
|---|
| 634 | functions.put(fnc, functionBox.getItemCount());
|
|---|
| 635 | functionBox.addItem(str);
|
|---|
| 636 | }
|
|---|
| 637 |
|
|---|
| 638 | private JRadioButton getObjButton(JRadioButton button, int x, int y, int w, int h, String tip, Obj obj) {
|
|---|
| 639 | button.setBounds(new Rectangle(x, y, w, h));
|
|---|
| 640 | button.setBorder(BorderFactory.createLoweredBevelBorder());
|
|---|
| 641 | button.setToolTipText(Messages.getString(tip));
|
|---|
| 642 | button.addActionListener(alObj);
|
|---|
| 643 | objButtons.add(button);
|
|---|
| 644 | objects.put(obj, button);
|
|---|
| 645 | return button;
|
|---|
| 646 | }
|
|---|
| 647 |
|
|---|
| 648 | }
|
|---|