use of org.graalvm.visualvm.core.ui.components.DataViewComponent in project visualvm by oracle.
the class HelloWorldView method createComponent.
protected DataViewComponent createComponent() {
// Data area for master view:
JEditorPane generalDataArea = new JEditorPane();
generalDataArea.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8));
// Panel, which we'll reuse in all four of our detail views for this sample:
JPanel panel = new JPanel();
// Master view:
DataViewComponent.MasterView masterView = new DataViewComponent.MasterView("Hello World Overview", null, generalDataArea);
// Configuration of master view:
DataViewComponent.MasterViewConfiguration masterConfiguration = new DataViewComponent.MasterViewConfiguration(false);
// Add the master view and configuration view to the component:
dvc = new DataViewComponent(masterView, masterConfiguration);
// Add detail views to the component:
dvc.addDetailsView(new DataViewComponent.DetailsView("Hello World Details 1", null, 10, panel, null), DataViewComponent.TOP_LEFT);
return dvc;
}
use of org.graalvm.visualvm.core.ui.components.DataViewComponent in project visualvm by oracle.
the class HostView method createComponent.
@Override
protected DataViewComponent createComponent() {
// Data area for master view:
JEditorPane generalDataArea = new JEditorPane();
generalDataArea.setText("Below you see the system properties of" + " all running apps!");
generalDataArea.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8));
// Master view:
DataViewComponent.MasterView masterView = new DataViewComponent.MasterView("All System Properties", null, generalDataArea);
// Configuration of master view:
DataViewComponent.MasterViewConfiguration masterConfiguration = new DataViewComponent.MasterViewConfiguration(false);
// Add the master view and configuration view to the component:
dvc = new DataViewComponent(masterView, masterConfiguration);
// Get all the applications deployed to the host:
Set apps = host.getRepository().getDataSources(Application.class);
// Get the iterator:
Iterator it = apps.iterator();
// Set count to zero:
int count = 0;
// Iterate through our applications:
while (it.hasNext()) {
// Increase the count:
count = count + 1;
// Now we have our application:
Application app = (Application) it.next();
// Get the process id:
String pid = count + ": " + (String.valueOf(app.getPid()));
// Get the system properties:
Properties jvmProperties = null;
jvm = JvmFactory.getJVMFor(app);
if (jvm.isGetSystemPropertiesSupported()) {
jvmProperties = jvm.getSystemProperties();
}
// Extrapolate the name from the type:
ApplicationType appType = ApplicationTypeFactory.getApplicationTypeFor(app);
String appName = appType.getName();
// Put the first application top left:
if (count == 1) {
dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.TOP_LEFT);
// //Put the second application top right:
} else if (count == 2) {
dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.TOP_RIGHT);
//
// //Put the third application bottom left:
} else if (count == 3) {
dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_LEFT);
// Put the fourth application bottom right:
} else if (count == 4) {
dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_RIGHT);
// Put all other applications bottom right,
// which creates tabs within the bottom right tab
} else {
dvc.addDetailsView(new SystemPropertiesViewSupport(jvmProperties).getDetailsView(app, appName), DataViewComponent.BOTTOM_RIGHT);
}
}
return dvc;
}
use of org.graalvm.visualvm.core.ui.components.DataViewComponent in project visualvm by oracle.
the class HeapDumpView method createComponent.
protected DataViewComponent createComponent() {
HeapDump heapDump = (HeapDump) getDataSource();
mvs = new MasterViewSupport(heapDump);
DataViewComponent dvc = new DataViewComponent(mvs.getMasterView(), new DataViewComponent.MasterViewConfiguration(true));
return dvc;
}
use of org.graalvm.visualvm.core.ui.components.DataViewComponent in project visualvm by oracle.
the class MBeansView method createComponent.
protected DataViewComponent createComponent() {
DataViewComponent dvc = null;
JmxModel jmx = JmxModelFactory.getJmxModelFor(application);
if (jmx == null || jmx.getConnectionState() != JmxModel.ConnectionState.CONNECTED) {
JTextArea textArea = new JTextArea();
textArea.setBorder(BorderFactory.createEmptyBorder(25, 9, 9, 9));
textArea.setEditable(false);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
// NOI18N
textArea.setText(Resources.getText("LBL_ConnectionNotEstablished"));
dvc = new DataViewComponent(// NOI18N
new DataViewComponent.MasterView(Resources.getText("LBL_MBeansBrowser"), null, textArea), new DataViewComponent.MasterViewConfiguration(true));
} else {
// MBeansTab
mbeansTab = new MBeansTab(application);
jmx.addPropertyChangeListener(WeakListeners.propertyChange(mbeansTab, jmx));
// MBeansTreeView
mbeansTreeView = new MBeansTreeView(mbeansTab);
jmx.addPropertyChangeListener(WeakListeners.propertyChange(mbeansTreeView, jmx));
// MBeansAttributesView
MBeansAttributesView mbeansAttributesView = new MBeansAttributesView(mbeansTab);
// MBeansOperationsView
MBeansOperationsView mbeansOperationsView = new MBeansOperationsView(mbeansTab);
// MBeansNotificationsView
MBeansNotificationsView mbeansNotificationsView = new MBeansNotificationsView(mbeansTab);
// MBeansMetadataView
MBeansMetadataView mbeansMetadataView = new MBeansMetadataView(mbeansTab);
// NOI18N
DataViewComponent.MasterView monitoringMasterView = new DataViewComponent.MasterView(Resources.getText("LBL_MBeansBrowser"), null, new JLabel(" "));
DataViewComponent.MasterViewConfiguration monitoringMasterConfiguration = new DataViewComponent.MasterViewConfiguration(false);
dvc = new DataViewComponent(monitoringMasterView, monitoringMasterConfiguration);
dvc.configureDetailsView(new DataViewComponent.DetailsViewConfiguration(0.33, 0, -1, -1, -1, -1));
// NOI18N
dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(Resources.getText("LBL_MBeans"), false), DataViewComponent.TOP_LEFT);
// NOI18N
dvc.addDetailsView(new DataViewComponent.DetailsView(Resources.getText("LBL_MBeans"), null, 10, mbeansTreeView, null), DataViewComponent.TOP_LEFT);
// NOI18N
dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(Resources.getText("LBL_Details"), false), DataViewComponent.TOP_RIGHT);
// NOI18N
dvc.addDetailsView(new DataViewComponent.DetailsView(Resources.getText("LBL_Attributes"), null, 10, mbeansAttributesView, null), DataViewComponent.TOP_RIGHT);
// NOI18N
dvc.addDetailsView(new DataViewComponent.DetailsView(Resources.getText("LBL_Operations"), null, 20, mbeansOperationsView, null), DataViewComponent.TOP_RIGHT);
// NOI18N
dvc.addDetailsView(new DataViewComponent.DetailsView(Resources.getText("LBL_Notifications"), null, 30, mbeansNotificationsView, null), DataViewComponent.TOP_RIGHT);
// NOI18N
dvc.addDetailsView(new DataViewComponent.DetailsView(Resources.getText("LBL_Metadata"), null, 40, mbeansMetadataView, null), DataViewComponent.TOP_RIGHT);
mbeansTab.setView(dvc);
// Disable "Attributes"
mbeansTab.getButtonAt(0).setEnabled(false);
// Disable "Operations"
mbeansTab.getButtonAt(1).setEnabled(false);
// Disable "Notifications"
mbeansTab.getButtonAt(2).setEnabled(false);
// Disable "Metadata"
mbeansTab.getButtonAt(3).setEnabled(false);
}
return dvc;
}
use of org.graalvm.visualvm.core.ui.components.DataViewComponent in project coherence-visualvm by oracle.
the class VisualVMView method createComponent.
// ----- helpers --------------------------------------------------------
/**
* Create the new {@link DataViewComponent} which will display all the
* Coherence related information.
*/
@Override
protected DataViewComponent createComponent() {
final VisualVMModel model = VisualVMModel.getInstance();
boolean fClusterSnapshotEnabled = com.oracle.coherence.plugin.visualvm.GlobalPreferences.sharedInstance().isClusterSnapshotEnabled();
// Data area for master view
JEditorPane generalDataArea = new JEditorPane();
generalDataArea.setEditable(false);
// do an initial refresh of the data so we can see if we need to display
// the proxy server tab
model.refreshStatistics(requestSender);
model.setIsFirstRefresh(false);
// we then construct the panels after the initial refresh so we can utilize
// any information we have gathered in the startup
final CoherenceClusterSnapshotPanel pnlClusterSnapshot = fClusterSnapshotEnabled ? new CoherenceClusterSnapshotPanel(model) : null;
final CoherenceClusterOverviewPanel pnlClusterOverview = new CoherenceClusterOverviewPanel(model);
final CoherenceMachinePanel pnlMachine = new CoherenceMachinePanel(model);
final CoherenceMemberPanel pnlMember = new CoherenceMemberPanel(model);
final CoherenceServicePanel pnlService = new CoherenceServicePanel(model);
final CoherenceCachePanel pnlCache = new CoherenceCachePanel(model);
final CoherenceTopicPanel pnlTopic = new CoherenceTopicPanel(model);
final CoherenceProxyPanel pnlProxy = new CoherenceProxyPanel(model);
final CoherenceHotCachePanel pnlHotCache = new CoherenceHotCachePanel(model);
final CoherencePersistencePanel pnlPersistence = new CoherencePersistencePanel(model);
final CoherenceHttpSessionPanel pnlHttpSession = new CoherenceHttpSessionPanel(model);
final CoherenceFederationPanel pnlFederation = new CoherenceFederationPanel(model);
final CoherenceElasticDataPanel pnlElasticData = new CoherenceElasticDataPanel(model);
final CoherenceJCachePanel pnlJCache = new CoherenceJCachePanel(model);
final CoherenceHttpProxyPanel pnlHttpProxy = new CoherenceHttpProxyPanel(model);
final CoherenceExecutorPanel pnlExecutor = new CoherenceExecutorPanel(model);
final CoherenceGrpcProxyPanel pnlGrpcProxy = new CoherenceGrpcProxyPanel(model);
String sClusterVersion = model.getClusterVersion();
String sClusterName = null;
List<Map.Entry<Object, Data>> clusterData = model.getData(VisualVMModel.DataType.CLUSTER);
for (Map.Entry<Object, Data> entry : clusterData) {
sClusterName = entry.getValue().getColumn(ClusterData.CLUSTER_NAME).toString();
break;
}
// Master view:
DataViewComponent.MasterView masterView = new DataViewComponent.MasterView(Localization.getLocalText("LBL_cluster_information", sClusterName, sClusterVersion), null, generalDataArea);
// Configuration of master view:
DataViewComponent.MasterViewConfiguration masterConfiguration = new DataViewComponent.MasterViewConfiguration(false);
// Add the master view and configuration view to the component:
m_dvc = new DataViewComponent(masterView, masterConfiguration);
m_dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(Localization.getLocalText("LBL_cluster_overview"), false), DataViewComponent.TOP_RIGHT);
// Add detail views to the components
if (pnlClusterSnapshot != null) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_cluster_snapshot"), null, 10, pnlClusterSnapshot, null), DataViewComponent.TOP_RIGHT);
}
DataViewComponent.DetailsView clusterOverview = new DataViewComponent.DetailsView(Localization.getLocalText("LBL_cluster_overview"), null, 10, pnlClusterOverview, null);
m_dvc.addDetailsView(clusterOverview, DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_machines"), null, 10, pnlMachine, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_members"), null, 10, pnlMember, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_services"), null, 10, pnlService, null), DataViewComponent.TOP_RIGHT);
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_caches"), null, 10, pnlCache, null), DataViewComponent.TOP_RIGHT);
// add the default panels
if (pnlClusterSnapshot != null) {
f_setPanels.add(pnlClusterSnapshot);
pnlClusterSnapshot.setRequestSender(requestSender);
}
f_setPanels.add(pnlClusterOverview);
f_setPanels.add(pnlMachine);
f_setPanels.add(pnlMember);
f_setPanels.add(pnlService);
f_setPanels.add(pnlCache);
if (model.isHotcacheConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_hotcache"), null, 10, pnlHotCache, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHotCache);
}
// selectively add tabs based upon used functionality
if (model.isFederationCongfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_federation"), null, 10, pnlFederation, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlFederation);
}
if (model.isCoherenceExtendConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_proxy_servers"), null, 10, pnlProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlProxy);
}
if (model.isHttpProxyConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_http_proxy_servers"), null, 10, pnlHttpProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHttpProxy);
}
if (model.isTopicsConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_topics"), null, 10, pnlTopic, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlTopic);
}
if (model.isPersistenceConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_persistence"), null, 10, pnlPersistence, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlPersistence);
}
if (model.isCoherenceWebConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_Coherence_web"), null, 10, pnlHttpSession, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlHttpSession);
}
if (model.isElasticDataConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_elastic_data"), null, 10, pnlElasticData, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlElasticData);
}
if (model.isJCacheConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_JCache"), null, 10, pnlJCache, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlJCache);
}
if (model.isExecutorConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_executors"), null, 10, pnlExecutor, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlExecutor);
}
if (model.isGrpcProxyConfigured()) {
m_dvc.addDetailsView(new DataViewComponent.DetailsView(Localization.getLocalText("LBL_grpc"), null, 10, pnlGrpcProxy, null), DataViewComponent.TOP_RIGHT);
f_setPanels.add(pnlGrpcProxy);
}
// update the request sender
pnlClusterOverview.setRequestSender(requestSender);
pnlMachine.setRequestSender(requestSender);
pnlMember.setRequestSender(requestSender);
pnlService.setRequestSender(requestSender);
pnlCache.setRequestSender(requestSender);
pnlHotCache.setRequestSender(requestSender);
pnlFederation.setRequestSender(requestSender);
pnlProxy.setRequestSender(requestSender);
pnlTopic.setRequestSender(requestSender);
pnlPersistence.setRequestSender(requestSender);
pnlHttpSession.setRequestSender(requestSender);
pnlElasticData.setRequestSender(requestSender);
pnlJCache.setRequestSender(requestSender);
pnlExecutor.setRequestSender(requestSender);
pnlGrpcProxy.setRequestSender(requestSender);
// using JMX queries rather than the reporter.
if (model.getDomainPartitions().size() > 1) {
JOptionPane.showMessageDialog(null, Localization.getLocalText("LBL_mt_warning"));
}
m_dvc.selectDetailsView(clusterOverview);
// create a timer that will refresh the TAB's as required every 3 seconds
// the reason for 3 seconds is so that with the min cluster data refresh time of
// 5 seconds, the updates will be smoother
m_timer = new Timer(3000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (refreshRunning) {
return;
}
refreshRunning = true;
RequestProcessor.getDefault().post(new Runnable() {
public void run() {
try {
// application may be null inside the constructor
if (m_application == null || m_application.getState() == Application.STATE_AVAILABLE) {
// Schedule the SwingWorker to update the GUI
model.refreshStatistics(requestSender);
// refresh only the panels that were activated on startup
for (AbstractCoherencePanel panel : f_setPanels) {
panel.updateData();
panel.updateGUI();
}
}
} catch (Exception ex) {
LOGGER.warning("Error while refreshing tabs. " + ex.toString());
ex.printStackTrace();
} finally {
refreshRunning = false;
}
}
});
}
});
m_timer.setInitialDelay(800);
m_timer.start();
return m_dvc;
}
Aggregations