ZK FontAwesome

A ZK wrapper for Font Awesome.

License

License

MIT
MIT
GroupId

GroupId

org.zkoss
ArtifactId

ArtifactId

zkfontawesome
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

ZK FontAwesome
A ZK wrapper for Font Awesome.
Project URL

Project URL

https://github.com/connollyst/zkfontawesome
Source Code Management

Source Code Management

https://github.com/connollyst/zkfontawesome

Download zkfontawesome

How to add to project

<!-- https://jarcasting.com/artifacts/org.zkoss/zkfontawesome/ -->
<dependency>
    <groupId>org.zkoss</groupId>
    <artifactId>zkfontawesome</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.zkoss/zkfontawesome/
implementation 'org.zkoss:zkfontawesome:1.3'
// https://jarcasting.com/artifacts/org.zkoss/zkfontawesome/
implementation ("org.zkoss:zkfontawesome:1.3")
'org.zkoss:zkfontawesome:jar:1.3'
<dependency org="org.zkoss" name="zkfontawesome" rev="1.3">
  <artifact name="zkfontawesome" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.zkoss', module='zkfontawesome', version='1.3')
)
libraryDependencies += "org.zkoss" % "zkfontawesome" % "1.3"
[org.zkoss/zkfontawesome "1.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.zkoss.zk : zul jar 5.0.10

test (2)

Group / Artifact Type Version
javax.servlet : servlet-api jar 2.4
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

zkfontawesome

What's Font Awesome?

ZK wrapper for Font Awesome glyphs.

Font Awesome is a project which grew out of Twitter's Bootstrap.

In the words of Font Awesome:

Font Awesome gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS.

In a nutshell, Font Awesome is a custom font designed by Dave Gandy which replaces letters with icons commonly used across the web. Think Wingdings.. but useful. The current version of Font Awesome, v3.2.1, contains 361 icons ranging from check marks, to paper clips, to an ambulance, to the Facebook logo. The idea is to reduce the footprint of your site by replacing lots of images with a single font file as well as giving you much more control over the icons using CSS.

The purpose of this ZK add-on, then, is to give you familiar ZK client/server control over the Font Awesome icons. Let's get started..

Get Font Awesome

<dependency>
    <groupId>org.zkoss</groupId>
    <artifactId>zkfontawesome</artifactId>
    <version>${zk.fontawesome.version}</version>
</dependency>

You can find the latest version on mvnrepository.

This will include all the CSS and font files you need and gives you access to the new ZUL and Java objects.

Be Awesome

You now have a new ZK component icon..

<icon type="fa-smile-o"/>

Supported Attributes

Font Awesome supports a number of ways to modify the icon further..

Size

Draw an icon larger than normal..

<icon type="fa-smile-o" size="large"/> <!-- 33% increase -->
<icon type="fa-smile-o" size="2x"/>
<icon type="fa-smile-o" size="3x"/>
<icon type="fa-smile-o" size="4x"/>

Border

Draws a border around the icon for emphasis..

<icon type="fa-smile-o" border="true"/>

Pull

Pull an icon to the left or right of surrounding text..

<icon type="fa-quote-left" pull="left"/>
<label value="That's what she said."/>
<icon type="fa-quote-right" pull="right"/>

Muting

An icon can be 'muted' to quickly make it lighter without needing to set a CSS color yourself..

<icon type="fa-smile-o" muted="true"/>

Java Support

Of course all of this can be done from the Java side also..

Icon quoteIcon = new Icon("fa-quote-left");
quoteIcon.setSize(IconSize.LARGE);
quoteIcon.setPull(IconPull.LEFT);
quoteIcon.setMuted(true);
quoteIcon.setBorder(true);
quoteIcon.setParent(window);

Cool huh?

Examples

These icons should behave much like any other component in ZK.

Links & Text

<vlayout>
    <a href="http://fortawesome.github.io/Font-Awesome/">
        <icon type="fa-angle-double-right"/>
        <label value="Goto Font Awesome"/>
    </a>
<vlayout>

ZK Events (Server Side)

<icon type="fa-hand-o-right">
    <attribute name="onClick">
       this.setType("fa-thumbs-up");
    </attribute>
</icon>

ZK Events (Client Side)

<zk xmlns:c="client">
    <icon type="fa-hand-o-right" c:onClick="this.setType('fa-thumbs-up')"/>
</zk>

CSS Styling

<zk>
    <style>
        .github-link {
            color: #000;
        }
        .github-link:hover {
            color: #4183C4;
        }
    </style>
    <a sclass="github-link" href="http://fortawesome.github.io/Font-Awesome/icon/github/">
        <icon type="fa-github" style="text-decoration:underline"/>
    </a>
</zk>

Versions

Version
1.3
1.2
1.1
1.0
0.2
0.1