Examples of CellPosition


Examples of simplesheet.model.selection.CellPosition

        }

        @Override
        public void mouseDragged(MouseEvent e) {
            SheetSelectionModel semod = table.getSelectionModel();
            CellPosition pos = table.getCellAtPoint(e.getPoint());
            if(pos == null) {
                return;
            }
            if(semod.getValueIsAdjusting()) {
                semod.addSelectionInterval(pos);
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        } else {
            borderInsets = new Insets(0, 0, 0, 0);
        }
        int colPos = getColumnAtPoint(point, borderInsets);
        int rowPos = getRowAtPoint(point, borderInsets);
        return new CellPosition(rowPos, colPos);
    }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        this.gridColor = gridColor;
    }

    public Component prepareRenderer(CellRenderer renderer, CellPosition pos) {
        TableCell value = model.getValueAt(pos);
        CellPosition lead = selectionModel.getLead();
        boolean focused = (lead != null) && pos.equals(lead) ? true : false;
        return renderer.getSheetCellRendererComponent(this, value,
                selectionModel.isSelected(pos), focused);
    }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

    public CellPosition getEditingCell() {
        return null;
    }

    public Rectangle getCellRect(CellPosition pos) {
        CellPosition origin = model.getOrigin(pos);
        if(origin == null) {
            return null;
        }
        Insets borderInsets = null;
        Border border = getBorder();
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        }

        private Rectangle getRowRect(int a, int b, int row) {
            Rectangle rc = new Rectangle();
            for(int i=a; i<=b; i++) {
                rc = rc.union(getCellRect(new CellPosition(row, i)));
            }
            return rc;
        }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        }

        private Rectangle getColRect(int a, int b, int col) {
            Rectangle rc = new Rectangle();
            for(int i=a; i<=b; i++) {
                rc = rc.union(getCellRect(new CellPosition(i, col)));
            }
            return rc;
        }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        }
        Rectangle clipRc = fixRectangle(oldRc, borderInsets);

        //calc rectangle
        SheetModel model = table.getModel();
        CellPosition origin0 = getTopLeft(clipRc);
        CellPosition originN = getBottomRight(clipRc);
        if(origin0 == null || originN == null) {
            //no cells
            return;
        }
       
        int yBase = borderInsets.top;
        for (int iRow = 0; iRow < origin0.row; iRow++) {
            yBase += model.getRow(iRow).getHeight();
        }
        int xBase = borderInsets.left;
        for (int iCol = 0; iCol < origin0.col; iCol++) {
            xBase += model.getColumn(iCol).getWidth();
        }

        Spanned spanned[] = new Spanned[originN.col - origin0.col + 1];

        for (int iRow = origin0.row; iRow <= originN.row; iRow++) {
            int xLocalBase = xBase;
            for (int iCol = origin0.col; iCol <= originN.col; ) { /// increment at end
                //check if spanned
                int index = iCol - origin0.col;
                if(spanned[index] != null) {
                   spanned[index].rows--;
                   iCol += spanned[index].cols;
                   xLocalBase += spanned[index].width;

                   if(spanned[index].rows == 0) {
                       spanned[index] = null;
                   }
                   continue;
                }
               
                //define dimensions
                CellPosition origin = model.getOrigin(new CellPosition(iRow, iCol));
                Dimension size = model.getSize(origin);
                Rectangle rc = new Rectangle();
                //y offset for spanned cells may be > 0
                rc.y = yBase;
                for(int i=0; i < iRow-origin.row; i++) {
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

     * @param rc
     * @return nearest cell in top left rect point, or null if no cell specified
     */
    private CellPosition getTopLeft(Rectangle rc) {
        Point topLeft = new Point(rc.x, rc.y);
        CellPosition pos = table.getCellAtPoint(topLeft);
        if(pos == null) {
            return null;
        }
        return table.getModel().getOrigin(pos);
    }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

     * @param rc
     * @return nearest cell in bottom right rect point, or null if no cell specified
     */
    private CellPosition getBottomRight(Rectangle rc) {
        Point bottomLeft = new Point(rc.x + rc.width, rc.y + rc.height);
        CellPosition pos = table.getCellAtPoint(bottomLeft);
        if(pos == null) {
            return null;
        }
        SheetModel model = table.getModel();
        CellPosition originN = model.getOrigin(pos);
        Dimension sizeN = model.getSize(originN);
        return new CellPosition(originN.row + sizeN.height-1, originN.col + sizeN.width-1);
    }
View Full Code Here

Examples of simplesheet.model.selection.CellPosition

        return new CellPosition(originN.row + sizeN.height-1, originN.col + sizeN.width-1);
    }

   
    private void paintCell(Graphics g, Rectangle cellRect, CellPosition pos) {
        CellPosition editingCell = table.getEditingCell();
        if (editingCell != null && editingCell.equals(pos)) {
            Component component = table.getEditorComponent();
            component.setBounds(cellRect);
            component.validate();
        } else {
            drawGrid(g, cellRect);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.