~ubuntu-branches/ubuntu/quantal/zeroc-ice/quantal

« back to all changes in this revision

Viewing changes to java/src/IceGridGUI/LiveDeploymentPane.java

  • Committer: Bazaar Package Importer
  • Author(s): Cleto Martin Angelina
  • Date: 2011-04-25 18:44:24 UTC
  • mfrom: (6.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110425184424-sep9i9euu434vq4c
Tags: 3.4.1-7
* Bug fix: "libdb5.1-java.jar was renamed to db.jar", thanks to Ondřej
  Surý (Closes: #623555).
* Bug fix: "causes noise in php5", thanks to Jayen Ashar (Closes:
  #623533).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// **********************************************************************
2
2
//
3
 
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
 
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
4
4
//
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
7
7
//
8
8
// **********************************************************************
 
9
 
9
10
package IceGridGUI;
10
11
 
11
12
import java.awt.*;
45
46
    {
46
47
        Coordinator c = _root.getCoordinator();
47
48
 
 
49
        if(c.connected())
 
50
        {
 
51
            c.getShowLiveDeploymentFiltersAction().setEnabled(true);
 
52
        }
48
53
        c.getCloseApplicationAction().setEnabled(false);
49
54
        c.getSaveAction().setEnabled(false);
50
55
        c.getSaveToRegistryAction().setEnabled(false);
51
56
        c.getSaveToFileAction().setEnabled(false);
52
57
        c.getDiscardUpdatesAction().setEnabled(false);
53
 
        
 
58
 
54
59
        c.getBackAction().setEnabled(_previousNodes.size() > 0);
55
60
        c.getForwardAction().setEnabled(_nextNodes.size() > 0);
56
61
        c.showActions(_currentNode);
72
77
        }
73
78
    }
74
79
 
75
 
 
76
80
    public void showNode(TreeNodeBase node)
77
81
    {
78
82
        TreeNode newNode = (TreeNode)node;
79
 
        
 
83
 
80
84
        if(newNode != _currentNode)
81
85
        {
82
86
            if(newNode == null)
94
98
                        _previousNodes.removeFirst();
95
99
                    }
96
100
                    _root.getCoordinator().getBackAction().setEnabled(true);
97
 
                }   
 
101
                }
98
102
                _nextNodes.clear();
99
103
                _root.getCoordinator().getForwardAction().setEnabled(false);
100
104
                _currentNode = newNode;
105
109
        {
106
110
            refresh();
107
111
        }
108
 
 
109
112
    }
110
113
 
111
114
    public void back()
113
116
        TreeNode previousNode = null;
114
117
        do
115
118
        {
116
 
            previousNode = (TreeNode)_previousNodes.removeLast();
117
 
        } while(_previousNodes.size() > 0 
118
 
                && (previousNode == _currentNode || !_root.hasNode(previousNode)));
119
 
                
 
119
            previousNode = _previousNodes.removeLast();
 
120
        } while(_previousNodes.size() > 0 && (previousNode == _currentNode || !_root.hasNode(previousNode)));
 
121
 
120
122
        if(_previousNodes.size() == 0)
121
123
        {
122
124
            _root.getCoordinator().getBackAction().setEnabled(false);
129
131
                _nextNodes.addFirst(_currentNode);
130
132
                _root.getCoordinator().getForwardAction().setEnabled(true);
131
133
            }
132
 
            
 
134
 
133
135
            _currentNode = previousNode;
134
136
            _selectionListenerEnabled = false;
135
137
            _root.setSelectedNode(_currentNode);
143
145
        TreeNode nextNode = null;
144
146
        do
145
147
        {
146
 
            nextNode = (TreeNode)_nextNodes.removeFirst();
147
 
        } while(_nextNodes.size() > 0 
148
 
                && (nextNode == _currentNode || !_root.hasNode(nextNode)));
149
 
        
 
148
            nextNode = _nextNodes.removeFirst();
 
149
        } while(_nextNodes.size() > 0 && (nextNode == _currentNode || !_root.hasNode(nextNode)));
 
150
 
150
151
        if(_nextNodes.size() == 0)
151
152
        {
152
153
            _root.getCoordinator().getForwardAction().setEnabled(false);
159
160
                _previousNodes.add(_currentNode);
160
161
                _root.getCoordinator().getBackAction().setEnabled(true);
161
162
            }
162
 
            
 
163
 
163
164
            _currentNode = nextNode;
164
165
            _selectionListenerEnabled = false;
165
166
            _root.setSelectedNode(_currentNode);
168
169
        }
169
170
    }
170
171
 
171
 
    
172
172
    public void save()
173
173
    {
174
174
        assert false;
175
175
    }
 
176
 
176
177
    public void saveToRegistry()
177
178
    {
178
179
        assert false;
179
180
    }
 
181
 
180
182
    public void saveToFile()
181
183
    {
182
184
        assert false;
183
185
    }
 
186
 
184
187
    public void discardUpdates()
185
188
    {
186
189
        assert false;
187
190
    }
 
191
 
188
192
    public boolean close()
189
193
    {
190
194
        return false;
191
195
    }
192
 
   
 
196
 
193
197
    LiveDeploymentPane(Root root)
194
198
    {
195
199
        super(JSplitPane.HORIZONTAL_SPLIT, true);
196
200
        _root = root;
197
201
        setBorder(new EmptyBorder(10, 10, 10, 10));
198
 
        
 
202
 
199
203
        //
200
204
        // Tree display
201
205
        //
209
213
        ToolTipManager.sharedInstance().registerComponent(tree);
210
214
        tree.addMouseListener(popupListener);
211
215
 
212
 
        tree.getSelectionModel().setSelectionMode
213
 
            (TreeSelectionModel.SINGLE_TREE_SELECTION);
 
216
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
214
217
 
215
218
        tree.addTreeSelectionListener(new SelectionListener());
216
 
        
 
219
 
217
220
        tree.setRootVisible(false);
218
221
 
219
 
        JScrollPane leftScroll = 
 
222
        JScrollPane leftScroll =
220
223
            new JScrollPane(tree,
221
 
                            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
 
224
                            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
222
225
                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
223
226
        leftScroll.setBorder(Borders.EMPTY_BORDER);
224
 
        
 
227
 
225
228
        _leftPane = new SimpleInternalFrame("Runtime Components");
226
229
        _leftPane.setContent(leftScroll);
227
230
        _leftPane.setPreferredSize(new Dimension(280, 350));
263
266
    private void setEmptyDividerBorder()
264
267
    {
265
268
        SplitPaneUI splitPaneUI = getUI();
266
 
        if(splitPaneUI instanceof BasicSplitPaneUI) 
 
269
        if(splitPaneUI instanceof BasicSplitPaneUI)
267
270
        {
268
271
            BasicSplitPaneUI basicUI = (BasicSplitPaneUI)splitPaneUI;
269
272
            basicUI.getDivider().setBorder(BorderFactory.createEmptyBorder());
270
273
        }
271
274
    }
272
275
 
273
 
 
274
276
    private class SelectionListener implements TreeSelectionListener
275
277
    {
276
278
        public void valueChanged(TreeSelectionEvent e)
295
297
        }
296
298
    }
297
299
 
298
 
 
299
300
    private class PopupListener extends MouseAdapter
300
301
    {
301
 
        public void mousePressed(MouseEvent e) 
302
 
        {
303
 
            maybeShowPopup(e);
304
 
        }
305
 
 
306
 
        public void mouseReleased(MouseEvent e) 
307
 
        {
308
 
            maybeShowPopup(e);
309
 
        }
310
 
 
311
 
        private void maybeShowPopup(MouseEvent e) 
312
 
        {
313
 
            if (e.isPopupTrigger()) 
 
302
        public void mousePressed(MouseEvent e)
 
303
        {
 
304
            maybeShowPopup(e);
 
305
        }
 
306
 
 
307
        public void mouseReleased(MouseEvent e)
 
308
        {
 
309
            maybeShowPopup(e);
 
310
        }
 
311
 
 
312
        private void maybeShowPopup(MouseEvent e)
 
313
        {
 
314
            if (e.isPopupTrigger())
314
315
            {
315
316
                JTree tree = (JTree)e.getComponent();
316
317
 
317
318
                TreePath path = tree.getPathForLocation(e.getX(), e.getY());
318
 
                
 
319
 
319
320
                if(path != null)
320
321
                {
321
322
                    TreeNode node = (TreeNode)path.getLastPathComponent();
333
334
    private SimpleInternalFrame _leftPane;
334
335
    private SimpleInternalFrame _propertiesFrame;
335
336
 
336
 
 
337
337
    //
338
338
    // back/forward navigation
339
339
    //
340
 
    private java.util.LinkedList _previousNodes = new java.util.LinkedList();
341
 
    private java.util.LinkedList _nextNodes = new java.util.LinkedList();
 
340
    private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>();
 
341
    private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>();
342
342
    private TreeNode _currentNode;
343
 
    
 
343
 
344
344
    private boolean _selectionListenerEnabled = true;
345
345
 
346
346
    static private final int HISTORY_MAX_SIZE = 20;