myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] 02/02: delete unused code / cleanup
Date Thu, 08 Aug 2019 12:20:02 GMT
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 292bb2fc24fc370497351b99d8b172e7e07c87ff
Author: Udo Schnurpfeil <lofwyr@apache.org>
AuthorDate: Thu Aug 8 14:15:23 2019 +0200

    delete unused code / cleanup
    
    issue: TOBAGO-1633: TS refactoring
---
 .../internal/renderkit/renderer/TreeRenderer.java  | 10 ++---
 .../src/main/npm/ts/tobago-utils.ts                | 48 ----------------------
 2 files changed, 5 insertions(+), 53 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java
index e4e01ff..44818ba 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java
@@ -53,13 +53,13 @@ public class TreeRenderer extends RendererBase {
 
   private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  protected static final String SCROLL_POSITION = ComponentUtils.SUB_SEPARATOR + "scrollPosition";
+  protected static final String SCROLL_POSITION = "scrollPosition";
 
   @Override
   public void decode(final FacesContext facesContext, final UIComponent component) {
     final AbstractUITree tree = (AbstractUITree) component;
     final String value = facesContext.getExternalContext().getRequestParameterMap().get(
-        tree.getClientId(facesContext) + SCROLL_POSITION);
+        tree.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + SCROLL_POSITION);
     if (value != null) {
       tree.getState().getScrollPosition().update(value);
     }
@@ -162,11 +162,11 @@ public class TreeRenderer extends RendererBase {
     writer.endElement(HtmlElements.INPUT);
 
     writer.startElement(HtmlElements.INPUT);
-    writer.writeIdAttribute(clientId + SCROLL_POSITION);
-    writer.writeNameAttribute(clientId + SCROLL_POSITION);
+    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + SCROLL_POSITION);
+    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + SCROLL_POSITION);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
     writer.writeAttribute(HtmlAttributes.VALUE, tree.getState().getScrollPosition().encode(),
false);
-    writer.writeAttribute(DataAttributes.SCROLL_POSITION, Boolean.TRUE.toString(), true);
+    writer.writeAttribute(DataAttributes.SCROLL_POSITION, Boolean.TRUE.toString(), false);
     writer.endElement(HtmlElements.INPUT);
 
     writer.endElement(HtmlElements.DIV);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
index d90707d..66b8423 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
@@ -189,52 +189,4 @@ export class Tobago4Utils {
     }
     return id.substring(0, id.lastIndexOf(":"));
   }
-
-  /**
-   * fix position, when the element it is outside of the current page
-   * @param elements is an jQuery Array of elements to be fixed.
-   */
-  static keepElementInVisibleArea(elements) {
-    elements.each(function () {
-      var element = jQuery(this);
-      var page = jQuery(".tobago-page-content:first");
-      var left = element.offset().left;
-      var top = element.offset().top;
-      // fix menu position, when it is outside of the current page
-      left = Math.max(0, Math.min(left, page.outerWidth() - element.outerWidth()));
-      top = Math.max(0, Math.min(top, page.outerHeight() - element.outerHeight()));
-      element.css('left', left);
-      element.css('top', top);
-    });
-  }
-
-  static addDataMarkup(element, markupString) {
-    var dataTobagoMarkup = element.attr("data-tobago-markup");
-    if (dataTobagoMarkup !== undefined) {
-      var markups = jQuery.parseJSON(dataTobagoMarkup);
-      markups.push(markupString);
-      element.attr("data-tobago-markup", JSON.stringify(markups));
-    } else {
-      element.attr("data-tobago-markup", JSON.stringify(markupString));
-    }
-  }
-
-  static removeDataMarkup(element, markupString) {
-    var dataTobagoMarkup = element.attr("data-tobago-markup");
-    if (dataTobagoMarkup !== undefined) {
-      var markups = jQuery.parseJSON(dataTobagoMarkup);
-      var index = jQuery.inArray(markupString, markups);
-      if (index >= 0) {
-        markups.splice(index, 1);
-      } else if (markups === markupString) {
-        markups = [];
-      }
-
-      if (markups.length > 0) {
-        element.attr("data-tobago-markup", JSON.stringify(markups));
-      } else {
-        element.removeAttr("data-tobago-markup");
-      }
-    }
-  }
 }
\ No newline at end of file


Mime
View raw message