Package simplesheet.model.selection

Examples of simplesheet.model.selection.SheetSelectionModel


                @Override
                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() != 2) {
                        return;
                    }
                    SheetSelectionModel selModel = table.getSelectionModel();
                    CellPosition lead = selModel.getLead();
                    if(lead == null) {
                        return;
                    }
                    CellPosition pos = model.getOrigin(lead);
                    TableCell cell = model.getValueAt(pos);
View Full Code Here


        public void valueChanged(SheetSelectionEvent e) {
            if (e.isAdjusting) {
                //only finished selection
                return;
            }
            SheetSelectionModel smod = table.getSelectionModel();
            if(smod.isSelectionEmpty()
                    || smod.getAnchor().equals(smod.getLead())) {
                //empty selection or single cell
                return;
            }

            //without head
            boolean dataAvailiable = true;
            int headHeight = RangeParser.getDimensions(format.getCols().getList()).height;
            if (smod.getAnchor().row < headHeight
                    || smod.getLead().row < headHeight) {
                dataAvailiable = false;
            }
            //without left head
            int leftHeadHeight = RangeParser.getDimensions(format.getRows().getList()).height;
            if (smod.getAnchor().col < leftHeadHeight
                    || smod.getLead().col < leftHeadHeight) {
                dataAvailiable = false;
            }
            checkIsFillRange(smod.getAnchor(), smod.getLead(), dataAvailiable);
        }
View Full Code Here

        @Override
        public void keyPressed(KeyEvent e) {
            if(table.getEditingCell() != null) {
                return;
            }
            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;
            }
            sm.setSelectionInterval(ankor, lead);
        }
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()) {
                semod.setValueIsAdjusting(true);
                semod.setSelectionInterval(pos, pos);
            } else {
                semod.addSelectionInterval(pos);
            }
        }
View Full Code Here

            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            SheetSelectionModel semod = table.getSelectionModel();
            semod.setValueIsAdjusting(false);
        }
View Full Code Here

            semod.setValueIsAdjusting(false);
        }

        @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

TOP

Related Classes of simplesheet.model.selection.SheetSelectionModel

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.