/* * The contents of this file are subject to the terms of the Common Development and * Distribution License (the License). You may not use this file except in compliance with the * License. * * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the * specific language governing permission and limitations under the License. * * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2009 Sun Microsystems, Inc. * Portions Copyright 2014-2016 ForgeRock AS. */ package org.opends.guitools.controlpanel.ui; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import javax.swing.Box; import javax.swing.JComponent; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.JTextComponent; import org.forgerock.opendj.ldap.Attribute; import org.forgerock.opendj.ldap.responses.SearchResultEntry; import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes; import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; import org.opends.guitools.controlpanel.ui.components.BasicExpander; import org.opends.guitools.controlpanel.util.Utilities; import org.opends.server.util.CollectionUtils; import static org.opends.messages.AdminToolMessages.*; import static org.opends.server.util.ServerConstants.*; /** The panel displaying the java monitoring information. */ public class JavaInformationMonitoringPanel extends GeneralMonitoringPanel { private static final long serialVersionUID = 9031734563799969830L; private final List generalAttributes = CollectionUtils.newArrayList( BasicMonitoringAttributes.JVM_VERSION, BasicMonitoringAttributes.JVM_VENDOR, BasicMonitoringAttributes.JVM_ARCHITECTURE, BasicMonitoringAttributes.JVM_ARGUMENTS, BasicMonitoringAttributes.CLASS_PATH, BasicMonitoringAttributes.JAVA_VERSION, BasicMonitoringAttributes.JAVA_VENDOR); private final List extraAttributes = CollectionUtils.newArrayList( BasicMonitoringAttributes.CLASS_PATH, BasicMonitoringAttributes.JAVA_VERSION, BasicMonitoringAttributes.JAVA_VENDOR); private final List generalMonitoringComps = new ArrayList<>(); { for (int i=0; i memoryAttributes = new ArrayList<>(); private final List memoryLabels = new ArrayList<>(); private JPanel memoryPanel; /** Default constructor. */ public JavaInformationMonitoringPanel() { super(); createLayout(); } @Override public Component getPreferredFocusComponent() { return generalMonitoringComps.get(0); } /** Creates the layout of the panel (but the contents are not populated here). */ private void createLayout() { GridBagConstraints gbc = new GridBagConstraints(); JLabel lTitle = Utilities.createTitleLabel( INFO_CTRL_PANEL_JAVA_INFORMATION.get()); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = 2; gbc.gridx = 0; gbc.gridy = 0; gbc.insets.top = 5; gbc.insets.bottom = 7; add(lTitle, gbc); gbc.insets.bottom = 0; gbc.insets.top = 10; gbc.gridy ++; gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = 1; for (int i=0; i sortedNames = new TreeSet<>(); for (Attribute attribute : csrMemory.getAllAttributes()) { String attrName = attribute.getAttributeDescriptionAsString(); if (!OBJECTCLASS_ATTRIBUTE_TYPE_NAME.equalsIgnoreCase(attrName) && !ATTR_COMMON_NAME.equalsIgnoreCase(attrName)) { sortedNames.add(attrName); } } memoryAttributes.addAll(sortedNames); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = 1; for (String attrName : memoryAttributes) { JLabel l = Utilities.createPrimaryLabel( INFO_CTRL_PANEL_OPERATION_NAME_AS_LABEL.get(attrName)); gbc.insets.left = 0; gbc.insets.right = 0; gbc.gridx = 0; gbc.weightx = 0.0; gbc.fill = GridBagConstraints.NONE; memoryPanel.add(l, gbc); gbc.insets.left = 10; gbc.gridx = 1; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; JLabel valueLabel = Utilities.createDefaultLabel(); memoryLabels.add(valueLabel); memoryPanel.add(valueLabel, gbc); gbc.gridy ++; gbc.insets.top = 10; } } for (int i=0; i