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 2016/03/09 17:54:57 UTC
svn commit: r1734287 - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/
tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/
tobago-theme/tobago-theme-standard/src/main/java/o...
Author: lofwyr
Date: Wed Mar 9 16:54:56 2016
New Revision: 1734287
URL: http://svn.apache.org/viewvc?rev=1734287&view=rev
Log:
TOBAGO-1538: Styling of <tc:file> with Bootstrap
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml
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
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java?rev=1734287&r1=1734286&r2=1734287&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Icons.java Wed Mar 9 16:54:56 2016
@@ -31,6 +31,7 @@ public enum Icons {
CALENDAR,
CLOCK_O,
ELLIPSIS_H,
+ FOLDER_OPEN,
FORWARD,
MINUS_SQUARE_O,
PLUS_SQUARE_O,
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml?rev=1734287&r1=1734286&r2=1734287&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/40-upload/upload.xhtml Wed Mar 9 16:54:56 2016
@@ -54,11 +54,20 @@
<tc:validateFileItem contentType="image/*"/>
</tc:file>
- <tc:button label="Submit" defaultCommand="true" action="#{upload.upload}"/>
+ <tc:flowLayout>
+ <tc:style textAlign="right"/>
+ <tc:button label="Submit" defaultCommand="true" action="#{upload.upload}"/>
+ </tc:flowLayout>
- <tc:file label="Instant" value="#{upload.file3}" tip="with AJAX" id="file3">
- <f:ajax listener="#{upload.uploadAjax}" render="panel"/>
- </tc:file>
+ <tc:section label="AJAX">
+
+ The AJAX feature of file upload currently only works with JSF 2.2 (not with JSF 2.0 or 2.1)!
+
+ <tc:file label="Instant" value="#{upload.file3}" tip="with AJAX" id="file3">
+ <f:ajax listener="#{upload.uploadAjax}" render="panel"/>
+ </tc:file>
+
+ </tc:section>
<tc:sheet id="sheet" var="entry" value="#{upload.list}" columns="*;*;*">
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=1734287&r1=1734286&r2=1734287&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 Wed Mar 9 16:54:56 2016
@@ -22,9 +22,12 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.internal.component.AbstractUIFile;
import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
import org.apache.myfaces.tobago.internal.util.PartUtils;
+import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.Icons;
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.renderkit.html.util.HtmlRendererUtils;
@@ -105,11 +108,22 @@ public class FileRenderer extends InputR
// visible fake input for a pretty look
writer.startElement(HtmlElements.DIV);
- writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "pretty");
- writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT);
- writer.writeClassAttribute(Classes.create(file, "pretty"));
+ writer.writeClassAttribute(BootstrapClass.INPUT_GROUP);
+ writer.startElement(HtmlElements.SPAN);
+ writer.writeClassAttribute(Classes.create(file, "pretty"), BootstrapClass.FORM_CONTROL);
// TODO Focus
//HtmlRendererUtils.renderFocus(clientId, file.isFocus(), ComponentUtils.isError(file), facesContext, writer);
+ writer.writeText("Â "); // this is a non breaking space
+ writer.endElement(HtmlElements.SPAN);
+
+ writer.startElement(HtmlElements.SPAN);
+ writer.writeClassAttribute(BootstrapClass.INPUT_GROUP_BTN);
+ writer.startElement(HtmlElements.BUTTON);
+ writer.writeClassAttribute(BootstrapClass.BTN, BootstrapClass.BTN_SECONDARY);
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON);
+ writer.writeIcon(Icons.FOLDER_OPEN);
+ writer.endElement(HtmlElements.BUTTON);
+ writer.endElement(HtmlElements.SPAN);
writer.endElement(HtmlElements.DIV);
// invisible file input
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=1734287&r1=1734286&r2=1734287&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 Wed Mar 9 16:54:56 2016
@@ -2586,7 +2586,7 @@ Tobago.File.init = function(elements) {
var files = Tobago.Utils.selectWithJQuery(elements, ".tobago-file-real");
files.change(function () {
var file = jQuery(this);
- var pretty = file.siblings(".tobago-file-pretty");
+ var pretty = file.parent().find(".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('\\'));
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
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/style/tobago.css?rev=1734287&r1=1734286&r2=1734287&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/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css Wed Mar 9 16:54:56 2016
@@ -51,6 +51,23 @@ needed for popups
z-index: 2000 !important;
}
+/* file -------------------------------------------------------------- */
+
+.tobago-file {
+ position: relative;
+}
+
+.tobago-file-real {
+ position: absolute;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ opacity: 0;
+ width: 100%;
+ filter: alpha(opacity: 0);
+ z-index: 2;
+}
+
/* flexLayout -------------------------------------------------------------- */
.tobago-flexLayout {