1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
|
// **********************************************************************
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package IceGrid;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.Rectangle;
import java.awt.Container;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import com.jgoodies.looks.Options;
import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import com.jgoodies.uif_lite.panel.SimpleInternalFrame;
import IceGrid.TreeNode.Application;
import IceGrid.TreeNode.CommonBase;
import IceGrid.TreeNode.Root;
//
// The class that holds all the data and more!
//
public class Model
{
public static class ConnectInfo
{
ConnectInfo(Preferences connectionPrefs,
Ice.Communicator communicator)
{
String defaultLocator = communicator.getProperties().
getProperty("Ice.Default.Locator");
if(defaultLocator.equals(""))
{
defaultLocator = "IceGrid/Locator:ssl -h hostname -p port -t timeout";
}
_connectionPrefs = connectionPrefs;
locatorProxy = _connectionPrefs.
get("locatorProxy", defaultLocator);
username = _connectionPrefs.get("username", username);
useGlacier = _connectionPrefs.
getBoolean("useGlacier", useGlacier);
autoconnect = _connectionPrefs.
getBoolean("autoconnect", autoconnect);
adminIdentity = _connectionPrefs.
get("adminIdentity", adminIdentity);
sessionManagerIdentity = _connectionPrefs.
get("sessionManagerIdentity", sessionManagerIdentity);
}
void save()
{
_connectionPrefs.put("locatorProxy", locatorProxy);
_connectionPrefs.put("username", username);
_connectionPrefs.putBoolean("useGlacier", useGlacier);
_connectionPrefs.putBoolean("autoconnect", autoconnect);
_connectionPrefs.put("adminIdentity", adminIdentity);
_connectionPrefs.put("sessionManagerIdentity",
sessionManagerIdentity);
}
String locatorProxy;
String username = System.getProperty("user.name");
char[] password;
boolean useGlacier = false;
boolean autoconnect = false;
String adminIdentity = "IceGrid/Admin";
String sessionManagerIdentity = "IceGrid/SessionManager";
private Preferences _connectionPrefs;
}
class MenuBar extends JMenuBar
{
MenuBar()
{
putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR);
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F);
add(fileMenu);
JMenu editMenu = new JMenu("Edit");
editMenu.setMnemonic(java.awt.event.KeyEvent.VK_E);
add(editMenu);
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic(java.awt.event.KeyEvent.VK_H);
add(helpMenu);
fileMenu.add(_connect);
fileMenu.addSeparator();
fileMenu.add(_save);
fileMenu.add(_discard);
fileMenu.addSeparator();
fileMenu.add(_exit);
editMenu.add(_copy);
editMenu.add(_paste);
editMenu.addSeparator();
editMenu.add(_delete);
helpMenu.add(_about);
}
}
class ToolBar extends JToolBar
{
ToolBar()
{
putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR);
setFloatable(false);
putClientProperty("JToolBar.isRollover", Boolean.TRUE);
add(_connect);
addSeparator();
add(_save);
add(_discard);
addSeparator();
add(_copy);
add(_paste);
addSeparator();
add(_delete);
addSeparator();
add(new JToggleButton(_substituteVar));
}
}
//
// All Model's methods run in the UI thread
//
public Ice.Communicator getCommunicator()
{
return _communicator;
}
public Root getRoot()
{
return _root;
}
public TreeModelI getTreeModel()
{
return _treeModel;
}
//
// From the Registry observer:
//
void registryInit(int serial, final java.util.List applications)
{
assert(_latestSerial == -1);
_latestSerial = serial;
_root.init(applications);
}
void applicationAdded(int serial, ApplicationDescriptor desc)
{
if(proceedWithUpdate(serial))
{
_root.applicationAdded(desc);
_statusBar.setText("Connected; application '"
+ desc.name + "' added (" + serial + ")");
checkWriteSerial();
}
}
void applicationRemoved(int serial, String name)
{
if(proceedWithUpdate(serial))
{
_root.applicationRemoved(name);
_statusBar.setText("Connected; application '"
+ name + "' removed (" + serial + ")");
checkWriteSerial();
}
}
void applicationUpdated(int serial, ApplicationUpdateDescriptor desc)
{
if(proceedWithUpdate(serial))
{
TreePath path = null;
CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
if(currentNode != null)
{
path = currentNode.getPath();
}
_root.applicationUpdated(desc);
_statusBar.setText("Connected; application '"
+ desc.name + "' updated (" + serial + ")");
checkWriteSerial();
restore(path);
}
}
boolean proceedWithUpdate(int serial)
{
if(serial <= _latestSerial)
{
//
// Ignore old messages
//
return false;
}
else if(serial == _latestSerial + 1)
{
boolean doIt = (_latestSerial == -1 || _writeSerial == -1 ||
_writeSerial > _latestSerial);
if(_writeSerial == _latestSerial)
{
_writeSerial = serial;
}
_latestSerial = serial;
return doIt;
}
else
{
_sessionKeeper.sessionLost(
"Received message from registry out of order");
return false;
}
}
private void checkWriteSerial()
{
if(_writeSerial != -1 && _writeSerial == _latestSerial)
{
updateInProgress();
}
}
public CommonBase getSelectedNode()
{
return (CommonBase)_tree.getLastSelectedPathComponent();
}
public CommonBase findNewNode(TreePath path)
{
CommonBase node = _root;
for(int i = 1; i < path.getPathCount(); ++i)
{
CommonBase child = node.findChild(((CommonBase)path.getPathComponent(i)).getId());
if(child == null)
{
break;
}
else
{
node = child;
}
}
return node;
}
public void setSelectionPath(TreePath path)
{
_tree.setSelectionPath(path);
}
public void refreshDisplay()
{
CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
if(currentNode != null)
{
currentNode.displayProperties();
}
}
public boolean displayEnabled()
{
return _displayEnabled;
}
public void enableDisplay()
{
_displayEnabled = true;
}
public void disableDisplay()
{
_displayEnabled = false;
}
private void restore(TreePath path)
{
if(path != null)
{
CommonBase newNode = findNewNode(path);
_tree.setSelectionPath(newNode.getPath());
newNode.displayProperties();
}
}
public boolean canUpdate()
{
if(_writeSerial == _latestSerial)
{
return true;
}
try
{
_writeSerial = _sessionKeeper.getSession().startUpdate();
}
catch(AccessDeniedException e)
{
_writeSerial = -1;
accessDenied(e);
return false;
}
if(_writeSerial > _latestSerial)
{
//
// Warn user that his updates were lost
//
JOptionPane.showMessageDialog(
_mainFrame,
"Your view was not up-to-date;"
+ " you now have exclusive write-access to the registry, however your previous changes were lost.",
"Concurrent update",
JOptionPane.WARNING_MESSAGE);
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
return false;
}
else
{
updateInProgress();
return true;
}
}
private void accessDenied(AccessDeniedException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
"Another session (username = " + e.lockUserId + ") has exclusive write access to the registry",
"Access Denied",
JOptionPane.ERROR_MESSAGE);
}
private boolean saveUpdates()
{
assert _writeSerial == _latestSerial;
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try
{
for(int i = 0; i < _root.getChildCount(); ++i)
{
Application application = (Application)_root.getChildAt(i);
try
{
if(application.isNew())
{
_sessionKeeper.getSession().addApplication(
(ApplicationDescriptor)application.getDescriptor());
application.commit();
}
else
{
ApplicationUpdateDescriptor updateDescriptor =
application.createUpdateDescriptor();
if(updateDescriptor != null)
{
_sessionKeeper.getSession().updateApplication(updateDescriptor);
application.commit();
}
}
//
// Will ignore these updates
//
_latestSerial++;
_writeSerial = _latestSerial;
}
catch(AccessDeniedException e)
{
// Very unlikely
accessDenied(e);
return false;
}
catch(ApplicationNotExistException e)
{
// Most likely an IceGrid bug, so no need to optimize!
//
JOptionPane.showMessageDialog(
_mainFrame,
"Can't update Application " + e.name + ": it does not exist!",
"Application does not exist",
JOptionPane.ERROR_MESSAGE);
return false;
}
catch(DeploymentException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
"Application " + application.getId() + ": "+ e.reason,
"Deployment Exception",
JOptionPane.ERROR_MESSAGE);
return false;
}
}
//
// Update completed entirely
//
try
{
_sessionKeeper.getSession().finishUpdate();
}
catch(AccessDeniedException e)
{
//
// Very unlikely; we still consider the update a success.
//
accessDenied(e);
}
_writeSerial = -1;
_save.setEnabled(false);
_discard.setEnabled(false);
_statusBar.setText("Saving complete");
return true;
}
finally
{
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
private void discardUpdates(boolean showDialog)
{
assert _writeSerial == _latestSerial;
//
// Reestablish session, since we don't keep the old data around
//
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try
{
_sessionKeeper.reconnect(showDialog);
_save.setEnabled(false);
_discard.setEnabled(false);
}
finally
{
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
private void updateInProgress()
{
_statusBar.setText("Update in progress");
_mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
_save.setEnabled(true);
_discard.setEnabled(true);
}
//
// From the Node observer:
//
void nodeUp(NodeDynamicInfo updatedInfo)
{
_root.nodeUp(updatedInfo);
}
void nodeDown(String node)
{
_root.nodeDown(node);
}
void updateServer(String node, ServerDynamicInfo updatedInfo)
{
_root.updateServer(node, updatedInfo);
}
void updateAdapter(String node, AdapterDynamicInfo updatedInfo)
{
_root.updateAdapter(node, updatedInfo);
}
//
// Other methods
//
void sessionLost()
{
_latestSerial = -1;
_writeSerial = -1;
_root.clear();
_sessionManager = null;
_admin = null;
}
boolean setConnectInfo(ConnectInfo info, Component parent,
Cursor oldCursor)
{
//
// Default locator
//
Ice.LocatorPrx defaultLocator = null;
try
{
defaultLocator = Ice.LocatorPrxHelper.
uncheckedCast(_communicator.stringToProxy(info.locatorProxy));
_communicator.setDefaultLocator(defaultLocator);
}
catch(Ice.LocalException e)
{
sessionLost();
parent.setCursor(oldCursor);
JOptionPane.showMessageDialog(
parent,
"The locator proxy is invalid: " + e.toString(),
"Invalid locator proxy",
JOptionPane.ERROR_MESSAGE);
return false;
}
//
// Session manager
//
try
{
_sessionManager = SessionManagerPrxHelper.
uncheckedCast(_communicator.stringToProxy(info.sessionManagerIdentity));
}
catch(Ice.LocalException e)
{
sessionLost();
parent.setCursor(oldCursor);
JOptionPane.showMessageDialog(
parent,
"The session manager identity is invalid: " + e.toString(),
"Invalid session manager",
JOptionPane.ERROR_MESSAGE);
return false;
}
//
// Admin
//
try
{
_admin = AdminPrxHelper.
uncheckedCast(_communicator.stringToProxy(info.adminIdentity));
}
catch(Ice.LocalException e)
{
sessionLost();
parent.setCursor(oldCursor);
JOptionPane.showMessageDialog(
parent,
"The admin identity is invalid: " + e.toString(),
"Invalid admin identity",
JOptionPane.ERROR_MESSAGE);
return false;
}
return true;
}
boolean save()
{
return true;
}
boolean updated()
{
return true;
}
void toggleSubstitute()
{
_substitute = !_substitute;
CommonBase node = (CommonBase)_tree.getLastSelectedPathComponent();
if(node != null)
{
node.displayProperties();
}
}
public boolean substitute()
{
return _substitute;
}
public AdminPrx getAdmin()
{
return _admin;
}
public SessionManagerPrx getSessionManager()
{
return _sessionManager;
}
public StatusBar getStatusBar()
{
return _statusBar;
}
public void setTree(JTree tree)
{
_tree = tree;
_tree.getActionMap().put("copy", _copy);
_tree.getActionMap().put("paste", _paste);
}
public JTree getTree()
{
return _tree;
}
public void setPropertiesFrame(SimpleInternalFrame frame)
{
_propertiesFrame = frame;
}
public SimpleInternalFrame getPropertiesFrame()
{
return _propertiesFrame;
}
public JFrame getMainFrame()
{
return _mainFrame;
}
Model(JFrame mainFrame, String[] args, Preferences prefs, StatusBar statusBar)
{
_mainFrame = mainFrame;
_communicator = Ice.Util.initialize(args);
_prefs = prefs;
_statusBar = statusBar;
_root = new Root(this);
_treeModel = new TreeModelI(_root);
//
// Actions
//
_connect = new AbstractAction("Connect...", Utils.getIcon("/icons/connect.gif"))
{
public void actionPerformed(ActionEvent e)
{
if(_latestSerial != -1 && _latestSerial == _writeSerial)
{
int saveFirst = JOptionPane.showConfirmDialog(
_mainFrame,
"Do you want to save your updates?",
"Save Confirmation",
JOptionPane.YES_NO_CANCEL_OPTION);
switch(saveFirst)
{
case JOptionPane.YES_OPTION:
if(saveUpdates())
{
_sessionKeeper.createSession(false);
}
break;
case JOptionPane.NO_OPTION:
discardUpdates(true);
break;
case JOptionPane.CANCEL_OPTION:
break;
default:
assert false;
}
}
else
{
_sessionKeeper.reconnect(true);
}
}
};
_connect.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("ctrl N"));
_save = new AbstractAction("Save", Utils.getIcon("/icons/save_edit.gif"))
{
public void actionPerformed(ActionEvent e)
{
saveUpdates();
}
};
_save.setEnabled(false);
_discard = new AbstractAction("Discard all updates...",
Utils.getIcon("/icons/undo_edit.gif"))
{
public void actionPerformed(ActionEvent e)
{
discardUpdates(false);
}
};
_discard.setEnabled(false);
_exit = new AbstractAction("Exit")
{
public void actionPerformed(ActionEvent e)
{
exit(0);
}
};
_exit.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt F4"));
_copy = new AbstractAction("Copy", Utils.getIcon("/icons/copy_edit.gif"))
{
public void actionPerformed(ActionEvent e)
{
CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
if(currentNode != null)
{
_copiedDescriptor = currentNode.copy();
_paste.setEnabled(_copiedDescriptor != null);
}
}
};
_copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("ctrl C"));
_paste = new AbstractAction("Paste", Utils.getIcon("/icons/paste_edit.gif"))
{
public void actionPerformed(ActionEvent e)
{
CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
if(currentNode != null)
{
currentNode.paste(_copiedDescriptor);
}
}
};
_paste.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("ctrl V"));
_paste.setEnabled(false);
_delete = new AbstractAction("Delete", Utils.getIcon("/icons/delete_edit.gif"))
{
public void actionPerformed(ActionEvent e)
{
CommonBase currentNode = (CommonBase)_tree.getLastSelectedPathComponent();
if(currentNode != null)
{
CommonBase parent = currentNode.getParent();
CommonBase toSelect = null;
if(parent != null)
{
int index = parent.getIndex(currentNode);
toSelect = (CommonBase)parent.getChildAt(index + 1);
if(toSelect == null)
{
if(index > 0)
{
toSelect = (CommonBase)parent.getChildAt(0);
}
else
{
toSelect = parent;
}
}
}
if(toSelect != null)
{
disableDisplay();
}
boolean destroyed = currentNode.destroy();
if(toSelect != null)
{
enableDisplay();
if(destroyed)
{
toSelect = findNewNode(toSelect.getPath());
_tree.setSelectionPath(toSelect.getPath());
}
}
}
}
};
_delete.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
_substituteVar = new AbstractAction("${}")
{
public void actionPerformed(ActionEvent e)
{
toggleSubstitute();
}
};
_substituteVar.putValue(Action.SHORT_DESCRIPTION,
"Substitute variables and parameters in servers' properties");
_about = new AbstractAction("About...")
{
public void actionPerformed(ActionEvent e)
{
// TODO: implement
}
};
}
void showMainFrame()
{
if(!loadWindowPrefs())
{
_mainFrame.setLocation(100, 100);
_mainFrame.pack();
}
_mainFrame.setVisible(true);
}
void exit(int status)
{
storeWindowPrefs();
try
{
_communicator.destroy();
}
catch(Ice.LocalException e)
{
// TODO: log error
}
_mainFrame.dispose();
Runtime.getRuntime().exit(status);
}
private boolean loadWindowPrefs()
{
try
{
if(!_prefs.nodeExists("Window"))
{
return false;
}
}
catch(BackingStoreException e)
{
return false;
}
Preferences windowPrefs = _prefs.node("Window");
int x = windowPrefs.getInt("x", 0);
int y = windowPrefs.getInt("y", 0);
int width = windowPrefs.getInt("width", 0);
int height = windowPrefs.getInt("height", 0);
_mainFrame.setBounds(new Rectangle(x, y, width, height));
if(windowPrefs.getBoolean("maximized", false))
{
_mainFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
}
return true;
}
private void storeWindowPrefs()
{
Preferences windowPrefs = _prefs.node("Window");
Rectangle rect = _mainFrame.getBounds();
windowPrefs.putInt("x", rect.x);
windowPrefs.putInt("y", rect.y);
windowPrefs.putInt("width", rect.width);
windowPrefs.putInt("height", rect.height);
windowPrefs.putBoolean("maximized",
_mainFrame.getExtendedState() == Frame.MAXIMIZED_BOTH);
}
SessionKeeper getSessionKeeper()
{
if(_sessionKeeper == null)
{
_sessionKeeper = new SessionKeeper(this);
}
return _sessionKeeper;
}
JToolBar createToolBar()
{
return new ToolBar();
}
JMenuBar createMenuBar()
{
return new MenuBar();
}
Preferences getPrefs()
{
return _prefs;
}
private Ice.Communicator _communicator;
private Preferences _prefs;
private StatusBar _statusBar;
private SessionManagerPrx _sessionManager;
private AdminPrx _admin;
private Root _root;
private TreeModelI _treeModel;
private int _latestSerial = -1;
private int _writeSerial = -1;
private JTree _tree;
private boolean _substitute = false;
private boolean _displayEnabled = true;
private SimpleInternalFrame _propertiesFrame;
private JFrame _mainFrame;
private SessionKeeper _sessionKeeper;
private Object _copiedDescriptor;
//
// Actions
//
private Action _connect;
private Action _save;
private Action _discard;
private Action _exit;
private Action _copy;
private Action _paste;
private Action _delete;
private Action _about;
private Action _substituteVar;
}
|