You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/12/15 17:24:38 UTC
svn commit: r1049633 - in
/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard: ./
src/main/resources/META-INF/
src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/
Author: lofwyr
Date: Wed Dec 15 16:24:37 2010
New Revision: 1049633
URL: http://svn.apache.org/viewvc?rev=1049633&view=rev
Log:
TOBAGO-943: Consolidate JavaScript
- remove tobago-tabgroup.js
Removed:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tabgroup.js
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/pom.xml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/pom.xml?rev=1049633&r1=1049632&r2=1049633&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/pom.xml Wed Dec 15 16:24:37 2010
@@ -62,8 +62,7 @@
<concat destfile="${project.build.directory}/javascript-min/standard/script/tobago.min.js">
<filelist
dir="${basedir}/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script"
- files="tobago.js,calendar.js,dateConverter.js,tobago-menu.js,tobago-sheet.js,
- tobago-tabgroup.js,tobago-tree.js"/>
+ files="tobago.js,calendar.js,dateConverter.js,tobago-menu.js,tobago-sheet.js,tobago-tree.js"/>
</concat>
<concat destfile="${project.build.directory}/javascript-min/msie_6_0/script/tobago.min.js">
<filelist
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml?rev=1049633&r1=1049632&r2=1049633&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-theme.xml Wed Dec 15 16:24:37 2010
@@ -301,7 +301,6 @@
<script name="script/dateConverter.js"/>
<script name="script/tobago-menu.js"/>
<script name="script/tobago-sheet.js"/>
- <script name="script/tobago-tabgroup.js"/>
<script name="script/tobago-tree.js"/>
<script name="script/jquery-ui/1_7_2/ui.core.min.js"/>
<script name="script/jquery-ui/1_7_2/ui.draggable.min.js"/>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1049633&r1=1049632&r2=1049633&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Dec 15 16:24:37 2010
@@ -2886,7 +2886,7 @@ Tobago.AutocompleterAjax.prototype.creat
return div;
};
-
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// popup.js
@@ -2964,5 +2964,92 @@ function setPopupPara(width, height, opt
return width + height + parent + dirbar + locationbar + menubar + resizable + scrollbars + statusbar + toolbar;
}
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// TabGroup
+
+Tobago.TabGroup = {};
+
+/**
+ * Initializes the tab-groups.
+ * @param elements a jQuery object to initialize (ajax) or null for initializing the whole document (full load).
+ */
+Tobago.TabGroup.init = function(elements) {
+
+ var tabGroups = Tobago.selectWidthJQuery(elements, ".tobago-tabGroup");
+
+ // initialize the tab header elements
+ // client case
+ tabGroups.filter("[switchType='client']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");
+ jQuery(this).addClass("tobago-tab-markup-selected");
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ tabGroup.find(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
+ tabGroup.find(".tobago-tab-content[tabgroupindex=" + activeIndex
+ + "]").addClass("tobago-tab-content-markup-selected");
+ });
+
+ // initialize the tab header elements
+ // reload tab case
+ tabGroups.filter("[switchType='reloadTab']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ LOG.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.Updater.update(tabGroup, tabGroup.attr("id"), tabGroup.attr("id"), {});
+ });
+
+ // initialize the tab header elements
+ // reload page case
+ tabGroups.filter("[switchType='reloadPage']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ LOG.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.submitAction(tabGroup.eq(0), tabGroup.attr("id"));
+ });
+
+ // initialize previous button
+ // XXX ":first" and eq(1) are dangerous, please define e.g. a unique class for "previous" and "next"
+ tabGroups.find(".tobago-tabGroupToolBar-button:first").click(function() {
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ var selected = tabGroup.find(".tobago-tab-markup-selected");
+ // the nearest of the previous siblings, which are not disabled
+ selected.prevAll(":not(.tobago-tab-markup-disabled):first").click();
+ });
+
+ // initialize next button
+ // XXX ":first" and eq(1) are dangerous, please define e.g. a unique class for "previous" and "next"
+ tabGroups.find(".tobago-tabGroupToolBar-button:eq(1)").click(function() {
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ var selected = tabGroup.find(".tobago-tab-markup-selected");
+ // the nearest of the next siblings, which are not disabled
+ selected.nextAll(":not(.tobago-tab-markup-disabled):first").click();
+ });
+
+ // initialize menu
+ // XXX ":last" is dangerous, please define e.g. a unique class for "menu"
+// tabGroups.find(".tobago-tabGroupToolBar-button:last").find(".tobago-menu").click(function() {
+// var index = jQuery(this).prevAll().size();
+// var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+// var selected = tabGroup.find(".tobago-tab").eq(index).click();
+// });
+
+ // XXX hack for webkit to avoid scrollbars in box
+// jQuery('.tobago-tabGroup').hide();
+// jQuery('.tobago-tabGroup').show();
+};
+
+/**
+ * Update the hidden field for the active index.
+ * @param tab is a jQuery object which represents the clicked tab area.
+ */
+Tobago.TabGroup.updateHidden = function(tab) {
+ var tabGroup = tab.parents(".tobago-tabGroup:first");
+ var hidden = tabGroup.children("input");
+ var activeIndex = tab.attr("tabgroupindex");
+ hidden.attr("value", activeIndex);
+ return activeIndex;
+};
+
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TbgTimer.endTbgJs = new Date(); // @DEV_ONLY