Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 51286 invoked from network); 22 Mar 2010 12:45:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Mar 2010 12:45:57 -0000 Received: (qmail 27668 invoked by uid 500); 22 Mar 2010 12:45:57 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 27639 invoked by uid 500); 22 Mar 2010 12:45:57 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 27632 invoked by uid 99); 22 Mar 2010 12:45:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Mar 2010 12:45:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Mar 2010 12:45:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 32434238897F; Mon, 22 Mar 2010 12:45:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r926051 - in /felix/trunk/webconsole: LICENSE.tabspaging NOTICE src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java src/main/resources/res/ui/configurationrender.css src/main/resources/res/ui/ui.tabs.paging.js Date: Mon, 22 Mar 2010 12:45:32 -0000 To: commits@felix.apache.org From: vvalchev@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100322124532.32434238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vvalchev Date: Mon Mar 22 12:45:31 2010 New Revision: 926051 URL: http://svn.apache.org/viewvc?rev=926051&view=rev Log: Resolved FELIX-2149 /Configuration Status tabs are not properly left aligned/ https://issues.apache.org/jira/browse/FELIX-2149 Added: felix/trunk/webconsole/LICENSE.tabspaging felix/trunk/webconsole/src/main/resources/res/ui/ui.tabs.paging.js Modified: felix/trunk/webconsole/NOTICE felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.css Added: felix/trunk/webconsole/LICENSE.tabspaging URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/LICENSE.tabspaging?rev=926051&view=auto ============================================================================== --- felix/trunk/webconsole/LICENSE.tabspaging (added) +++ felix/trunk/webconsole/LICENSE.tabspaging Mon Mar 22 12:45:31 2010 @@ -0,0 +1,19 @@ +Copyright (c) 2009, http://seyfertdesign.com/jquery/ui-tabs-paging.html + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. Modified: felix/trunk/webconsole/NOTICE URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/NOTICE?rev=926051&r1=926050&r2=926051&view=diff ============================================================================== --- felix/trunk/webconsole/NOTICE (original) +++ felix/trunk/webconsole/NOTICE Mon Mar 22 12:45:31 2010 @@ -44,6 +44,10 @@ Licensed under the BSD License This product includes software from the Mozilla Foundation Licensed under the MIT License +This product includes software from http://seyfertdesign.com/jquery/ +Copyright (c) 2009, http://seyfertdesign.com/ +Licensed under the MIT License + II. Used Software Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java?rev=926051&r1=926050&r2=926051&view=diff ============================================================================== --- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java (original) +++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java Mon Mar 22 12:45:31 2010 @@ -48,7 +48,7 @@ public class ConfigurationRender extends private static final String LABEL = "config"; private static final String TITLE = "%configStatus.pluginTitle"; - private static final String[] CSS_REFS = null; + private static final String[] CSS_REFS = { "/res/ui/configurationrender.css" }; // use English as the locale for all non-display titles private static final Locale DEFAULT = Locale.ENGLISH; @@ -87,6 +87,9 @@ public class ConfigurationRender extends } + /** + * @see org.apache.felix.webconsole.SimpleWebConsolePlugin#deactivate() + */ public void deactivate() { // make sure the service tracker is closed and removed on deactivate @@ -180,10 +183,10 @@ public class ConfigurationRender extends //ConfigurationWriter pw = new HtmlConfigurationWriter( response.getWriter() ); PrintWriter pw = response.getWriter(); - + pw.println( "" ); pw.println( "" ); Modified: felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.css URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.css?rev=926051&r1=926050&r2=926051&view=diff ============================================================================== --- felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.css (original) +++ felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.css Mon Mar 22 12:45:31 2010 @@ -15,77 +15,33 @@ * limitations under the License. */ -/* tabbed view */ - -#divcfgprttabs { -} - -.divcfgprttabshidden { - display: none; -} - -#divcfgprttabs ul { - list-style: none; -} - -#divcfgprttabs ul li { - display: inline-block; - background: #fff; -} - -#divcfgprttabs ul li.tabactive { +.ui-tabs-paging-next { + float: right !important; } - -#divcfgprttabs ul li a { - color: #6181A9; - background-color: white; - display: block; - float: left; - height: 100%; - line-height: 2; - padding: 0 10px 0 10px; - cursor: pointer; -} - -#divcfgprttabs ul li a.tabactive { - background-color: #6181A9; - color: white; -} - -#divcfgprttabs ul li a:hover { - color: white; - background-color: #6181A9; -} - -.menu { - background: none; - margin-bottom: 0; - padding-left: 0; -} -.area { - background: #fff; - border: 1px solid #999; - padding: 1px; -} - -/* Contents container of the tabs */ -.tabcont { - background: #fff; - border: 1px solid #999; - border-right: none; - padding: 1px; -} - -/* The actual content of the tabs */ -.space { - padding: 10px; - - /* don't let this area make the display wider */ - width: 100px; - overflow: visible; -} - -.space div { - font-family: monospace; - white-space: pre; +.ui-tabs-paging-prev, +.ui-tabs-paging-next { + background: transparent !important; + border: 0 !important; + margin-bottom: 1px !important; +} +.ui-tabs-paging-prev a, +.ui-tabs-paging-next a { + display: block; + position: relative; + top: 1px; + border: 0; + z-index: 2; + padding: 0; + text-decoration: none; + background: transparent !important; + cursor: pointer; +} +.ui-tabs-paging-next a:hover, +.ui-tabs-paging-next a:focus, +.ui-tabs-paging-next a:active, +.ui-tabs-paging-prev a:hover, +.ui-tabs-paging-prev a:focus, +.ui-tabs-paging-prev a:active { + background: transparent } +.ui-tabs-paging-disabled { visibility: hidden } Added: felix/trunk/webconsole/src/main/resources/res/ui/ui.tabs.paging.js URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/ui.tabs.paging.js?rev=926051&view=auto ============================================================================== --- felix/trunk/webconsole/src/main/resources/res/ui/ui.tabs.paging.js (added) +++ felix/trunk/webconsole/src/main/resources/res/ui/ui.tabs.paging.js Mon Mar 22 12:45:31 2010 @@ -0,0 +1,270 @@ +/* +Copyright (c) 2009, http://seyfertdesign.com/jquery/ui-tabs-paging.html + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +$.extend($.ui.tabs.prototype, { + paging: function(options) { + var opts = { + tabsPerPage: 0, + nextButton: '»', + prevButton: '«', + follow: false, + cycle: false, + selectOnAdd: false, + followOnSelect: false + }; + + opts = $.extend(opts, options); + + var self = this, initialized = false, currentPage, + buttonWidth, containerWidth, allTabsWidth, tabWidths, + maxPageWidth, pages, resizeTimer = null, + windowHeight = $(window).height(), windowWidth = $(window).width(); + + function init() { + destroy(); + + allTabsWidth = 0, currentPage = 0, maxPageWidth = 0, buttonWidth = 0, + pages = new Array(), tabWidths = new Array(), selectedTabWidths = new Array(); + + containerWidth = self.element.width(); + + // loops through LIs, get width of each tab when selected and unselected. + var maxDiff = 0; // the max difference between a selected and unselected tab + self.lis.each(function(i) { + if (i == self.options.selected) { + selectedTabWidths[i] = $(this).outerWidth({ margin: true }); + tabWidths[i] = self.lis.eq(i).removeClass('ui-tabs-selected').outerWidth({ margin: true }); + self.lis.eq(i).addClass('ui-tabs-selected'); + maxDiff = Math.min(maxDiff, Math.abs(selectedTabWidths[i] - tabWidths[i])); + allTabsWidth += tabWidths[i]; + } else { + tabWidths[i] = $(this).outerWidth({ margin: true }); + selectedTabWidths[i] = self.lis.eq(i).addClass('ui-tabs-selected').outerWidth({ margin: true }); + self.lis.eq(i).removeClass('ui-tabs-selected'); + maxDiff = Math.max(maxDiff, Math.abs(selectedTabWidths[i] - tabWidths[i])); + allTabsWidth += tabWidths[i]; + } + }); + // fix padding issues with buttons + // TODO determine a better way to handle this + allTabsWidth += maxDiff + ($.browser.msie?4:0) + 9; + + // if the width of all tables is greater than the container's width, calculate the pages + if (allTabsWidth > containerWidth) { + // create next button + li = $('
  • ') + .addClass('ui-state-default ui-tabs-paging-next') + .append($('') + .click(function() { page('next'); return false; }) + .html(opts.nextButton)); + + self.lis.eq(self.length()-1).after(li); + buttonWidth = li.outerWidth({ margin: true }); + + // create prev button + li = $('
  • ') + .addClass('ui-state-default ui-tabs-paging-prev') + .append($('') + .click(function() { page('prev'); return false; }) + .html(opts.prevButton)); + self.lis.eq(0).before(li); + buttonWidth += li.outerWidth({ margin: true }); + + // TODO determine fix for padding issues to next button + buttonWidth += 19; + + var pageIndex = 0, pageWidth = 0, maxTabPadding = 0; + + // start calculating pageWidths + for (var i = 0; i < tabWidths.length; i++) { + // if first tab of page or selected tab's padding larger than the current max, set the maxTabPadding + if (pageWidth == 0 || selectedTabWidths[i] - tabWidths[i] > maxTabPadding) + maxTabPadding = (selectedTabWidths[i] - tabWidths[i]); + + // if first tab of page, initialize pages variable for page + if (pages[pageIndex] == null) { + pages[pageIndex] = { start: i }; + + } else if ((i > 0 && (i % opts.tabsPerPage) == 0) || (tabWidths[i] + pageWidth + buttonWidth + 12) > containerWidth) { + if ((pageWidth + maxTabPadding) > maxPageWidth) + maxPageWidth = (pageWidth + maxTabPadding); + pageIndex++; + pages[pageIndex] = { start: i }; + pageWidth = 0; + } + pages[pageIndex].end = i+1; + pageWidth += tabWidths[i]; + if (i == self.options.selected) currentPage = pageIndex; + } + if ((pageWidth + maxTabPadding) > maxPageWidth) + maxPageWidth = (pageWidth + maxTabPadding); + + // hide all tabs then show tabs for current page + self.lis.hide().slice(pages[currentPage].start, pages[currentPage].end).show(); + if (currentPage == (pages.length - 1) && !opts.cycle) + disableButton('next'); + if (currentPage == 0 && !opts.cycle) + disableButton('prev'); + + // calculate the right padding for the next button + buttonPadding = containerWidth - maxPageWidth - buttonWidth; + if (buttonPadding > 0) + $('.ui-tabs-paging-next', self.element).css({ paddingRight: buttonPadding + 'px' }); + + initialized = true; + } else { + destroy(); + } + + $(window).bind('resize', handleResize); + } + + function page(direction) { + currentPage = currentPage + (direction == 'prev'?-1:1); + + if ((direction == 'prev' && currentPage < 0 && opts.cycle) || + (direction == 'next' && currentPage >= pages.length && !opts.cycle)) + currentPage = pages.length - 1; + else if ((direction == 'prev' && currentPage < 0) || + (direction == 'next' && currentPage >= pages.length && opts.cycle)) + currentPage = 0; + + var start = pages[currentPage].start; + var end = pages[currentPage].end; + self.lis.hide().slice(start, end).show(); + + if (direction == 'prev') { + enableButton('next'); + if (opts.follow && (self.options.selected < start || self.options.selected > (end-1))) self.select(end-1); + if (!opts.cycle && start <= 0) disableButton('prev'); + } else { + enableButton('prev'); + if (opts.follow && (self.options.selected < start || self.options.selected > (end-1))) self.select(start); + if (!opts.cycle && end >= self.length()) disableButton('next'); + } + } + + function disableButton(direction) { + $('.ui-tabs-paging-'+direction, self.element).addClass('ui-tabs-paging-disabled'); + } + + function enableButton(direction) { + $('.ui-tabs-paging-'+direction, self.element).removeClass('ui-tabs-paging-disabled'); + } + + // special function defined to handle IE6 and IE7 resize issues + function handleResize() { + if (resizeTimer) clearTimeout(resizeTimer); + + if (windowHeight != $(window).height() || windowWidth != $(window).width()) + resizeTimer = setTimeout(reinit, 100); + } + + function reinit() { + windowHeight = $(window).height(); + windowWidth = $(window).width(); + init(); + } + + function destroy() { + // remove buttons + $('.ui-tabs-paging-next', self.element).remove(); + $('.ui-tabs-paging-prev', self.element).remove(); + + // show all tabs + self.lis.show(); + + initialized = false; + + $(window).unbind('resize', handleResize); + } + + // reconfigure "ui.tabs" add/remove events to reinit paging + var tabsAdd = self.add; + self.add = function(url, label, index) { + // remove paging buttons before adding a tab + if (initialized) + destroy(); + + tabsAdd.apply(this, [url, label, index]); + + if (opts.selectOnAdd) { + if (index == undefined) index = this.lis.length-1; + this.select(index); + } + // re-initialize paging buttons + init(); + }; + var tabsRemove = self.remove; + self.remove = function(index) { + // remove paging buttons before removing a tab + if (initialized) + destroy(); + + tabsRemove.apply(this, [index]); + + // re-initialize paging buttons + init(); + }; + // reconfigure "ui.tabs" select event to change pages if new tab is selected + var tabsSelect = self.select; + self.select = function(index) { + tabsSelect.apply(this, [index]); + + // if paging is not initialized or it is not configured to + // change pages when a new tab is selected, then do nothing + if (!initialized || !opts.followOnSelect) + return; + + // find the new page based on index of the tab selected + for (i in pages) { + var start = pages[i].start; + var end = pages[i].end; + if (index >= start && index < end) { + // if the the tab selected is not within the currentPage of tabs, then change pages + if (i != currentPage) { + self.lis.hide().slice(start, end).show(); + + currentPage = parseInt(i); + if (currentPage == 0) { + enableButton('next'); + if (!opts.cycle && start <= 0) disableButton('prev'); + } else { + enableButton('prev'); + if (!opts.cycle && end >= self.length()) disableButton('next'); + } + } + break; + } + } + }; + + // add, remove, and destroy functions specific for paging + $.extend($.ui.tabs.prototype, { + pagingDestroy: function() { + destroy(); + } + }); + + init(); + } +});