本文整理汇总了Java中ro.nextreports.engine.exporter.util.StyleFormatConstants类的典型用法代码示例。如果您正苦于以下问题:Java StyleFormatConstants类的具体用法?Java StyleFormatConstants怎么用?Java StyleFormatConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StyleFormatConstants类属于ro.nextreports.engine.exporter.util包,在下文中一共展示了StyleFormatConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCellBorder
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void buildCellBorder(Map<String, Object> format, Border border) {
if (border.getLeft() > 0) {
format.put(StyleFormatConstants.BORDER_LEFT, new Float(border.getLeft()));
}
if (border.getRight() > 0) {
format.put(StyleFormatConstants.BORDER_RIGHT, new Float(border.getRight()));
}
if (border.getTop() > 0) {
format.put(StyleFormatConstants.BORDER_TOP, new Float(border.getTop()));
}
if (border.getBottom() > 0) {
format.put(StyleFormatConstants.BORDER_BOTTOM, new Float(border.getBottom()));
}
format.put(StyleFormatConstants.BORDER_LEFT_COLOR, border.getLeftColor());
format.put(StyleFormatConstants.BORDER_RIGHT_COLOR, border.getRightColor());
format.put(StyleFormatConstants.BORDER_TOP_COLOR, border.getTopColor());
format.put(StyleFormatConstants.BORDER_BOTTOM_COLOR, border.getBottomColor());
}
示例2: buildCellFont
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void buildCellFont(Map<String, Object> format, Font font) {
format.put(StyleFormatConstants.FONT_FAMILY_KEY, font.getFamily());
format.put(StyleFormatConstants.FONT_NAME_KEY, font.getName());
format.put(StyleFormatConstants.FONT_SIZE, new Float(font.getSize()));
if (Font.PLAIN == font.getStyle()) {
format.put(StyleFormatConstants.FONT_STYLE_KEY, StyleFormatConstants.FONT_STYLE_NORMAL);
}
if (Font.BOLD == font.getStyle()) {
format.put(StyleFormatConstants.FONT_STYLE_KEY, StyleFormatConstants.FONT_STYLE_BOLD);
}
if (Font.ITALIC == font.getStyle()) {
format.put(StyleFormatConstants.FONT_STYLE_KEY, StyleFormatConstants.FONT_STYLE_ITALIC);
}
if ((Font.BOLD | Font.ITALIC) == font.getStyle()) {
format.put(StyleFormatConstants.FONT_STYLE_KEY, StyleFormatConstants.FONT_STYLE_BOLDITALIC);
}
}
示例3: getCategory
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
public int getCategory(String pattern) {
if (pattern == null) {
return 0;
} else {
if (pattern.equals(StyleFormatConstants.ROMAN_PATTERN)) {
return 1;
} else if (pattern.contains("dd") || pattern.contains("MM") || pattern.contains("yy")) {
return 2;
} else if (pattern.contains("HH") || pattern.contains("mm") || pattern.contains("ss")) {
return 3;
} else {
boolean isCurrency = false;
int index = pattern.indexOf("#");
if (index == -1) {
index = pattern.indexOf("0");
}
if (index != -1) {
String s = pattern.substring(0, index);
if (s.contains(" ")) {
isCurrency = true;
}
}
if (isCurrency) {
return 4;
} else if (pattern.contains("%") || pattern.contains("\u2030")) {
return 5;
} else if (pattern.contains("E")) {
return 6;
}
return 0;
}
}
}
示例4: renderCssCode
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private String renderCssCode(BandElement be, Object value, int gridRow, int gridColumn, int colSpan, boolean overwriteCellRenderCond) {
Map<String, Object> style = null;
style = buildCellStyleMap(be, value, gridRow, gridColumn, colSpan, overwriteCellRenderCond);
// to see a background image all cells must not have any background!
if (bean.getReportLayout().getBackgroundImage() != null) {
style.remove(StyleFormatConstants.BACKGROUND_COLOR);
}
return HtmlUtil.getCssCode(be, style);
}
示例5: onOpenDocument
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
/**
* Creates the PdfTemplate that will hold the total number of pages.
*/
public void onOpenDocument(PdfWriter writer, Document document) {
int size = 10;
if (totalPageNoVbe != null) {
Map<String, Object> style = buildCellStyleMap(totalPageNoVbe);
size = ((Float) style.get(StyleFormatConstants.FONT_SIZE)).intValue();
}
total = writer.getDirectContent().createTemplate(30, size);
}
示例6: onCloseDocument
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
/**
* Fills out the total number of pages before the document is closed.
*/
public void onCloseDocument(PdfWriter writer, Document document) {
totalPageNo = writer.getPageNumber() - 1;
if (totalPageNoVbe != null) {
Map<String, Object> style = buildCellStyleMap(totalPageNoVbe);
fontName = (String) style.get(StyleFormatConstants.FONT_NAME_KEY);
int size = ((Float) style.get(StyleFormatConstants.FONT_SIZE)).intValue();
Font fnt = getFont(size);
updateFont(style, fnt);
ColumnText.showTextAligned(total, Element.ALIGN_LEFT, new Phrase(String.valueOf(totalPageNo), fnt), 0, 1, 0);
}
}
示例7: setBackground
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void setBackground(Tc tableCell, Map<String, Object> style) {
// to see a background image all cells must not have any background!
if (bean.getReportLayout().getBackgroundImage() == null) {
if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
setCellColor(tableCell, ColorUtil.getHexColor(val).substring(1));
}
}
}
示例8: setVerticalAlignment
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void setVerticalAlignment(Tc tableCell, Map<String, Object> style) {
if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
if (StyleFormatConstants.VERTICAL_ALIGN_TOP.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
setVerticalAlignment(tableCell, STVerticalJc.TOP);
}
if (StyleFormatConstants.VERTICAL_ALIGN_MIDDLE.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
setVerticalAlignment(tableCell, STVerticalJc.CENTER);
}
if (StyleFormatConstants.VERTICAL_ALIGN_BOTTOM.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
setVerticalAlignment(tableCell, STVerticalJc.BOTTOM);
}
}
}
示例9: setHorizontalAlignment
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void setHorizontalAlignment(P paragraph, Map<String, Object> style) {
if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
if (StyleFormatConstants.HORIZONTAL_ALIGN_LEFT.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
setHorizontalAlignment(paragraph, JcEnumeration.LEFT);
}
if (StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
setHorizontalAlignment(paragraph, JcEnumeration.RIGHT);
}
if (StyleFormatConstants.HORIZONTAL_ALIGN_CENTER.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
setHorizontalAlignment(paragraph, JcEnumeration.CENTER);
}
}
}
示例10: buildCellHAllign
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void buildCellHAllign(Map<String, Object> format, int hAllign) {
if (SwingConstants.CENTER == hAllign) {
format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_CENTER);
}
if (SwingConstants.LEFT == hAllign) {
format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_LEFT);
}
if (SwingConstants.RIGHT == hAllign) {
format.put(StyleFormatConstants.HORIZONTAL_ALIGN_KEY, StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT);
}
}
示例11: buildCellVAllign
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void buildCellVAllign(Map<String, Object> format, int vAllign) {
if (SwingConstants.CENTER == vAllign) {
format.put(StyleFormatConstants.VERTICAL_ALIGN_KEY, StyleFormatConstants.VERTICAL_ALIGN_MIDDLE);
}
if (SwingConstants.TOP == vAllign) {
format.put(StyleFormatConstants.VERTICAL_ALIGN_KEY, StyleFormatConstants.VERTICAL_ALIGN_TOP);
}
if (SwingConstants.BOTTOM == vAllign) {
format.put(StyleFormatConstants.VERTICAL_ALIGN_KEY, StyleFormatConstants.VERTICAL_ALIGN_BOTTOM);
}
}
示例12: setCellStyle
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void setCellStyle(Item cellItem, IModel rowModel, int rowIndex) {
List<Map<String, Object>> styles = ((RowData)rowModel.getObject()).getStyles();
if (styles.size() > rowIndex) {
Map<String, Object> style = styles.get(rowIndex);
boolean needed = setIframeStyleParameters(style);
Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR);
if ((val != null) || (iframeFontSize != null)) {
String text = HtmlUtil.getCssCode(null, style, needed);
cellItem.add(new AttributeAppender("style", Model.of(text)));
}
}
}
示例13: setIframeStyleParameters
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private boolean setIframeStyleParameters(Map<String, Object> style) {
boolean needed = false;
if (iframeFontSize != null) {
style.put(StyleFormatConstants.FONT_SIZE, Float.parseFloat(iframeFontSize));
if (iframeCellPadding != null) {
Float padding = Float.parseFloat(iframeCellPadding);
style.put(StyleFormatConstants.PADDING_LEFT, padding);
style.put(StyleFormatConstants.PADDING_RIGHT, padding);
style.put(StyleFormatConstants.PADDING_TOP, padding);
style.put(StyleFormatConstants.PADDING_BOTTOM, padding);
}
needed = true;
}
return needed;
}
示例14: setCellStyle
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
private void setCellStyle(Item cellItem, IModel rowModel, int rowIndex) {
List<Map<String, Object>> styles = ((AnalysisRow)rowModel.getObject()).getStyles();
if (styles.size() > rowIndex) {
Map<String, Object> style = styles.get(rowIndex);
Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR);
if (val != null) {
String text = HtmlUtil.getCssCode(null, style, false);
cellItem.add(new AttributeAppender("style", Model.of(text)));
}
}
}
示例15: exportCell
import ro.nextreports.engine.exporter.util.StyleFormatConstants; //导入依赖的package包/类
protected void exportCell(String bandName, BandElement bandElement, Object value, int gridRow, int row, int column, int cols,
int rowSpan, int colSpan, boolean isImage) {
int headerRows = getHeaderRows();
int detailRows = getDetailRows();
Map<String, Object> style = buildCellStyleMap(bandElement, value, gridRow, column, colSpan);
if (ReportLayout.HEADER_BAND_NAME.equals(bandName)) {
if (headerRows == 1) {
if (row == 0) {
switch (column) {
case 0:
data.setTitle(replaceParameters(getBandElementValueAsString(bandElement)));
if (bandElement.getHorizontalAlign() == BandElement.CENTER) {
data.setTitleAlignment(DisplayData.TITLE_ALIGNMENT_CENTER);
} else {
data.setTitleAlignment(DisplayData.TITLE_ALIGNMENT_VALUE);
}
data.setBackground(ColorUtil.getHexColor(bandElement.getBackground()));
if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
data.setBackground(ColorUtil.getHexColor((Color) style.get(StyleFormatConstants.BACKGROUND_COLOR)));
}
data.setTitleColor(ColorUtil.getHexColor(bandElement.getForeground()));
if (style.containsKey(StyleFormatConstants.FONT_COLOR)) {
data.setTitleColor(ColorUtil.getHexColor((Color) style.get(StyleFormatConstants.FONT_COLOR)));
}
break;
case 1:
data.setShouldRise(Boolean.parseBoolean(bandElement.getText()));
break;
case 2:
data.setShadow(Boolean.parseBoolean(bandElement.getText()));
break;
}
}
}
} else if (ReportLayout.DETAIL_BAND_NAME.equals(bandName)) {
if (detailRows == 1) {
if (column == 0) {
data.setValueColor(ColorUtil.getHexColor(bandElement.getForeground()));
if (style.containsKey(StyleFormatConstants.FONT_COLOR)) {
data.setValueColor(ColorUtil.getHexColor((Color) style.get(StyleFormatConstants.FONT_COLOR)));
}
data.setValue(StringUtil.getValueAsString(value, ((ColumnBandElement)bandElement).getPattern()));
for (Alert alert : alerts) {
if (isAlert(alert, value)) {
executeAlert(alert, value, "");
}
}
} else if (column == 1) {
data.setPreviousColor(ColorUtil.getHexColor(bandElement.getForeground()));
if (style.containsKey(StyleFormatConstants.FONT_COLOR)) {
data.setPreviousColor(ColorUtil.getHexColor((Color) style.get(StyleFormatConstants.FONT_COLOR)));
}
data.setPrevious(StringUtil.getValueAsString(value, ((ColumnBandElement)bandElement).getPattern()));
} else if (column == 2) {
data.setUp((Boolean)value);
} else if (column == 3) {
String prev = getBandElementValueAsString(bandElement);
if ((prev != null) && !prev.endsWith("%")) {
prev = prev + "%";
}
data.setPrevious(prev);
}
}
return;
}
}