@@ -104,11 +104,11 @@ protected DataViewComponent createComponent() {
104
104
dvc .addDetailsView (cpuViewSupport .getDetailsView (), DataViewComponent .TOP_LEFT );
105
105
106
106
final HeapViewSupport heapViewSupport = new HeapViewSupport (model );
107
- final PermGenViewSupport permGenViewSupport = new PermGenViewSupport (model );
107
+ final PermGenViewSupport permGenViewSupport = model . isMemoryMonitoringSupported () ? new PermGenViewSupport (model ) : null ;
108
108
dvc .configureDetailsArea (new DataViewComponent .DetailsAreaConfiguration (NbBundle .
109
109
getMessage (ApplicationMonitorView .class , "LBL_Memory" ), true ), DataViewComponent .TOP_RIGHT ); // NOI18N
110
110
dvc .addDetailsView (heapViewSupport .getDetailsView (), DataViewComponent .TOP_RIGHT );
111
- dvc .addDetailsView (permGenViewSupport .getDetailsView (), DataViewComponent .TOP_RIGHT );
111
+ if ( permGenViewSupport != null ) dvc .addDetailsView (permGenViewSupport .getDetailsView (), DataViewComponent .TOP_RIGHT );
112
112
113
113
final ClassesViewSupport classesViewSupport = new ClassesViewSupport (model );
114
114
dvc .configureDetailsArea (new DataViewComponent .DetailsAreaConfiguration (NbBundle .
@@ -125,7 +125,7 @@ public void run() {
125
125
masterViewSupport .refresh (model );
126
126
cpuViewSupport .refresh (model );
127
127
heapViewSupport .refresh (model );
128
- permGenViewSupport .refresh (model );
128
+ if ( permGenViewSupport != null ) permGenViewSupport .refresh (model );
129
129
classesViewSupport .refresh (model );
130
130
threadsViewSupport .refresh (model );
131
131
}
@@ -291,7 +291,7 @@ private static class CpuViewSupport extends JPanel {
291
291
292
292
public CpuViewSupport (ApplicationMonitorModel model ) {
293
293
initModels (model );
294
- initComponents (model );
294
+ initComponents ();
295
295
}
296
296
297
297
public DataViewComponent .DetailsView getDetailsView () {
@@ -355,23 +355,25 @@ private void initModels(ApplicationMonitorModel model) {
355
355
cpuMonitoringSupported = model .isCpuMonitoringSupported ();
356
356
gcMonitoringSupported = model .isGcMonitoringSupported ();
357
357
358
- SimpleXYChartDescriptor chartDescriptor =
359
- SimpleXYChartDescriptor .percent (false , 0.1d , model .getChartCache ());
358
+ if (cpuMonitoringSupported || gcMonitoringSupported ) {
359
+ SimpleXYChartDescriptor chartDescriptor =
360
+ SimpleXYChartDescriptor .percent (false , 0.1d , model .getChartCache ());
361
+
362
+ chartDescriptor .addLineItems (CPU_USAGE , GC_USAGE );
363
+ chartDescriptor .setDetailsItems (new String [] { CPU_USAGE , GC_USAGE });
360
364
361
- chartDescriptor . addLineItems ( CPU_USAGE , GC_USAGE );
362
- chartDescriptor . setDetailsItems ( new String [] { CPU_USAGE , GC_USAGE } );
365
+ chartSupport = ChartFactory . createSimpleXYChart ( chartDescriptor );
366
+ model . registerCpuChartSupport ( chartSupport );
363
367
364
- chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
365
- model .registerCpuChartSupport (chartSupport );
366
-
367
- chartSupport .setZoomingEnabled (!liveModel );
368
+ chartSupport .setZoomingEnabled (!liveModel );
369
+ }
368
370
}
369
371
370
- private void initComponents (ApplicationMonitorModel model ) {
372
+ private void initComponents () {
371
373
setLayout (new BorderLayout ());
372
374
setOpaque (false );
373
375
374
- if (model . isCpuMonitoringSupported () || model . isGcMonitoringSupported () ) {
376
+ if (cpuMonitoringSupported || gcMonitoringSupported ) {
375
377
add (chartSupport .getChart (), BorderLayout .CENTER );
376
378
chartSupport .updateDetails (new String [] { UNKNOWN , UNKNOWN });
377
379
} else {
@@ -394,7 +396,7 @@ private static class HeapViewSupport extends JPanel {
394
396
395
397
public HeapViewSupport (ApplicationMonitorModel model ) {
396
398
initModels (model );
397
- initComponents (model );
399
+ initComponents ();
398
400
}
399
401
400
402
public DataViewComponent .DetailsView getDetailsView () {
@@ -418,31 +420,33 @@ public void refresh(ApplicationMonitorModel model) {
418
420
private void initModels (ApplicationMonitorModel model ) {
419
421
liveModel = model .isLive ();
420
422
memoryMonitoringSupported = model .isMemoryMonitoringSupported ();
421
- heapName = model .getHeapName ();
423
+ heapName = memoryMonitoringSupported ? model .getHeapName () : NbBundle . getMessage ( ApplicationMonitorView . class , "LBL_Memory" ); // NOI18N
422
424
423
- String HEAP_SIZE = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Heap_size" ); // NOI18N
424
- String HEAP_SIZE_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Heap_size_leg" ,heapName ); // NOI18N
425
- String USED_HEAP = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_heap" ); // NOI18N
426
- String USED_HEAP_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_heap_leg" ,heapName .toLowerCase ()); // NOI18N
427
- String MAX_HEAP = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Max_Heap" ); // NOI18N
425
+ if (memoryMonitoringSupported ) {
426
+ String HEAP_SIZE = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Heap_size" ); // NOI18N
427
+ String HEAP_SIZE_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Heap_size_leg" ,heapName ); // NOI18N
428
+ String USED_HEAP = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_heap" ); // NOI18N
429
+ String USED_HEAP_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_heap_leg" ,heapName .toLowerCase ()); // NOI18N
430
+ String MAX_HEAP = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Max_Heap" ); // NOI18N
428
431
429
- SimpleXYChartDescriptor chartDescriptor =
430
- SimpleXYChartDescriptor .bytes (10 * 1024 * 1024 , false , model .getChartCache ());
432
+ SimpleXYChartDescriptor chartDescriptor =
433
+ SimpleXYChartDescriptor .bytes (10 * 1024 * 1024 , false , model .getChartCache ());
431
434
432
- chartDescriptor .addLineFillItems (HEAP_SIZE_LEG , USED_HEAP_LEG );
433
- chartDescriptor .setDetailsItems (new String [] { HEAP_SIZE , USED_HEAP , MAX_HEAP });
435
+ chartDescriptor .addLineFillItems (HEAP_SIZE_LEG , USED_HEAP_LEG );
436
+ chartDescriptor .setDetailsItems (new String [] { HEAP_SIZE , USED_HEAP , MAX_HEAP });
434
437
435
- chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
436
- model .registerHeapChartSupport (chartSupport );
437
-
438
- chartSupport .setZoomingEnabled (!liveModel );
438
+ chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
439
+ model .registerHeapChartSupport (chartSupport );
440
+
441
+ chartSupport .setZoomingEnabled (!liveModel );
442
+ }
439
443
}
440
444
441
- private void initComponents (ApplicationMonitorModel model ) {
445
+ private void initComponents () {
442
446
setLayout (new BorderLayout ());
443
447
setOpaque (false );
444
448
445
- if (model . isMemoryMonitoringSupported () ) {
449
+ if (memoryMonitoringSupported ) {
446
450
add (chartSupport .getChart (), BorderLayout .CENTER );
447
451
chartSupport .updateDetails (new String [] { UNKNOWN , UNKNOWN , UNKNOWN });
448
452
} else {
@@ -466,7 +470,7 @@ private static class PermGenViewSupport extends JPanel {
466
470
467
471
public PermGenViewSupport (ApplicationMonitorModel model ) {
468
472
initModels (model );
469
- initComponents (model );
473
+ initComponents ();
470
474
}
471
475
472
476
public DataViewComponent .DetailsView getDetailsView () {
@@ -492,29 +496,31 @@ private void initModels(ApplicationMonitorModel model) {
492
496
memoryMonitoringSupported = model .isMemoryMonitoringSupported ();
493
497
permgenName = model .getPermgenName ();
494
498
495
- String PERM_SIZE = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_PermGen_size" ); // NOI18N
496
- String PERM_SIZE_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_PermGen_size_leg" , permgenName ); // NOI18N
497
- String USED_PERM = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_PermGen" ); // NOI18N
498
- String USED_PERM_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_PermGen_leg" , permgenName ); // NOI18N
499
- String MAX_PERM = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Max_PermGen_size" ); // NOI18N
499
+ if (memoryMonitoringSupported ) {
500
+ String PERM_SIZE = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_PermGen_size" ); // NOI18N
501
+ String PERM_SIZE_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_PermGen_size_leg" , permgenName ); // NOI18N
502
+ String USED_PERM = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_PermGen" ); // NOI18N
503
+ String USED_PERM_LEG = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Used_PermGen_leg" , permgenName ); // NOI18N
504
+ String MAX_PERM = NbBundle .getMessage (ApplicationMonitorView .class , "LBL_Max_PermGen_size" ); // NOI18N
500
505
501
- SimpleXYChartDescriptor chartDescriptor =
502
- SimpleXYChartDescriptor .bytes (10 * 1024 * 1024 , false , model .getChartCache ());
506
+ SimpleXYChartDescriptor chartDescriptor =
507
+ SimpleXYChartDescriptor .bytes (10 * 1024 * 1024 , false , model .getChartCache ());
503
508
504
- chartDescriptor .addLineFillItems (PERM_SIZE_LEG , USED_PERM_LEG );
505
- chartDescriptor .setDetailsItems (new String [] { PERM_SIZE , USED_PERM , MAX_PERM });
509
+ chartDescriptor .addLineFillItems (PERM_SIZE_LEG , USED_PERM_LEG );
510
+ chartDescriptor .setDetailsItems (new String [] { PERM_SIZE , USED_PERM , MAX_PERM });
506
511
507
- chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
508
- model .registerPermGenChartSupport (chartSupport );
509
-
510
- chartSupport .setZoomingEnabled (!liveModel );
512
+ chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
513
+ model .registerPermGenChartSupport (chartSupport );
514
+
515
+ chartSupport .setZoomingEnabled (!liveModel );
516
+ }
511
517
}
512
518
513
- private void initComponents (ApplicationMonitorModel model ) {
519
+ private void initComponents () {
514
520
setLayout (new BorderLayout ());
515
521
setOpaque (false );
516
522
517
- if (model . isMemoryMonitoringSupported () ) {
523
+ if (memoryMonitoringSupported ) {
518
524
add (chartSupport .getChart (), BorderLayout .CENTER );
519
525
chartSupport .updateDetails (new String [] { UNKNOWN , UNKNOWN , UNKNOWN });
520
526
} else {
@@ -544,7 +550,7 @@ private static class ClassesViewSupport extends JPanel {
544
550
545
551
public ClassesViewSupport (ApplicationMonitorModel model ) {
546
552
initModels (model );
547
- initComponents (model );
553
+ initComponents ();
548
554
}
549
555
550
556
public DataViewComponent .DetailsView getDetailsView () {
@@ -571,24 +577,26 @@ private void initModels(ApplicationMonitorModel model) {
571
577
liveModel = model .isLive ();
572
578
classMonitoringSupported = model .isClassMonitoringSupported ();
573
579
574
- SimpleXYChartDescriptor chartDescriptor =
575
- SimpleXYChartDescriptor .decimal (100 , false , model .getChartCache ());
580
+ if (classMonitoringSupported ) {
581
+ SimpleXYChartDescriptor chartDescriptor =
582
+ SimpleXYChartDescriptor .decimal (100 , false , model .getChartCache ());
576
583
577
- chartDescriptor .addLineItems (TOTAL_LOADED_LEG , SHARED_LOADED_LEG );
578
- chartDescriptor .setDetailsItems (new String [] { TOTAL_LOADED , SHARED_LOADED ,
579
- TOTAL_UNLOADED , SHARED_UNLOADED });
584
+ chartDescriptor .addLineItems (TOTAL_LOADED_LEG , SHARED_LOADED_LEG );
585
+ chartDescriptor .setDetailsItems (new String [] { TOTAL_LOADED , SHARED_LOADED ,
586
+ TOTAL_UNLOADED , SHARED_UNLOADED });
580
587
581
- chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
582
- model .registerClassesChartSupport (chartSupport );
583
-
584
- chartSupport .setZoomingEnabled (!liveModel );
588
+ chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
589
+ model .registerClassesChartSupport (chartSupport );
590
+
591
+ chartSupport .setZoomingEnabled (!liveModel );
592
+ }
585
593
}
586
594
587
- private void initComponents (ApplicationMonitorModel model ) {
595
+ private void initComponents () {
588
596
setLayout (new BorderLayout ());
589
597
setOpaque (false );
590
598
591
- if (model . isClassMonitoringSupported () ) {
599
+ if (classMonitoringSupported ) {
592
600
add (chartSupport .getChart (), BorderLayout .CENTER );
593
601
chartSupport .updateDetails (new String [] { UNKNOWN , UNKNOWN , UNKNOWN , UNKNOWN });
594
602
} else {
@@ -618,7 +626,7 @@ private static class ThreadsViewSupport extends JPanel {
618
626
619
627
public ThreadsViewSupport (ApplicationMonitorModel model ) {
620
628
initModels (model );
621
- initComponents (model );
629
+ initComponents ();
622
630
}
623
631
624
632
public DataViewComponent .DetailsView getDetailsView () {
@@ -645,24 +653,26 @@ private void initModels(ApplicationMonitorModel model) {
645
653
liveModel = model .isLive ();
646
654
threadsMonitoringSupported = model .isThreadsMonitoringSupported ();
647
655
648
- SimpleXYChartDescriptor chartDescriptor =
649
- SimpleXYChartDescriptor .decimal (3 , false , model .getChartCache ());
656
+ if (threadsMonitoringSupported ) {
657
+ SimpleXYChartDescriptor chartDescriptor =
658
+ SimpleXYChartDescriptor .decimal (3 , false , model .getChartCache ());
650
659
651
- chartDescriptor .addLineItems (LIVE_LEG , DAEMON_LEG );
652
- chartDescriptor .setDetailsItems (new String [] { LIVE , DAEMON ,
653
- PEAK , STARTED });
660
+ chartDescriptor .addLineItems (LIVE_LEG , DAEMON_LEG );
661
+ chartDescriptor .setDetailsItems (new String [] { LIVE , DAEMON ,
662
+ PEAK , STARTED });
654
663
655
- chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
656
- model .registerThreadsChartSupport (chartSupport );
657
-
658
- chartSupport .setZoomingEnabled (!liveModel );
664
+ chartSupport = ChartFactory .createSimpleXYChart (chartDescriptor );
665
+ model .registerThreadsChartSupport (chartSupport );
666
+
667
+ chartSupport .setZoomingEnabled (!liveModel );
668
+ }
659
669
}
660
670
661
- private void initComponents (ApplicationMonitorModel model ) {
671
+ private void initComponents () {
662
672
setLayout (new BorderLayout ());
663
673
setOpaque (false );
664
674
665
- if (model . isThreadsMonitoringSupported () ) {
675
+ if (threadsMonitoringSupported ) {
666
676
add (chartSupport .getChart (), BorderLayout .CENTER );
667
677
chartSupport .updateDetails (new String [] { UNKNOWN , UNKNOWN , UNKNOWN , UNKNOWN });
668
678
} else {
0 commit comments