1 /* 2 * Copyright (c) 2003-2008 by Cosylab d. d. 3 * 4 * This file is part of Java-Common. 5 * 6 * Java-Common is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Java-Common is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Java-Common. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 package com.cosylab.events; 21 22 import java.util.EventObject; 23 24 /** 25 * 26 * 27 * @author gpajor 28 * @version @@VERSION@@ 29 */ 30 public class RangeSelectionEvent extends EventObject { 31 private int selectionStart=-1; 32 private int selectionEnd=-1; 33 private boolean selected=true; 34 35 /** 36 * Constructor for RangeSelectionEvent. 37 * @param source 38 * @param start Start index, should be -1 iff nothing is selected 39 * @param end End index, should be >= start, -1 if nothing is selected. 40 * @param selecrted, <code>true</code> if interval was selected, <code>false</code> if deselected. 41 */ 42 public RangeSelectionEvent(RangeSelectable source, int start, int end, boolean selected) { 43 super(source); 44 selectionStart=start; 45 selectionEnd=end; 46 this.selected=selected; 47 } 48 49 /** 50 * Returns the selectionEnd. 51 * @return int 52 */ 53 public int getSelectionEnd() { 54 return selectionEnd; 55 } 56 57 /** 58 * Returns the selectionStart. 59 * @return int 60 */ 61 public int getSelectionStart() { 62 return selectionStart; 63 } 64 65 66 /** 67 * Returns <code>true</code> if specified interval was selected. 68 * If it was deselected, it is <code>false</code>. 69 * @return boolean <code>true</code> if selected 70 */ 71 public boolean isSelected() { 72 return selected; 73 } 74 75 }