SelectionModel.java
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:4k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /*
  2.  * $Id: SelectionModel.java,v 1.2 2005/10/10 17:01:02 rbair Exp $
  3.  *
  4.  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
  5.  * Santa Clara, California 95054, U.S.A. All rights reserved.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  20.  */
  21. package org.jdesktop.binding;
  22. /**
  23.  * A basic selection model interface that can be used in any situation
  24.  * where one or more contiguous or noncontiguous "rows" may be
  25.  * selected.
  26.  * <p/>
  27.  * The SelectionModel is used to define which rows are selected in a
  28.  * collection of rows. From the perspective of the SelectionModel, index
  29.  * 0 is the first index. Any index value &lt; 0 is invalid, as is any index
  30.  * greater than the size of the collection. It is up to the implementation
  31.  * of SelectionModel to ensure that the upper index is valid.
  32.  * <p/>
  33.  * @author Richard Bair
  34.  */
  35. public interface SelectionModel {
  36. /**
  37.  * 
  38.  * @param indices
  39.  */
  40.     public void setSelectionIndices(int[] indices);
  41.     
  42.     /**
  43.      * 
  44.      * @return
  45.      */
  46.     public int[] getSelectionIndices();
  47.     
  48. /**
  49.  * Add a listener to the list that's notified each time a change to the selection
  50.  * occurs.
  51.  * @param listener The listener to be notified
  52.  */
  53. public void addSelectionModelListener(SelectionModelListener listener);
  54.     
  55. /**
  56.  * Remove the given listener from the list that's notified each time a change
  57.  * to the selection occurs
  58.  * @param listener the listener to be removed
  59.  */
  60. public void removeSelectionModelListener(SelectionModelListener listener);
  61. // /**
  62. //  * Change the selection to be between index0 and index1 inclusive. If this represents
  63. //  * a change to the current selection, then notify each SelectionModelListener. Note
  64. //  * that index0 doesn't have to be less than or equal to index1.
  65. //  * @param index0 one end of the interval
  66. //  * @param index1 other end of the interval.
  67. //  */
  68. // public void setSelectionInterval(int index0, int index1);
  69. // /**
  70. //  * Change the selection to be the set union of the current selection and the indices
  71. //  * between index0 and index1 inclusive. If this represents a change to the current
  72. //  * selection, then notify each SelectionModelListener. Note that index0 doesn't have
  73. //  * to be less than or equal to index1.
  74. //  * @param index0 one end of the interval
  75. //  * @param index1 other end of the interval
  76. //  */
  77. // public void addSelectionInterval(int index0, int index1);
  78. // /**
  79. //  * Change the selection to be the set difference of the current selection and the
  80. //  * indices between index0 and index1 inclusive. If this represents a change to the
  81. //  * current selection, then notify each SelectionModelListener. Note that index0
  82. //  * doesn't have to be less than or equal to index1.
  83. //  * @param index0 one end of the interval
  84. //  * @param index1 other end of the interval
  85. //  */
  86. // public void removeSelectionInterval(int index0, int index1);
  87. // /**
  88. //  * @return the first selected index or -1 if the selection is empty
  89. //  */
  90. // public int getMinSelectionIndex();
  91. // /**
  92. //  * @return the last selected index or -1 if the selection is empty
  93. //  */
  94. // public int getMaxSelectionIndex();
  95. // /**
  96. //  * @param index a valid index
  97. //  * @return true if the specified index is selected
  98. //  */
  99. // public boolean isSelectedIndex(int index);
  100. // /**
  101. //  * Change the selection to the empty set. If this represents a change to the current
  102. //  * selection, then notify each listener.
  103. //  */
  104. // public void clearSelection();
  105. // /**
  106. //  * @return true if no indices are selected
  107. //  */
  108. // public boolean isSelectionEmpty();
  109. }