Package simplesheet.model.selection

Examples of simplesheet.model.selection.CellPosition


            }
        }

        private void fillCell(int iRow, int iCol,
                AutoFillDlg autoFill, Element savedStream, Style style) throws ReportException {
            TableCell iCell = model.getValueAt(new CellPosition(iRow, iCol));
            if (iCell instanceof SheetCell) {
                SheetCell sc = (SheetCell) iCell;
                if (autoFill.isCopyValue() && savedStream != null) {
                    sc.getCellFormat().restoreState(savedStream);
                }
View Full Code Here


            }
            SheetSelectionModel sm = table.getSelectionModel();
            if(sm.isSelectionEmpty() || sm.getValueIsAdjusting()) {
               return;
            }
            CellPosition lead = getNextLead(e, sm.getLead());
            if(lead == null) {
                return;
            }
            CellPosition ankor = null;
            if((e.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) > 0) {
                ankor = sm.getAnchor();
            } else {
                ankor = lead;
            }
View Full Code Here

            lead = model.getOrigin(lead);
            switch(e.getKeyCode()) {
                case KeyEvent.VK_DOWN : {
                    Dimension size = model.getSize(lead);
                    if(lead.row + size.height < model.getRowCount()) {
                        return model.getOrigin(new CellPosition(lead.row+size.height, lead.col));
                    }
                    break;
                }
                case KeyEvent.VK_UP : {
                    if(lead.row -1 >= 0) {
                        return model.getOrigin(new CellPosition(lead.row-1, lead.col));
                    }
                    break;
                }
                case KeyEvent.VK_RIGHT : {
                    Dimension size = model.getSize(lead);
                    if(lead.col + size.width < model.getColumnCount()) {
                        return model.getOrigin(new CellPosition(lead.row, lead.col+size.width));
                    }
                    break;
                }
                case KeyEvent.VK_LEFT : {
                    if(lead.col - 1 >= 0) {
                        return model.getOrigin(new CellPosition(lead.row, lead.col-1));
                    }
                    break;
                }
            }
            return null;
View Full Code Here

    private class MyMouse extends MouseAdapter {
        @Override
        public void mousePressed(MouseEvent e) {
            table.requestFocus();
            SheetSelectionModel semod = table.getSelectionModel();
            CellPosition pos = table.getCellAtPoint(e.getPoint());
            if(pos == null) {
                return;
            }
            pos = table.getModel().getOrigin(pos);
            if(!semod.getValueIsAdjusting()) {
View Full Code Here

        }

        @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

        } 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

        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

    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

        }

        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

        }

        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

TOP

Related Classes of simplesheet.model.selection.CellPosition

Copyright © 2018 www.massapicom. 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.