public GridTable(int top, int left, int bottom, int right, IGrid grid) { this(new GridRegion(top, left, bottom, right), grid); }
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); } } }
public static TableModel initializeTableModel(IGridTable table, IGridFilter[] filters, int numRows, LinkBuilder linkBuilder, String mode, String view) { if (table == null) { return null; } IGrid grid; if (CollectionUtils.isNotEmpty(filters)) { grid = new FilteredGrid(table.getGrid(), filters); } else { grid = table.getGrid(); } IGridRegion region = table.getRegion(); if (numRows > -1 && region.getTop() + numRows < region.getBottom()) { region = new GridRegion(region); ((GridRegion) region).setBottom(region.getTop() + numRows - 1); } return new TableViewer(grid, region, linkBuilder, mode, view).buildModel(table, numRows); }
public static TableModel initializeTableModel(IGridTable table, IGridFilter[] filters, int numRows, LinkBuilder linkBuilder, String mode, String view, MetaInfoReader metaInfoReader) { if (table == null) { return null; } boolean editing = Constants.MODE_EDIT.equals(mode); if (editing) { // Prepare workbook for edit (load it to memory before editing starts) table.edit(); } IGrid grid; if (CollectionUtils.isNotEmpty(filters)) { grid = new FilteredGrid(table.getGrid(), filters, metaInfoReader); } else { grid = table.getGrid(); } IGridRegion region = table.getRegion(); if (numRows > -1 && region.getTop() + numRows < region.getBottom()) { region = new GridRegion(region); ((GridRegion) region).setBottom(region.getTop() + numRows - 1); } return new TableViewer(grid, region, linkBuilder, mode, view, metaInfoReader).buildModel(table, numRows); }
public IGridRegion getRegion() { return height == 1 && width == 1 ? null : new GridRegion(row, column, row + height - 1, column + width - 1); }
public IGridRegion getAbsoluteRegion() { IGridRegion absoluteRegion = getRegion(); if (absoluteRegion == null) { absoluteRegion = new GridRegion(row, column, row, column); } return absoluteRegion; }
@Override public IGridRegion getAbsoluteRegion() { IGridRegion absoluteRegion = getRegion(); if (absoluteRegion == null) { absoluteRegion = new GridRegion(row, column, row, column); } return absoluteRegion; }
public IGridRegion getAbsoluteRegion() { IGridRegion absoluteRegion = getRegion(); if (absoluteRegion == null) { absoluteRegion = new GridRegion(row, column, row, column); } return absoluteRegion; }
private void mergeArrayCells(IWritableGrid sheet, int rowIndex, int columnIndex, int numberOfValues) { // counting begins from 0 int lastMergedColumnIndex = columnIndex + numberOfValues - 1; sheet.addMergedRegion(new GridRegion(rowIndex, columnIndex, rowIndex, lastMergedColumnIndex)); }
private void processHorizConditionsHeaders(IGridRegion displayRowRegion, int firstLookupGridColumn, IGrid grid) throws OpenLCompilationException { IGridRegion hcHeadersRegion = new GridRegion(displayRowRegion, IGridRegion.LEFT, firstLookupGridColumn); IGridTable hcHeaderTable = new GridTable(hcHeadersRegion, grid); validateHCHeaders(hcHeaderTable); }
/** * Gets the regions from grid tables, and according it initialize regions on * current grid. */ private void initMappedRegions() { mappedRegions = new GridRegion[gridTables.length]; int w = 0; int h = 0; for (int i = 0; i < gridTables.length; i++) { IGridRegion reg = gridTables[i].getRegion(); GridRegion mapped = null; int last = i == gridTables.length - 1 ? 1 : 0; if (vertical) { int rh = IGridRegion.Tool.height(reg); mapped = new GridRegion(h, 0, h + rh - 1 + last, width); h += rh; } else { int rw = IGridRegion.Tool.width(reg); mapped = new GridRegion(0, w, height, w + rw - 1 + last); w += rw; } mappedRegions[i] = mapped; } }
/** * Builds the header of the table in the given sheet. Merges the appropriate region. * * @param sheet sheet for header writing * @param lastTableColumnNumber the number of the last column of the table. Is needed to merge the * header region. * @param columnStartIndex the start index of the column on the sheet where header is starting * @param rowStartIndex the start index of the row on the sheet where header is starting * */ public void build(IWritableGrid sheet, int lastTableColumnNumber, int columnStartIndex, int rowStartIndex) { sheet.setCellValue(columnStartIndex, rowStartIndex, tableHeader); sheet.addMergedRegion(new GridRegion(rowStartIndex, columnStartIndex, rowStartIndex, lastTableColumnNumber)); } }
public static IGridRegion makeRegion(String range) { int idx = range.indexOf(AGrid.RANGE_SEPARATOR); if (idx < 0) { int col1 = getColumn(range); int row1 = getRow(range); return new GridRegion(row1, col1, row1, col1); } String[] rr = StringTool.tokenize(range, AGrid.RANGE_SEPARATOR); int col1 = getColumn(rr[0]); int row1 = getRow(rr[0]); int col2 = getColumn(rr[1]); int row2 = getRow(rr[1]); return new GridRegion(row1, col1, row2, col2); }
/** * Finds common {@link IGridRegion} for incoming regions. * * @param i1 first grid region * @param i2 second grid region * @return intersection of incoming grid regions. <code>null</code> if there is no intersection. */ public static IGridRegion intersect(IGridRegion i1, IGridRegion i2) { int left = Math.max(i1.getLeft(), i2.getLeft()); int right = Math.min(i1.getRight(), i2.getRight()); int top = Math.max(i1.getTop(), i2.getTop()); int bottom = Math.min(i1.getBottom(), i2.getBottom()); return top <= bottom && left <= right ? new GridRegion(top, left, bottom, right) : null; }
public IGridRegion findEmptyRect(int width, int height) { int lastRow = PoiExcelHelper.getLastRowNum(getSheet()); int top = lastRow + 2, left = 1; GridRegion newRegion = new GridRegion(top, left, top + height - 1, left + width - 1); if (IGridRegion.Tool.isValidRegion(newRegion, getSpreadsheetConstants())) { return newRegion; } return null; }
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 static IGridRegion shiftRight(Point start, int shiftRight) { return new GridRegion(start.getRow(), start.getColumn(), start.getRow(), start.getColumn() + shiftRight); }
public static IGridRegion shiftBottom(Point start, int shiftBottom) { return new GridRegion(start.getRow(), start.getColumn(), start.getRow() + shiftBottom, start.getColumn()); }