[jboss-cvs] JBoss Profiler SVN: r573 - in branches/JBossProfiler2/src: main/org/jboss/profiler/client/web and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 28 16:39:39 EDT 2009
Author: jesper.pedersen
Date: 2009-10-28 16:39:39 -0400 (Wed, 28 Oct 2009)
New Revision: 573
Modified:
branches/JBossProfiler2/src/etc/faces-config.xml
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
branches/JBossProfiler2/src/main/www/loadhotspots.xhtml
branches/JBossProfiler2/src/main/www/snapshotoperations.xhtml
Log:
[JBPROFILER-101] use existing hotspot xhtml to display selected snapshot
Modified: branches/JBossProfiler2/src/etc/faces-config.xml
===================================================================
--- branches/JBossProfiler2/src/etc/faces-config.xml 2009-10-28 19:28:57 UTC (rev 572)
+++ branches/JBossProfiler2/src/etc/faces-config.xml 2009-10-28 20:39:39 UTC (rev 573)
@@ -120,5 +120,12 @@
<to-view-id>/snapshotoperations.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>go_hotspots</from-outcome>
+ <to-view-id>/loadhotspots.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java 2009-10-28 19:28:57 UTC (rev 572)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java 2009-10-28 20:39:39 UTC (rev 573)
@@ -75,6 +75,8 @@
private List<String> interceptClassList = new ArrayList<String>();
private List<Snapshot> snapshotsList = new ArrayList<Snapshot>();
+
+ private Snapshot currentSnapshot;
private org.jboss.remoting.InvokerLocator locator;
@@ -400,6 +402,7 @@
remotingClient.disconnect();
selectedSnapshot = null;
+ currentSnapshot = null;
}
/**
@@ -429,14 +432,11 @@
public void saveSnapshot() throws Throwable
{
+ File fileToSend = new File(SnapshotHelper.getName(currentSnapshot));
- Snapshot snapshot = snapshotsList.get(getSnapshots().indexOf(selectedSnapshot));
-
- File fileToSend = new File(SnapshotHelper.getName(snapshot));
-
try
{
- SnapshotHelper.save(snapshot, fileToSend);
+ SnapshotHelper.save(currentSnapshot, fileToSend);
this.saveSnapshotName = this.saveSnapshotName == null || this.saveSnapshotName.trim().length() == 0 ?
fileToSend.getName() : this.saveSnapshotName;
@@ -459,14 +459,17 @@
}
}
+
/**
- * selects a snapshot
+ * ui selects a snapshot
+ * @throws Throwable If an error occurs
*/
- public void selectSnapshot()
+ public void selectSnapshot() throws Throwable
{
FacesContext facesContext = FacesContext.getCurrentInstance();
selectedSnapshot = (String)facesContext.getApplication()
.getVariableResolver().resolveVariable(facesContext, "snapshot");
+ currentSnapshot = snapshotsList.get(getSnapshots().indexOf(selectedSnapshot));
}
/**
@@ -741,4 +744,13 @@
this.connectionSuccessful = connectionSuccessful;
}
+ /**
+ * returns the current selected Snapshot object
+ * @return the current selected Snapshot object
+ */
+ public Snapshot getCurrentSnapshot()
+ {
+ return currentSnapshot;
+ }
+
}
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java 2009-10-28 19:28:57 UTC (rev 572)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java 2009-10-28 20:39:39 UTC (rev 573)
@@ -28,6 +28,7 @@
import org.jboss.profiler.client.TimedClassInfo;
import org.jboss.profiler.shared.AllocationComparator;
import org.jboss.profiler.shared.AllocationInfo;
+import org.jboss.profiler.shared.Snapshot;
import org.jboss.profiler.shared.ThreadComparator;
import org.jboss.profiler.shared.ThreadInfo;
@@ -39,6 +40,10 @@
import java.util.List;
import java.util.Map;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -126,10 +131,10 @@
public List<AllocationInfo> getAllocations()
{
List<AllocationInfo> allocationList = null;
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
- Collections.sort(LoadSnapshotBean.getSnapshot().getAllocations(), new AllocationComparator());
- allocationList = LoadSnapshotBean.getSnapshot().getAllocations();
+ Collections.sort(getSelectedSnapshot().getAllocations(), new AllocationComparator());
+ allocationList = getSelectedSnapshot().getAllocations();
}
return allocationList;
}
@@ -176,10 +181,10 @@
*/
public List<CombinedFrameInfo> getHotspots()
{
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
- Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
+ Map<String, List<CombinedFrameInfo>> info = su.getInformation(getSelectedSnapshot());
List<CombinedFrameInfo> hotspotsInfo = new ArrayList<CombinedFrameInfo>();
Iterator it = info.values().iterator();
while (it.hasNext())
@@ -221,10 +226,10 @@
public List<CombinedFrameInfo> getMostTime()
{
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
- Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
- List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+ Map<String, List<CombinedFrameInfo>> info = su.getInformation(getSelectedSnapshot());
+ List<TimedClassInfo> classes = su.getTimedClasses(getSelectedSnapshot().getClasses(), info);
List<CombinedFrameInfo> allMethods = new ArrayList<CombinedFrameInfo>();
Iterator it = info.values().iterator();
while (it.hasNext())
@@ -266,10 +271,10 @@
public List<ThreadInfo> getThreads()
{
List<ThreadInfo> threads = null;
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
- Collections.sort(LoadSnapshotBean.getSnapshot().getThreads(), new ThreadComparator());
- threads = LoadSnapshotBean.getSnapshot().getThreads();
+ Collections.sort(getSelectedSnapshot().getThreads(), new ThreadComparator());
+ threads = getSelectedSnapshot().getThreads();
return threads;
}
return null;
@@ -281,11 +286,11 @@
*/
public List<CombinedFrameInfo> getPackages()
{
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
- Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
- List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+ Map<String, List<CombinedFrameInfo>> info = su.getInformation(getSelectedSnapshot());
+ List<TimedClassInfo> classes = su.getTimedClasses(getSelectedSnapshot().getClasses(), info);
Map<String, CombinedFrameInfo> packages = new HashMap<String, CombinedFrameInfo>();
Iterator it = info.entrySet().iterator();
while (it.hasNext())
@@ -349,11 +354,11 @@
public List<TimedClassInfo> getClasses()
{
List<TimedClassInfo> thresholdClasses = new ArrayList<TimedClassInfo>();
- if (LoadSnapshotBean.getSnapshot() != null)
+ if (getSelectedSnapshot() != null)
{
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
- Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
- List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
+ Map<String, List<CombinedFrameInfo>> info = su.getInformation(getSelectedSnapshot());
+ List<TimedClassInfo> classes = su.getTimedClasses(getSelectedSnapshot().getClasses(), info);
Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
Iterator<TimedClassInfo> it = classes.iterator();
@@ -371,4 +376,17 @@
}
return thresholdClasses;
}
+
+ /**
+ * returns the current selected Snapshot object
+ * @return the current selected Snapshot object
+ */
+ public Snapshot getSelectedSnapshot()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Application application = facesContext.getApplication();
+ ValueBinding binding = application.createValueBinding("#{basicOptBean.currentSnapshot}");
+ return (Snapshot)binding.getValue(facesContext);
+
+ }
}
Modified: branches/JBossProfiler2/src/main/www/loadhotspots.xhtml
===================================================================
--- branches/JBossProfiler2/src/main/www/loadhotspots.xhtml 2009-10-28 19:28:57 UTC (rev 572)
+++ branches/JBossProfiler2/src/main/www/loadhotspots.xhtml 2009-10-28 20:39:39 UTC (rev 573)
@@ -6,9 +6,12 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <ui:composition template="/template/analyzetemplate.xhtml">
- <ui:define name="analyzeContent">
- <h:outputText value="One snapshot #{loadSnapshotBean.snapshotToLoad} is profiled. Threshold is #{basicOptBean.threshold}"/>
+ <ui:composition template="/template/template.xhtml">
+ <ui:define name="mainContent">
+ <h2>
+ #{basicOptBean.selectedSnapshot}
+ </h2>
+ <h:outputText value="Threshold is #{basicOptBean.threshold}ms"/>
<rich:tabPanel id="classTabPanel" width="800px" headerAlignment="left">
<rich:tab label="hotspot" styleClass="cc">
<h:form>
Modified: branches/JBossProfiler2/src/main/www/snapshotoperations.xhtml
===================================================================
--- branches/JBossProfiler2/src/main/www/snapshotoperations.xhtml 2009-10-28 19:28:57 UTC (rev 572)
+++ branches/JBossProfiler2/src/main/www/snapshotoperations.xhtml 2009-10-28 20:39:39 UTC (rev 573)
@@ -12,7 +12,7 @@
<a4j:commandLink value="Take Snapshot" action="${basicOptBean.takeSnapshot}" reRender="listSnapshotPanel"/>
<p>
</p>
- <a4j:commandLink value="Clear Snapshots" action="${basicOptBean.clearSnapshot}" reRender="listSnapshotPanel"/>
+ <a4j:commandLink value="Clear Snapshots" action="${basicOptBean.clearSnapshot}" reRender="listSnapshotPanel,selectedSnapshotSection"/>
<p></p>
<a4j:outputPanel id="listSnapshotPanel" layout="block">
@@ -37,6 +37,8 @@
<rich:panel id="savePanel" rendered="#{!empty basicOptBean.selectedSnapshot}">
<h:outputText id="selectedOutput" value="the selected snapshot is No.#{basicOptBean.selectedSnapshot}"/>
<p></p>
+ <h:commandLink value="Classes" action="go_hotspots"/>
+ <p></p>
<h:outputText value="Input the snapshot name. If it's blank, the name based on time is generated."/>
<rich:spacer width="50" height="20" title="Here is a spacer..."/>
<br/>
@@ -45,7 +47,7 @@
<br/>
<br/>
- <h:commandButton id="savebutton" value="Save" action="#{basicOptBean.saveSnapshot}" reRender="inputSaveName,saveEcho"/>
+ <h:commandButton id="savebutton" value="Save" action="#{basicOptBean.saveSnapshot}"/>
<p>
</p>
<h:outputText id="saveEcho" value="#{basicOptBean.saveEcho}"/>
More information about the jboss-cvs-commits
mailing list