private IGridTable getLookupValuesTable(ILogicalTable originaltable, int firstLookupGridColumn, IGrid grid) { ILogicalTable valueTable = originaltable.getRows(DISPLAY_ROW + 1); IGridRegion lookupValuesRegion = new GridRegion((valueTable.getSource()).getRegion(), IGridRegion.LEFT, firstLookupGridColumn); return new GridTable(lookupValuesRegion, grid); }
public String getTableName() { String header = table.getGridTable().getCell(0, 0).getStringValue(); String tableName = (header == null) ? "" : header; return tableName; }
private static int[] getRowOffsets(ILogicalTable table) { if (table instanceof LogicalTable) { return ((LogicalTable)table).getRowOffset(); } return calculateRowOffsets(table.getHeight(), table.getSource()); }
public void moveRegion(boolean isInsert, boolean isColumns, int rowsOrColumns, IGridRegion r) { int inc = isInsert ? rowsOrColumns : -rowsOrColumns; if (isColumns) { ((GridRegion) r).setLeft(r.getLeft() + inc); ((GridRegion) r).setRight(r.getRight() + inc); } else { ((GridRegion) r).setTop(r.getTop() + inc); ((GridRegion) r).setBottom(r.getBottom() + inc); } } }
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; }
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 IGridRegion getRegionStartingAt(int colFrom, int rowFrom) { IGridRegion reg = getRegionContaining(colFrom, rowFrom); if (reg != null && reg.getLeft() == colFrom && reg.getTop() == rowFrom) { return reg; } return null; }
public static int[] calculateRowOffsets(int height, IGridTable gt) { int[] rowOffset = new int[height + 1]; int offset = 0; for (int i = 0, cellHeight = 0; i < height; offset += cellHeight, ++i) { rowOffset[i] = offset; cellHeight = gt.getCell(0, offset).getHeight(); } rowOffset[height] = offset; return rowOffset; }
private static int[] getColumnOffsets(ILogicalTable table) { if (table instanceof LogicalTable) { return ((LogicalTable)table).getColumnOffset(); } return calculateColumnOffsets(table.getWidth(), table.getSource()); }
public String getUri() { int w = getWidth(); int h = getHeight(); return getGrid().getRangeUri(getGridColumn(0, 0), getGridRow(0, 0), getGridColumn(w - 1, h - 1), getGridRow(w - 1, h - 1)); }
public static IGridRegion shiftRight(Point start, int shiftRight) { return new GridRegion(start.getRow(), start.getColumn(), start.getRow(), start.getColumn() + shiftRight); }
public void undoAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); for (IGridRegion region : createdRegions) { grid.removeMergedRegion(region); } for (IGridRegion region : removedRegions) { grid.addMergedRegion(region); } }
public ILogicalTable getSubtable(int column, int row, int width, int height) { if (width == 0 || height == 0) { return null; } int startRow = rowOffset[row]; int endRow = rowOffset[row + height]; int startColumn = columnOffset[column]; int endColumn = columnOffset[column + width]; return LogicalTableHelper.logicalTable( getSource().getSubtable(startColumn, startRow, endColumn - startColumn, endRow - startRow)); }
public IGridTable getSubtable(int column, int row, int width, int height) { if (width == 0 || height == 0) { return null; } if (getWidth() == width && getHeight() == height) { return this; } if (width == 1 && height == 1) return new SingleCellGridTable(this, column, row); return new SubGridTable(this, column, row, width, height); }
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; }