myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject [myfaces-tobago] branch tobago-4.x updated: add outline markup for buttons
Date Thu, 02 Apr 2020 12:43:04 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/tobago-4.x by this push:
     new 282ce1a  add outline markup for buttons
282ce1a is described below

commit 282ce1ac81f118d4329a3f3b7b5fbb2c3ee806d7
Author: Jasmin Kroeger <jasmin.kroeger@irian.eu>
AuthorDate: Wed Mar 25 16:46:29 2020 +0100

    add outline markup for buttons
    
    Buttons can also be created with an outline markup.
    
    Issue: TOBAGO-1863
    (cherry picked from commit 032ff587882099869913274ce8ec9dfbae3d7711)
---
 .../org/apache/myfaces/tobago/context/Markup.java    | 16 ++++++++++++++++
 .../internal/renderkit/renderer/ButtonRenderer.java  | 16 ++++++++++++++++
 .../myfaces/tobago/renderkit/css/BootstrapClass.java |  7 +++++++
 .../040-command/00-button+link/button+link.xhtml     | 20 +++++++++++++++++++-
 4 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
index 089b567..ac4fbfd 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
@@ -107,6 +107,14 @@ public final class Markup implements Serializable, Iterable<String>
{
   public static final Markup NONE = valueOf("none");
   public static final Markup NUMBER = valueOf("number");
   public static final Markup ODD = valueOf("odd");
+  public static final Markup OUTLINE_DANGER = valueOf("outlineDanger");
+  public static final Markup OUTLINE_DARK = valueOf("outlineDark");
+  public static final Markup OUTLINE_INFO = valueOf("outlineInfo");
+  public static final Markup OUTLINE_LIGHT = valueOf("outlineLight");
+  public static final Markup OUTLINE_PRIMARY = valueOf("outlinePrimary");
+  public static final Markup OUTLINE_SECONDARY = valueOf("outlineSecondary");
+  public static final Markup OUTLINE_SUCCESS = valueOf("outlineSuccess");
+  public static final Markup OUTLINE_WARNING = valueOf("outlineWarning");
   public static final Markup PILL = valueOf("pill");
   public static final Markup PORTLET = valueOf("portlet");
   public static final Markup PRIMARY = valueOf("primary");
@@ -192,6 +200,14 @@ public final class Markup implements Serializable, Iterable<String>
{
   public static final String STRING_NONE = "none";
   public static final String STRING_NUMBER = "number";
   public static final String STRING_ODD = "odd";
+  public static final String STRING_OUTLINE_DANGER = "outlineDanger";
+  public static final String STRING_OUTLINE_DARK = "outlineDark";
+  public static final String STRING_OUTLINE_INFO = "outlineInfo";
+  public static final String STRING_OUTLINE_LIGHT = "outlineLight";
+  public static final String STRING_OUTLINE_PRIMARY = "outlinePrimary";
+  public static final String STRING_OUTLINE_SECONDARY = "outlineSecondary";
+  public static final String STRING_OUTLINE_SUCCESS = "outlineSuccess";
+  public static final String STRING_OUTLINE_WARNING = "outlineWarning";
   public static final String STRING_PILL = "pill";
   public static final String STRING_PORTLET = "portlet";
   public static final String STRING_PRIMARY = "primary";
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonRenderer.java
index 25d8fe8..4ddc5be 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ButtonRenderer.java
@@ -73,6 +73,22 @@ public class ButtonRenderer extends CommandRendererBase {
         return BootstrapClass.BTN_LIGHT;
       } else if (markup.contains(Markup.DARK)) {
         return BootstrapClass.BTN_DARK;
+      } else if (markup.contains(Markup.OUTLINE_PRIMARY)) {
+        return BootstrapClass.BTN_OUTLINE_PRIMARY;
+      } else if (markup.contains(Markup.OUTLINE_SECONDARY)) {
+        return BootstrapClass.BTN_OUTLINE_SECONDARY;
+      } else if (markup.contains(Markup.OUTLINE_SUCCESS)) {
+        return BootstrapClass.BTN_OUTLINE_SUCCESS;
+      } else if (markup.contains(Markup.OUTLINE_DANGER)) {
+        return BootstrapClass.BTN_OUTLINE_DANGER;
+      } else if (markup.contains(Markup.OUTLINE_WARNING)) {
+        return BootstrapClass.BTN_OUTLINE_WARNING;
+      } else if (markup.contains(Markup.OUTLINE_INFO)) {
+        return BootstrapClass.BTN_OUTLINE_INFO;
+      } else if (markup.contains(Markup.OUTLINE_LIGHT)) {
+        return BootstrapClass.BTN_OUTLINE_LIGHT;
+      } else if (markup.contains(Markup.OUTLINE_DARK)) {
+        return BootstrapClass.BTN_OUTLINE_DARK;
       }
     }
     return defaultCommand ? BootstrapClass.BTN_PRIMARY : BootstrapClass.BTN_SECONDARY;
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
index 388e52a..632eb84 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
@@ -88,7 +88,14 @@ public enum BootstrapClass implements CssItem {
   BTN_LIGHT("btn-light"),
   BTN_LINK("btn-link"),
   BTN_PRIMARY("btn-primary"),
+  BTN_OUTLINE_DANGER("btn-outline-danger"),
+  BTN_OUTLINE_DARK("btn-outline-dark"),
   BTN_OUTLINE_INFO("btn-outline-info"),
+  BTN_OUTLINE_LIGHT("btn-outline-light"),
+  BTN_OUTLINE_PRIMARY("btn-outline-primary"),
+  BTN_OUTLINE_SECONDARY("btn-outline-secondary"),
+  BTN_OUTLINE_SUCCESS("btn-outline-success"),
+  BTN_OUTLINE_WARNING("btn-outline-warning"),
   BTN_SECONDARY("btn-secondary"),
   BTN_SUCCESS("btn-success"),
   BTN_TOOLBAR("btn-toolbar"),
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button+link/button+link.xhtml
b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button+link/button+link.xhtml
index e116863..bdce9b2 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button+link/button+link.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button+link/button+link.xhtml
@@ -140,7 +140,7 @@
   </tc:section>
 
   <tc:section id="markup" label="Markups">
-    <tc:segmentLayout medium="6seg">
+    <tc:segmentLayout medium="7seg 5seg">
       <tc:box label="Buttons">
         <p>Colors can be set with markups. Markup <code>none</code> unset
the color.</p>
         <pre><code class="language-markup">&lt;tc:button label="Primary"
markup="primary"/>
@@ -161,6 +161,24 @@
         <tc:button label="Light" markup="light"/>
         <tc:button label="Dark" markup="dark"/>
         <tc:button label="None" markup="none"/>
+        <tc:separator/>
+        <p>Colors can also be set with an outline markup.</p>
+        <pre><code class="language-markup">&lt;tc:button label="Primary"
markup="outlinePrimary"/>
+&lt;tc:button label="Secondary" markup="outlineSecondary"/>
+&lt;tc:button label="Success" markup="outlineSuccess"/>
+&lt;tc:button label="Danger" markup="outlineDanger"/>
+&lt;tc:button label="Warning" markup="outlineWarning"/>
+&lt;tc:button label="Info" markup="outlineInfo"/>
+&lt;tc:button label="Light" markup="outlineLight"/>
+&lt;tc:button label="Dark" markup="outlineDark"/></code></pre>
+        <tc:button label="Primary" markup="outlinePrimary"/>
+        <tc:button label="Secondary" markup="outlineSecondary"/>
+        <tc:button label="Success" markup="outlineSuccess"/>
+        <tc:button label="Danger" markup="outlineDanger"/>
+        <tc:button label="Warning" markup="outlineWarning"/>
+        <tc:button label="Info" markup="outlineInfo"/>
+        <tc:button label="Light" markup="outlineLight"/>
+        <tc:button label="Dark" markup="outlineDark"/>
       </tc:box>
       <tc:box label="Links">
         <tc:link label="thin" markup="thin"/>


Mime
View raw message