JDAL Swing Spring Namespace
Since the version 1.2.1 JDAL Swing supports Spring custom namespace with the intenction of simplify the configuration of the context.
The namespace http://www.jdal.org/schema/swing defines the following elements:
- defaults define the beans necessary to use JDAL with default values.
- table simplify the definition of TablePanels y PageableTables
- column simplify the definition of coumns in the tables paginables.
Defaults
The element defaults doesnt have attributes and declares the following beans:
- paginatorView paginator for pageable tables
- controlAccessorFactory default implementation of ControlAccessorFactory
- binderFactory default implementation of BinderFactroy
- customEditorConfigurer CustomEditorConfiguer declaring the PropertyEditors necessary to assign icons from the configuration of the context.
- defaultTableActions list with the actions of the pageable table by defect.
- defaultGuiFactory GuiFactory by defect for as pageable tables
- controlInitilizer ControlInitializer by defect that use the implementationes of AbstractView.
Table
The table elemenent simplifies pageable table definition. Assume the following conventión of names in the beans defined in the context of the application.
It's to say that the beans related with the entity of the name simple Entity are named using the following suffixes:
- table for TablePanel
- PageableTable for PageableTable
- FilterView for filter view
- Service for PersistentService
- Editor for editors.
Attributes
- entity mantatory, defines the entity that will be displayed in the table.
- paginator optional , by defect defaultPaginator.
- datasource optional, by defect entityService.
- editor optional, by defect entityEditor.
- actions optional, by defect defaultActions.
- filter optional, by defect entityFilter.
- filterView optional, by defect entityFilterView
- tableService optional. reference the bean that implements TableService to make persistent the table configuration.
Sub-elements
The table element admits an indeterminable number of column elements to define each one of the columns of the table.
Column
The column element is used for the definition of the columns in the table element or has sub-elements and admits the following elements:
- name obligatory, name of the property of the la entity that is shown in the column.
- displayName optional, name that is shown in the heading of the column. Internationalization codes can be used. The codes can be resolved through the bean MessageSource defined in the context.
- editable opcional, true if column cells are editable.
- sortProperty optional, name the property used to order the column. PropertyPaths can be used. By defect the value defined in name.
- width optional, permits assign a size in pixels to the column.
- renderer optional, TableCellRenderer that is used to draw the cells of the column.
- editor optional, TableCellEditor that is used to edit content of the cells.
- class optional, type of element that is shown in the column.
Namespace Declaration
To use the namespace, need to declare it in the beans element in a similar way to the rest of the Spring namespaces.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:swing="http://www.jdal.org/schema/swing" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.jdal.org/schema/swing http://www.jdal.org/schema/jdal/jdal-swing.xsd" default-init-method="init"> <swing:defaults /> <!-- Project --> <swing:table entity="info.joseluismartin.gefa.model.Project" tableService="tableService" > <swing:columns> <swing:column name="name" displayName="Name" /> <swing:column name="customer" displayName="Customer" /> <swing:column name="bid" displayName="Bid" /> <swing:column name="description" displayName="Description" /> <swing:column name="amount" displayName="Amount" /> </swing:columns> </swing:table> </beans>
th_footer(); ?>