~duyi001/gephi/DSNI

« back to all changes in this revision

Viewing changes to DesktopFilters/src/org/gephi/desktop/filters/query/QueryExplorer.java

  • Committer: sunsnowad
  • Author(s): Yi Du
  • Date: 2011-09-08 16:36:59 UTC
  • mfrom: (1435.1.968 gephi)
  • Revision ID: sunsnowad@www-691ed046717-20110908163659-aorx14ylp8f9qwdx
1.merge with main branch
2.update twitter4j to version 2.2.4
3.fix an existing bug on "twitter user import"

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
Copyright 2008-2010 Gephi
3
 
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>
 
2
Copyright 2008-2011 Gephi
 
3
Authors : Mathieu Bastian <mathieu.bastian@gephi.org>, Sébastien Heymann <sebastien.heymann@gephi.org>
4
4
Website : http://www.gephi.org
5
5
 
6
6
This file is part of Gephi.
17
17
 
18
18
You should have received a copy of the GNU Affero General Public License
19
19
along with Gephi.  If not, see <http://www.gnu.org/licenses/>.
20
 
*/
 
20
 */
21
21
package org.gephi.desktop.filters.query;
22
22
 
23
23
import java.beans.PropertyChangeEvent;
28
28
import javax.swing.event.ChangeListener;
29
29
import javax.swing.tree.TreeSelectionModel;
30
30
import org.gephi.desktop.filters.FilterUIModel;
 
31
import org.gephi.filters.api.FilterController;
31
32
import org.gephi.filters.api.FilterModel;
32
33
import org.gephi.filters.api.Query;
33
34
import org.openide.explorer.ExplorerManager;
35
36
import org.openide.nodes.AbstractNode;
36
37
import org.openide.nodes.Children;
37
38
import org.openide.nodes.Node;
 
39
import org.openide.util.Lookup;
38
40
 
39
41
/**
40
42
 *
45
47
    private ExplorerManager manager;
46
48
    private FilterModel model;
47
49
    private FilterUIModel uiModel;
 
50
    private FilterController filterController;
48
51
    //state
49
52
    private boolean listenSelectedNodes = false;
50
53
 
63
66
        this.manager = manager;
64
67
        this.model = model;
65
68
        this.uiModel = uiModel;
 
69
        this.filterController = Lookup.getDefault().lookup(FilterController.class);
66
70
 
67
71
        if (model != null) {
68
72
            model.addChangeListener(this);
104
108
                Node node = ((Node[]) evt.getNewValue())[0];
105
109
                if (node instanceof RootNode) {
106
110
                    uiModel.setSelectedQuery(null);
 
111
                    filterController.setCurrentQuery(null);
107
112
                    return;
108
113
                }
109
114
                while (!(node instanceof QueryNode)) {
110
115
                    node = node.getParentNode();
111
116
                    if (node.getParentNode() == null) {
112
117
                        uiModel.setSelectedQuery(null);
 
118
                        filterController.setCurrentQuery(null);
113
119
                        return;
114
120
                    }
115
121
                }
119
125
 
120
126
                    public void run() {
121
127
                        uiModel.setSelectedQuery(query);
 
128
                        model.removeChangeListener(QueryExplorer.this);
 
129
                        filterController.setCurrentQuery(uiModel.getSelectedRoot());
 
130
                        model.addChangeListener(QueryExplorer.this);
122
131
                    }
123
132
                }).start();
124
133
            }
130
139
        SwingUtilities.invokeLater(new Runnable() {
131
140
 
132
141
            public void run() {
 
142
                //uiModel.setSelectedQuery(model.getCurrentQuery());
133
143
                saveExpandStatus(QueryExplorer.this.manager.getRootContext());
134
144
                QueryExplorer.this.manager.setRootContext(new RootNode(new QueryChildren(QueryExplorer.this.model.getQueries())));
135
145
                loadExpandStatus(QueryExplorer.this.manager.getRootContext());