本文整理汇总了Java中org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType类的典型用法代码示例。如果您正苦于以下问题:Java CellBordersType类的具体用法?Java CellBordersType怎么用?Java CellBordersType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CellBordersType类属于org.odftoolkit.simple.style.StyleTypeDefinitions包,在下文中一共展示了CellBordersType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastBorderSourceType
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
/**
* Gets the <code>CellBordersType</code> matching a string representation. Only a subset of the CellBorderTypes are
* contemplated since this method is used for those that are compatible with the <code>LastBorderSource</code> parameter.
* The allowed representations include the standard ones accepted by valueOf and shorthands to be used to match table
* parameters in the template.
*
* @param string the string representation of the CellBordersType to be obtained
* @return the <code>CellBordersType</code> matching the given string or null if there is no match.
* @throws NullPointerException if the provided string is null.
*/
private static CellBordersType getLastBorderSourceType(String string) {
try {
CellBordersType type = CellBordersType.valueOf(string.toUpperCase());
if (type == CellBordersType.LEFT || type == CellBordersType.RIGHT || type == CellBordersType.BOTTOM
|| type == CellBordersType.TOP) {
return type;
} else {
return null;
}
} catch (IllegalArgumentException re) {
switch (string) {
case "l":
return CellBordersType.LEFT;
case "r":
return CellBordersType.RIGHT;
case "b":
return CellBordersType.BOTTOM;
case "t":
return CellBordersType.TOP;
default:
return null;
}
}
}
示例2: invisibleBorders
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
private void invisibleBorders( Table table ) {
for( int i=0; i<table.getRowCount(); i++ ) {
for( int j=0; j<table.getColumnCount(); j++ ) {
table.getRowByIndex( i ).getCellByIndex( j ).setBorders( CellBordersType.NONE, null );
}
}
}
示例3: putHeader
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
public static Cell putHeader(final Row row, int cellIndex, String header) {
Cell cell = row.getCellByIndex(cellIndex);
cell.setStringValue(header);
cell.setBorders(CellBordersType.ALL_FOUR, getBlackBorder());
cell.setCellBackgroundColor(ExportConstants.CALC_COL_GRAY10);
cell.setFont(getBoldFont(10));
cell.setVerticalAlignment(ExportConstants.ALIGN_VER_MIDDLE);
cell.setHorizontalAlignment(ExportConstants.ALIGH_HOR_CENTER);
cell.setTextWrapped(true);
return cell;
}
示例4: putHeader
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
private void putHeader(int cellIndex, String header) {
cell = row.getCellByIndex(cellIndex);
cell.setStringValue(header);
cell.setBorders(CellBordersType.ALL_FOUR, getBorder());
cell.setCellBackgroundColor(gray);
cell.setFont(getBoldFont(10));
cell.setVerticalAlignment(ExportConstants.ALIGN_VER_MIDDLE);
cell.setHorizontalAlignment(ExportConstants.ALIGH_HOR_CENTER);
cell.setTextWrapped(true);
}
示例5: readInto
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
/**
* Reads a parameter string representation and sets its matching parameter in a {@link TableConfiguration} instance. The
* parameter strings are case-insensitive.
*
* @param parameter the parameter string representation to be read.
* @param tableConfig the TableConfiguration instance to be affected.
* @throws {@link UnknownParameterTypeException} if the given string fulfills the generic parameter restrictions but not a
* specific parameter type.
* @throws {@link IllegalTableParameterRepresentationException} if the given string does not fulfill the generic parameter
* restrictions.
*/
public static void readInto(String parameter, TableConfiguration tableConfig) throws UnknownParameterTypeException,
IllegalTableParameterRepresentationException {
parameter = parameter.toLowerCase();
Matcher matcher = null;
if ((matcher = ParameterType.HEADER.getMatcher(parameter)).find()) {
tableConfig.header =
matcher.group(1) != null ? new TableCoordinate() : new TableCoordinate(
Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)));
} else if ((matcher = ParameterType.CONTENT_STRUCTURE.getMatcher(parameter)).find()) {
tableConfig.contentStructure =
matcher.group(1) != null ? ContentStructure.POSITIONAL : ContentStructure.CATEGORICAL;
} else if ((matcher = ParameterType.FILL_BEHAVIOR.getMatcher(parameter)).find()) {
tableConfig.fillBehavior =
matcher.group(1) != null ? FillBehavior.SKIP : matcher.group(2) != null ? FillBehavior.STEP : FillBehavior.WRITE;
} else if ((matcher = ParameterType.WRITE_BEHAVIOR.getMatcher(parameter)).find()) {
tableConfig.writeBehavior =
matcher.group(1) != null ? WriteBehavior.APPEND : matcher.group(2) != null ? WriteBehavior.PREPEND : WriteBehavior.OVERWRITE;
} else if ((matcher = ParameterType.CONTENT_DIRECTION.getMatcher(parameter)).find()) {
tableConfig.contentDirection = matcher.group(1) != null ? ContentDirection.VERTICAL : ContentDirection.HORIZONTAL;
} else if ((matcher = ParameterType.STYLE_SOURCE.getMatcher(parameter)).find()) {
if (matcher.group(4) != null && matcher.group(5) != null) {
int col = Integer.parseInt(matcher.group(4));
int row = Integer.parseInt(matcher.group(5));
if (row == 0 && col == 0) {
// Style source (0,0) is the same as prestyled
tableConfig.styleRelativeCoord = null;
} else {
tableConfig.styleRelativeCoord = new TableCoordinate(col, row);
}
} else {
tableConfig.styleRelativeCoord =
matcher.group(2) != null ? new TableCoordinate(0, 1) : matcher.group(3) != null ? new TableCoordinate(
1, 0) : null;
}
} else if ((matcher = ParameterType.LAST_BORDER.getMatcher(parameter)).find()) {
if (matcher.group(4) != null) {
tableConfig.lastBorderSourceSection = LastBorderSourceSection.NONE;
} else if (matcher.group(2) != null) {
tableConfig.lastBorderSourceSection = LastBorderSourceSection.getLastBorderSourceSection(matcher.group(2));
tableConfig.lastBorderSourceType = LastBorderSourceSection.getLastBorderSourceType(matcher.group(3));
} else {
tableConfig.lastBorderSourceSection = LastBorderSourceSection.HEADER;
tableConfig.lastBorderSourceType = CellBordersType.BOTTOM;
}
} else if ((ParameterType.GENERIC.getMatcher(parameter)).find()) {
throw new UnknownParameterTypeException(parameter);
} else {
throw new IllegalTableParameterRepresentationException(parameter);
}
}
示例6: collectLastBorder
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
private static Border collectLastBorder(Table table, int hCol, int hRow, LastBorderSourceSection lastBorderOrigin,
CellBordersType lastBorderOriginType) {
Border border = null;
if (lastBorderOrigin != null) {
border = Border.NONE;
switch (lastBorderOrigin) {
case HEADER:
switch (lastBorderOriginType) {
case LEFT:
case TOP:
border = table.getCellByPosition(0, 0).getBorder(lastBorderOriginType);
break;
case RIGHT:
case BOTTOM:
if (hCol != 0 && hRow != 0) {
border = null;
} else {
border =
table.getCellByPosition((hCol != 0 ? hCol : table.getColumnCount()) - 1,
(hRow != 0 ? hRow : table.getRowCount()) - 1).getBorder(lastBorderOriginType);
}
break;
default:
break;
}
break;
case BODY:
switch (lastBorderOriginType) {
case LEFT:
case TOP:
border = table.getCellByPosition(hCol, hRow).getBorder(lastBorderOriginType);
break;
case RIGHT:
case BOTTOM:
border =
table.getCellByPosition(table.getColumnCount() - 1, table.getRowCount() - 1).getBorder(
lastBorderOriginType);
break;
default:
break;
}
break;
default:
break;
}
}
return border;
}
示例7: putIndicators
import org.odftoolkit.simple.style.StyleTypeDefinitions.CellBordersType; //导入依赖的package包/类
private int putIndicators(final Set<Indicator> indicators, int rowIndex, boolean mergeCodeCells) throws Throwable {
if (indicators.size() > 0) {
int startIndex = rowIndex;
for (final Indicator indicator : indicators) {
if (data.isIndicatorsSheetExist()) {
cell = createBasicCell(5, rowIndex, null);
CalcUtils.applyLink(cell, indicator.getName(), ExportConstants.INDICATOR_SHEET_PREFIX + indicator.getName());
} else {
cell = createBasicCell(5, rowIndex, data.getDetailedIndicatorName(indicator.getId()));
}
cell = createBasicCell(6, rowIndex, indicator.getSourceOfVerification());
rowIndex++;
}
rowIndex--;
for (int i = startIndex; i <= rowIndex; i++) {
cell = cellRange.getCellByPosition(7, i);
cell.setBorders(CellBordersType.RIGHT, getBorder());
}
if (mergeCodeCells) {
cellRange = table.getCellRangeByPosition(2, startIndex, 3, rowIndex);
cellRange.merge();
} else {
cellRange = table.getCellRangeByPosition(2, startIndex, 2, rowIndex);
cellRange.merge();
cellRange = table.getCellRangeByPosition(3, startIndex, 3, rowIndex);
cellRange.merge();
}
cellRange = table.getCellRangeByPosition(4, startIndex, 4, rowIndex);
cellRange.merge();
cellRange = table.getCellRangeByPosition(7, startIndex, 7, rowIndex);
cellRange.merge();
} else {
cell = createBasicCell(5, rowIndex, null);
cell = createBasicCell(6, rowIndex, null);
if (mergeCodeCells) {
cellRange = table.getCellRangeByPosition(2, rowIndex, 3, rowIndex);
cellRange.merge();
} else {
cellRange = table.getCellRangeByPosition(2, rowIndex, 2, rowIndex);
cellRange.merge();
cellRange = table.getCellRangeByPosition(3, rowIndex, 3, rowIndex);
cellRange.merge();
}
}
return rowIndex;
}