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 2014/12/18 10:27:36 UTC

svn commit: r1646417 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/...

Author: lofwyr
Date: Thu Dec 18 09:27:36 2014
New Revision: 1646417

URL: http://svn.apache.org/r1646417
Log:
TOBAGO-1358: Using CSS box-sizing: border-box instead of content-box
- fix file upload

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FileRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java?rev=1646417&r1=1646416&r2=1646417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java Thu Dec 18 09:27:36 2014
@@ -42,6 +42,11 @@ public class Upload {
           null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "No UploadItem found!", null));
       return null;
     }
+    if (file.get().length == 0) {
+      FacesContext.getCurrentInstance().addMessage(
+          null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Empty UploadItem found!", null));
+      return null;
+    }
     LOG.info("type=" + file.getContentType());
     LOG.info("size=" + file.get().length);
     String name = file.getName();

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1646417&r1=1646416&r2=1646417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Thu Dec 18 09:27:36 2014
@@ -320,8 +320,9 @@ span.tobago-calendar-header {
   position: absolute;
   right: 0;
   top: 0;
-  opacity: 0.5;
-  filter: alpha(opacity: 0.5);
+  width: 100%;
+  opacity: 0;
+  filter: alpha(opacity: 0);
 }
 
 /* formatted --------------------------------------------------------------- */

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FileRenderer.java?rev=1646417&r1=1646416&r2=1646417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FileRenderer.java Thu Dec 18 09:27:36 2014
@@ -107,19 +107,13 @@ public class FileRenderer extends InputR
     writer.writeStyleAttribute(style);
 
     // visible fake input for a pretty look
-    // XXX fixme!!!
-//    final Style inputStyle = new Style();
-//    final Measure prettyWidthSub = getResourceManager().getThemeMeasure(facesContext, file, "prettyWidthSub");
-//    inputStyle.setWidth(style.getWidth().subtract(prettyWidthSub));
-    writer.startElement(HtmlElements.INPUT, file);
+    writer.startElement(HtmlElements.DIV, file);
     writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "pretty");
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT, false);
     writer.writeClassAttribute(Classes.create(file, "pretty"));
-//    writer.writeStyleAttribute(inputStyle);
-    writer.writeAttribute(HtmlAttributes.DISABLED, true);
     // TODO Focus
     //HtmlRendererUtils.renderFocus(clientId, file.isFocus(), ComponentUtils.isError(file), facesContext, writer);
-    writer.endElement(HtmlElements.INPUT);
+    writer.endElement(HtmlElements.DIV);
 
     // invisible file input
     writer.startElement(HtmlElements.INPUT, file);

Modified: myfaces/tobago/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1646417&r1=1646416&r2=1646417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Dec 18 09:27:36 2014
@@ -2585,14 +2585,14 @@ Tobago.File.init = function(elements) {
   var files = Tobago.Utils.selectWidthJQuery(elements, ".tobago-file-real");
   files.change(function () {
     var file = jQuery(this);
-    var pretty = file.prev();
+    var pretty = file.siblings(".tobago-file-pretty");
     var filename = file.val();
     // remove path, if any. Some old browsers set the path, others like webkit uses the prefix "C:\facepath\".
     var pos = Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
     if (pos >= 0) {
       filename = filename.substr(pos + 1);
     }
-    pretty.val(filename);
+    pretty.text(filename);
   });
   if (files.length > 0) {
     jQuery("form").attr('enctype', 'multipart/form-data')