private void initCode() { code = table.getCell(column, row).getStringValue(); if (code == null) { code = ""; } }
public static boolean isDefault(ICell cell) { // Type name and field name can't be blank or start with number but default value can. String value = cell.getStringValue(); if (StringUtils.isBlank(value)) { return true; } char firstChar = value.charAt(0); return '0' <= firstChar && firstChar <= '9'; }
public static boolean isFormula(ILogicalTable valuesTable) { String stringValue = valuesTable.getSource().getCell(0, 0).getStringValue(); if (stringValue != null) { stringValue = stringValue.trim(); return stringValue.startsWith("="); } return false; }
private ICellEditor defaultEditor(ICell cell) { final String cellValue = cell.getStringValue(); return cellValue != null && cellValue.indexOf('\n') >= 0 ? factory.makeMultilineEditor() : factory.makeTextEditor(); }
private ICellEditor defaultEditor(ICell cell) { final String cellValue = cell.getStringValue(); return cellValue != null && cellValue.indexOf('\n') >= 0 ? factory.makeMultilineEditor() : factory.makeTextEditor(); }
private boolean isEmptyRow(IGridTable row) { int width = row.getWidth(); for (int i = 0; i < width; i++) { if (row.getCell(i, 0).getStringValue() != null) { return false; } } return true; }
public String getTableName() { String header = table.getGridTable().getCell(0, 0).getStringValue(); String tableName = (header == null) ? "" : header; return tableName; }
private boolean isEmptyRow(IGridTable row) { int width = row.getWidth(); for (int i = 0; i < width; i++) { if (row.getCell(i, 0).getStringValue() != null) { return false; } } return true; }
@Override public boolean isEmpty(int col, int row) { ICell cell = getCell(col, row); return cell == null || StringUtils.isBlank(cell.getStringValue()); }
private String getHeaderStr(int row, ILogicalTable table) { String headerStr = table.getRow(row) .getSource() .getCell(IDecisionTableConstants.INFO_COLUMN_INDEX, 0) .getStringValue(); if (headerStr == null) { return ""; } return headerStr.toUpperCase(); }
public static int calculateHeight(ILogicalTable table) { int height = table.getHeight(); int last = -1; for (int i = 0; i < height; i++) { String source = table.getRow(i).getSource().getCell(0, 0).getStringValue(); if (source != null && source.trim().length() != 0) { last = i; } } return last + 1; }
private int getWidthWithIgnoredEmptyCells(IGridTable table) { int width = table.getWidth(); while (width > 0) { for (int i = 0; i < table.getHeight(); i++) { if (table.getCell(width - 1, 0).getStringValue() != null) { return width; } } width--; } return 0; }
public static String[] extractElementsFromCommaSeparatedArray(ILogicalTable cell) { String[] tokens = null; String src = cell.getSource().getCell(0, 0).getStringValue(); if (src != null) { tokens = StringTool.splitAndEscape(src, ARRAY_ELEMENTS_SEPARATOR, ARRAY_ELEMENTS_SEPARATOR_ESCAPER); } return tokens; }
public ICellEditor selectEditor(ICell cell, CellMetaInfo meta) { if (cell.getFormula() != null) { return factory.makeFormulaEditor(); } ICellEditor editor = selectEditor(cell, cell.getStringValue(), meta); return editor == null ? defaultEditor(cell) : editor; }
private void preprocessOpenlTable(IGridTable table, XlsSheetSourceCodeModule source) { String openlName = table.getCell(1, 0).getStringValue(); if (StringUtils.isNotBlank(openlName)) { openlName = openlName.trim(); } setOpenl(new OpenlSyntaxNode(openlName, new GridLocation(table), source)); }
public ICellEditor selectEditor(ICell cell) { if (cell.getFormula() != null) { return factory.makeFormulaEditor(); } CellMetaInfo cellMetaInfo = cell.getMetaInfo(); ICellEditor editor = selectEditor(cellMetaInfo, cell.getStringValue()); return editor == null ? defaultEditor(cell) : editor; }
public String[] getColumnNames() { if (columnNames == null) { int width = getWidth(); columnNames = new String[width]; for (int col = 0; col < width; col++) { IGridTable nameCell = columnNamesTable.getColumn(col).getRow(0).getSource(); columnNames[col] = nameCell.getCell(0, 0).getStringValue(); } } return columnNames; }
public String[] getRowNames() { if (rowNames == null) { int height = getHeight(); rowNames = new String[height]; for (int row = 0; row < height; row++) { IGridTable nameCell = rowNamesTable.getRow(row).getColumn(0).getSource(); rowNames[row] = nameCell.getCell(0, 0).getStringValue(); } } return rowNames; }
private void initTableName() { if (table != null) { String name = table.getName(); if (StringUtils.isEmpty(name)) { // If table contains errors, it will not contain compiled name. Try to parse table header instead. String methodHeader = table.getGridTable().getCell(0, 0).getStringValue(); name = TableSyntaxNodeUtils.str2name(methodHeader, XlsNodeTypes.getEnumByValue(table.getType())); } tableTechnicalName = name; } }
private void initTableName() { if (table != null) { String name = table.getName(); if (StringUtils.isEmpty(name)) { // If table contains errors, it will not contain compiled name. Try to parse table header instead. String methodHeader = table.getGridTable().getCell(0, 0).getStringValue(); name = TableSyntaxNodeUtils.str2name(methodHeader, XlsNodeTypes.getEnumByValue(table.getType())); } tableTechnicalName = name; } }