01: /*
02: * $Id: SelectionMapper.java,v 1.5 2006/09/21 12:08:18 kleopatra Exp $
03: *
04: * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
05: * Santa Clara, California 95054, U.S.A. All rights reserved.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * 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.swingx.decorator;
22:
23: import javax.swing.ListSelectionModel;
24:
25: /**
26: * Responsible for keeping track of selection in model coordinates.<p>
27: *
28: * updates view selection on pipeline change.
29: * updates model selection on view selection change.
30: *
31: * @author Jeanette Winzenburg
32: */
33: public interface SelectionMapper {
34:
35: /**
36: * sets the view selection model. Must not be null.
37: *
38: * @param viewSelectionMode holding selected indices in view coordinates
39: */
40: void setViewSelectionModel(ListSelectionModel viewSelectionMode);
41:
42: /**
43: * @return view selection model
44: */
45: ListSelectionModel getViewSelectionModel();
46:
47: /**
48: * Install the new filter pipeline and map the newly filtered data
49: * towards the view.
50: */
51: void setFilters(FilterPipeline pipeline);
52:
53: /**
54: * Toggle whether selection mapping is active. If mapping is active, user
55: * actions to select rows in the view will be recorded in model coordinates.
56: * When the model changes due to filtering, the view selection will be
57: * updated to maintain the logical selection.
58: */
59: void setEnabled(boolean enabled);
60:
61: /**
62: * @return true if selection mapping is active.
63: */
64: boolean isEnabled();
65:
66: void clearModelSelection();
67:
68: /**
69: * Adjust the model by adding the specified rows.
70: */
71: void insertIndexInterval(int start, int length, boolean before);
72:
73: /**
74: * Adjust the model by removing the specified rows.
75: */
76: void removeIndexInterval(int start, int end);
77: }
|