All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.purej.vminspect.html.MBeansInvokeAttributeView Maven / Gradle / Ivy

// Copyright (c), 2013, adopus consulting GmbH Switzerland, all rights reserved.
package com.purej.vminspect.html;

import java.io.IOException;
import com.purej.vminspect.data.MBeanAttribute;
import com.purej.vminspect.data.MBeanData;
import com.purej.vminspect.data.MBeanUtils;

/**
 * Displays the view to edit an attribute of an MBean.
 *
 * @author Stefan Mueller
 */
public class MBeansInvokeAttributeView extends AbstractMBeansView {
  private final MBeanData _mbean;
  private final MBeanAttribute _attribute;
  private final ConfirmState _confirm;
  private final String _newValue;

  /**
   * Creates a new instance of this view.
   */
  public MBeansInvokeAttributeView(StringBuilder output, MBeanData mbean, MBeanAttribute attribute, ConfirmState confirmState, String newValue) {
    super(output);
    _mbean = mbean;
    _attribute = attribute;
    _confirm = confirmState;
    _newValue = newValue;
  }

  @Override
  public void render() throws IOException {
    // Write the mbean title:
    writeln("

" + img("icons/beans-24.png", "MBean") + " MBean: " + htmlEncode(_mbean.getName().getObjectNameString()) + "

"); if (_confirm.isNow()) { writeln("
Please confirm the MBeans attribute change!

"); } // Write the form with a table: writeln("

"); HtmlTable table = new HtmlTable("MBean Attribute"); table.nextRow(); table.addValue(img("icons/books-16.png", "MBean Attribute") + " Attribute"); table.addValue("" + htmlEncode(_attribute.getName()) + ""); table.nextRow("Description", htmlEncode(_attribute.getDescription())); table.nextRow("Type", htmlEncode(MBeanUtils.toDisplayType(_attribute.getType()))); table.nextRow("Current Value    "); write(""); writeMBeanValue(_attribute.getValue(), false); write(""); table.nextRow("
", ""); if (_confirm.isNow()) { table.nextRow("New Value", _newValue + ""); } else { table.nextRow("New Value", ""); } table.nextRow("
", ""); table.nextRow(""); String okAction = _confirm.isNext() ? "mbAtrInvokeConfirm" : "mbAtrInvoke"; table.addValueRight(""); table.endTable(); writeln(""); writeln(""); writeln(""); writeln(""); writeln("
"); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy