From 1460e91541c7748af85b286567634f36855a6ab7 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 18 Sep 2013 18:07:49 +0300 Subject: [PATCH] Changes scrollable tabs forward/backward icons if new message is received and the tab is not in the visible list of opened chat tabs, a problem where user can miss messages if too many open tabs exist. --- resources/images/images.properties | 2 + .../images/impl/gui/common/tabBackward.png | Bin 0 -> 1134 bytes .../images/impl/gui/common/tabForward.png | Bin 0 -> 1140 bytes .../plaf/SIPCommTabbedPaneEnhancedUI.java | 85 +++++++++++++++++- .../desktoputil/plaf/SIPCommTabbedPaneUI.java | 6 +- 5 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 resources/images/impl/gui/common/tabBackward.png create mode 100644 resources/images/impl/gui/common/tabForward.png diff --git a/resources/images/images.properties b/resources/images/images.properties index 762de5dbc..df885dab0 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -40,6 +40,8 @@ service.gui.icons.FONT_ICON=resources/images/impl/gui/buttons/fontIcon.png service.gui.icons.ADD_CONTACT_CHAT_ICON=resources/images/impl/gui/buttons/addContactChatIcon.png service.gui.icons.CHAT_CONFIGURE_ICON=resources/images/impl/gui/buttons/chatConfigureIcon.png service.gui.icons.WARNING_ICON=resources/images/impl/gui/common/warning.png +service.gui.icons.TAB_UNREAD_FORWARD_ICON=resources/images/impl/gui/common/tabForward.png +service.gui.icons.TAB_UNREAD_BACKWARD_ICON=resources/images/impl/gui/common/tabBackward.png service.gui.icons.ERROR_ICON=resources/images/impl/gui/common/error.png service.gui.icons.INFO_ICON=resources/images/impl/gui/common/info.png service.gui.icons.SEND_MESSAGE_16x16_ICON=resources/images/impl/gui/common/sendMessage16x16.png diff --git a/resources/images/impl/gui/common/tabBackward.png b/resources/images/impl/gui/common/tabBackward.png new file mode 100644 index 0000000000000000000000000000000000000000..2bdb3dd07fa828ac367744536d9105c1e548a281 GIT binary patch literal 1134 zcmbVMO-K|`9G}|I&6Mm5)S`wlBBR~;+L_%Q+|=FK$%WQr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zCYa>zWJ94M@kSZ*ZBi6tRz>E#16`a^lQj9lShl5bf<&^Ih;s>^6D0s7pb2_hRCz&G zMNQ_L9LHf}8lMtXi3f?427nez#dRSS7h;ksq$Qcxn%ImRV8bbIHn7C>30NiV zLjxnffY5BS1IEh;qo9mDDxDXp7qf-84~E;L<|l`v@qsRx8J`Tt z)xs^74A!R^b+}M{@b(foeTVDRHuGQa${#Mj(tY;Qy5Gs@Jv&?5TX*}4&!i~vhYvnJ zxS>yc+5OkO@0ZTM-+F!g+E*Q`GrL!Qtesn%{P~xb-F9 nnq2I84=%5+{tabIndex is visible in the scrollable + * tabs list. + * + * @param tabIndex the tab index to check. + * @return whether tabIndex is visible in the list of scrollable + * tabs. + */ + private boolean isScrollTabVisible(int tabIndex) + { + Rectangle tabRect = rects[tabIndex]; + Rectangle viewRect = tabScroller.viewport.getViewRect(); + if ((tabRect.x + tabRect.width - BUTTONSIZE < viewRect.x) + || (tabRect.x + BUTTONSIZE > viewRect.x + viewRect.width)) + { + return false; + } + else + { + return true; + } } @Override diff --git a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java index 8afc0ec11..bbe944904 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/plaf/SIPCommTabbedPaneUI.java @@ -863,7 +863,7 @@ public int getOverTabIndex() * Returns the index of the tab closest to the passed in location, note that * the returned tab may not contain the location x,y. */ - private int getClosestTab(int x, int y) + protected int getClosestTab(int x, int y) { int min = 0; int tabCount = Math.min(rects.length, tabPane.getTabCount()); @@ -1358,7 +1358,7 @@ protected void calculateTabRects(int tabPlacement, int tabCount) } } - private class ScrollableTabSupport implements ChangeListener + protected class ScrollableTabSupport implements ChangeListener { public ScrollableTabViewport viewport; @@ -1471,7 +1471,7 @@ public String toString() } - private static class ScrollableTabViewport + protected static class ScrollableTabViewport extends JViewport implements UIResource {