Skip to content

Commit

Permalink
- Add datatable i18n and support to responsive and fixed header plugins
Browse files Browse the repository at this point in the history
- Add snake-case attribute to growl and tree components
- Small additions.
  • Loading branch information
asterd committed Mar 14, 2016
1 parent 1ddf8b3 commit 3963916
Show file tree
Hide file tree
Showing 19 changed files with 771 additions and 32 deletions.
8 changes: 5 additions & 3 deletions gradleResources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ task copyCssResources(type: Copy) {
description 'BootsFaces task: copies additional CSS files to the target folder (i.e. files that are not part of Bootstrap).'
from 'css/bootstrap-multiselect.css'
from 'css/bootstrap-switch.css'
from 'css/dataTables.bootstrap.min.css'
// from 'css/dataTables.bootstrap.min.css'
from 'css/datatables.min.css'
from 'css/bootstrap-tree.css'
from 'css/bootstrap-treeview.min.css'
from 'css/animate.css'
Expand All @@ -132,9 +133,10 @@ task copyJsResources(type: Copy) {
from 'js/bootstrap-tree.js'
from 'js/bootstrap-treeview.min.js'
from 'js/bootstrap-notify.min.js'
from 'js/jquery.dataTables.min.js'
from 'js/datatables.min.js'
// from 'js/jquery.dataTables.min.js'
from 'js/jquery.blockUI.js'
from 'js/dataTables.bootstrap.min.js'
// from 'js/dataTables.bootstrap.min.js'
from 'js/jquery.scrollUp.min.js'
from 'js/jquery.minicolors.min.js'
from 'ie8support/respond.js'
Expand Down
28 changes: 28 additions & 0 deletions gradleResources/css/datatables.min.css

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sLoadingRecords": "Wird geladen...",
"sProcessing": "Bitte warten...",
"sSearch": "Suchen",
"sZeroRecords": "Keine Einträge vorhanden.",
"oPaginate": {
"sFirst": "Erste",
"sPrevious": "Zurück",
"sNext": "Nächste",
"sLast": "Letzte"
},
"oAria": {
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
}
}
23 changes: 23 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Show _MENU_ entries",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "Search:",
"sZeroRecords": "No matching records found",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
}
}
24 changes: 24 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
}
22 changes: 22 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"sProcessing": "Traitement en cours...",
"sSearch": "Rechercher :",
"sLengthMenu": "Afficher _MENU_ éléments",
"sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément",
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
"sInfoPostFix": "",
"sLoadingRecords": "Chargement en cours...",
"sZeroRecords": "Aucun élément à afficher",
"sEmptyTable": "Aucune donnée disponible dans le tableau",
"oPaginate": {
"sFirst": "Premier",
"sPrevious": "Précédent",
"sNext": "Suivant",
"sLast": "Dernier"
},
"oAria": {
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
}
}
23 changes: 23 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-hu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"sEmptyTable": "Nincs rendelkezésre álló adat",
"sInfo": "Találatok: _START_ - _END_ Összesen: _TOTAL_",
"sInfoEmpty": "Nulla találat",
"sInfoFiltered": "(_MAX_ összes rekord közül szűrve)",
"sInfoPostFix": "",
"sInfoThousands": " ",
"sLengthMenu": "_MENU_ találat oldalanként",
"sLoadingRecords": "Betöltés...",
"sProcessing": "Feldolgozás...",
"sSearch": "Keresés:",
"sZeroRecords": "Nincs a keresésnek megfelelő találat",
"oPaginate": {
"sFirst": "Első",
"sPrevious": "Előző",
"sNext": "Következő",
"sLast": "Utolsó"
},
"oAria": {
"sSortAscending": ": aktiválja a növekvő rendezéshez",
"sSortDescending": ": aktiválja a csökkenő rendezéshez"
}
}
23 changes: 23 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"sEmptyTable": "Nessun dato presente nella tabella",
"sInfo": "Vista da _START_ a _END_ di _TOTAL_ elementi",
"sInfoEmpty": "Vista da 0 a 0 di 0 elementi",
"sInfoFiltered": "(filtrati da _MAX_ elementi totali)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "Visualizza _MENU_ elementi",
"sLoadingRecords": "Caricamento...",
"sProcessing": "Elaborazione...",
"sSearch": "Cerca:",
"sZeroRecords": "La ricerca non ha portato alcun risultato.",
"oPaginate": {
"sFirst": "Inizio",
"sPrevious": "Precedente",
"sNext": "Successivo",
"sLast": "Fine"
},
"oAria": {
"sSortAscending": ": attiva per ordinare la colonna in ordine crescente",
"sSortDescending": ": attiva per ordinare la colonna in ordine decrescente"
}
}
22 changes: 22 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"processing": "Przetwarzanie...",
"search": "Szukaj:",
"lengthMenu": "Pokaż _MENU_ pozycji",
"info": "Pozycje od _START_ do _END_ z _TOTAL_ łącznie",
"infoEmpty": "Pozycji 0 z 0 dostępnych",
"infoFiltered": "(filtrowanie spośród _MAX_ dostępnych pozycji)",
"infoPostFix": "",
"loadingRecords": "Wczytywanie...",
"zeroRecords": "Nie znaleziono pasujących pozycji",
"emptyTable": "Brak danych",
"paginate": {
"first": "Pierwsza",
"previous": "Poprzednia",
"next": "Następna",
"last": "Ostatnia"
},
"aria": {
"sortAscending": ": aktywuj, by posortować kolumnę rosnąco",
"sortDescending": ": aktywuj, by posortować kolumnę malejąco"
}
}
22 changes: 22 additions & 0 deletions gradleResources/jq/ui/i18n/dt/datatable-ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"processing": "Подождите...",
"search": "Поиск:",
"lengthMenu": "Показать _MENU_ записей",
"info": "Записи с _START_ до _END_ из _TOTAL_ записей",
"infoEmpty": "Записи с 0 до 0 из 0 записей",
"infoFiltered": "(отфильтровано из _MAX_ записей)",
"infoPostFix": "",
"loadingRecords": "Загрузка записей...",
"zeroRecords": "Записи отсутствуют.",
"emptyTable": "В таблице отсутствуют данные",
"paginate": {
"first": "Первая",
"previous": "Предыдущая",
"next": "Следующая",
"last": "Последняя"
},
"aria": {
"sortAscending": ": активировать для сортировки столбца по возрастанию",
"sortDescending": ": активировать для сортировки столбца по убыванию"
}
}
253 changes: 253 additions & 0 deletions gradleResources/js/datatables.min.js

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions src/main/java/net/bootsfaces/beans/BsfBeanInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package net.bootsfaces.beans;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import net.bootsfaces.component.tree.Tree;

/**
* Utility class that extends SimpleBeanInfo
* to manage automatic mapping of all properties and
* additional custom ones
*
* @author durzod
*
*/
public abstract class BsfBeanInfo
extends java.beans.SimpleBeanInfo {

/**
* Abstract method to manage custom property descriptor
* @return
*/
public abstract PropertyDescriptor[] getCustomPropertyDescriptor() throws IntrospectionException;

@Override
public PropertyDescriptor[] getPropertyDescriptors() {
// get properties from default property descriptors
List<PropertyDescriptor> pdl = new ArrayList<PropertyDescriptor>();
PropertyDescriptor rv[] = super.getPropertyDescriptors();
if(rv != null) {
pdl.addAll(Arrays.asList(rv));
}

try {
// if i have found nothing, i'm trying to get manually
if(pdl.size() <= 0) {
BeanInfo bi = Introspector.getBeanInfo(Tree.class, Introspector.IGNORE_ALL_BEANINFO);
PropertyDescriptor birv[] = bi.getPropertyDescriptors();
if(birv != null) {
pdl.addAll(Arrays.asList(birv));
}
}

// then add custom properties
PropertyDescriptor[] customPd = getCustomPropertyDescriptor();
if(customPd != null)
pdl.addAll(Arrays.asList(customPd));
} catch (IntrospectionException e) {
e.printStackTrace();
throw new Error(e.toString());
}

PropertyDescriptor[] array = new PropertyDescriptor[pdl.size()];
return pdl.toArray(array);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@

package net.bootsfaces.component.column;

import javax.faces.FacesException;
import javax.faces.component.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;

import net.bootsfaces.render.A;
import net.bootsfaces.render.CoreRenderer;
import net.bootsfaces.render.Tooltip;

Expand Down Expand Up @@ -103,6 +100,9 @@ public void encodeBegin(FacesContext context, UIComponent component) throws IOEx
sb.append("col-md-offset-" + offsmd);
}
}
if(colmd == 0) {
sb.append(" hidden-md");
}

if (colxs > 0) {
sb.append(" col-xs-").append(colxs);
Expand Down
38 changes: 37 additions & 1 deletion src/main/java/net/bootsfaces/component/dataTable/DataTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ protected enum PropertyKeys {
fixedHeader,
paginated,
pageLength,
pageLengthMenu
pageLengthMenu,
lang,
customLangUrl
;

String toString;
Expand Down Expand Up @@ -688,5 +690,39 @@ public String getPageLengthMenu() {
public void setPageLengthMenu(String _pageLengthMenu) {
getStateHelper().put(PropertyKeys.pageLengthMenu, _pageLengthMenu);
}

/**
* Configured lang for the dataTable. <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
*/
public String getLang() {
String value = (String)getStateHelper().eval(PropertyKeys.lang);
return value;
}

/**
* Configured lang for the dataTable. <P>
* Usually this method is called internally by the JSF engine.
*/
public void setLang(String _lang) {
getStateHelper().put(PropertyKeys.lang, _lang);
}

/**
* Here we can define a custom lang file url for non-integrated languages. <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
*/
public String getCustomLangUrl() {
String value = (String)getStateHelper().eval(PropertyKeys.customLangUrl);
return value;
}

/**
* Here we can define a custom lang file url for non-integrated languages. <P>
* Usually this method is called internally by the JSF engine.
*/
public void setCustomLangUrl(String _customLangUrl) {
getStateHelper().put(PropertyKeys.customLangUrl, _customLangUrl);
}
}

0 comments on commit 3963916

Please sign in to comment.