Ignore:
Timestamp:
2011-11-09T16:41:26+01:00 (13 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed/plugs/oseam/src
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages.properties

    r26908 r27031  
    210210Painted=Painted
    211211
     212NoRadar=No radar aids
     213RadarReflector=Radar Reflector
     214Ramark=Ramark
     215Racon=Racon
     216LeadingRacon=Leading Racon
     217VisibleSector=Visible sector
     218Start=Start
     219End=End
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_en.properties

    r27028 r27031  
    210210Painted=Painted
    211211
     212NoRadar=No radar aids
     213RadarReflector=Radar Reflector
     214Ramark=Ramark
     215Racon=Racon
     216LeadingRacon=Leading Racon
     217VisibleSector=Visible sector
     218Start=Start
     219End=End
     220
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java

    r27027 r27031  
    2323        public JRadioButton whiteButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/WhiteButton.png")));
    2424        public JRadioButton redButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RedButton.png")));
     25        public JRadioButton greenButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/GreenButton.png")));
     26        public JRadioButton yellowButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/YellowButton.png")));
    2527        public JRadioButton orangeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OrangeButton.png")));
    2628        public JRadioButton amberButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/AmberButton.png")));
    27         public JRadioButton yellowButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/YellowButton.png")));
    28         public JRadioButton greenButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/GreenButton.png")));
    2929        public JRadioButton blueButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BlueButton.png")));
    3030        public JRadioButton violetButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/VioletButton.png")));
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java

    r27027 r27031  
    110110                        } else {
    111111                                dlg.mark.setSectored(false);
    112                                 panelSector.setVisible(false);
     112                                if (panelSector != null) {
     113                                        panelSector.setVisible(false);
     114                                }
    113115                        }
    114116                }
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java

    r27023 r27031  
    2727        public JLabel topIcon = null;
    2828        public JLabel radarIcon = null;
     29        public JLabel radarLabel = null;
    2930        public JLabel fogIcon = null;
     31        public JLabel fogLabel = null;
    3032        public JLabel colLabel = null;
    3133        public JLabel nameLabel = null;
     
    208210                fogIcon.setBounds(new Rectangle(235, 0, 150, 185));
    209211                this.add(fogIcon, null);
     212                radarLabel = new JLabel("", SwingConstants.RIGHT);
     213                radarLabel.setBounds(new Rectangle(210, 35, 100, 20));
     214                this.add(radarLabel, null);
     215                fogLabel = new JLabel("", SwingConstants.RIGHT);
     216                fogLabel.setBounds(new Rectangle(210, 60, 100, 20));
     217                this.add(fogLabel, null);
    210218                colLabel = new JLabel("", SwingConstants.CENTER);
    211219                colLabel.setBounds(new Rectangle(235, 100, 150, 20));
     
    284292                panelLights.setVisible(false);
    285293                panelMore.setVisible(false);
     294                radarLabel.setText("");
     295                fogLabel.setText("");
    286296                colLabel.setText("");
    287297                shapeIcon.setIcon(null);
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelRadar.java

    r26998 r27031  
    1717        private ButtonGroup radarButtons = new ButtonGroup();
    1818        public JRadioButton noRadButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
    19         public JRadioButton reflButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
    20         public JRadioButton raconButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
    21         public JRadioButton ramarkButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
    22         public JRadioButton leadingButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OffButton.png")));
     19        public JRadioButton reflButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RadarReflectorButton.png")));
     20        public JRadioButton ramarkButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RamarkButton.png")));
     21        public JRadioButton raconButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RaconButton.png")));
     22        public JRadioButton leadingButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LeadingRaconButton.png")));
    2323        private EnumMap<Rtb, JRadioButton> rads = new EnumMap<Rtb, JRadioButton>(Rtb.class);
    2424        private ActionListener alRad = new ActionListener() {
     
    2727                                JRadioButton button = rads.get(rtb);
    2828                                if (button.isSelected()) {
    29                                         dlg.mark.setRaType(rtb);
    30                                         button.setBorderPainted(true);
    31                                 } else
    32                                         button.setBorderPainted(false);
     29                                        dlg.mark.setRadar(rtb);
     30                                }
    3331                        }
     32                        syncPanel();
    3433                        dlg.mark.paintSign();
    3534                }
     
    4039                public void actionPerformed(java.awt.event.ActionEvent e) {
    4140                        dlg.mark.setRaconGroup(groupBox.getText());
     41                        dlg.mark.paintSign();
    4242                }
    4343        };
     
    4747                public void actionPerformed(java.awt.event.ActionEvent e) {
    4848                        dlg.mark.setRaconPeriod(periodBox.getText());
     49                        dlg.mark.paintSign();
    4950                }
    5051        };
     
    5455                public void actionPerformed(java.awt.event.ActionEvent e) {
    5556                        dlg.mark.setRaconSequence(seqBox.getText());
     57                        dlg.mark.paintSign();
    5658                }
    5759        };
     
    6163                public void actionPerformed(java.awt.event.ActionEvent e) {
    6264                        dlg.mark.setRaconRange(rangeBox.getText());
     65                        dlg.mark.paintSign();
    6366                }
    6467        };
     
    6770        private ActionListener alSector1 = new ActionListener() {
    6871                public void actionPerformed(java.awt.event.ActionEvent e) {
    69                         dlg.mark.setRaconSector1(rangeBox.getText());
     72                        dlg.mark.setRaconSector1(sector1Box.getText());
    7073                }
    7174        };
     
    7477        private ActionListener alSector2 = new ActionListener() {
    7578                public void actionPerformed(java.awt.event.ActionEvent e) {
    76                         dlg.mark.setRaconSector2(rangeBox.getText());
     79                        dlg.mark.setRaconSector2(sector2Box.getText());
    7780                }
    7881        };
     82        public JLabel sectorsLabel;
    7983
    8084        public PanelRadar(OSeaMAction dia) {
     
    8387                this.add(getRadButton(noRadButton, 0, 3, 27, 27, "NoRadar", Rtb.NONE), null);
    8488                this.add(getRadButton(reflButton, 0, 33, 27, 27, "RadarReflector", Rtb.REFLECTOR), null);
    85                 this.add(getRadButton(raconButton, 0, 63, 27, 27, "Racon", Rtb.RACON), null);
    86                 this.add(getRadButton(ramarkButton, 0, 93, 27, 27, "Ramark", Rtb.RAMARK), null);
    87                 this.add(getRadButton(leadingButton, 0, 123, 27, 27, "LeadingBeacon", Rtb.LEADING), null);
     89                this.add(getRadButton(ramarkButton, 0, 63, 27, 27, "Ramark", Rtb.RAMARK), null);
     90                this.add(getRadButton(raconButton, 0, 93, 27, 27, "Racon", Rtb.RACON), null);
     91                this.add(getRadButton(leadingButton, 0, 123, 27, 27, "LeadingRacon", Rtb.LEADING), null);
    8892
    8993                groupLabel = new JLabel(Messages.getString("Group"), SwingConstants.CENTER);
    90                 groupLabel.setBounds(new Rectangle(75, 0, 100, 20));
     94                groupLabel.setBounds(new Rectangle(30, 0, 100, 20));
    9195                this.add(groupLabel, null);
    9296                groupBox = new JTextField();
    93                 groupBox.setBounds(new Rectangle(100, 20, 50, 20));
     97                groupBox.setBounds(new Rectangle(55, 20, 50, 20));
    9498                this.add(groupBox, null);
    9599                groupBox.addActionListener(alGroup);
    96100
    97101                periodLabel = new JLabel(Messages.getString("Period"), SwingConstants.CENTER);
    98                 periodLabel.setBounds(new Rectangle(75, 40, 100, 20));
     102                periodLabel.setBounds(new Rectangle(130, 0, 100, 20));
    99103                this.add(periodLabel, null);
    100104                periodBox = new JTextField();
    101                 periodBox.setBounds(new Rectangle(100, 60, 50, 20));
     105                periodBox.setBounds(new Rectangle(155, 20, 50, 20));
    102106                this.add(periodBox, null);
    103107                periodBox.addActionListener(alPeriod);
    104108
    105109                seqLabel = new JLabel(Messages.getString("Sequence"), SwingConstants.CENTER);
    106                 seqLabel.setBounds(new Rectangle(75, 80, 100, 20));
     110                seqLabel.setBounds(new Rectangle(30, 40, 100, 20));
    107111                this.add(seqLabel, null);
    108112                seqBox = new JTextField();
    109                 seqBox.setBounds(new Rectangle(100, 100, 50, 20));
     113                seqBox.setBounds(new Rectangle(55, 60, 50, 20));
    110114                this.add(seqBox, null);
    111115                seqBox.addActionListener(alSeq);
    112116
    113117                rangeLabel = new JLabel(Messages.getString("Range"), SwingConstants.CENTER);
    114                 rangeLabel.setBounds(new Rectangle(75, 120, 100, 20));
     118                rangeLabel.setBounds(new Rectangle(130, 40, 100, 20));
    115119                this.add(rangeLabel, null);
    116120                rangeBox = new JTextField();
    117                 rangeBox.setBounds(new Rectangle(100, 140, 50, 20));
     121                rangeBox.setBounds(new Rectangle(155, 60, 50, 20));
    118122                this.add(rangeBox, null);
    119123                rangeBox.addActionListener(alRange);
     124               
     125                sectorsLabel = new JLabel(Messages.getString("VisibleSector"), SwingConstants.CENTER);
     126                sectorsLabel.setBounds(new Rectangle(75, 85, 100, 20));
     127                this.add(sectorsLabel, null);
    120128
    121                 sector1Label = new JLabel(Messages.getString("SectorStart"), SwingConstants.CENTER);
    122                 sector1Label.setBounds(new Rectangle(175, 40, 100, 20));
     129                sector1Label = new JLabel(Messages.getString("Start"), SwingConstants.CENTER);
     130                sector1Label.setBounds(new Rectangle(30, 100, 100, 20));
    123131                this.add(sector1Label, null);
    124132                sector1Box = new JTextField();
    125                 sector1Box.setBounds(new Rectangle(200, 60, 50, 20));
     133                sector1Box.setBounds(new Rectangle(55, 120, 50, 20));
    126134                this.add(sector1Box, null);
    127135                sector1Box.addActionListener(alSector1);
    128136
    129                 sector2Label = new JLabel(Messages.getString("SectorEnd"), SwingConstants.CENTER);
    130                 sector2Label.setBounds(new Rectangle(175, 80, 100, 20));
     137                sector2Label = new JLabel(Messages.getString("End"), SwingConstants.CENTER);
     138                sector2Label.setBounds(new Rectangle(130, 100, 100, 20));
    131139                this.add(sector2Label, null);
    132140                sector2Box = new JTextField();
    133                 sector2Box.setBounds(new Rectangle(200, 100, 50, 20));
     141                sector2Box.setBounds(new Rectangle(155, 120, 50, 20));
    134142                this.add(sector2Box, null);
    135                 sector2Box.addActionListener(alSector1);
     143                sector2Box.addActionListener(alSector2);
    136144        }
    137145
    138146        public void syncPanel() {
     147                boolean rad = ((dlg.mark.getRadar() != Rtb.NONE) && (dlg.mark.getRadar() != Rtb.REFLECTOR));
     148                groupLabel.setVisible(rad);
     149                groupBox.setVisible(rad);
     150                periodLabel.setVisible(rad);
     151                periodBox.setVisible(rad);
     152                seqLabel.setVisible(rad);
     153                seqBox.setVisible(rad);
     154                rangeLabel.setVisible(rad);
     155                rangeBox.setVisible(rad);
     156                sector1Label.setVisible(rad);
     157                sector1Box.setVisible(rad);
     158                sector2Label.setVisible(rad);
     159                sector2Box.setVisible(rad);
     160                sectorsLabel.setVisible(rad);
    139161                for (Rtb rtb : rads.keySet()) {
    140                         JRadioButton button = rads.get(rtb);
    141                         if (dlg.mark.getRaType() == rtb) {
    142                                 button.setBorderPainted(true);
    143                         } else
    144                                 button.setBorderPainted(false);
     162                        rads.get(rtb).setBorderPainted(dlg.mark.getRadar() == rtb);
    145163                }
    146164                groupBox.setText(dlg.mark.getRaconGroup());
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSectors.java

    r27028 r27031  
    1010import oseam.Messages;
    1111import oseam.dialogs.OSeaMAction;
    12 import oseam.seamarks.SeaMark;
    1312import oseam.seamarks.SeaMark.*;
    1413
     
    6867                this.getContentPane().add(panel);
    6968               
    70                 TableColumn col = table.getColumnModel().getColumn(1);
    71                 col.setCellRenderer(new ColourCellRenderer());
     69                table.setDefaultRenderer(String.class, new CentreRenderer());
     70                table.getColumnModel().getColumn(1).setCellRenderer(new ColourCellRenderer());
    7271
    7372                TableColumn colColumn = table.getColumnModel().getColumn(1);
     
    140139                        switch (col) {
    141140                        case 0:
    142                                 return row;
     141                                if (row == 0)
     142                                        return "Common";
     143                                else
     144                                        return row;
    143145                        case 1:
    144146                                return dlg.mark.getLightAtt(Att.COL, row);
     
    212214        }
    213215
     216        static class CentreRenderer extends DefaultTableCellRenderer {
     217                public CentreRenderer() {
     218                        super();
     219                        setHorizontalAlignment(SwingConstants.CENTER);
     220                }
     221        }
     222
    214223        public class ColourCellRenderer extends JLabel implements TableCellRenderer {
     224                public ColourCellRenderer() {
     225                        super();
     226                        setHorizontalAlignment(SwingConstants.CENTER);
     227                }
    215228                public Component getTableCellRendererComponent(JTable table, Object value,
    216229                                boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
    217                         setHorizontalAlignment(SwingConstants.CENTER);
    218230                        setIcon(colours.get(value));
    219231                        return this;
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r27028 r27031  
    671671        }
    672672
    673         private boolean Radar = false;
    674 
    675         public boolean hasRadar() {
    676                 return Radar;
    677         }
    678 
    679         public void setRadar(boolean radar) {
    680                 Radar = radar;
    681         }
    682 
    683         private boolean Racon = false;
    684 
    685         public boolean hasRacon() {
    686                 return Racon;
    687         }
    688 
    689         public void setRacon(boolean racon) {
    690                 Racon = racon;
    691         }
    692 
    693673        public enum Rtb {
    694674                NONE, REFLECTOR, RACON, RAMARK, LEADING
    695675        }
    696676
     677        public static final EnumMap<Rtb, String> RtbSTR = new EnumMap<Rtb, String>(Rtb.class);
     678        static {
     679                RtbSTR.put(Rtb.RACON, "racon");
     680                RtbSTR.put(Rtb.RAMARK, "ramark");
     681                RtbSTR.put(Rtb.LEADING, "leading");
     682        }
     683
    697684        private Rtb RaType = Rtb.NONE;
    698685
    699         public Rtb getRaType() {
     686        public boolean hasRadar() {
     687                return (RaType != Rtb.NONE);
     688        }
     689
     690        public boolean hasRacon() {
     691                return (RaType == Rtb.RACON);
     692        }
     693
     694        public Rtb getRadar() {
    700695                return RaType;
    701696        }
    702697
    703         public void setRaType(Rtb type) {
     698        public void setRadar(Rtb type) {
    704699                RaType = type;
    705700        }
     
    13941389                if (paintlock)
    13951390                        return;
     1391                paintlock = true;
    13961392
    13971393                dlg.panelMain.shapeIcon.setIcon(null);
     1394                dlg.panelMain.colLabel.setText("");
     1395                dlg.panelMain.radarLabel.setText("");
     1396                dlg.panelMain.fogLabel.setText("");
     1397                dlg.panelMain.topIcon.setIcon(null);
     1398                dlg.panelMain.fogIcon.setIcon(null);
     1399                dlg.panelMain.radarIcon.setIcon(null);
    13981400                dlg.panelMain.lightIcon.setIcon(null);
    1399                 dlg.panelMain.topIcon.setIcon(null);
    1400                 dlg.panelMain.radarIcon.setIcon(null);
    1401                 dlg.panelMain.fogIcon.setIcon(null);
    1402                 dlg.panelMain.colLabel.setText("");
    14031401
    14041402                String colStr;
     
    16821680                        dlg.panelMain.fogIcon.setIcon(new ImageIcon(getClass().getResource("/images/Fog_Signal.png")));
    16831681                }
     1682               
     1683                if (hasRadar()) {
     1684                        if (getRadar() == Rtb.REFLECTOR) {
     1685                                dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png")));
     1686                        } else {
     1687                                dlg.panelMain.radarIcon.setIcon(new ImageIcon(getClass().getResource("/images/Radar_Station.png")));
     1688                                String str = "";
     1689                                if (getRadar() == Rtb.RAMARK)
     1690                                        str += "Ramark";
     1691                                else
     1692                                        str += "Racon";
     1693                                if (!getRaconGroup().isEmpty())
     1694                                        str += ("(" + getRaconGroup() + ")");
     1695                                else
     1696                                        str += " ";
     1697                                if (!getRaconPeriod().isEmpty())
     1698                                        str += getRaconPeriod() + "s";
     1699                                dlg.panelMain.radarLabel.setText(str);
     1700                        }
     1701                }
     1702               
     1703                if (isFired()) {
     1704                        dlg.panelMain.lightIcon.setIcon(new ImageIcon(getClass().getResource("/images/Light_Magenta_120.png")));
     1705                }
     1706               
     1707                paintlock = false;
    16841708        }
    16851709
     
    17981822                                }
    17991823                        }
     1824                       
     1825                        if (hasRadar()) {
     1826                                if (getRadar() == Rtb.REFLECTOR) {
     1827                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes"));
     1828                                } else {
     1829                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:category", RtbSTR.get(getRadar())));
     1830                                        if (!getRaconGroup().isEmpty()) {
     1831                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:group", getRaconGroup()));
     1832                                        }
     1833                                        if (!getRaconPeriod().isEmpty()) {
     1834                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:period", getRaconPeriod()));
     1835                                        }
     1836                                        if (!getRaconSequence().isEmpty()) {
     1837                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sequence", getRaconSequence()));
     1838                                        }
     1839                                        if (!getRaconRange().isEmpty()) {
     1840                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:range", getRaconRange()));
     1841                                        }
     1842                                        if ((!getRaconSector1().isEmpty()) && (!getRaconSector2().isEmpty())) {
     1843                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_start", getRaconSector1()));
     1844                                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_transponder:sector_end", getRaconSector2()));
     1845                                        }
     1846                                }
     1847                        }
     1848
    18001849                        if (!getInfo().isEmpty()) {
    18011850                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:information", getInfo()));
Note: See TracChangeset for help on using the changeset viewer.