Build the crosstab. Throws LayoutException if anything is wrong
@return
961846
public DJCrosstab build(){
		if (crosstab.getMeasures().isEmpty()){
			throw new LayoutException("Crosstabs must have at least one measure");
		}
		if (crosstab.getColumns().isEmpty()){
			throw new LayoutException("Crosstabs must have at least one column");
		}
		if (crosstab.getRows().isEmpty()){
			throw new LayoutException("Crosstabs must have at least one row");
		}
		
		
		//Ensure default dimension values
		for (DJCrosstabColumn col : crosstab.getColumns()) {
			if (col.getWidth() == -1 && cellWidth != -1)
				col.setWidth(cellWidth);

			if (col.getWidth() == -1 )
				col.setWidth(DEFAULT_CELL_WIDTH);

			if (col.getHeaderHeight() == -1 && columnHeaderHeight != -1)
				col.setHeaderHeight(columnHeaderHeight);

			if (col.getHeaderHeight() == -1)
				col.setHeaderHeight(DEFAULT_COLUMN_HEADER_HEIGHT);
		}

		for (DJCrosstabRow row : crosstab.getRows()) {
			if (row.getHeight() == -1 && cellHeight != -1)
				row.setHeight(cellHeight);

			if (row.getHeight() == -1 )
				row.setHeight(DEFAULT_CELL_HEIGHT);

			if (row.getHeaderWidth() == -1 && rowHeaderWidth != -1)
				row.setHeaderWidth(rowHeaderWidth);

			if (row.getHeaderWidth() == -1)
				row.setHeaderWidth(DEFAULT_ROW_HEADER_WIDTH);

		}
		return crosstab;
	}
814306
public CrosstabBuilder addRow(String title, String property, String className, boolean showTotal,
			Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
		DJCrosstabRow row = new CrosstabRowBuilder()
		.setProperty(property,className)
		.setShowTotals(showTotal)
		.setTitle(title)
		.setHeaderStyle(headerStyle)
		.setTotalHeaderStyle(totalHeaderStyle)
		.setTotalStyle(totalStyle)
		.build();
		addRow(row);
		return this;
	}
11750
private void showTab() {
		if (parentTab != null) {
			tab = parentTab.getTab(this);
			if (tab != null) {
				// FIXME: this should be added by the constructor or by the panel that adds this
				// tab
				// tab.getComponent().addStyleName("example-queries-tab");
				tab.setEnabled(true);

				if (!(parentTab.getSelectedTab() instanceof ResultViewPanel)) {
					parentTab.setSelectedTab(tab);
				}
			}
		}

	}
1330601
public CrosstabBuilder setColumnStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
		crosstab.setColumnHeaderStyle(headerStyle);
		crosstab.setColumnTotalheaderStyle(totalHeaderStyle);
		crosstab.setColumnTotalStyle(totalStyle);
		return this;
	}
718200
@Override
	public PageSection build() {
		final PageSectionStyle style = new PageSectionStyle(this.marginsBuilder.build(),
				this.minHeight);
		final PageSectionContent header = new SimpleFooterHeader(
				this.curRegionBox.get());
		return new PageSection(header, style);
	}
662724
public GraphHopperStorage build() {
        Directory dir = mmap ?
                new MMapDirectory(location) :
                new RAMDirectory(location, store);

        GraphExtension graphExtension = encodingManager.needsTurnCostsSupport() ?
                new TurnCostExtension() :
                new TurnCostExtension.NoOpExtension();

        return singleCHWeighting == null ?
                new GraphHopperStorage(dir, encodingManager, elevation, graphExtension) :
                edgeBasedCH ?
                        new GraphHopperStorage(Collections.<Weighting>emptyList(), Arrays.asList(singleCHWeighting), dir, encodingManager, elevation, graphExtension) :
                        new GraphHopperStorage(Arrays.asList(singleCHWeighting), Collections.<Weighting>emptyList(), dir, encodingManager, elevation, graphExtension);
    }
1173768
function BuildLayout(layoutObject) {
    let finishedLayout = {
        start: "",
        end: "",
    };

    if (layoutObject) {
        const layout = new Layout(layoutObject.template);
        finishedLayout.start = `${layout.html.start}<head>${layoutObject.head}<style>${layoutObject.css}</style></head>${layout.body.start}${layout.template.start}`;
        finishedLayout.end = `${layout.template.end}${BuildScript(layoutObject.script)}${layout.body.end}${layout.html.end}`;
    } else {
        throw new Error("Missing Layout Object");
    }

    return finishedLayout;
}
178137
public ConcatVectorTableProto.ConcatVectorTable.Builder getProtoBuilder() {
        ConcatVectorTableProto.ConcatVectorTable.Builder b = ConcatVectorTableProto.ConcatVectorTable.newBuilder();
        for (int n : getDimensions()) {
            b.addDimensionSize(n);
        }
        for (int[] assignment : this) {
            b.addFactorTable(getAssignmentValue(assignment).get().getProtoBuilder());
        }
        return b;
    }
1084944
public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
		crosstab.setRowHeaderStyle(headerStyle);
		crosstab.setRowTotalheaderStyle(totalHeaderStyle);
		crosstab.setRowTotalStyle(totalStyle);
		return this;
	}
876025
protected void layoutGroupCrosstabs(DJGroup columnsGroup,	JRDesignGroup jgroup) {
		for (DJCrosstab djcross : columnsGroup.getHeaderCrosstabs()) {
			Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();

			JRDesignCrosstab crosst = djcb.createCrosstab(djcross, this);
			JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupHeaderSection());
			if (djcross.getBottomSpace() != 0) {
				JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
				LayoutUtils.moveBandsElemnts(rect.getHeight(), band);
				band.addElement(rect);
			}

			LayoutUtils.moveBandsElemnts(crosst.getHeight(), band);
			band.addElement(crosst);
			DJLabel caption = djcross.getCaption();
			if (caption != null) {
				JRDesignExpression captExp;
				if (caption.isJasperExpression()) //a text with things like "$F{myField}"
					captExp = ExpressionUtils.createStringExpression(caption.getText());
				else if (caption.getLabelExpression() != null) {
					String name = "expression_for_label_at_header_of_group[" + getReport().getColumnsGroups().indexOf(columnsGroup) + "]_crosstab[" + columnsGroup.getHeaderCrosstabs().indexOf(djcross) + "]";
					LayoutUtils.registerCustomExpressionParameter((DynamicJasperDesign) getDesign(), name, caption.getLabelExpression());
					String invocationText = ExpressionUtils.createCustomExpressionInvocationText(caption.getLabelExpression(), name, false);
					captExp = ExpressionUtils.createExpression(invocationText, caption.getLabelExpression().getClassName());
					log.debug(invocationText);
				} else //a simple text
					captExp = ExpressionUtils.createStringExpression("\"" + Utils.escapeTextForExpression(caption.getText()) + "\"");

				JRDesignTextField captTf = new JRDesignTextField();
				captTf.setExpression(captExp);
				captTf.setHeight(caption.getHeight());
				captTf.setWidth(getReport().getOptions().getPrintableWidth());
				LayoutUtils.moveBandsElemnts(caption.getHeight(), band);
				band.addElement(captTf);
			}

			if (djcross.getTopSpace() != 0) {
				LayoutUtils.moveBandsElemnts(djcross.getTopSpace(), band);
				JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), 0);
				band.addElement(rect);
			}
		}

		for (DJCrosstab djcross : columnsGroup.getFooterCrosstabs()) {
			Dj2JrCrosstabBuilder djcb = new Dj2JrCrosstabBuilder();

			JRDesignCrosstab crosst = djcb.createCrosstab(djcross, this);
			JRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());
			int yOffset = LayoutUtils.findVerticalOffset(band);
			if (djcross.getTopSpace() != 0) {
//				moveBandsElemnts(djcross.getTopSpace(), band);
				JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), yOffset);
				rect.setPositionType(PositionTypeEnum.FIX_RELATIVE_TO_TOP);
				band.addElement(rect);
				crosst.setY(rect.getY() + rect.getHeight());
			}

			band.addElement(crosst);

			if (djcross.getBottomSpace() != 0) {
				JRDesignRectangle rect = createBlankRectableCrosstab(djcross.getBottomSpace(), crosst.getY() + crosst.getHeight());
				band.addElement(rect);
			}
		}


	}
551666
public CmsContainerPageBean build() {

        List<CmsContainerBean> containers = Lists.newArrayList();
        for (String containerName : m_containerInfos.keySet()) {
            CmsContainerBean containerBean = buildContainerBean(m_containerInfos.get(containerName));
            containers.add(containerBean);
        }
        return new CmsContainerPageBean(containers);
    }
39793
public Canvas getViewPanel() {
		VLayout layout = new VLayout(5);
		layout.setPadding(5);

		MapWidget mapWidget = new MapWidget("mapGuwOsm", "appGuw");
		final RibbonBarLayout ribbonBar = new RibbonBarLayout(mapWidget, "appGuw", "guwRibbonBar1");
		ribbonBar.setSize("100%", "94px");

		ToolStrip toolStrip = new ToolStrip();
		toolStrip.setWidth100();
		ToolStripButton btn1 = new ToolStripButton("Toggle group title");
		btn1.addClickHandler(new ClickHandler() {

			public void onClick(ClickEvent event) {
				ribbonBar.setShowGroupTitles(!ribbonBar.isShowGroupTitles());
			}
		});
		toolStrip.addButton(btn1);
		layout.addMember(toolStrip);
		layout.addMember(ribbonBar);
		layout.addMember(mapWidget);
		return layout;
	}
1241152
protected TextView createDefaultTabView(Context context) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
        textView.setTypeface(Typeface.DEFAULT_BOLD);
        textView.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

        TypedValue outValue = new TypedValue();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                    outValue, true);
        }

        textView.setBackgroundResource(outValue.resourceId);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            textView.setAllCaps(true);
        }

        int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
        textView.setPadding(padding, padding, padding, padding);

        return textView;
    }
355109
private Table buildRtfTable(int type) throws DocumentException {
		List<Band> bands = new ArrayList<Band>();
		if (type == 1) {
			bands.add(getReportLayout().getPageHeaderBand());
		} else if (type == 2) {
			bands.add(getReportLayout().getPageFooterBand());
		} else {
			bands = getReportLayout().getDocumentBands();
		}
		int totalRows = 0;
		int totalColumns = 0;
		for (Band band : bands) {
			totalRows += band.getRowCount();
			int cols = band.getColumnCount();
			if (cols > totalColumns) {
				totalColumns = cols;
			}
		}

		// no page header or no page footer
		if (totalColumns == 0) {
			return null;
		}
		Table datatable = new Table(totalColumns);
		int[] headerwidths = new int[totalColumns]; // %
		int size = 100 / totalColumns;
		int totalWidth = 0;
		for (int i = 0; i < totalColumns; i++) {
			if (bean.getReportLayout().isUseSize()) {
				headerwidths[i] = bean.getReportLayout().getColumnsWidth().get(i);
			} else {
				headerwidths[i] = size;
			}
			totalWidth += headerwidths[i];
		}

		if (bean.getReportLayout().isUseSize()) {
			float pixels = A4_PORTRAIT_PIXELS;
			if (bean.getReportLayout().getOrientation() == LANDSCAPE) {
				pixels = A4_LANDSCAPE_PIXELS;
			}
			float percentage = totalWidth * 100 / pixels;
			// do not allow to go outside an A4 frame
			if (percentage > 100) {
				percentage = 100;
			}
			if (!ReportLayout.CUSTOM.equals(bean.getReportLayout().getPageFormat())) {
				datatable.setWidth(percentage);
			}
			datatable.setWidths(headerwidths);
		} else {
			datatable.setWidth(100);
		}

		datatable.setPadding(2);
		if (type == PRINT_DOCUMENT) {
			writeHeader(datatable);
		}
		return datatable;
	}
417229
protected JComponent createViewMenuBar() {
    	if(getPageComponent() instanceof AbstractEditor){
    		AbstractEditor editor = (AbstractEditor)getPageComponent();
    		return editor.getEditorMenuBar();
    	}
    	return null;
    }
55615
@NonNull protected Integer getTabsLayoutRes() {
    return com.christianbahl.appkit.core.R.id.tabs;
  }
746820
protected TableMetaReader createTableMetaReader() {
    return globalFactory.createTableMetaReader(
        dialect, dataSource, schemaName, tableNamePattern, ignoredTableNamePattern, tableTypes);
  }