myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1790232 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/context/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit...
Date Wed, 05 Apr 2017 13:02:58 GMT
Author: lofwyr
Date: Wed Apr  5 13:02:57 2017
New Revision: 1790232

URL: http://svn.apache.org/viewvc?rev=1790232&view=rev
Log:
TOBAGO-1728: Selector for all/none/toggle in sheet is displayed behind the sheet-body
* Re-implementation with a single checkbox instead of using dropdown menu.
* It's easier to implement and easier to use.

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
    myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource.xml
    myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_de.xml
    myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_es.xml
    myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/20-selector/sheet-column-selector.xhtml
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
Wed Apr  5 13:02:57 2017
@@ -96,8 +96,14 @@ public final class Markup implements Ser
   public static final Markup RIGHT = valueOf("right");
   public static final Markup SECONDS = valueOf("seconds");
   public static final Markup SELECTED = valueOf("selected");
+  /** @deprecated since 3.0.4 */
+  @Deprecated
   public static final Markup SHEET_SELECT_ALL = valueOf("sheetSelectAll");
+  /** @deprecated since 3.0.4 */
+  @Deprecated
   public static final Markup SHEET_DESELECT_ALL = valueOf("sheetDeselectAll");
+  /** @deprecated since 3.0.4 */
+  @Deprecated
   public static final Markup SHEET_TOGGLE_ALL = valueOf("sheetToggleAll");
   public static final Markup SMALL = valueOf("small");
   public static final Markup SORTABLE = valueOf("sortable");

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
Wed Apr  5 13:02:57 2017
@@ -63,10 +63,8 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.css.Icons;
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
-import org.apache.myfaces.tobago.renderkit.html.Arias;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
-import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -98,7 +96,6 @@ public class SheetRenderer extends Rende
   private static final String SUFFIX_COLUMN_RENDERED = ComponentUtils.SUB_SEPARATOR + "rendered";
   private static final String SUFFIX_SCROLL_POSITION = ComponentUtils.SUB_SEPARATOR + "scrollPosition";
   private static final String SUFFIX_SELECTED = ComponentUtils.SUB_SEPARATOR + "selected";
-  private static final String SUFFIX_SELECTOR_DROPDOWN = ComponentUtils.SUB_SEPARATOR + "selectorDropdown";
 
   @Override
   public void decode(final FacesContext facesContext, final UIComponent component) {
@@ -634,7 +631,7 @@ public class SheetRenderer extends Rende
               writer.writeAttribute(HtmlAttributes.DISABLED, selector.isDisabled());
               writer.writeClassAttribute(
                   BootstrapClass.FORM_CHECK_INLINE,
-                  Classes.create(sheet, "columnSelector"));
+                  TobagoClass.SHEET__COLUMN_SELECTOR);
               writer.endElement(HtmlElements.INPUT);
             } else if (normalColumn instanceof AbstractUIColumnNode) {
               RenderUtils.encode(facesContext, normalColumn);
@@ -860,44 +857,15 @@ public class SheetRenderer extends Rende
             writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
 
             if (column instanceof UIColumnSelector && selectable.isMulti()) {
-              writer.writeClassAttribute(Classes.create(sheet, "selectorDropdown"));
+              writer.startElement(HtmlElements.INPUT);
+              writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.CHECKBOX);
 
-              writer.startElement(HtmlElements.DIV);
-              writer.writeClassAttribute(BootstrapClass.DROPDOWN);
-              writer.startElement(HtmlElements.BUTTON);
-              writer.writeClassAttribute(
-                  BootstrapClass.BTN, BootstrapClass.BTN_SECONDARY, BootstrapClass.DROPDOWN_TOGGLE);
-              writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON);
-              writer.writeIdAttribute(sheet.getClientId(facesContext) + SUFFIX_SELECTOR_DROPDOWN);
-              writer.writeAttribute(DataAttributes.TOGGLE, "dropdown", false);
-              writer.writeAttribute(Arias.HASPOPUP, Boolean.TRUE.toString(), false);
-              writer.writeAttribute(Arias.EXPANDED, Boolean.FALSE.toString(), false);
-              writer.endElement(HtmlElements.BUTTON);
-              writer.startElement(HtmlElements.DIV);
-              writer.writeClassAttribute(BootstrapClass.DROPDOWN_MENU);
-              writer
-                  .writeAttribute(Arias.LABELLEDBY, sheet.getClientId(facesContext) + SUFFIX_SELECTOR_DROPDOWN,
false);
-              writer.startElement(HtmlElements.BUTTON);
-              writer.writeClassAttribute(BootstrapClass.DROPDOWN_ITEM);
-              writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON);
-              writer.writeAttribute(DataAttributes.COMMAND, "sheetSelectAll", false);
-              writer.writeText(TobagoResourceBundle.getString(facesContext, "sheetMenuSelect"));
-              writer.endElement(HtmlElements.BUTTON);
-              writer.startElement(HtmlElements.BUTTON);
-              writer.writeClassAttribute(BootstrapClass.DROPDOWN_ITEM);
-              writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON);
-              writer.writeAttribute(DataAttributes.COMMAND, "sheetDeselectAll", false);
-              writer.writeText(TobagoResourceBundle.getString(facesContext, "sheetMenuUnselect"));
-              writer.endElement(HtmlElements.BUTTON);
-              writer.startElement(HtmlElements.BUTTON);
-              writer.writeClassAttribute(BootstrapClass.DROPDOWN_ITEM);
-              writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON);
-              writer.writeAttribute(DataAttributes.COMMAND, "sheetToggleAll", false);
-              writer
-                  .writeText(TobagoResourceBundle.getString(facesContext, "sheetMenuToggleselect"));
-              writer.endElement(HtmlElements.BUTTON);
-              writer.endElement(HtmlElements.DIV);
-              writer.endElement(HtmlElements.DIV);
+              writer.writeClassAttribute(TobagoClass.SHEET__COLUMN_SELECTOR);
+              writer.writeAttribute(
+                  HtmlAttributes.TITLE,
+                  TobagoResourceBundle.getString(facesContext, "sheetMenuSelect"),
+                  true);
+              writer.endElement(HtmlElements.INPUT);
             } else {
               RenderUtils.encode(facesContext, cellComponent);
             }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
Wed Apr  5 13:02:57 2017
@@ -83,6 +83,7 @@ public enum TobagoClass implements CssIt
   SELECT_ONE_RADIO__INLINE("tobago-selectOneRadio-inline"),
   SHEET__HEADER("tobago-sheet-header"),
   SHEET__BODY_TABLE("tobago-sheet-bodyTable"),
+  SHEET__COLUMN_SELECTOR("tobago-sheet-columnSelector"),
   SHEET__HEADER_TABLE("tobago-sheet-headerTable"),
   SHEET__PAGING_INPUT("tobago-sheet-pagingInput"),
   SHEET__PAGING_OUTPUT("tobago-sheet-pagingOutput"),

Modified: myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource.xml?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource.xml
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource.xml
Wed Apr  5 13:02:57 2017
@@ -58,8 +58,6 @@
   <entry key="sheetPagingInfoUndefinedSinglePage">Page {0}</entry>
   <entry key="sheetPagingInfoEmptyPage"/>
   <entry key="sheetPagingInfoPagePagingTip">Click here, to change the displayed page</entry>
-  <entry key="sheetMenuToggleselect">Invert selections</entry>
-  <entry key="sheetMenuUnselect">Unselect all</entry>
   <entry key="sheetMenuSelect">Select all</entry>
 
   <!-- Tree -->

Modified: myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_de.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_de.xml?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_de.xml
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_de.xml
Wed Apr  5 13:02:57 2017
@@ -61,9 +61,7 @@
   <entry key="sheetPagingInfoUndefinedSinglePage">Seite {0}</entry>
   <entry key="sheetPagingInfoEmptyPage"/>
   <entry key="sheetPagingInfoPagePagingTip">Hier klicken, zum Eingeben der anzuzeigenden
Seite.</entry>
-  <entry key="sheetMenuToggleselect">Markierung umkehren</entry>
-  <entry key="sheetMenuUnselect">Markierungen löschen</entry>
-  <entry key="sheetMenuSelect">Alles markieren</entry>
+  <entry key="sheetMenuSelect">Alles auswählen</entry>
 
   <!-- Tree -->
   <entry key="treeNew">Neu</entry>

Modified: myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_es.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_es.xml?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_es.xml
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResource_es.xml
Wed Apr  5 13:02:57 2017
@@ -58,8 +58,6 @@
   <entry key="sheetPagingInfoUndefinedSinglePage">Página {0}</entry>
   <entry key="sheetPagingInfoEmptyPage"/>
   <entry key="sheetPagingInfoPagePagingTip">Click aquí, para cambiar el nombre desplegado.</entry>
-  <entry key="sheetMenuToggleselect">Invertir seleccion</entry>
-  <entry key="sheetMenuUnselect">Deseleccionar todo</entry>
   <entry key="sheetMenuSelect">Seleccionar todo</entry>
 
   <!-- Tree -->

Modified: myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss Wed Apr  5 13:02:57
2017
@@ -22,6 +22,9 @@ XXX code will be inserted after the _var
 $brand-info: #00f !default;
 $zindex-dropdown: 1000 !default;
 $zindex-popover: 1060 !default;
+$spacer: 1rem !default;
+$spacer-x: $spacer !default;
+$spacer-y: $spacer !default;
 
 /* fix bootstrap ---------------------------------------------------- */
 span.dropdown {
@@ -41,7 +44,7 @@ Todo: check, if this is needed? (It does
 */
 
 /*
-.tobago-treeNode-toggle // XXX dummy: only occurs in JavaScript, is here to satisfy the Test
+.tobago-treeNode-toggle // XXX dummy: only occurs in JavaScript, is here to satisfy the TobagoClassUnitTest
  */
 
 /*
@@ -740,6 +743,11 @@ th.tobago-sheet-headerCell .tobago-out {
   flex-shrink: 0;
 }
 
+.tobago-sheet-columnSelector {
+  margin-top: ($spacer-y * 0.75);
+  margin-bottom: ($spacer-y * 0.75);
+}
+
 .tobago-sheet {
   display: flex;
   flex-direction: column;

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/20-selector/sheet-column-selector.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/20-selector/sheet-column-selector.xhtml?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/20-selector/sheet-column-selector.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/20-selector/sheet-column-selector.xhtml
Wed Apr  5 13:02:57 2017
@@ -64,7 +64,7 @@
       </tc:column>
     </tc:sheet>
 
-    <tc:selectOneRadio label="Mode" value="#{sheetController.selectable}">
+    <tc:selectOneRadio label="Mode" value="#{sheetController.selectable}" required="true">
       <tc:selectItems value="#{sheetController.selectableModes}"/>
       <f:ajax render="s4"/>
     </tc:selectOneRadio>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js?rev=1790232&r1=1790231&r2=1790232&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-sheet.js
Wed Apr  5 13:02:57 2017
@@ -71,14 +71,13 @@ Tobago.Sheet.init = function(elements) {
 
   Tobago.Sheet.setup2(sheets);
 
-  Tobago.Utils.selectWithJQuery(elements, "button[data-tobago-command=sheetSelectAll]").click(function(event)
{
-    Tobago.Sheet.selectAll(jQuery(event.target).closest(".tobago-sheet"));
-  });
-  Tobago.Utils.selectWithJQuery(elements, "button[data-tobago-command=sheetDeselectAll]").click(function(event)
{
-    Tobago.Sheet.deselectAll(jQuery(event.target).closest(".tobago-sheet"));
-  });
-  Tobago.Utils.selectWithJQuery(elements, "button[data-tobago-command=sheetToggleAll]").click(function(event)
{
-    Tobago.Sheet.toggleAll(jQuery(event.target).closest(".tobago-sheet"));
+  Tobago.Utils.selectWithJQuery(elements, ".tobago-sheet-header .tobago-sheet-columnSelector").click(function(event)
{
+    var $checkbox = jQuery(event.target);
+    if ($checkbox.is(':checked')) {
+      Tobago.Sheet.selectAll($checkbox.closest(".tobago-sheet"));
+    } else {
+      Tobago.Sheet.deselectAll($checkbox.closest(".tobago-sheet"));
+    }
   });
 
   console.timeEnd("[tobago-sheet] init"); // @DEV_ONLY
@@ -423,7 +422,7 @@ Tobago.Sheet.setup2 = function (sheets)
         }
       });
     }
-    sheet.find("input.tobago-sheet-columnSelector").click(function(event) {event.preventDefault()});
+    sheet.find("tobago-sheet-cell > input.tobago-sheet-columnSelector").click(function(event)
{event.preventDefault()});
   });
 
     // init reload



Mime
View raw message