KAWWA Markup Pattern Library


Site Utilities

Icon Buttons Component Information

  • Class name: (actions)
  • Version: 1.0
  • Tapestry Tapestry Integration

Add to list

Icon buttons may be used for general or common actions that don't need to be directly explained by text. They're also handy for actions that are specific to a table row item, for example.

HTML5 Plain Code

COPY
  1. <!-- The text for the "title" attributes are just examples. Adapt them to your own context -->
  2. <ul class="actions">
  3. 	<li><a href="#" class="bt-new" title="Create new item" role="button">New</a></li>
  4. 	<li><a href="#" class="bt-search" title="Search for..." role="button">Search</a></li>
  5. 	<li><a href="#" class="bt-email" title="Email a friend" role="button">Email</a></li>
  6. 	<li><a href="#" class="bt-print" title="Print page" role="button">Print</a></li>
  7. 	<li><a href="#" class="bt-download" title="Download data" role="button">Download</a></li>
  8. 	<li><a href="#" class="bt-edit" title="Edit account" role="button">Edit</a></li>
  9. 	<li><a href="#" class="bt-view" title="View details" role="button">View</a></li>
  10. 	<li><a href="#" class="bt-del" title="Delete item" role="button">Delete</a></li>
  11. </ul>

CSS Code

COPY
  1. ul.actions {}
  2. 
                                
  3. 		ul.actions li {
  4. 			display: inline-block;
  5. 			list-style-type: none;
  6. 		}
  7. 		ul.actions a, ul.actions a:link, ul.actions a:visited {
  8. 			overflow: hidden;
  9. 			display: inline-block;
  10. 			width: 1px;
  11. 			height: 2em;
  12. 			line-height: 2em;
  13. 			text-decoration: none;
  14. 			color: #ECECEC;
  15. 			background: #ECECEC url(../img/k-theme0/sprites-trans.png) no-repeat 4px 30px;
  16. 			padding: 0 10px;
  17. 			margin: 0 0.5em;
  18. 			border: 1px solid #CCC;
  19. 			border-radius: 3px;
  20. 			box-shadow: 0 1px 1px rgba(0,0,0,.5);
  21. 		}
  22. 
                                
  23. 		ul.actions a:hover {color: #FFF; background-color: #FFF;}
  24. 
                                
  25. 
                                
  26. 	/* Icons sprite */
  27. 	ul.actions a.bt-print {background-position: 11px -740px; padding-left: 35px;}
  28. 	ul.actions a.bt-download {background-position: 11px -618px; padding-left: 35px;}
  29. 	ul.actions a.bt-edit {background-position: 11px -377px; padding-left: 35px;}
  30. 	ul.actions a.bt-view {background-position: 11px -508px; padding-left: 35px;}
  31. 	ul.actions a.bt-email {background-position: 11px 6px; padding-left: 35px;}
  32. 	ul.actions a.bt-search {background-position: 11px -77px; padding-left: 35px;}
  33. 	ul.actions a.bt-new {background-position: 11px -275px; padding-left: 35px;}
  34. 	ul.actions a.bt-del {background-position: 11px -172px; padding-left: 35px;}
  35. 
                                

How to apply

COPY
  1. (function($){
  2.     'use strict';
  3.     $(document).ready(function(){
  4.         $('a.bt-print').click(function(){
  5.             window.print();
  6.             return false;
  7.         });
  8.     });
  9. })(jQuery);

Clicking the "print" button will open the print dialog window.

IE Backward Compatibility

In order to correct display bugs for Internet Explorer versions prior to 9, your html pages need to call the following file by Conditional Comments:

Tapestry Integration

Components used to display a list of links. It will implement 3 Kawwa components : ActionButtons, ActionButtonsBar and iconButtons

By default, the component will render a link for each item of your list. But you can override the rendering, by providing block parameters. If you want to override the rendering of the item with an id="i1", you should define a block parameter <p:i1>...</p:i1>

ProductGallery parameters
Name Required Java Type Default Prefix Default Value Description
items true Map<ListOfActionsItem> prop Actions Actions you want to display with this component. You will need to create a List of ListOfActionsItem. If the onlyIcon parameter is set to true, every ListOfActionsItem item should have a value for its classe attribute.
items false Boolean prop false If set to true, the list of actions will be surround by a bar.
items false Boolean prop false If set to true, your list will display only the icon of each item. The label associated to your link will be hidden.

The Template

COPY
  1. <t:kawwa2.listOfActions t:items="items" withBar="false" onlyIcon="true"/>

Java Implementation

COPY
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. 
                                
  4. import net.atos.kawwaportal.components.data.ListOfActionsItem;
  5. 
                                
  6. public class ListOfActions {
  7. 	
  8. 	public List<ListOfActionsItem> getItems(){
  9. 		List<ListOfActionsItem> items = new ArrayList<ListOfActionsItem>();
  10. 		
  11. 		items.add(new ListOfActionsItem("print", "#", "bt-print", false));
  12. 		items.add(new ListOfActionsItem("download", "#", "bt-download", false));
  13. 		items.add(new ListOfActionsItem("edit", "#", "bt-edit", false));
  14. 		items.add(new ListOfActionsItem("view", "#", "bt-view", false));
  15. 		items.add(new ListOfActionsItem("email", "#", "bt-email", false));
  16. 		return items;
  17. 	}
  18. }
  19. 
                                
  20. 
                                

Top


List of Components

Top

jQuery Feature
jQuery Interactive Feature
Tapestry Integration
Tapestry integration
AngularJS Feature
AngularJS Feature

Navigation

Forms

Tables

Blocks

Site Utilities

Editorial

eCommerce