private static boolean validateCanInstantiate(final ElementMetaData metaData) { try { //noinspection UnusedDeclaration final Object type = metaData.create(); } catch (InstantiationException e) { logger.warn("Failed to instantiate ElementType"); return true; } return false; }
protected Element createElement( final ElementMetaData elementMetaData, final String fieldName, final ReportDocumentContext context) throws InstantiationException { final ElementType type = elementMetaData.create(); final IndexElement visualElement = new IndexElement(); visualElement.setAutoSort(Boolean.TRUE); visualElement .getRelationalGroup(0) .getHeader() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getRelationalGroup(0) .getFooter() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getDetailsFooter() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getDetailsHeader() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getNoDataBand() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getWatermark() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); type.configureDesignTimeDefaults(visualElement, Locale.getDefault()); final ElementStyleSheet styleSheet = visualElement.getStyle(); styleSheet.setStyleProperty(ElementStyleKeys.MIN_WIDTH, DEFAULT_WIDTH); styleSheet.setStyleProperty(ElementStyleKeys.MIN_HEIGHT, DEFAULT_HEIGHT); return visualElement; }
protected Element createElement( final ElementMetaData elementMetaData, final String fieldName, final ReportDocumentContext context) throws InstantiationException { // Create a crosstab element final ElementType type = elementMetaData.create(); final CrosstabElement visualElement = new CrosstabElement(); visualElement.setElementType(type); visualElement.setRootGroup(new CrosstabGroup()); // Hide all bands except for Details visualElement .getPageHeader() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getReportHeader() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getReportFooter() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getPageFooter() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); visualElement .getWatermark() .setAttribute( ReportDesignerParserModule.NAMESPACE, ReportDesignerParserModule.HIDE_IN_LAYOUT_GUI_ATTRIBUTE, Boolean.TRUE); type.configureDesignTimeDefaults(visualElement, Locale.getDefault()); final ElementStyleSheet styleSheet = visualElement.getStyle(); styleSheet.setStyleProperty(ElementStyleKeys.MIN_WIDTH, DEFAULT_WIDTH); styleSheet.setStyleProperty(ElementStyleKeys.MIN_HEIGHT, DEFAULT_HEIGHT); return visualElement; }