[sip-comm-dev] Re: svn commit: r4659 - trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java


#1

Hi Ben,

first, thanks for taking care of this! I'm now applying some modifications to the whole toolbar there, concerning the spaces you mentioned earlier and will commit soon.

I've just noticed in your commit that you've moved all equals signs on the previous line of a multiline expression, like the following one.

- private static int BUTTON_HEIGHT
- = GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+ GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");

This may be a result of automatic formatting, but if not I just wanted to say that in the Java convention (which is the one we're trying to stick with), they advise to break an expression before an operator.
If you're interested in further details you could have a look here: http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248.

Cheers,
Yana

pradelle@dev.java.net wrote:

···

Author: pradelle
Date: 2008-10-29 02:57:03+0000
New Revision: 4659

Modified:
   trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java

Log:
- fix a minor issue with the smiley layout computation
- refresh code to use templates and for each

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java?view=diff&rev=4659&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&r1=4658&r2=4659

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java 2008-10-29 02:57:03+0000
@@ -1,8 +1,7 @@
/*
  * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * + * Distributable under LGPL license. See terms of license at gnu.org.
  */
  package net.java.sip.communicator.impl.gui.main.chat;
@@ -20,17 +19,18 @@
import net.java.sip.communicator.impl.gui.utils.*;
  /**
- * The <tt>SmiliesSelectorBox</tt> is the component where user could choose
- * a smiley icon to send.
+ * The <tt>SmiliesSelectorBox</tt> is the component where user could choose a
+ * smiley icon to send.
  * * @author Yana Stamcheva
  */
-public class SmiliesSelectorBox extends JMenuBar
+public class SmiliesSelectorBox
+ extends JMenuBar
     implements ActionListener
{
     private ChatWritePanel chatWritePanel;
- private ArrayList imageList;
+ private ArrayList<Smiley> imageList;
      private int gridRowCount = 0;
@@ -38,14 +38,14 @@
      private SIPCommMenu selectorBox = new SIPCommMenu();
- private static int BUTTON_HEIGHT
- = GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+ GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
- private static int BUTTON_WIDTH
- = GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
+ private static int BUTTON_WIDTH =
+ GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
- private SelectorBoxRolloverListener rolloverListener
- = new SelectorBoxRolloverListener();
+ private SelectorBoxRolloverListener rolloverListener =
+ new SelectorBoxRolloverListener();
      /**
      * Creates an instance of this <tt>SmiliesSelectorBox</tt> and initializes
@@ -53,7 +53,8 @@
      * * @param imageList The pack of smiley icons.
      */
- public SmiliesSelectorBox(ArrayList imageList, ChatWritePanel writePanel)
+ public SmiliesSelectorBox(ArrayList<Smiley> imageList,
+ ChatWritePanel writePanel)
     {
         this.imageList = imageList;
@@ -63,11 +64,10 @@
          this.setOpaque(false);
         this.selectorBox.setOpaque(false);
- this.setPreferredSize(
- new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
+ this.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
- //Should explicitly remove any border in order to align correctly the
- //icon.
+ // Should explicitly remove any border in order to align correctly the
+ // icon.
         this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
          this.selectorBox.setIcon(new ImageIcon(ImageLoader
@@ -75,23 +75,22 @@
          this.calculateGridDimensions(imageList.size());
- this.selectorBox.getPopupMenu().setLayout(new GridLayout(
- this.gridRowCount, this.gridColCount, 5, 5));
-
- for (int i = 0; i < imageList.size(); i++) {
+ this.selectorBox.getPopupMenu().setLayout(
+ new GridLayout(this.gridRowCount, this.gridColCount, 5, 5));
- Smiley smiley = (Smiley) this.imageList.get(i);
+ for (Smiley smiley : imageList)
+ {
- ImageIcon imageIcon
- = new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
+ ImageIcon imageIcon =
+ new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
- JMenuItem smileyItem = new JMenuItem (imageIcon);
+ JMenuItem smileyItem = new JMenuItem(imageIcon);
-// smileyItem.setPreferredSize(
-// new Dimension( imageIcon.getIconWidth(),
-// imageIcon.getIconHeight()));
+ // smileyItem.setPreferredSize(
+ // new Dimension( imageIcon.getIconWidth(),
+ // imageIcon.getIconHeight()));
-// smileyItem.setMargin(new Insets(2, 2, 2, 2));
+ // smileyItem.setMargin(new Insets(2, 2, 2, 2));
              smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
@@ -102,16 +101,18 @@
          this.add(selectorBox);
     }
- +
     /**
      * In order to have a popup which is at the form closest to sqware.
+ * * @param itemsCount the count of items that will be laied out.
      */
- private void calculateGridDimensions(int itemsCount) {
+ private void calculateGridDimensions(int itemsCount)
+ {
          this.gridRowCount = (int) Math.round(Math.sqrt(itemsCount));
- this.gridColCount = (int) Math.round(itemsCount / gridRowCount);
+ this.gridColCount = (int) Math.ceil(itemsCount / gridRowCount);
     }
      /**
@@ -124,13 +125,14 @@
      /**
      * Returns TRUE if the selector box is opened, otherwise returns FALSE.
+ * * @return TRUE if the selector box is opened, otherwise returns FALSE
      */
     public boolean isMenuSelected()
     {
- if(selectorBox.isPopupMenuVisible())
+ if (selectorBox.isPopupMenuVisible())
             return true;
- +
         return false;
     }
@@ -143,9 +145,8 @@
         JMenuItem smileyItem = (JMenuItem) e.getSource();
         String buttonText = smileyItem.getToolTipText();
- for (int i = 0; i < this.imageList.size(); i++)
+ for (Smiley smiley : imageList)
         {
- Smiley smiley = (Smiley) this.imageList.get(i);
              String smileyString = smiley.getSmileyStrings()[0];
@@ -171,9 +172,8 @@
         this.selectorBox.setFont(getFont().deriveFont(Font.BOLD, 10f));
         this.selectorBox.setVerticalTextPosition(SwingConstants.BOTTOM);
         this.selectorBox.setHorizontalTextPosition(SwingConstants.CENTER);
- this.selectorBox.setForeground(
- new Color(GuiActivator.getResources().
- getColor("chatMenuForeground")));
+ this.selectorBox.setForeground(new Color(GuiActivator.getResources()
+ .getColor("chatMenuForeground")));
     }
      /**
@@ -181,11 +181,11 @@
      * this smilies selector box.
      * * @param isRollover <code>true</code> to enable the roll-over,
- * <code>false</code> - otherwise.
+ * <code>false</code> - otherwise.
      */
     public void setRollover(boolean isRollover)
     {
- if(isRollover)
+ if (isRollover)
             selectorBox.addMouseListener(rolloverListener);
         else
             selectorBox.removeMouseListener(rolloverListener);
@@ -195,7 +195,8 @@
      * Handles <tt>MouseEvent</tt>s and changes the state of the contained
      * selector box in order to make a roll-over effect.
      */
- private class SelectorBoxRolloverListener extends MouseAdapter
+ private class SelectorBoxRolloverListener
+ extends MouseAdapter
     {
         public void mouseEntered(MouseEvent e)
         {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi Yana, all,

I'm glad to hear that the modifications are comming soon!

The source modifications you've noticed are the result of the Eclipse
auto-formatting tool. I'm using the formatter proposed on our website so it
probably has to be updated. I'll see if I can fix the formater and correct
this bad formatting. Thanks for reporting it!

Ben

···

2008/10/29 Yana Stamcheva <yana@sip-communicator.org>

Hi Ben,

first, thanks for taking care of this! I'm now applying some modifications
to the whole toolbar there, concerning the spaces you mentioned earlier and
will commit soon.

I've just noticed in your commit that you've moved all equals signs on the
previous line of a multiline expression, like the following one.

- private static int BUTTON_HEIGHT

- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");

This may be a result of automatic formatting, but if not I just wanted to
say that in the Java convention (which is the one we're trying to stick
with), they advise to break an expression before an operator.
If you're interested in further details you could have a look here: http://java.sun.com/docs/code
a result of automatic formatting, but if not I just
conv/html/CodeConventions.doc3.html#248<http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248>
.

Cheers,
Yana

pradelle@dev.java.net wrote:

Author: pradelle
Date: 2008-10-29 02:57:03+0000
New Revision: 4659

Modified:

trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java

Log:
- fix a minor issue with the smiley layout computation
- refresh code to use templates and for each

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java?view=diff&rev=4659&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&r1=4658&r2=4659

==============================================================================
---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
     (original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
     2008-10-29 02:57:03+0000
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging
client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * + * Distributable under LGPL license. See terms of license at gnu.org
.
*/
  package net.java.sip.communicator.impl.gui.main.chat;
@@ -20,17 +19,18 @@
import net.java.sip.communicator.impl.gui.utils.*;
  /**
- * The <tt>SmiliesSelectorBox</tt> is the component where user could
choose
- * a smiley icon to send.
+ * The <tt>SmiliesSelectorBox</tt> is the component where user could
choose a
+ * smiley icon to send.
* * @author Yana Stamcheva
*/
-public class SmiliesSelectorBox extends JMenuBar
+public class SmiliesSelectorBox
+ extends JMenuBar
    implements ActionListener
{
    private ChatWritePanel chatWritePanel;
- private ArrayList imageList;
+ private ArrayList<Smiley> imageList;
      private int gridRowCount = 0;
@@ -38,14 +38,14 @@
      private SIPCommMenu selectorBox = new SIPCommMenu();
- private static int BUTTON_HEIGHT
- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
- private static int BUTTON_WIDTH
- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
+ private static int BUTTON_WIDTH =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
- private SelectorBoxRolloverListener rolloverListener
- = new SelectorBoxRolloverListener();
+ private SelectorBoxRolloverListener rolloverListener =
+ new SelectorBoxRolloverListener();
      /**
     * Creates an instance of this <tt>SmiliesSelectorBox</tt> and
initializes
@@ -53,7 +53,8 @@
     * * @param imageList The pack of smiley icons.
     */
- public SmiliesSelectorBox(ArrayList imageList, ChatWritePanel
writePanel)
+ public SmiliesSelectorBox(ArrayList<Smiley> imageList,
+ ChatWritePanel writePanel)
    {
        this.imageList = imageList;
@@ -63,11 +64,10 @@
          this.setOpaque(false);
        this.selectorBox.setOpaque(false);
- this.setPreferredSize(
- new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
+ this.setPreferredSize(new Dimension(BUTTON_WIDTH,
BUTTON_HEIGHT));
- //Should explicitly remove any border in order to align
correctly the
- //icon.
+ // Should explicitly remove any border in order to align
correctly the
+ // icon.
        this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0, 0,
0, 0));
          this.selectorBox.setIcon(new ImageIcon(ImageLoader
@@ -75,23 +75,22 @@
          this.calculateGridDimensions(imageList.size());
- this.selectorBox.getPopupMenu().setLayout(new GridLayout(
- this.gridRowCount, this.gridColCount, 5, 5));
-
- for (int i = 0; i < imageList.size(); i++) {
+ this.selectorBox.getPopupMenu().setLayout(
+ new GridLayout(this.gridRowCount, this.gridColCount, 5, 5));
- Smiley smiley = (Smiley) this.imageList.get(i);
+ for (Smiley smiley : imageList)
+ {
- ImageIcon imageIcon
- = new
ImageIcon(ImageLoader.getImage(smiley.getImageID()));
+ ImageIcon imageIcon =
+ new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
- JMenuItem smileyItem = new JMenuItem (imageIcon);
+ JMenuItem smileyItem = new JMenuItem(imageIcon);
-// smileyItem.setPreferredSize(
-// new Dimension( imageIcon.getIconWidth(),
-// imageIcon.getIconHeight()));
+ // smileyItem.setPreferredSize(
+ // new Dimension( imageIcon.getIconWidth(),
+ // imageIcon.getIconHeight()));
-// smileyItem.setMargin(new Insets(2, 2, 2, 2));
+ // smileyItem.setMargin(new Insets(2, 2, 2, 2));
              smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
@@ -102,16 +101,18 @@
          this.add(selectorBox);
    }
- +
    /**
     * In order to have a popup which is at the form closest to sqware.
+ * * @param itemsCount the count of items that will be laied
out.
     */
- private void calculateGridDimensions(int itemsCount) {
+ private void calculateGridDimensions(int itemsCount)
+ {
          this.gridRowCount = (int) Math.round(Math.sqrt(itemsCount));
- this.gridColCount = (int) Math.round(itemsCount / gridRowCount);
+ this.gridColCount = (int) Math.ceil(itemsCount / gridRowCount);
    }
      /**
@@ -124,13 +125,14 @@
      /**
     * Returns TRUE if the selector box is opened, otherwise returns
FALSE.
+ * * @return TRUE if the selector box is opened, otherwise
returns FALSE
     */
    public boolean isMenuSelected()
    {
- if(selectorBox.isPopupMenuVisible())
+ if (selectorBox.isPopupMenuVisible())
            return true;
- +
        return false;
    }
@@ -143,9 +145,8 @@
        JMenuItem smileyItem = (JMenuItem) e.getSource();
        String buttonText = smileyItem.getToolTipText();
- for (int i = 0; i < this.imageList.size(); i++)
+ for (Smiley smiley : imageList)
        {
- Smiley smiley = (Smiley) this.imageList.get(i);
              String smileyString = smiley.getSmileyStrings()[0];
@@ -171,9 +172,8 @@
        this.selectorBox.setFont(getFont().deriveFont(Font.BOLD, 10f));
        this.selectorBox.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.selectorBox.setHorizontalTextPosition(SwingConstants.CENTER);
- this.selectorBox.setForeground(
- new Color(GuiActivator.getResources().
- getColor("chatMenuForeground")));
+ this.selectorBox.setForeground(new
Color(GuiActivator.getResources()
+ .getColor("chatMenuForeground")));
    }
      /**
@@ -181,11 +181,11 @@
     * this smilies selector box.
     * * @param isRollover <code>true</code> to enable the roll-over,
- * <code>false</code> - otherwise.
+ * <code>false</code> - otherwise.
     */
    public void setRollover(boolean isRollover)
    {
- if(isRollover)
+ if (isRollover)
            selectorBox.addMouseListener(rolloverListener);
        else
            selectorBox.removeMouseListener(rolloverListener);
@@ -195,7 +195,8 @@
     * Handles <tt>MouseEvent</tt>s and changes the state of the contained
     * selector box in order to make a roll-over effect.
     */
- private class SelectorBoxRolloverListener extends MouseAdapter
+ private class SelectorBoxRolloverListener
+ extends MouseAdapter
    {
        public void mouseEntered(MouseEvent e)
        {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail:
commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hi all,

It seems that the Eclipse code formatter is not able to generate line breaks
before an affectation so this will have to be fixed by hand...

Ben

···

2008/10/29 Yana Stamcheva <yana@sip-communicator.org>

Hi Ben,

first, thanks for taking care of this! I'm now applying some modifications
to the whole toolbar there, concerning the spaces you mentioned earlier and
will commit soon.

I've just noticed in your commit that you've moved all equals signs on the
previous line of a multiline expression, like the following one.

- private static int BUTTON_HEIGHT

- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");

This may be a result of automatic formatting, but if not I just wanted to
say that in the Java convention (which is the one we're trying to stick
with), they advise to break an expression before an operator.
If you're interested in further details you could have a look here:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248.

Cheers,
Yana

pradelle@dev.java.net wrote:

Author: pradelle
Date: 2008-10-29 02:57:03+0000
New Revision: 4659

Modified:

trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java

Log:
- fix a minor issue with the smiley layout computation
- refresh code to use templates and for each

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java?view=diff&rev=4659&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java&r1=4658&r2=4659

==============================================================================
---
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
     (original)
+++
trunk/src/net/java/sip/communicator/impl/gui/main/chat/SmiliesSelectorBox.java
     2008-10-29 02:57:03+0000
@@ -1,8 +1,7 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging
client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
+ * + * Distributable under LGPL license. See terms of license at gnu.org
.
*/
  package net.java.sip.communicator.impl.gui.main.chat;
@@ -20,17 +19,18 @@
import net.java.sip.communicator.impl.gui.utils.*;
  /**
- * The <tt>SmiliesSelectorBox</tt> is the component where user could
choose
- * a smiley icon to send.
+ * The <tt>SmiliesSelectorBox</tt> is the component where user could
choose a
+ * smiley icon to send.
* * @author Yana Stamcheva
*/
-public class SmiliesSelectorBox extends JMenuBar
+public class SmiliesSelectorBox
+ extends JMenuBar
    implements ActionListener
{
    private ChatWritePanel chatWritePanel;
- private ArrayList imageList;
+ private ArrayList<Smiley> imageList;
      private int gridRowCount = 0;
@@ -38,14 +38,14 @@
      private SIPCommMenu selectorBox = new SIPCommMenu();
- private static int BUTTON_HEIGHT
- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
+ private static int BUTTON_HEIGHT =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonHeight");
- private static int BUTTON_WIDTH
- =
GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
+ private static int BUTTON_WIDTH =
+
GuiActivator.getResources().getSettingsInt("mainToolbarButtonWidth");
- private SelectorBoxRolloverListener rolloverListener
- = new SelectorBoxRolloverListener();
+ private SelectorBoxRolloverListener rolloverListener =
+ new SelectorBoxRolloverListener();
      /**
     * Creates an instance of this <tt>SmiliesSelectorBox</tt> and
initializes
@@ -53,7 +53,8 @@
     * * @param imageList The pack of smiley icons.
     */
- public SmiliesSelectorBox(ArrayList imageList, ChatWritePanel
writePanel)
+ public SmiliesSelectorBox(ArrayList<Smiley> imageList,
+ ChatWritePanel writePanel)
    {
        this.imageList = imageList;
@@ -63,11 +64,10 @@
          this.setOpaque(false);
        this.selectorBox.setOpaque(false);
- this.setPreferredSize(
- new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
+ this.setPreferredSize(new Dimension(BUTTON_WIDTH,
BUTTON_HEIGHT));
- //Should explicitly remove any border in order to align
correctly the
- //icon.
+ // Should explicitly remove any border in order to align
correctly the
+ // icon.
        this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0, 0,
0, 0));
          this.selectorBox.setIcon(new ImageIcon(ImageLoader
@@ -75,23 +75,22 @@
          this.calculateGridDimensions(imageList.size());
- this.selectorBox.getPopupMenu().setLayout(new GridLayout(
- this.gridRowCount, this.gridColCount, 5, 5));
-
- for (int i = 0; i < imageList.size(); i++) {
+ this.selectorBox.getPopupMenu().setLayout(
+ new GridLayout(this.gridRowCount, this.gridColCount, 5, 5));
- Smiley smiley = (Smiley) this.imageList.get(i);
+ for (Smiley smiley : imageList)
+ {
- ImageIcon imageIcon
- = new
ImageIcon(ImageLoader.getImage(smiley.getImageID()));
+ ImageIcon imageIcon =
+ new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
- JMenuItem smileyItem = new JMenuItem (imageIcon);
+ JMenuItem smileyItem = new JMenuItem(imageIcon);
-// smileyItem.setPreferredSize(
-// new Dimension( imageIcon.getIconWidth(),
-// imageIcon.getIconHeight()));
+ // smileyItem.setPreferredSize(
+ // new Dimension( imageIcon.getIconWidth(),
+ // imageIcon.getIconHeight()));
-// smileyItem.setMargin(new Insets(2, 2, 2, 2));
+ // smileyItem.setMargin(new Insets(2, 2, 2, 2));
              smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
@@ -102,16 +101,18 @@
          this.add(selectorBox);
    }
- +
    /**
     * In order to have a popup which is at the form closest to sqware.
+ * * @param itemsCount the count of items that will be laied
out.
     */
- private void calculateGridDimensions(int itemsCount) {
+ private void calculateGridDimensions(int itemsCount)
+ {
          this.gridRowCount = (int) Math.round(Math.sqrt(itemsCount));
- this.gridColCount = (int) Math.round(itemsCount / gridRowCount);
+ this.gridColCount = (int) Math.ceil(itemsCount / gridRowCount);
    }
      /**
@@ -124,13 +125,14 @@
      /**
     * Returns TRUE if the selector box is opened, otherwise returns
FALSE.
+ * * @return TRUE if the selector box is opened, otherwise
returns FALSE
     */
    public boolean isMenuSelected()
    {
- if(selectorBox.isPopupMenuVisible())
+ if (selectorBox.isPopupMenuVisible())
            return true;
- +
        return false;
    }
@@ -143,9 +145,8 @@
        JMenuItem smileyItem = (JMenuItem) e.getSource();
        String buttonText = smileyItem.getToolTipText();
- for (int i = 0; i < this.imageList.size(); i++)
+ for (Smiley smiley : imageList)
        {
- Smiley smiley = (Smiley) this.imageList.get(i);
              String smileyString = smiley.getSmileyStrings()[0];
@@ -171,9 +172,8 @@
        this.selectorBox.setFont(getFont().deriveFont(Font.BOLD, 10f));
        this.selectorBox.setVerticalTextPosition(SwingConstants.BOTTOM);
        this.selectorBox.setHorizontalTextPosition(SwingConstants.CENTER);
- this.selectorBox.setForeground(
- new Color(GuiActivator.getResources().
- getColor("chatMenuForeground")));
+ this.selectorBox.setForeground(new
Color(GuiActivator.getResources()
+ .getColor("chatMenuForeground")));
    }
      /**
@@ -181,11 +181,11 @@
     * this smilies selector box.
     * * @param isRollover <code>true</code> to enable the roll-over,
- * <code>false</code> - otherwise.
+ * <code>false</code> - otherwise.
     */
    public void setRollover(boolean isRollover)
    {
- if(isRollover)
+ if (isRollover)
            selectorBox.addMouseListener(rolloverListener);
        else
            selectorBox.removeMouseListener(rolloverListener);
@@ -195,7 +195,8 @@
     * Handles <tt>MouseEvent</tt>s and changes the state of the contained
     * selector box in order to make a roll-over effect.
     */
- private class SelectorBoxRolloverListener extends MouseAdapter
+ private class SelectorBoxRolloverListener
+ extends MouseAdapter
    {
        public void mouseEntered(MouseEvent e)
        {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail:
commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net