~ubuntu-branches/ubuntu/wily/389-ds-console/wily-proposed

« back to all changes in this revision

Viewing changes to src/com/netscape/admin/dirserv/panel/replication/AgreementInfoPanel.java

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-03-15 19:58:37 UTC
  • Revision ID: package-import@ubuntu.com-20120315195837-296zyft51thld8q7
Tags: upstream-1.2.6
ImportĀ upstreamĀ versionĀ 1.2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** BEGIN COPYRIGHT BLOCK
 
2
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 
3
 * Copyright (C) 2005 Red Hat, Inc.
 
4
 * All rights reserved.
 
5
 * 
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation version 2 of the License.
 
9
 * 
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * 
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 * END COPYRIGHT BLOCK **/
 
19
 
 
20
package com.netscape.admin.dirserv.panel.replication;
 
21
 
 
22
import java.awt.*;
 
23
import java.util.*;
 
24
import java.text.*;
 
25
import java.awt.event.*;
 
26
import javax.swing.*;
 
27
import javax.swing.event.*;
 
28
import com.netscape.admin.dirserv.*;
 
29
import com.netscape.admin.dirserv.logging.DSLogViewerModel;
 
30
import com.netscape.admin.dirserv.panel.*;
 
31
import com.netscape.management.client.*;
 
32
import com.netscape.management.client.console.*;
 
33
import com.netscape.management.client.util.*;
 
34
import netscape.ldap.*;
 
35
 
 
36
 
 
37
/**
 
38
 * Information Panel for Replication Agreement
 
39
 *
 
40
 * @author  jpanchen
 
41
 * @version %I%, %G%
 
42
 * @date                11/11/97
 
43
 * @see     com.netscape.admin.dirserv.panel.replication
 
44
 */
 
45
public class AgreementInfoPanel extends ReplicationBlankPanel
 
46
    implements ITabPanel, DocumentListener {
 
47
 
 
48
    /*==========================================================
 
49
     * constructors
 
50
     *==========================================================*/
 
51
 
 
52
    /**
 
53
     * public constructor
 
54
     * construction is delayed until selected.
 
55
     * @param owner resource object owner
 
56
     */
 
57
    AgreementInfoPanel(IAgreementPanel parent, int index) {
 
58
        super(parent, index);
 
59
        setTitle(_resource.getString("replication-info-tab","label"));
 
60
        if(_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD)
 
61
        {
 
62
                _helpToken = "configuration-sync-summary-help";
 
63
        } else {
 
64
                _helpToken = "configuration-replication-summary-help";
 
65
        }               
 
66
                _refreshWhenSelect = false;
 
67
    }
 
68
 
 
69
        /*==========================================================
 
70
         * public methods
 
71
     *==========================================================*/
 
72
 
 
73
    public void init() {
 
74
                int space = UIFactory.getComponentSpace();
 
75
                GridBagLayout gb = new GridBagLayout();
 
76
            GridBagConstraints gbc = new GridBagConstraints();
 
77
                ReplicationTool.resetGBC(gbc);
 
78
                _myPanel.setLayout(gb);
 
79
        _myPanel.setBackground(getBackground());
 
80
 
 
81
        //======== Top Panel ===========================
 
82
        JPanel top = new JPanel();
 
83
        GridBagLayout gb1 = new GridBagLayout();
 
84
        top.setLayout(gb1);
 
85
        top.setBackground(getBackground());
 
86
        ReplicationTool.resetGBC(gbc);
 
87
        gbc.anchor = gbc.NORTH;
 
88
        gbc.gridwidth = gbc.REMAINDER;
 
89
        gbc.weightx = 1.0;
 
90
        gb.setConstraints(top, gbc);
 
91
        _myPanel.add(top);
 
92
 
 
93
        //add icon
 
94
        RemoteImage img;
 
95
        String description;
 
96
        if (_agreement.getAgreementType() ==
 
97
                        ReplicationAgreement.AGREEMENT_TYPE_MMR) {
 
98
            img = ReplicationTool.getImage(_resource.getString(
 
99
                                "replication-info","mmrIcon"));
 
100
            description = _resource.getString("replication-info","mmrDesc");
 
101
        } else if (_agreement.getAgreementType() ==
 
102
        ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
103
              img = ReplicationTool.getImage(_resource.getString(
 
104
                "replication-info","mmrIcon"));
 
105
                  description = "This is an Active Directory agreement";
 
106
        } else {
 
107
            img = ReplicationTool.getImage(_resource.getString(
 
108
                                "replication-info","legacyrIcon"));
 
109
            description = _resource.getString("replication-info","legacyrDesc");
 
110
        }
 
111
 
 
112
        JLabel iconLabel = makeJLabel(img);
 
113
        ReplicationTool.resetGBC(gbc);
 
114
        gbc.fill = gbc.NONE;
 
115
        gbc.insets = ReplicationTool.DEFAULT_EMPTY_INSETS; 
 
116
        gb1.setConstraints(iconLabel, gbc);
 
117
        top.add(iconLabel);
 
118
 
 
119
        JPanel titlePanel = new JPanel();
 
120
        GridBagLayout gb1a = new GridBagLayout();
 
121
        titlePanel.setLayout(gb1a);
 
122
        titlePanel.setBackground(getBackground());
 
123
        ReplicationTool.resetGBC(gbc);
 
124
        gbc.weightx = 1.0;
 
125
        gbc.gridwidth = gbc.REMAINDER;
 
126
        gb1.setConstraints(titlePanel, gbc);
 
127
        top.add(titlePanel);
 
128
 
 
129
        JLabel label = makeJLabel(description);
 
130
                label.setLabelFor(this);
 
131
        ReplicationTool.resetGBC(gbc);
 
132
        gbc.gridwidth = gbc.REMAINDER;
 
133
        gbc.gridheight = gbc.REMAINDER;
 
134
        gbc.insets = ReplicationTool.DEFAULT_EMPTY_INSETS;
 
135
        gbc.weightx=1.0;
 
136
        gb1a.setConstraints(label, gbc);
 
137
        titlePanel.add(label);
 
138
 
 
139
        //name
 
140
        JLabel name = makeJLabel(_resource.getString(
 
141
                        "replication-destination-description","label"));
 
142
        ReplicationTool.resetGBC(gbc);
 
143
        gbc.anchor = gbc.EAST;
 
144
        gbc.fill = gbc.NONE;
 
145
        gbc.insets = new Insets(10,space,0,space);
 
146
        gb1.setConstraints(name, gbc);
 
147
        top.add(name);
 
148
 
 
149
        _nameTextField= makeJTextField("");
 
150
                name.setLabelFor(_nameTextField);
 
151
        //_nameTextField.getDocument().addDocumentListener(this);
 
152
        _activeColor = name.getBackground();
 
153
        ReplicationTool.resetGBC(gbc);
 
154
        gbc.gridwidth = gbc.REMAINDER;
 
155
        gbc.weightx= 1.0;
 
156
        gbc.insets = new Insets(10,space,0,10);
 
157
        gb1.setConstraints(_nameTextField, gbc);
 
158
        top.add(_nameTextField);
 
159
 
 
160
 
 
161
        // create DSEntry associated with name to ensure
 
162
        // proper coloring and button enabling
 
163
                entries = getDSEntrySet();
 
164
        _nameDSEntry = new DSEntryTextStrict (_agreement.getDescription(), _nameTextField, name);
 
165
        setComponentTable(_nameTextField, _nameDSEntry);
 
166
                entries.add( _agreement.getEntryDN(), ATTR_DESCRIPTION, _nameDSEntry );
 
167
                
 
168
 
 
169
        //========= summary panel =======================
 
170
                String title = _resource.getString("replication-info-summary","label");
 
171
        JPanel summary = new GroupPanel(title);        
 
172
                GridBagLayout gb2 = new GridBagLayout();
 
173
                summary.setLayout(gb2);
 
174
        ReplicationTool.resetGBC(gbc);
 
175
        gbc.gridwidth = gbc.REMAINDER;
 
176
        gbc.weightx = 1.0;
 
177
        gb.setConstraints(summary, gbc);
 
178
        _myPanel.add(summary);
 
179
 
 
180
        //from
 
181
        JLabel from;
 
182
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
183
            from = makeJLabel(_resource.getString(
 
184
                    "sync-info-summary-from","label"));
 
185
        } else {
 
186
            from = makeJLabel(_resource.getString(
 
187
                        "replication-info-summary-from","label"));
 
188
        }
 
189
        from.setToolTipText(_resource.getString(
 
190
                        "replication-info-summary-from","ttip"));
 
191
        ReplicationTool.resetGBC(gbc);
 
192
        gbc.anchor = gbc.EAST;
 
193
        gbc.fill = gbc.NONE;
 
194
        gb2.setConstraints(from, gbc);
 
195
        summary.add(from);
 
196
 
 
197
        _fromText = makeJLabel("");
 
198
                from.setLabelFor(_fromText);
 
199
        ReplicationTool.resetGBC(gbc);
 
200
        gbc.gridwidth = gbc.REMAINDER;
 
201
        gbc.anchor = gbc.WEST;
 
202
        gbc.weightx = 1.0;
 
203
        gb2.setConstraints(_fromText, gbc);
 
204
        summary.add(_fromText);
 
205
 
 
206
        //to
 
207
        JLabel to;
 
208
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
209
            to = makeJLabel(_resource.getString(
 
210
                    "sync-info-summary-to","label"));
 
211
        } else {
 
212
            to = makeJLabel(_resource.getString(
 
213
                        "replication-info-summary-to","label"));
 
214
        }
 
215
        to.setToolTipText(_resource.getString(
 
216
                        "replication-info-summary-to","ttip"));
 
217
        ReplicationTool.resetGBC(gbc);
 
218
        gbc.anchor = gbc.EAST;
 
219
        gbc.fill = gbc.NONE;
 
220
        gb2.setConstraints(to, gbc);
 
221
        summary.add(to);
 
222
 
 
223
        _toText = makeJLabel("");
 
224
                to.setLabelFor(_toText);
 
225
        ReplicationTool.resetGBC(gbc);
 
226
        gbc.gridwidth = gbc.REMAINDER;
 
227
        gbc.anchor = gbc.WEST;
 
228
        gb2.setConstraints(_toText, gbc);
 
229
        summary.add(_toText);
 
230
 
 
231
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
232
            // DS Subtree
 
233
            JLabel dsRepSubtree = makeJLabel(_resource.getString("replication-info-summary-ds-subtree","label")); //XXX
 
234
            dsRepSubtree.setToolTipText(_resource.getString(
 
235
                "replication-info-summary-ds-subtree","ttip"));
 
236
            ReplicationTool.resetGBC(gbc);
 
237
            gbc.anchor = gbc.EAST;
 
238
            gbc.fill = gbc.NONE;
 
239
          //  gbc.insets = new Insets(space,space,10,space);
 
240
            gb2.setConstraints(dsRepSubtree, gbc);
 
241
            summary.add(dsRepSubtree);
 
242
    
 
243
            _dsRepSubtreeText = makeJLabel();
 
244
                dsRepSubtree.setLabelFor(_dsRepSubtreeText);
 
245
            ReplicationTool.resetGBC(gbc);
 
246
            gbc.gridwidth = gbc.REMAINDER;
 
247
           // gbc.insets = new Insets(space,space,10,space);
 
248
            gbc.anchor = gbc.EAST;
 
249
            gb2.setConstraints(_dsRepSubtreeText, gbc);
 
250
            summary.add(_dsRepSubtreeText);
 
251
            
 
252
            // Win Subtree
 
253
        JLabel winRepSubtree = makeJLabel(_resource.getString("replication-info-summary-win-subtree","label")); //XXX
 
254
        winRepSubtree.setToolTipText(_resource.getString(
 
255
                        "replication-info-summary-win-subtree","ttip"));
 
256
        ReplicationTool.resetGBC(gbc);
 
257
            gbc.anchor = gbc.EAST;
 
258
        gbc.fill = gbc.NONE;
 
259
      //  gbc.insets = new Insets(space,space,10,space);
 
260
        gb2.setConstraints(winRepSubtree, gbc);
 
261
        summary.add(winRepSubtree);
 
262
 
 
263
        _winRepSubtreeText = makeJLabel();
 
264
                winRepSubtree.setLabelFor(_winRepSubtreeText);
 
265
        ReplicationTool.resetGBC(gbc);
 
266
        gbc.gridwidth = gbc.REMAINDER;
 
267
       // gbc.insets = new Insets(space,space,10,space);
 
268
            gbc.anchor = gbc.EAST;
 
269
        gb2.setConstraints(_winRepSubtreeText, gbc);
 
270
        summary.add(_winRepSubtreeText);
 
271
        }
 
272
        
 
273
        //suffix
 
274
        JLabel suffix = makeJLabel(_resource.getString(
 
275
                        "replication-info-summary-subtree","label"));
 
276
        suffix.setToolTipText(_resource.getString(
 
277
                        "replication-info-summary-subtree","ttip"));
 
278
        ReplicationTool.resetGBC(gbc);
 
279
        gbc.anchor = gbc.EAST;
 
280
        gbc.fill = gbc.NONE;
 
281
        gbc.insets = new Insets(space,space,10,space);
 
282
        gb2.setConstraints(suffix, gbc);
 
283
        summary.add(suffix);
 
284
 
 
285
        _suffixText = makeJLabel();
 
286
                suffix.setLabelFor(_suffixText);
 
287
        ReplicationTool.resetGBC(gbc);
 
288
        gbc.gridwidth = gbc.REMAINDER;
 
289
        gbc.insets = new Insets(space,space,10,space);
 
290
        gbc.anchor = gbc.WEST;
 
291
        gb2.setConstraints(_suffixText, gbc);
 
292
        summary.add(_suffixText);
 
293
        
 
294
 
 
295
 
 
296
        //========== status panel ======================
 
297
                title = _resource.getString("replication-info-status","label");
 
298
        JPanel status = new GroupPanel(title);        
 
299
                GridBagLayout gb3 = new GridBagLayout();
 
300
                status.setLayout(gb3);
 
301
        ReplicationTool.resetGBC(gbc);
 
302
        gbc.anchor = gbc.NORTH;
 
303
        gbc.gridwidth = gbc.REMAINDER;        
 
304
        gbc.weightx = 1.0;
 
305
                gbc.fill = gbc.HORIZONTAL;
 
306
        
 
307
        gb.setConstraints(status, gbc);
 
308
        _myPanel.add(status);
 
309
 
 
310
        //update in progress?
 
311
        JLabel lInProgress = makeJLabel(_resource.getString(
 
312
                        "replication-info-status-inProgress","label"));
 
313
        ReplicationTool.resetGBC(gbc);
 
314
        gbc.anchor = gbc.EAST;
 
315
        gbc.fill = gbc.NONE;
 
316
                gbc.insets = new Insets(space,space,0,space);
 
317
        gb3.setConstraints(lInProgress, gbc);
 
318
        status.add(lInProgress);
 
319
 
 
320
        _valInProgress = makeJLabel("");
 
321
                lInProgress.setLabelFor(_valInProgress);
 
322
        ReplicationTool.resetGBC(gbc);
 
323
        gbc.anchor = gbc.WEST;
 
324
        gbc.gridwidth = gbc.REMAINDER;
 
325
        gbc.weightx= 1.0;
 
326
                gbc.insets = new Insets(space,space,0,space);
 
327
        gb3.setConstraints(_valInProgress, gbc);
 
328
        status.add(_valInProgress);
 
329
 
 
330
        //lastUpdate
 
331
        JLabel lastUpdate = makeJLabel(_resource.getString(
 
332
                        "replication-info-status-lastUpdate","label"));
 
333
        ReplicationTool.resetGBC(gbc);
 
334
        gbc.anchor = gbc.EAST;
 
335
        gbc.fill = gbc.NONE;
 
336
                gbc.insets = new Insets(space,space,0,space);
 
337
        gb3.setConstraints(lastUpdate, gbc);
 
338
        status.add(lastUpdate);
 
339
 
 
340
        _lastUpdateText = makeJLabel("");
 
341
                lastUpdate.setLabelFor(_lastUpdateText);
 
342
        ReplicationTool.resetGBC(gbc);
 
343
        gbc.anchor = gbc.WEST;
 
344
        gbc.gridwidth = gbc.REMAINDER;
 
345
        gbc.weightx= 1.0;
 
346
                gbc.insets = new Insets(space,space,0,space);
 
347
        gb3.setConstraints(_lastUpdateText, gbc);
 
348
        status.add(_lastUpdateText);
 
349
 
 
350
        //n changes sent last update
 
351
        JLabel lNChangesLast = makeJLabel(_resource.getString(
 
352
                        "replication-info-status-nChangesLast","label"));
 
353
        ReplicationTool.resetGBC(gbc);
 
354
        gbc.anchor = gbc.EAST;
 
355
        gbc.fill = gbc.NONE;
 
356
        gbc.insets = new Insets(space,space,0,space);
 
357
        gb3.setConstraints(lNChangesLast, gbc);
 
358
        status.add(lNChangesLast);
 
359
 
 
360
        _valNChangesLast = makeJLabel("");
 
361
                lNChangesLast.setLabelFor(_valNChangesLast);
 
362
        ReplicationTool.resetGBC(gbc);
 
363
        gbc.gridwidth = gbc.REMAINDER;
 
364
        gbc.anchor = gbc.WEST;
 
365
        gbc.insets = new Insets(space,space,0,space);
 
366
        gb3.setConstraints(_valNChangesLast, gbc);
 
367
        status.add(_valNChangesLast);
 
368
 
 
369
        //last update begin time
 
370
        JLabel lLastUpdateBegin = makeJLabel(_resource.getString(
 
371
                        "replication-info-status-lastUpdateBegin","label"));
 
372
        ReplicationTool.resetGBC(gbc);
 
373
        gbc.anchor = gbc.EAST;
 
374
        gbc.fill = gbc.NONE;
 
375
        gbc.insets = new Insets(space,space,0,space);
 
376
        gb3.setConstraints(lLastUpdateBegin, gbc);
 
377
        status.add(lLastUpdateBegin);
 
378
 
 
379
        _valLastUpdateBegin = makeJLabel("");
 
380
                lLastUpdateBegin.setLabelFor(_valLastUpdateBegin);
 
381
        ReplicationTool.resetGBC(gbc);
 
382
        gbc.gridwidth = gbc.REMAINDER;
 
383
        gbc.anchor = gbc.WEST;
 
384
        gbc.insets = new Insets(space,space,0,space);
 
385
        gb3.setConstraints(_valLastUpdateBegin, gbc);
 
386
        status.add(_valLastUpdateBegin);
 
387
 
 
388
        //last update end time
 
389
        JLabel lLastUpdateEnd = makeJLabel(_resource.getString(
 
390
                        "replication-info-status-lastUpdateEnd","label"));
 
391
        ReplicationTool.resetGBC(gbc);
 
392
        gbc.anchor = gbc.EAST;
 
393
        gbc.fill = gbc.NONE;
 
394
        gbc.insets = new Insets(space,space,0,space);
 
395
                gbc.insets.bottom = ReplicationTool.BOTTOM_INSETS.bottom;
 
396
        gb3.setConstraints(lLastUpdateEnd, gbc);
 
397
        status.add(lLastUpdateEnd);
 
398
 
 
399
        _valLastUpdateEnd = makeJLabel("");
 
400
                lLastUpdateEnd.setLabelFor(_valLastUpdateEnd);
 
401
        ReplicationTool.resetGBC(gbc);
 
402
        gbc.gridwidth = gbc.REMAINDER;
 
403
        gbc.anchor = gbc.WEST;
 
404
        gbc.insets = new Insets(space,space,0,space);
 
405
                gbc.insets.bottom = ReplicationTool.BOTTOM_INSETS.bottom;
 
406
        gb3.setConstraints(_valLastUpdateEnd, gbc);
 
407
        status.add(_valLastUpdateEnd);
 
408
 
 
409
 
 
410
 
 
411
       //========== Consumer init status panel ======================
 
412
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
413
                title = _resource.getString("sync-info-fullsync-status","label");
 
414
        } else {
 
415
                title = _resource.getString("replication-info-initconsumer-status","label");
 
416
        }
 
417
        _consumerInitPanel = new GroupPanel(title);                             
 
418
                GridBagLayout gb4 = new GridBagLayout();
 
419
                _consumerInitPanel.setLayout(gb4);        
 
420
        ReplicationTool.resetGBC(gbc);
 
421
        gbc.anchor = gbc.NORTH;
 
422
        gbc.gridwidth = gbc.REMAINDER;
 
423
        gbc.gridheight = gbc.REMAINDER;
 
424
        gbc.weightx = 1.0;
 
425
                gbc.fill = gbc.HORIZONTAL;
 
426
                
 
427
        gb.setConstraints(_consumerInitPanel, gbc);
 
428
        _myPanel.add(_consumerInitPanel);
 
429
                
 
430
                gbc.weighty = 1.0;
 
431
                gbc.fill = gbc.VERTICAL;
 
432
                _myPanel.add(Box.createVerticalGlue(), gbc);
 
433
 
 
434
        //consumer initialization in progress?
 
435
        JLabel lConsumerInitializationInProgress;
 
436
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
437
            lConsumerInitializationInProgress = makeJLabel(_resource.getString(
 
438
                    "sync-info-fullsync-status-inProgress","label"));
 
439
        } else {
 
440
            lConsumerInitializationInProgress = makeJLabel(_resource.getString(
 
441
                        "replication-info-initconsumer-status-inProgress","label"));
 
442
        }
 
443
        ReplicationTool.resetGBC(gbc);
 
444
        gbc.anchor = gbc.EAST;
 
445
        gbc.fill = gbc.NONE;
 
446
                gbc.insets = new Insets(space,space,0,space);
 
447
        gb4.setConstraints(lConsumerInitializationInProgress, gbc);
 
448
        _consumerInitPanel.add(lConsumerInitializationInProgress);
 
449
 
 
450
        _valConsumerInitializationInProgress = makeJLabel("");
 
451
                lConsumerInitializationInProgress.setLabelFor(_valConsumerInitializationInProgress);
 
452
        ReplicationTool.resetGBC(gbc);
 
453
        gbc.anchor = gbc.WEST;
 
454
        gbc.gridwidth = gbc.REMAINDER;
 
455
        gbc.weightx= 1.0;
 
456
                gbc.insets = new Insets(space,space,0,space);
 
457
        gb4.setConstraints(_valConsumerInitializationInProgress, gbc);
 
458
        _consumerInitPanel.add(_valConsumerInitializationInProgress);           
 
459
 
 
460
        //last Consumer Initialization Status
 
461
        JLabel consumerInitializationStatus;
 
462
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
463
            consumerInitializationStatus = makeJLabel(_resource.getString(
 
464
                    "sync-info-fullsync-status-lastUpdate","label"));
 
465
        } else {
 
466
            consumerInitializationStatus = makeJLabel(_resource.getString(
 
467
                        "replication-info-initconsumer-status-lastUpdate","label"));
 
468
        }
 
469
        ReplicationTool.resetGBC(gbc);
 
470
        gbc.anchor = gbc.EAST;
 
471
        gbc.fill = gbc.NONE;
 
472
                gbc.insets = new Insets(space,space,0,space);
 
473
        gb4.setConstraints(consumerInitializationStatus, gbc);
 
474
        _consumerInitPanel.add(consumerInitializationStatus);
 
475
 
 
476
        _consumerInitializationStatus = makeJLabel("");
 
477
                consumerInitializationStatus.setLabelFor(_consumerInitializationStatus);
 
478
        ReplicationTool.resetGBC(gbc);
 
479
        gbc.anchor = gbc.WEST;
 
480
        gbc.gridwidth = gbc.REMAINDER;
 
481
        gbc.weightx= 1.0;
 
482
                gbc.insets = new Insets(space,space,0,space);
 
483
        gb4.setConstraints(_consumerInitializationStatus, gbc);
 
484
        _consumerInitPanel.add(_consumerInitializationStatus);   
 
485
 
 
486
        //last consumer initialization begin time
 
487
        JLabel lConsumerInitializationBegin;
 
488
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
489
            lConsumerInitializationBegin = makeJLabel(_resource.getString(
 
490
                    "sync-info-fullsync-status-begin","label"));
 
491
        } else {
 
492
            lConsumerInitializationBegin = makeJLabel(_resource.getString(
 
493
                        "replication-info-initconsumer-status-begin","label"));
 
494
        }
 
495
        ReplicationTool.resetGBC(gbc);
 
496
        gbc.anchor = gbc.EAST;
 
497
        gbc.fill = gbc.NONE;
 
498
        gbc.insets = new Insets(space,space,0,space);
 
499
        gb4.setConstraints(lConsumerInitializationBegin, gbc);
 
500
        _consumerInitPanel.add(lConsumerInitializationBegin);
 
501
 
 
502
        _valConsumerInitializationBegin = makeJLabel("");
 
503
                lConsumerInitializationBegin.setLabelFor(_valConsumerInitializationBegin);
 
504
        ReplicationTool.resetGBC(gbc);
 
505
        gbc.gridwidth = gbc.REMAINDER;
 
506
        gbc.anchor = gbc.WEST;
 
507
        gbc.insets = new Insets(space,space,0,space);
 
508
        gb4.setConstraints(_valConsumerInitializationBegin, gbc);
 
509
        _consumerInitPanel.add(_valConsumerInitializationBegin);
 
510
 
 
511
        //last consumer initialization end time
 
512
        JLabel lConsumerInitializationEnd;
 
513
        if (_agreement.getAgreementType() == ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
514
            lConsumerInitializationEnd = makeJLabel(_resource.getString(
 
515
                    "sync-info-fullsync-status-end","label"));
 
516
        } else {
 
517
            lConsumerInitializationEnd = makeJLabel(_resource.getString(
 
518
                        "replication-info-initconsumer-status-end","label"));
 
519
        }
 
520
        ReplicationTool.resetGBC(gbc);
 
521
        gbc.anchor = gbc.EAST;
 
522
        gbc.fill = gbc.NONE;
 
523
        gbc.insets = new Insets(space,space,0,space);
 
524
                gbc.insets.bottom = ReplicationTool.BOTTOM_INSETS.bottom;
 
525
        gb4.setConstraints(lConsumerInitializationEnd, gbc);
 
526
        _consumerInitPanel.add(lConsumerInitializationEnd);
 
527
 
 
528
        _valConsumerInitializationEnd = makeJLabel("");
 
529
                lConsumerInitializationEnd.setLabelFor(_valConsumerInitializationEnd);
 
530
        ReplicationTool.resetGBC(gbc);
 
531
        gbc.gridwidth = gbc.REMAINDER;
 
532
        gbc.anchor = gbc.WEST;
 
533
        gbc.insets = new Insets(space,space,0,space);
 
534
                gbc.insets.bottom = ReplicationTool.BOTTOM_INSETS.bottom;
 
535
        gb4.setConstraints(_valConsumerInitializationEnd, gbc);
 
536
        _consumerInitPanel.add(_valConsumerInitializationEnd);
 
537
 
 
538
        initialize ();
 
539
    }
 
540
 
 
541
    /**
 
542
      * Called when the object is selected.
 
543
      */
 
544
    public void select(IResourceObject parent, IPage viewInstance) {
 
545
        super.select(parent, viewInstance);
 
546
        invalidate();
 
547
        validate();
 
548
        repaint();
 
549
    }
 
550
 
 
551
    //===== ITabPanel interface functions =========
 
552
    public boolean validateEntries() {
 
553
 
 
554
        /* now all validation is done through DSEntry
 
555
           provided mechanism before the Save button
 
556
           is enabled. So we don't need to do anyhting 
 
557
           here                                        */
 
558
 
 
559
        return true;
 
560
    }
 
561
 
 
562
    public void getUpdateInfo( Object inf ) {
 
563
                AgreementWizardInfo info = (AgreementWizardInfo)inf;
 
564
        info.setDescription(_nameTextField.getText());
 
565
    }
 
566
 
 
567
    public boolean refresh() {
 
568
                super.refresh();
 
569
        populateData();
 
570
 
 
571
            return true;
 
572
    }
 
573
 
 
574
        public void resetCallback() {
 
575
                populateData();
 
576
                clearDirtyFlag();
 
577
        }
 
578
 
 
579
    /*==========================================================
 
580
     * private methods
 
581
     *==========================================================*/
 
582
    /**
 
583
     * Populate the UI with data
 
584
     */
 
585
    protected void populateData() {
 
586
                
 
587
        _agreement.updateAgreementFromServer();
 
588
        
 
589
        //              _nameDSEntry.fakeInitModel (_agreement.getNickname());
 
590
        _nameTextField.setText( _agreement.getDescription());
 
591
        _fromText.setText(_agreement.getSupplierHost() + ":" +
 
592
                          _agreement.getSupplierPort());
 
593
        _toText.setText(_agreement.getConsumerHost() + ":" +
 
594
                        _agreement.getConsumerPort());  
 
595
        _suffixText.setText(_agreement.getReplicatedSubtree());
 
596
 if (_agreement.getAgreementType() ==
 
597
        ReplicationAgreement.AGREEMENT_TYPE_AD) {
 
598
  _winRepSubtreeText.setText(((ActiveDirectoryAgreement)_agreement).getWinRepArea());
 
599
  _dsRepSubtreeText.setText(((ActiveDirectoryAgreement)_agreement).getDSRepArea());
 
600
 }
 
601
  // status
 
602
        _lastUpdateText.setText(ReplicationTool.convertStatusMessage(
 
603
                                                                                                                                _agreement.getLastUpdateStatus()));
 
604
        _valInProgress.setText(_agreement.getInProgress());
 
605
        _valNChangesLast.setText(_agreement.getNChangesLast());
 
606
        _valLastUpdateBegin.setText(_agreement.getLastUpdateBegin());
 
607
        _valLastUpdateEnd.setText(_agreement.getLastUpdateEnd());
 
608
  
 
609
        // consumer initialization status
 
610
        if (!_agreement.getConsumerInitializationBegin().equals(
 
611
                                                                                                                        _resource.getString("replication-agreement", 
 
612
                                                                                                                                                                "initconsumer-begin-unknown-value"))) {
 
613
                _consumerInitPanel.setVisible(true);
 
614
                _consumerInitializationStatus.setText(ReplicationTool.convertStatusMessage(
 
615
                                                                                                                                                                  _agreement.getConsumerInitializationStatus()));
 
616
                _valConsumerInitializationInProgress.setText(_agreement.getConsumerInitializationInProgress()); 
 
617
                _valConsumerInitializationBegin.setText(_agreement.getConsumerInitializationBegin());
 
618
                _valConsumerInitializationEnd.setText(_agreement.getConsumerInitializationEnd());
 
619
        } else {
 
620
                _consumerInitPanel.setVisible(false);           
 
621
        }
 
622
    }
 
623
    
 
624
    //get replication status
 
625
    private void updateReplicaStatus() {
 
626
        _agreement.updateReplicaStatus();
 
627
    }
 
628
 
 
629
    /*==========================================================
 
630
     * variables
 
631
     *==========================================================*/
 
632
    
 
633
    JLabel _fromText, _toText, _suffixText, _winRepSubtreeText, _dsRepSubtreeText;
 
634
    JTextField _nameTextField;
 
635
    // status GUI
 
636
    JLabel _lastUpdateText, _valInProgress, _valNChangesLast,
 
637
        _valLastUpdateBegin, _valLastUpdateEnd,
 
638
                _consumerInitializationStatus, _valConsumerInitializationInProgress, 
 
639
                _valConsumerInitializationBegin, _valConsumerInitializationEnd;
 
640
    JLabel domain;
 
641
    JPanel _consumerInitPanel;
 
642
                
 
643
    private DSEntryTextStrict _nameDSEntry;
 
644
    private DSEntrySet entries;
 
645
    private static final String ATTR_DESCRIPTION = "description";
 
646
 
 
647
}