You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2013/08/23 03:19:51 UTC

[11/35] git commit: Add Glyphicon component

Add Glyphicon component


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/06b7c163
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/06b7c163
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/06b7c163

Branch: refs/heads/master
Commit: 06b7c1639ef15fbb2311700dcea4f2b3135a4e79
Parents: 7436c9a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu Aug 22 15:53:05 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu Aug 22 15:53:05 2013 -0700

----------------------------------------------------------------------
 54_RELEASE_NOTES.txt                            |  4 ++
 .../tapestry5/corelib/components/Glyphicon.java | 42 ++++++++++++++++++++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/06b7c163/54_RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/54_RELEASE_NOTES.txt b/54_RELEASE_NOTES.txt
index fe4298c..90bc175 100644
--- a/54_RELEASE_NOTES.txt
+++ b/54_RELEASE_NOTES.txt
@@ -65,6 +65,10 @@ Less into CSS, and for minimizing CSS and JavaScript. All processing takes place
 This new mixin for Field components adds the outer <div> and <label> elements for a Field to layout correctly
 inside a Twitter Bootstrap form.
 
+## Glyphicon Component
+
+This new component renders a `<span>` tag for a Bootstrap 3 Glyphicon.
+
 ## tapestry-test deprecated
 
 The tapestry-test module contains base classes used when writing TestNG, Selenium, and EasyMock tests.

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/06b7c163/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Glyphicon.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Glyphicon.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Glyphicon.java
new file mode 100644
index 0000000..838f523
--- /dev/null
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Glyphicon.java
@@ -0,0 +1,42 @@
+// Copyright 2013 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.corelib.components;
+
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.annotations.Parameter;
+
+/**
+ * Renders a {@code <span>} tag with the CSS class to select a <a href="http://getbootstrap.com/components/#glyphicons">Bootstrap Glyphicon</a>.
+ *
+ * @since 5.4
+ */
+public class Glyphicon
+{
+    /**
+     * The name of the icon, e.g., "arrow-up", "flag", "fire" etc.
+     */
+    @Parameter(required = true, allowNull = false, defaultPrefix = BindingConstants.LITERAL)
+    String name;
+
+    boolean beginRender(MarkupWriter writer)
+    {
+        writer.element("span",
+                "class", "glyphicon glyphicon-" + name);
+        writer.end();
+
+        return false;
+    }
+}