Search in sources :

Example 1 with GridView

use of com.axelor.meta.schema.views.GridView in project axelor-open-suite by axelor.

the class ReportBuilderService method createTable.

/**
 * Process panelRelated to find right grid view of reference model. Grid view used to create html
 * table.
 *
 * @param panelRelated PanelRelated to use.
 * @param refModel Name of model refer by panelRelated.
 * @return Html table string created.
 */
private String createTable(PanelRelated panelRelated, String refModel) {
    List<AbstractWidget> items = panelRelated.getItems();
    if (items != null && !items.isEmpty()) {
        return getHtmlTable(panelRelated.getName(), items, refModel);
    }
    MetaView gridView = findGridView(panelRelated.getGridView(), refModel);
    if (gridView != null) {
        try {
            ObjectViews views = XMLViews.fromXML(gridView.getXml());
            GridView grid = (GridView) views.getViews().get(0);
            return getHtmlTable(panelRelated.getName(), grid.getItems(), refModel);
        } catch (JAXBException e) {
            e.printStackTrace();
        }
    }
    return "";
}
Also used : JAXBException(javax.xml.bind.JAXBException) AbstractWidget(com.axelor.meta.schema.views.AbstractWidget) ObjectViews(com.axelor.meta.schema.ObjectViews) MetaView(com.axelor.meta.db.MetaView) GridView(com.axelor.meta.schema.views.GridView)

Aggregations

MetaView (com.axelor.meta.db.MetaView)1 ObjectViews (com.axelor.meta.schema.ObjectViews)1 AbstractWidget (com.axelor.meta.schema.views.AbstractWidget)1 GridView (com.axelor.meta.schema.views.GridView)1 JAXBException (javax.xml.bind.JAXBException)1