Changeset 24460 in osm for applications


Ignore:
Timestamp:
2010-11-29T23:29:14+01:00 (14 years ago)
Author:
postfix
Message:

panel limits ready

Location:
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/panels/PanelLimits.java

    r24451 r24460  
    22
    33import harbour.widgets.LightTile;
    4 import harbour.widgets.TextFieldEx;
    5 import harbour.widgets.TextFieldEx.Ssize;
     4import harbour.widgets.SizePanel;
     5// import harbour.widgets.SizePanel.Ssize;
    66import harbour.widgets.TristateCheckBox;
    77
     
    1010
    1111import java.awt.Color;
    12 import java.awt.GridBagLayout;
    1312import java.awt.Dimension;
    1413import javax.swing.JLabel;
     
    1716import java.awt.Font;
    1817
     18import javax.swing.ButtonGroup;
    1919import javax.swing.Icon;
    2020import javax.swing.JTextField;
     
    2323import javax.swing.JButton;
    2424import javax.swing.ImageIcon;
    25 import java.awt.Button;
    2625
    2726
    2827public class PanelLimits extends JPanel {
    2928
     29        private ButtonGroup buttons = new ButtonGroup();
    3030        private JLabel limLabel = null;
    3131        private JCheckBox tideCheckBox = null;
     
    4444        private JCheckBox etaCheckBox = null;
    4545        private JPanel exPanel = null;
    46        
     46        private JLabel unitLabel = null;
     47        private JRadioButton meterRadioButton = null;
     48        private JRadioButton feetRadioButton = null;
     49               
    4750        public PanelLimits() {
    4851                super();
     
    5558         */
    5659        private void initialize() {
     60        unitLabel = new JLabel();
     61        unitLabel.setBounds(new Rectangle(235, 53, 50, 20));
     62        unitLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
     63        unitLabel.setText("Einheit:");
    5764        grLabel = new JLabel();
    58         grLabel.setBounds(new Rectangle(215, 222, 80, 16));
     65        grLabel.setBounds(new Rectangle(213, 242, 80, 16));
    5966        grLabel.setFont(new Font("Dialog", Font.PLAIN, 12));
    6067        grLabel.setText("Ankergrund");
     
    8693        this.add(getAllComboBox(), null);
    8794        this.add(getExPanel(), null);
     95        this.add(unitLabel, null);
     96        this.add(getMeterRadioButton(), null);
     97        this.add(getFeetRadioButton(), null);
     98       
     99        buttons.add(feetRadioButton);
     100        buttons.add(meterRadioButton);
    88101        }
    89102
     
    169182                if (allComboBox == null) {
    170183                        allComboBox = new JComboBox();
    171                         allComboBox.setBounds(new Rectangle(135, 70, 190, 20));
     184                        allComboBox.setBounds(new Rectangle(135, 83, 190, 20));
    172185                        allComboBox.setFont(new Font("Dialog", Font.PLAIN, 12));
    173186                        allComboBox.addActionListener(new java.awt.event.ActionListener() {
    174187                                public void actionPerformed(java.awt.event.ActionEvent e) {
     188                                       
     189                                        if(((SizePanel) exPanel).selTextField == null ) return;
    175190                                        int type = allComboBox.getSelectedIndex();
    176                                         Ssize sType = ((TextFieldEx) exPanel).getSizeType();
    177                                         if(sType == TextFieldEx.VS_SIZE ) {
     191                                        if(type < 0) return;
     192                                       
     193                                        ((SizePanel) exPanel).selTextField.setIndex(type, false);
     194                                        /*
     195                                        Ssize sType = ((SizePanel) exPanel).getSizeType();
     196                                        if(sType == SizePanel.VS_SIZE ) {
    178197                                                switch (type) {
    179                                                         case TextFieldEx.NOT_SELECTED:
    180                                                                 if(((TextFieldEx) exPanel).selTextField != null ) ((TextFieldEx) exPanel).selTextField.setText("");
     198                                                        case SizePanel.NOT_SELECTED:
     199                                                                ((SizePanel) exPanel).selTextField.setText("");
    181200                                                                break;
    182201
    183                                                         case TextFieldEx.LARGE:
    184                                                                 ((TextFieldEx) exPanel).selTextField.setText("> 500ft");
     202                                                        case SizePanel.UNKNOWN:
     203                                                                ((SizePanel) exPanel).selTextField.setText("unbekannt");
    185204                                                                break;
    186                                                                
    187                                                         case TextFieldEx.MEDIUM:
    188                                                                 ((TextFieldEx) exPanel).selTextField.setText("bis 500ft");
     205
     206                                                        default:
     207                                                                ((SizePanel) exPanel).selTextField.setText(((SizePanel) exPanel).vsSize[type-1][((SizePanel) exPanel).units]);
    189208                                                                break;
    190                                                                
    191                                                         case TextFieldEx.UNKNOWN:
    192                                                                 ((TextFieldEx) exPanel).selTextField.setText("unbekannt");
    193                                                                 break;
    194                                                                
    195209                                                }
    196 
    197210                                        }
     211                                       
     212                                        if(sType == SizePanel.AN_SIZE) {
     213                                                switch (type) {
     214                                                case SizePanel.NOT_SELECTED:
     215                                                        ((SizePanel) exPanel).selTextField.setText("");
     216                                                        break;
     217                                                       
     218                                                case SizePanel.CAT_UNKNOWN:
     219                                                        ((SizePanel) exPanel).selTextField.setText("unbekannt");
     220                                                        break;
     221                                                       
     222                                                default:
     223                                                        ((SizePanel) exPanel).selTextField.setText(((SizePanel) exPanel).anSize[type-1][((SizePanel) exPanel).units]);
     224                                                        break;
     225                                                }
     226                                        } */
    198227                                }
    199228                        });
     
    215244                       
    216245                        grButton = new LightTile(grey, green, yellow, red);
    217                         grButton.setBounds(new Rectangle(164, 220, 50, 20));
     246                        grButton.setBounds(new Rectangle(162, 240, 50, 20));
    218247                }
    219248                return grButton;
     
    228257                if (olCheckBox == null) {
    229258                        olCheckBox = new TristateCheckBox();
    230                         olCheckBox.setBounds(new Rectangle(2, 95, 133, 20));
     259                        olCheckBox.setBounds(new Rectangle(7, 109, 133, 20));
    231260                        olCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
    232261                        olCheckBox.setText("Overhead Limits");
     
    243272                if (turnCheckBox == null) {
    244273                        turnCheckBox = new TristateCheckBox();
    245                         turnCheckBox.setBounds(new Rectangle(2, 118, 105, 20));
     274                        turnCheckBox.setBounds(new Rectangle(7, 132, 105, 20));
    246275                        turnCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
    247276                        turnCheckBox.setText("Wendeplatz");
     
    258287                if (impCheckBox == null) {
    259288                        impCheckBox = new TristateCheckBox();
    260                         impCheckBox.setBounds(new Rectangle(2, 141, 95, 20));
     289                        impCheckBox.setBounds(new Rectangle(7, 155, 95, 20));
    261290                        impCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
    262291                        impCheckBox.setText("Zollhafen");
     
    273302                if (usCheckBox == null) {
    274303                        usCheckBox = new TristateCheckBox();
    275                         usCheckBox.setBounds(new Rectangle(2, 164, 125, 20));
     304                        usCheckBox.setBounds(new Rectangle(7, 178, 125, 20));
    276305                        usCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
    277306                        usCheckBox.setText("US. Vertretung");
     
    288317                if (etaCheckBox == null) {
    289318                        etaCheckBox = new TristateCheckBox();
    290                         etaCheckBox.setBounds(new Rectangle(2, 187, 120, 20));
     319                        etaCheckBox.setBounds(new Rectangle(7, 201, 120, 20));
    291320                        etaCheckBox.setText("ETA Nachricht");
    292321                        etaCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
     
    302331        private JPanel getExPanel() {
    303332                if (exPanel == null) {
    304                         exPanel = new TextFieldEx();
     333                        exPanel = new SizePanel();
    305334                        exPanel.setLayout(null);
    306                         exPanel.setBounds(new Rectangle(135, 95, 190, 112));
    307                         ((TextFieldEx) exPanel).setComboBox(allComboBox);
    308                         ((TextFieldEx) exPanel).initialize();
     335                        exPanel.setBounds(new Rectangle(135, 110, 190, 112));
     336                        ((SizePanel) exPanel).setComboBox(allComboBox);
     337                        ((SizePanel) exPanel).initialize();
    309338                }
    310339                return exPanel;
    311340        }
     341
     342        /**
     343         * This method initializes meterRadioButton     
     344         *     
     345         * @return javax.swing.JRadioButton     
     346         */
     347        private JRadioButton getMeterRadioButton() {
     348                if (meterRadioButton == null) {
     349                        meterRadioButton = new JRadioButton();
     350                        meterRadioButton.setBounds(new Rectangle(290, 45, 38, 20));
     351                        meterRadioButton.setFont(new Font("Dialog", Font.PLAIN, 12));
     352                        meterRadioButton.setSelected(true);
     353                        meterRadioButton.setText("m");
     354                        meterRadioButton.addActionListener(new java.awt.event.ActionListener() {
     355                                public void actionPerformed(java.awt.event.ActionEvent e) {
     356                                        ((SizePanel) exPanel).units = SizePanel.METER;
     357                                        ((SizePanel) exPanel).changeUnits();
     358                                }
     359                        });
     360                }
     361                return meterRadioButton;
     362        }
     363
     364        /**
     365         * This method initializes feetRadioButton     
     366         *     
     367         * @return javax.swing.JRadioButton     
     368         */
     369        private JRadioButton getFeetRadioButton() {
     370                if (feetRadioButton == null) {
     371                        feetRadioButton = new JRadioButton();
     372                        feetRadioButton.setBounds(new Rectangle(290, 62, 38, 20));
     373                        feetRadioButton.setFont(new Font("Dialog", Font.PLAIN, 12));
     374                        feetRadioButton.setText("ft");
     375                        feetRadioButton.addActionListener(new java.awt.event.ActionListener() {
     376                                public void actionPerformed(java.awt.event.ActionEvent e) {
     377                                        ((SizePanel) exPanel).units = SizePanel.FEET;
     378                                        ((SizePanel) exPanel).changeUnits();
     379                                }
     380                        });
     381                }
     382                return feetRadioButton;
     383        }
    312384}
Note: See TracChangeset for help on using the changeset viewer.