|
From: Pavel V. <va...@us...> - 2002-07-22 23:39:24
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/views
In directory usw-pr-cvs1:/tmp/cvs-serv16586
Modified Files:
AllocHistogramTableModel.java AllocHistogramTable.java
Log Message:
realtime is working
Index: AllocHistogramTableModel.java
===================================================================
RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/views/AllocHistogramTableModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** AllocHistogramTableModel.java 22 Jul 2002 00:20:24 -0000 1.1
--- AllocHistogramTableModel.java 22 Jul 2002 23:39:21 -0000 1.2
***************
*** 36,41 ****
private String columnNames[] = { "name", "count", "max count", "histogram", "space", "max space" };
private Class columnClasses[] = { String.class, Long.class, Long.class, AllocStat.class, Long.class, Long.class };
! private Method method_getName;
/** Creates a new instance of HistogramTableModel
--- 36,42 ----
private String columnNames[] = { "name", "count", "max count", "histogram", "space", "max space" };
private Class columnClasses[] = { String.class, Long.class, Long.class, AllocStat.class, Long.class, Long.class };
+ private AllocStatListener statListener;
! //private Method method_getName;
/** Creates a new instance of HistogramTableModel
***************
*** 45,53 ****
public AllocHistogramTableModel(List allocStats) {
this.allocStats = allocStats;
ListIterator iter = allocStats.listIterator();
while ( iter.hasNext() ) {
! AllocStat alloc = (AllocStat) iter.next();
! alloc.addAllocStatListener( new HistogramStatListener() );
}
--- 46,54 ----
public AllocHistogramTableModel(List allocStats) {
this.allocStats = allocStats;
+ statListener = new HistogramStatListener();
ListIterator iter = allocStats.listIterator();
while ( iter.hasNext() ) {
! ((AllocStat) iter.next()).addAllocStatListener( statListener );
}
***************
*** 58,62 ****
//parent.addChildListener( type, new HistogramChildrenListener );
! if ( ! (allocStats.get(0) instanceof TypeRef) ) {
try {
Method method_getName = allocStats.get(0).getClass()
--- 59,63 ----
//parent.addChildListener( type, new HistogramChildrenListener );
! /*if ( ! (allocStats.get(0) instanceof TypeRef) ) {
try {
Method method_getName = allocStats.get(0).getClass()
***************
*** 66,70 ****
throw new RuntimeException( e.getMessage() + " requested method: getType()" );
}
! }
}
--- 67,71 ----
throw new RuntimeException( e.getMessage() + " requested method: getType()" );
}
! }*/
}
***************
*** 83,86 ****
--- 84,88 ----
switch ( colIndex ) {
case 0: {
+ //return ((HaveTypeRoot) alloc).getType().getName();
//FIXME
if ( alloc instanceof TypeRef ) {
***************
*** 88,92 ****
}
//FIXME add interface with getType method
! try {
return ((TypeRef) method_getName.invoke( alloc, null )).getName();
}
--- 90,94 ----
}
//FIXME add interface with getType method
! /*try {
return ((TypeRef) method_getName.invoke( alloc, null )).getName();
}
***************
*** 99,103 ****
catch (InvocationTargetException e) {
throw new RuntimeException( e.getMessage() + " requested method: getType()" );
! }
}
case 1: {
--- 101,105 ----
catch (InvocationTargetException e) {
throw new RuntimeException( e.getMessage() + " requested method: getType()" );
! }*/
}
case 1: {
***************
*** 139,145 ****
class HistogramStatListener implements AllocStatListener {
public void allocStatChanged( AllocStatEvent event ) {
! //FIXME how to get index
int index = allocStats.indexOf( event.getSource() );
! fireTableRowsUpdated(index, index);
}
}
--- 141,152 ----
class HistogramStatListener implements AllocStatListener {
public void allocStatChanged( AllocStatEvent event ) {
! //FIXME dispatch to swing thread
int index = allocStats.indexOf( event.getSource() );
! //??do invokeLater
! //!!why this don't work
! //fireTableRowsUpdated(index, index);
!
! //use brutal method
! fireTableDataChanged();
}
}
***************
*** 148,164 ****
public void childrenAdded( ChildrenEvent event ) {
int delta[] = event.getDeltaIndices();
! int i=0,j=0;
int len = delta.length;
while (i<len) {
j=i+1;
! while (delta[i] - delta[j] == i-j) { //pack neighbours into one event
! j++;
! if (j >= len )
! break;
}
fireTableRowsInserted( i, j-1 );
i = j;
}
};
--- 155,178 ----
public void childrenAdded( ChildrenEvent event ) {
int delta[] = event.getDeltaIndices();
! int i=0,j=0, old = 0;
int len = delta.length;
while (i<len) {
j=i+1;
! if (j<len) {
! while (delta[i] - delta[j] == i-j) { //pack neighbours into one event
! j++;
! if (j >= len )
! break;
! }
}
fireTableRowsInserted( i, j-1 );
i = j;
}
+
+ //register allocStat listener for new instances
+ for (i=0; i<len; i++) {
+ ((AllocStat) allocStats.get(i)).addAllocStatListener(statListener);
+ }
};
***************
*** 170,177 ****
while (i<len) {
j=i+1;
! while (delta[i] - delta[j] == i-j) { //pack neighbours into one event
! j++;
! if (j >= len )
! break;
}
fireTableRowsUpdated( i, j-1 );
--- 184,193 ----
while (i<len) {
j=i+1;
! if (j<len) {
! while (delta[i] - delta[j] == i-j) { //pack neighbours into one event
! j++;
! if (j >= len )
! break;
! }
}
fireTableRowsUpdated( i, j-1 );
Index: AllocHistogramTable.java
===================================================================
RCS file: /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/views/AllocHistogramTable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** AllocHistogramTable.java 22 Jul 2002 00:20:24 -0000 1.1
--- AllocHistogramTable.java 22 Jul 2002 23:39:21 -0000 1.2
***************
*** 64,67 ****
--- 64,69 ----
setOpaque( true );
setBorder(noFocusBorder);
+
+ //setHorizontalAlignment( RIGHT );
}
***************
*** 129,136 ****
while( barMax < alloc.getLiveInstancesCount() ) {
barMax = barMax * 2;
! //PENDING REDRAW
}
! bar.setValue( (int) (100*alloc.getLiveInstancesCount()/barMax) );
if (isBordered) {
--- 131,141 ----
while( barMax < alloc.getLiveInstancesCount() ) {
barMax = barMax * 2;
!
! //PENDING fire event
! //?invoke later
! //fireTableDataChanged();
}
! bar.setValue( (int) ((100*alloc.getLiveInstancesCount())/barMax) );
if (isBordered) {
|