New smileys pack and some improvements of the smileys box look and feel.

cusax-fix
Yana Stamcheva 17 years ago
parent 7076dcd63d
commit d9ed67e0c4

@ -150,23 +150,27 @@ service.gui.buttons.MORE_ACTIONS_ROLLOVER_BUTTON=resources/images/impl/gui/butto
service.gui.buttons.HIDE_ACTIONS_BUTTON=resources/images/impl/gui/buttons/hideMoreActions.png
service.gui.buttons.HIDE_ACTIONS_ROLLOVER_BUTTON=resources/images/impl/gui/buttons/hideMoreActionsRollover.png
# Smilies icons
service.gui.smilies.SMILEY1=resources/images/impl/gui/common/smilies/default/smiley1.gif
service.gui.smilies.SMILEY2=resources/images/impl/gui/common/smilies/default/smiley2.gif
service.gui.smilies.SMILEY3=resources/images/impl/gui/common/smilies/default/smiley3.gif
service.gui.smilies.SMILEY4=resources/images/impl/gui/common/smilies/default/smiley4.gif
service.gui.smilies.SMILEY5=resources/images/impl/gui/common/smilies/default/smiley5.gif
service.gui.smilies.SMILEY6=resources/images/impl/gui/common/smilies/default/smiley6.gif
service.gui.smilies.SMILEY7=resources/images/impl/gui/common/smilies/default/smiley7.gif
service.gui.smilies.SMILEY8=resources/images/impl/gui/common/smilies/default/smiley8.gif
service.gui.smilies.SMILEY9=resources/images/impl/gui/common/smilies/default/smiley9.gif
service.gui.smilies.SMILEY10=resources/images/impl/gui/common/smilies/default/smiley10.gif
service.gui.smilies.SMILEY11=resources/images/impl/gui/common/smilies/default/smiley11.gif
service.gui.smilies.SMILEY12=resources/images/impl/gui/common/smilies/default/smiley12.gif
service.gui.smilies.SMILEY13=resources/images/impl/gui/common/smilies/default/smiley13.gif
service.gui.smilies.SMILEY14=resources/images/impl/gui/common/smilies/default/smiley14.gif
service.gui.smilies.SMILEY15=resources/images/impl/gui/common/smilies/default/smiley15.gif
service.gui.smilies.SMILEY16=resources/images/impl/gui/common/smilies/default/smiley16.gif
# Smileys icons
service.gui.smileys.SMILEY1=resources/images/impl/gui/common/smileys/default/smiley1.gif
service.gui.smileys.SMILEY2=resources/images/impl/gui/common/smileys/default/smiley2.gif
service.gui.smileys.SMILEY3=resources/images/impl/gui/common/smileys/default/smiley3.gif
service.gui.smileys.SMILEY4=resources/images/impl/gui/common/smileys/default/smiley4.gif
service.gui.smileys.SMILEY5=resources/images/impl/gui/common/smileys/default/smiley5.gif
service.gui.smileys.SMILEY6=resources/images/impl/gui/common/smileys/default/smiley6.gif
service.gui.smileys.SMILEY7=resources/images/impl/gui/common/smileys/default/smiley7.gif
service.gui.smileys.SMILEY8=resources/images/impl/gui/common/smileys/default/smiley8.gif
service.gui.smileys.SMILEY9=resources/images/impl/gui/common/smileys/default/smiley9.gif
service.gui.smileys.SMILEY10=resources/images/impl/gui/common/smileys/default/smiley10.gif
service.gui.smileys.SMILEY11=resources/images/impl/gui/common/smileys/default/smiley11.gif
service.gui.smileys.SMILEY12=resources/images/impl/gui/common/smileys/default/smiley12.gif
service.gui.smileys.SMILEY13=resources/images/impl/gui/common/smileys/default/smiley13.gif
service.gui.smileys.SMILEY14=resources/images/impl/gui/common/smileys/default/smiley14.gif
service.gui.smileys.SMILEY15=resources/images/impl/gui/common/smileys/default/smiley15.gif
service.gui.smileys.SMILEY16=resources/images/impl/gui/common/smileys/default/smiley16.gif
service.gui.smileys.SMILEY17=resources/images/impl/gui/common/smileys/default/smiley17.gif
service.gui.smileys.SMILEY18=resources/images/impl/gui/common/smileys/default/smiley18.gif
service.gui.smileys.SMILEY19=resources/images/impl/gui/common/smileys/default/smiley19.gif
service.gui.smileys.SMILEY20=resources/images/impl/gui/common/smileys/default/smiley20.gif
# Look and Feel images
service.gui.lookandfeel.CLOSE_TAB_ICON=resources/images/impl/gui/buttons/closeTab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

@ -682,14 +682,14 @@ plugin.keybindings.CHAT_COPY=Copy
plugin.keybindings.CHAT_CUT=Cut
plugin.keybindings.CHAT_NEXT_TAB=Next tab
plugin.keybindings.CHAT_OPEN_HISTORY=Open history
plugin.keybindings.CHAT_OPEN_SMILIES=Open smilies
plugin.keybindings.CHAT_OPEN_SMILIES=Open smileys
plugin.keybindings.CHAT_PASTE=Paste
plugin.keybindings.CHAT_PREVIOUS_TAB=Previous tab
plugin.keybindings.MAIN_NEXT_TAB=Next tab
plugin.keybindings.MAIN_PREVIOUS_TAB=Previous tab
plugin.keybindings.MAIN_RENAME=Rename contact
plugin.keybindings.OPEN_HISTORY=Show History
plugin.keybindings.OPEN_SMILIES=Show Smilies
plugin.keybindings.OPEN_SMILIES=Show Smileys
plugin.keybindings.PLUGIN_NAME=Keybindings
# Notification Configuration Form

@ -22,6 +22,12 @@
public class SIPCommMenuItemUI
extends BasicMenuItemUI
{
public SIPCommMenuItemUI()
{
UIManager.put("MenuItem.selectionBackground", Color.WHITE);
UIManager.put("MenuItem.background", Color.WHITE);
}
/**
* Creates a new SIPCommMenuItemUI instance.
*/
@ -30,54 +36,41 @@ public static ComponentUI createUI(JComponent x)
return new SIPCommMenuItemUI();
}
/**
* Draws the background of the menu item.
*
* @param g the paint graphics
* @param menuItem menu item to be painted
* @param bgColor selection background color
* @since 1.4
*/
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
{
super.paintBackground(g, menuItem, bgColor);
g = g.create();
try
{
internalPaintBackground(g, menuItem, bgColor);
}
finally
{
g.dispose();
}
}
private void internalPaintBackground(Graphics g, JMenuItem menuItem,
Color bgColor)
private void internalPaintRollover(Graphics g, JMenuItem menuItem)
{
AntialiasingManager.activateAntialiasing(g);
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
if (menuItem.isOpaque()) {
if (menuItem.isOpaque())
{
if (model.isArmed()
|| (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(bgColor);
g.fillRoundRect(0, 0, menuWidth, menuHeight, 5, 5);
|| (menuItem instanceof JMenu && model.isSelected()))
{
g.setColor(SIPCommLookAndFeel.getControlDarkShadow());
g.drawRoundRect(0, 0, menuWidth - 1, menuHeight - 1, 5, 5);
}
else {
g.setColor(menuItem.getBackground());
g.fillRoundRect(0, 0, menuWidth, menuHeight, 5, 5);
g.drawRoundRect(0, 0, menuWidth - 1, menuHeight - 1, 10, 10);
}
g.setColor(oldColor);
}
}
protected void paintMenuItem (Graphics g, JComponent c, Icon
checkIcon, Icon arrowIcon, Color background,
Color foreground, int defaultTextIconGap)
{
super.paintMenuItem(g, c, null, arrowIcon, background, foreground, 0);
this.internalPaintRollover(g, menuItem);
}
protected void paintText (Graphics g, JMenuItem menuItem, Rectangle
textRect, String text)
{
textRect.x += 6;
super.paintText(g, menuItem, textRect, text);
}
}

@ -28,7 +28,7 @@
/**
* The <tt>ChatConversationPanel</tt> is the panel, where all sent and received
* messages appear. All data is stored in an HTML document. An external CSS file
* is applied to the document to provide the look&feel. All smilies and link
* is applied to the document to provide the look&feel. All smileys and link
* strings are processed and finally replaced by corresponding images and HTML
* links.
*
@ -567,7 +567,7 @@ private String processKeyword(String message, String contentType,
}
/**
* Formats the given message. Processes all smilies chars, new lines and all
* Formats the given message. Processes all smileys chars, new lines and all
* the links.
*
* @return the formatted message
@ -577,7 +577,7 @@ private String formatMessage(String message, String contentType)
String processedString = message;
// If the message content type is HTML we won't process links and
// new lines, but only the smilies.
// new lines, but only the smileys.
if (contentType == null || !contentType.equals(HTML_CONTENT_TYPE))
{
String linkProcessedString = processLinks(message);
@ -593,7 +593,7 @@ else if(contentType.equals(HTML_CONTENT_TYPE))
contentType);
}
return processSmilies(processedString, contentType);
return processSmileys(processedString, contentType);
}
/**
@ -672,12 +672,12 @@ private String processNewLines(String message)
}
/**
* Formats message smilies.
* Formats message smileys.
*
* @param message The source message string.
* @return The message string with properly formated smilies.
* @return The message string with properly formated smileys.
*/
private String processSmilies(String message, String contentType)
private String processSmileys(String message, String contentType)
{
String startPlainTextTag;
String endPlainTextTag;
@ -694,13 +694,13 @@ private String processSmilies(String message, String contentType)
endPlainTextTag = "";
}
Collection<Smiley> smilies = ImageLoader.getDefaultSmiliesPack();
Collection<Smiley> smileys = ImageLoader.getDefaultSmileysPack();
StringBuffer regexp = new StringBuffer();
regexp.append("(?<!(alt='|alt=\"))(");
for (Smiley smiley : smilies)
for (Smiley smiley : smileys)
{
for (String smileyString : smiley.getSmileyStrings())
{

@ -161,7 +161,7 @@ public void stateChanged(ChangeEvent evt)
new CopyAction());
this.addKeybindingAction( "plugin.keybindings.CHAT_PASTE",
new PasteAction());
this.addKeybindingAction( "chat-openSmilies",
this.addKeybindingAction( "chat-openSmileys",
new OpenSmileyAction());
this.addKeybindingAction( "chat-openHistory",
new OpenHistoryAction());
@ -608,7 +608,7 @@ public void actionPerformed(ActionEvent e)
/**
* The <tt>OpenSmileyAction</tt> is an <tt>AbstractAction</tt> that
* opens the menu, containing all available smilies' icons.
* opens the menu, containing all available smileys' icons.
*/
private class OpenSmileyAction
extends AbstractAction
@ -616,7 +616,7 @@ private class OpenSmileyAction
public void actionPerformed(ActionEvent e)
{
getCurrentChatPanel().getChatWritePanel()
.getEditTextToolBar().getSmiliesSelectorBox().open();
.getEditTextToolBar().getSmileysSelectorBox().open();
}
}

@ -499,7 +499,7 @@ public void clearWriteArea()
/**
* Appends the given text to the end of the contained HTML document. This
* method is used to insert smilies when user selects a smiley from the
* method is used to insert smileys when user selects a smiley from the
* menu.
*
* @param text the text to append.

@ -13,22 +13,25 @@
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.lookandfeel.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>SmiliesSelectorBox</tt> is the component where user could choose a
* The <tt>SmileysSelectorBox</tt> is the component where user could choose a
* smiley icon to send.
*
* @author Yana Stamcheva
*/
public class SmiliesSelectorBox
public class SmileysSelectorBox
extends SIPCommMenuBar
implements ActionListener
implements ActionListener,
MouseListener
{
private final ChatWritePanel chatWritePanel;
private final Collection<Smiley> imageList;
private final Hashtable<JMenuItem, Smiley> smileysList
= new Hashtable<JMenuItem, Smiley>();
private int gridRowCount = 0;
@ -36,20 +39,20 @@ public class SmiliesSelectorBox
private final SIPCommMenu selectorBox = new SIPCommMenu();
private final SelectorBoxRolloverListener rolloverListener =
new SelectorBoxRolloverListener();
private final GridBagConstraints gridBagConstraints
= new GridBagConstraints();
private final JLabel smileyTextLabel = new JLabel();
/**
* Creates an instance of this <tt>SmiliesSelectorBox</tt> and initializes
* Creates an instance of this <tt>SmileysSelectorBox</tt> and initializes
* the panel with the smiley icons given by the incoming imageList.
*
* @param imageList The pack of smiley icons.
*/
public SmiliesSelectorBox(Collection<Smiley> imageList,
public SmileysSelectorBox(Collection<Smiley> imageList,
ChatWritePanel writePanel)
{
this.imageList = imageList;
this.chatWritePanel = writePanel;
this.setOpaque(false);
@ -57,35 +60,35 @@ public SmiliesSelectorBox(Collection<Smiley> imageList,
// Should explicitly remove any border in order to align correctly the
// icon.
this.selectorBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
this.selectorBox.setBorder(BorderFactory.createEmptyBorder());
this.selectorBox.setIcon(new ImageIcon(ImageLoader
.getImage(ImageLoader.SMILIES_ICON)));
this.calculateGridDimensions(imageList.size());
this.selectorBox.getPopupMenu().setLayout(
new GridLayout(this.gridRowCount, this.gridColCount, 5, 5));
JPopupMenu popupMenu = this.selectorBox.getPopupMenu();
popupMenu.setLayout(new GridBagLayout());
popupMenu.setBackground(Color.WHITE);
int count = 0;
for (Smiley smiley : imageList)
{
ImageIcon imageIcon =
new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
JMenuItem smileyItem = new JMenuItem(imageIcon);
this.addSmileyToGrid(smiley, count);
// smileyItem.setPreferredSize(
// new Dimension( imageIcon.getIconWidth(),
// imageIcon.getIconHeight()));
count++;
}
// smileyItem.setMargin(new Insets(2, 2, 2, 2));
smileyTextLabel.setPreferredSize(new Dimension(50, 25));
smileyTextLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = gridRowCount;
gridBagConstraints.gridwidth = gridColCount;
smileyItem.addActionListener(this);
popupMenu.add(smileyTextLabel, gridBagConstraints);
this.selectorBox.add(smileyItem);
}
this.add(selectorBox);
}
@ -109,7 +112,35 @@ private void calculateGridDimensions(int itemsCount)
}
/**
* Opens the smilies selector box.
* Adds the given smiley to the grid of the selector box popup menu.
*
* @param smiley the smiley to add
* @param smileyIndex the index of the smiley in the table
*/
private void addSmileyToGrid( Smiley smiley,
int smileyIndex)
{
ImageIcon imageIcon =
new ImageIcon(ImageLoader.getImage(smiley.getImageID()));
SmileyMenuItem smileyItem = new SmileyMenuItem(imageIcon);
smileyItem.setPreferredSize(new Dimension(36, 36));
smileyItem.addActionListener(this);
smileyItem.addMouseListener(this);
gridBagConstraints.anchor = GridBagConstraints.EAST;
gridBagConstraints.gridx = smileyIndex%gridColCount;
gridBagConstraints.gridy = smileyIndex%gridRowCount;
selectorBox.getPopupMenu().add(smileyItem, gridBagConstraints);
smileysList.put(smileyItem, smiley);
}
/**
* Opens the smileys selector box.
*/
public void open()
{
@ -127,25 +158,20 @@ public boolean isMenuSelected()
}
/**
* Writes the symbol corresponding to a choosen smiley icon to the write
* Writes the symbol corresponding to a chosen smiley icon to the write
* message area at the end of the current text.
*/
public void actionPerformed(ActionEvent e)
{
JMenuItem smileyItem = (JMenuItem) e.getSource();
String buttonText = smileyItem.getToolTipText();
for (Smiley smiley : imageList)
{
String smileyString = smiley.getSmileyStrings()[0];
Smiley smiley = smileysList.get(smileyItem);
if (buttonText.equals(smileyString))
{
chatWritePanel.appendText(smileyString);
chatWritePanel.appendText(smiley.getSmileyStrings()[0]);
chatWritePanel.getEditorPane().requestFocus();
}
}
chatWritePanel.getEditorPane().requestFocus();
smileyTextLabel.setText("");
}
/**
@ -165,40 +191,40 @@ public void setText(String text)
.getColor("service.gui.CHAT_MENU_FOREGROUND")));
}
/**
* Enables or disabled the roll-over effect, when user moves the mouse over
* this smilies selector box.
*
* @param isRollover <code>true</code> to enable the roll-over,
* <code>false</code> - otherwise.
*/
public void setRollover(boolean isRollover)
public void paintComponent(Graphics g)
{
if (isRollover)
selectorBox.addMouseListener(rolloverListener);
else
selectorBox.removeMouseListener(rolloverListener);
}
/**
* 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 SmileyMenuItem extends JMenuItem
{
public void mouseEntered(MouseEvent e)
public SmileyMenuItem(Icon imageIcon)
{
selectorBox.setMouseOver(true);
super(imageIcon);
this.setUI(new SIPCommMenuItemUI());
}
}
public void mouseExited(MouseEvent e)
{
selectorBox.setMouseOver(false);
}
public void mouseEntered(MouseEvent e)
{
JMenuItem smileyItem = (JMenuItem) e.getSource();
Smiley smiley = smileysList.get(smileyItem);
smileyTextLabel.setText(smiley.getDescription()
+ " - " + smiley.getSmileyStrings()[0]);
}
public void paintComponent(Graphics g)
public void mouseExited(MouseEvent e)
{
smileyTextLabel.setText("");
}
public void mouseClicked(MouseEvent e)
{}
public void mousePressed(MouseEvent e)
{}
public void mouseReleased(MouseEvent e)
{}
}

@ -48,7 +48,7 @@ public class EditTextToolBar
ImageLoader.getImage(ImageLoader.EDIT_TOOLBAR_BUTTON),
ImageLoader.getImage(ImageLoader.FONT_ICON));
private SmiliesSelectorBox smiliesBox;
private SmileysSelectorBox smileysBox;
private JToggleButton boldButton;
@ -75,14 +75,14 @@ public EditTextToolBar(ChatWritePanel writePanel)
this.initColorLabel();
this.smiliesBox = new SmiliesSelectorBox(
ImageLoader.getDefaultSmiliesPack(), chatWritePanel);
this.smileysBox = new SmileysSelectorBox(
ImageLoader.getDefaultSmileysPack(), chatWritePanel);
this.smiliesBox.setName("smiley");
this.smiliesBox.setToolTipText(GuiActivator.getResources()
this.smileysBox.setName("smiley");
this.smileysBox.setToolTipText(GuiActivator.getResources()
.getI18NString("service.gui.INSERT_SMILEY") + " Ctrl-M");
this.add(smiliesBox);
this.add(smileysBox);
logger.trace("[GUI] Editor Pane font name: "
+ chatEditorPane.getFont().getName());
@ -477,13 +477,13 @@ public void setFontColor(Color color)
}
/**
* Returns the button used to show the list of smilies.
* Returns the button used to show the list of smileys.
*
* @return the button used to show the list of smilies.
* @return the button used to show the list of smileys.
*/
public SmiliesSelectorBox getSmiliesSelectorBox()
public SmileysSelectorBox getSmileysSelectorBox()
{
return smiliesBox;
return smileysBox;
}
/**
@ -494,7 +494,7 @@ public SmiliesSelectorBox getSmiliesSelectorBox()
*/
public boolean hasSelectedMenus()
{
if(smiliesBox.isMenuSelected())
if(smileysBox.isMenuSelected())
return true;
return false;

@ -1036,84 +1036,133 @@ public class ImageLoader
*/
public static final ImageID SMILEY1
= new ImageID("service.gui.smilies.SMILEY1");
= new ImageID("service.gui.smileys.SMILEY1");
public static final ImageID SMILEY2
= new ImageID("service.gui.smilies.SMILEY2");
= new ImageID("service.gui.smileys.SMILEY2");
public static final ImageID SMILEY3
= new ImageID("service.gui.smilies.SMILEY3");
= new ImageID("service.gui.smileys.SMILEY3");
public static final ImageID SMILEY4
= new ImageID("service.gui.smilies.SMILEY4");
= new ImageID("service.gui.smileys.SMILEY4");
public static final ImageID SMILEY5
= new ImageID("service.gui.smilies.SMILEY5");
= new ImageID("service.gui.smileys.SMILEY5");
public static final ImageID SMILEY6
= new ImageID("service.gui.smilies.SMILEY6");
= new ImageID("service.gui.smileys.SMILEY6");
public static final ImageID SMILEY7
= new ImageID("service.gui.smilies.SMILEY7");
= new ImageID("service.gui.smileys.SMILEY7");
public static final ImageID SMILEY8
= new ImageID("service.gui.smilies.SMILEY8");
= new ImageID("service.gui.smileys.SMILEY8");
public static final ImageID SMILEY9
= new ImageID("service.gui.smilies.SMILEY9");
= new ImageID("service.gui.smileys.SMILEY9");
public static final ImageID SMILEY10
= new ImageID("service.gui.smilies.SMILEY10");
= new ImageID("service.gui.smileys.SMILEY10");
public static final ImageID SMILEY11
= new ImageID("service.gui.smilies.SMILEY11");
= new ImageID("service.gui.smileys.SMILEY11");
public static final ImageID SMILEY12
= new ImageID("service.gui.smilies.SMILEY12");
= new ImageID("service.gui.smileys.SMILEY12");
public static final ImageID SMILEY13
= new ImageID("service.gui.smileys.SMILEY13");
public static final ImageID SMILEY14
= new ImageID("service.gui.smileys.SMILEY14");
public static final ImageID SMILEY15
= new ImageID("service.gui.smileys.SMILEY15");
public static final ImageID SMILEY16
= new ImageID("service.gui.smileys.SMILEY16");
public static final ImageID SMILEY17
= new ImageID("service.gui.smileys.SMILEY17");
public static final ImageID SMILEY18
= new ImageID("service.gui.smileys.SMILEY18");
public static final ImageID SMILEY19
= new ImageID("service.gui.smileys.SMILEY19");
public static final ImageID SMILEY20
= new ImageID("service.gui.smileys.SMILEY20");
/**
* Load default smilies pack.
* Load default smileys pack.
*
* @return the ArrayList of all smilies.
* @return the ArrayList of all smileys.
*/
public static Collection<Smiley> getDefaultSmiliesPack() {
public static Collection<Smiley> getDefaultSmileysPack() {
List<Smiley> defaultPackList = new ArrayList<Smiley>();
defaultPackList.add(new Smiley(ImageLoader.SMILEY1, new String[] {
";-(", ";(", ":'(", ":'-(", ":~-(", ":~(" }));
":((", ":-((", ":((", ":(", ":-(", "(sad)"}, "Sad"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY2, new String[] {
"B-)", "B)" }));
"(angel)" }, "Angel"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY3, new String[] {
":-*", ":*" }));
":-*", ":*", "(kiss)"}, "Kiss"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY4, new String[] {
":-0" }));
":-0", "(shocked)"}, "Shocked"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY5, new String[] {
":-((", ":((" }));
";-((", ";((", ";-(", ";(", ":'(", ":'-(",
":~-(", ":~(", "(upset)" }, "Upset"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY6, new String[] {
"(L)" , "(l)"}));
"(L)" , "(l)", "(H)", "(h)"}, "In love"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY7, new String[] {
":-|", ":|" }));
"(blush)"}, "Blushing"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY8, new String[] {
":-P", ":P", ":-p", ":p" }));
":-P", ":P", ":-p", ":p" }, "Tongue out"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY9, new String[] {
":-))", ":))" }));
":-))", ":))", ";-))", ";))", "(lol)"}, "Laughing"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY10, new String[] {
":-(", ":(" }));
"(y)", "(Y)", "(ok)"}, "Ok"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY11, new String[] {
":-)", ":)" }));
";-)", ";)", ":-)", ":)"}, "Smile"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY12, new String[] {
";-)", ";)" }));
"(sick)"}, "Sick"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY13, new String[] {
"(n)", "(N)" }, "No"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY14, new String[] {
"(chuckle)" }, "Chuckle"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY15, new String[] {
"(wave)" }, "Waving"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY16, new String[] {
"(clap)"}, "Clapping"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY17, new String[] {
"(angry)"}, "Angry"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY18, new String[] {
"(bomb)"}, "Explosing"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY19, new String[] {
"(search)"}, "Searching"));
defaultPackList.add(new Smiley(ImageLoader.SMILEY20, new String[] {
"(oops)"}, "Oops"));
return defaultPackList;
}
@ -1124,9 +1173,9 @@ public static Collection<Smiley> getDefaultSmiliesPack() {
* @return A Smiley object for a given smiley string.
*/
public static Smiley getSmiley(String smileyString) {
Collection<Smiley> smilies = getDefaultSmiliesPack();
Collection<Smiley> smileys = getDefaultSmileysPack();
for (Smiley smiley : smilies) {
for (Smiley smiley : smileys) {
String[] smileyStrings = smiley.getSmileyStrings();
for (int j = 0; j < smileyStrings.length; j++) {

@ -16,76 +16,101 @@
*
* @author Yana Stamcheva
*/
public class Smiley {
public class Smiley
{
private ImageID imageID;
private String[] smileyStrings;
private String description;
/**
* Creates an instance of <tt>Smily</tt>, by specifying the smily
* Creates an instance of <tt>Smiley</tt>, by specifying the smiley
* image identifier and the strings corresponding to it.
* @param imageID The image identifier of the smily icon.
* @param smileyStrings A set of strings corresponding to the smily
* @param imageID The image identifier of the smiley icon.
* @param smileyStrings A set of strings corresponding to the smiley
* icon.
*/
public Smiley(ImageID imageID, String[] smileyStrings) {
public Smiley(ImageID imageID, String[] smileyStrings, String description)
{
this.imageID = imageID;
this.setSmileyStrings(smileyStrings);
this.setDescription(description);
}
/**
* Returns the set of Strings corresponding to this smily.
* @return the set of Strings corresponding to this smily.
* Returns the set of Strings corresponding to this smiley.
* @return the set of Strings corresponding to this smiley.
*/
public String[] getSmileyStrings() {
public String[] getSmileyStrings()
{
return smileyStrings;
}
/**
* Sets the set of Strings corresponding to this smily. They could be
* Sets the set of Strings corresponding to this smiley. They could be
* ":-)", ":)", ":))" for example.
* @param smileyStrings the set of Strings corresponding to this smily.
* @param smileyStrings the set of Strings corresponding to this smiley.
*/
public void setSmileyStrings(String[] smileyStrings) {
public void setSmileyStrings(String[] smileyStrings)
{
this.smileyStrings = smileyStrings;
}
/**
* Returns the default String corresponding for this smily. For example
* ":-)".
* @return the default String corresponding for this smily.
* Returns the description of this smiley.
*
* @return the description of this smiley.
*/
public String getDefaultString() {
public String getDescription()
{
return description;
}
return this.smileyStrings[0];
/**
* Sets the description of this smiley.
*
* @param description the description of the smiley.
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* Returns the identifier of the image corresponding to this smily.
* @return the identifier of the image corresponding to this smily.
* Returns the default String corresponding for this smiley. For example
* ":-)".
* @return the default String corresponding for this smiley.
*/
public ImageID getImageID() {
public String getDefaultString()
{
return this.smileyStrings[0];
}
/**
* Returns the identifier of the image corresponding to this smiley.
* @return the identifier of the image corresponding to this smiley.
*/
public ImageID getImageID()
{
return this.imageID;
}
/**
* Returns the path of the image corresponding to this smily.
* @return the path of the image corresponding to this smily.
* Returns the path of the image corresponding to this smiley.
* @return the path of the image corresponding to this smiley.
*/
public String getImagePath()
{
URL url =
GuiActivator.getResources().getImageURL(this.getImageID().getId());
URL url
= GuiActivator.getResources()
.getImageURL(this.getImageID().getId());
if(url == null)
return null;
return url.toString();
}
}

Loading…
Cancel
Save