Ignore:
Timestamp:
2016-03-17T01:50:12+01:00 (10 years ago)
Author:
Don-vip
Message:

sonar - Local variable and method parameter names should comply with a naming convention

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r9078 r10001  
    107107    public void reconstruct(Action action, ToggleDialog triggeredBy) {
    108108
    109         final int N = allDialogs.size();
     109        final int n = allDialogs.size();
    110110
    111111        /**
     
    126126         * in the last panel anyway.
    127127         */
    128         JPanel p = panels.get(N-1); // current Panel (start with last one)
     128        JPanel p = panels.get(n-1); // current Panel (start with last one)
    129129        int k = -1;                 // indicates that current Panel index is N-1, but no default-view-Dialog has been added to this Panel yet.
    130         for (int i = N-1; i >= 0; --i) {
     130        for (int i = n-1; i >= 0; --i) {
    131131            final ToggleDialog dlg = allDialogs.get(i);
    132132            if (dlg.isDialogInDefaultView()) {
    133133                if (k == -1) {
    134                     k = N-1;
     134                    k = n-1;
    135135                } else {
    136136                    --k;
     
    146146
    147147        if (k == -1) {
    148             k = N-1;
    149         }
    150         final int numPanels = N - k;
     148            k = n-1;
     149        }
     150        final int numPanels = n - k;
    151151
    152152        /**
     
    154154         */
    155155        if (action == Action.ELEMENT_SHRINKS) {
    156             for (int i = 0; i < N; ++i) {
     156            for (int i = 0; i < n; ++i) {
    157157                final ToggleDialog dlg = allDialogs.get(i);
    158158                if (dlg.isDialogInDefaultView()) {
     
    191191
    192192            /** total Height */
    193             final int H = mSpltPane.getMultiSplitLayout().getModel().getBounds().getSize().height;
     193            final int h = mSpltPane.getMultiSplitLayout().getModel().getBounds().getSize().height;
    194194
    195195            /** space, that is available for dialogs in default view (after the reconfiguration) */
    196             final int s2 = H - (numPanels - 1) * DIVIDER_SIZE - sumC;
    197 
    198             final int hp_trig = triggeredBy.getPreferredHeight();
    199             if (hp_trig <= 0) throw new IllegalStateException(); // Must be positive
     196            final int s2 = h - (numPanels - 1) * DIVIDER_SIZE - sumC;
     197
     198            final int hpTrig = triggeredBy.getPreferredHeight();
     199            if (hpTrig <= 0) throw new IllegalStateException(); // Must be positive
    200200
    201201            /** The new dialog gets a fair share */
    202             final int hn_trig = hp_trig * s2 / (hp_trig + sumP);
    203             triggeredBy.setPreferredSize(new Dimension(Integer.MAX_VALUE, hn_trig));
     202            final int hnTrig = hpTrig * s2 / (hpTrig + sumP);
     203            triggeredBy.setPreferredSize(new Dimension(Integer.MAX_VALUE, hnTrig));
    204204
    205205            /** This is remainig for the other default view dialogs */
    206             final int R = s2 - hn_trig;
     206            final int r = s2 - hnTrig;
    207207
    208208            /**
    209209             * Take space only from dialogs that are relatively large
    210210             */
    211             int D_m = 0;        // additional space needed by the small dialogs
    212             int D_p = 0;        // available space from the large dialogs
    213             for (int i = 0; i < N; ++i) {
     211            int dm = 0;        // additional space needed by the small dialogs
     212            int dp = 0;        // available space from the large dialogs
     213            for (int i = 0; i < n; ++i) {
    214214                final ToggleDialog dlg = allDialogs.get(i);
    215215                if (dlg.isDialogInDefaultView() && dlg != triggeredBy) {
    216216                    final int ha = dlg.getSize().height;                              // current
    217                     final int h0 = ha * R / sumA;                                     // proportional shrinking
    218                     final int he = dlg.getPreferredHeight() * s2 / (sumP + hp_trig);  // fair share
     217                    final int h0 = ha * r / sumA;                                     // proportional shrinking
     218                    final int he = dlg.getPreferredHeight() * s2 / (sumP + hpTrig);  // fair share
    219219                    if (h0 < he) {                  // dialog is relatively small
    220220                        int hn = Math.min(ha, he);  // shrink less, but do not grow
    221                         D_m += hn - h0;
     221                        dm += hn - h0;
    222222                    } else {                        // dialog is relatively large
    223                         D_p += h0 - he;
     223                        dp += h0 - he;
    224224                    }
    225225                }
    226226            }
    227227            /** adjust, without changing the sum */
    228             for (int i = 0; i < N; ++i) {
     228            for (int i = 0; i < n; ++i) {
    229229                final ToggleDialog dlg = allDialogs.get(i);
    230230                if (dlg.isDialogInDefaultView() && dlg != triggeredBy) {
    231231                    final int ha = dlg.getHeight();
    232                     final int h0 = ha * R / sumA;
    233                     final int he = dlg.getPreferredHeight() * s2 / (sumP + hp_trig);
     232                    final int h0 = ha * r / sumA;
     233                    final int he = dlg.getPreferredHeight() * s2 / (sumP + hpTrig);
    234234                    if (h0 < he) {
    235235                        int hn = Math.min(ha, he);
     
    238238                        int d;
    239239                        try {
    240                             d = (h0-he) * D_m / D_p;
     240                            d = (h0-he) * dm / dp;
    241241                        } catch (ArithmeticException e) { /* D_p may be zero - nothing wrong with that. */
    242242                            d = 0;
     
    253253        final List<Node> ch = new ArrayList<>();
    254254
    255         for (int i = k; i <= N-1; ++i) {
     255        for (int i = k; i <= n-1; ++i) {
    256256            if (i != k) {
    257257                ch.add(new Divider());
     
    279279         * Hide the Panel, if there is nothing to show
    280280         */
    281         if (numPanels == 1 && panels.get(N-1).getComponents().length == 0) {
     281        if (numPanels == 1 && panels.get(n-1).getComponents().length == 0) {
    282282            parent.setDividerSize(0);
    283283            this.setVisible(false);
Note: See TracChangeset for help on using the changeset viewer.