JMX Console cosmetic changes #PL-2647 #PL-2656

This commit is contained in:
Yuriy Artamonov 2013-09-24 12:58:16 +00:00
parent 2460e0b38c
commit c1133ec05b
7 changed files with 74 additions and 48 deletions

View File

@ -115,7 +115,7 @@ public class MbeanInspectWindow extends AbstractEditor {
BoxLayout vl = componentsFactory.createComponent(BoxLayout.VBOX);
vl.setMargin(false, false, true, false);
vl.setSpacing(true);
vl.setStyleName("cuba-mbeans-operationContainer");
vl.setStyleName("cuba-mbeans-operation-container");
Label nameLbl = componentsFactory.createComponent(Label.NAME);
nameLbl.setValue(op.getReturnType() + " " + op.getName() + "()");

View File

@ -5,12 +5,11 @@
package com.haulmont.cuba.web.app.ui.jmxcontrol.inspect.attribute;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.haulmont.cuba.gui.components.GridLayout;
import com.haulmont.cuba.web.jmx.entity.ManagedBeanAttribute;
import com.haulmont.cuba.web.app.ui.jmxcontrol.util.AttributeEditor;
import com.haulmont.cuba.web.jmx.JmxControlAPI;
import com.haulmont.cuba.web.jmx.entity.ManagedBeanAttribute;
import org.apache.commons.lang.ObjectUtils;
import javax.inject.Inject;
@ -19,24 +18,24 @@ import javax.inject.Inject;
* @author budarov
* @version $Id$
*/
public class AttributeEditWindow extends AbstractEditor {
public class AttributeEditWindow extends AbstractEditor<ManagedBeanAttribute> {
private AttributeEditor valueHolder;
protected AttributeEditor valueHolder;
@Inject
protected JmxControlAPI jmxControlAPI;
@Override
public void setItem(Entity item) {
super.setItem(item);
@Inject
protected GridLayout valueContainer;
ManagedBeanAttribute mba = (ManagedBeanAttribute) getItem();
@Override
protected void postInit() {
ManagedBeanAttribute mba = getItem();
final String type = mba.getType();
GridLayout layout = getComponent("valueContainer");
valueHolder = new AttributeEditor(this, type, mba.getValue());
valueHolder = new AttributeEditor(this, type, mba.getValue(), true);
layout.add(valueHolder.getComponent(), 1, 0);
valueContainer.add(valueHolder.getComponent(), 1, 0);
if (mba.getName() != null) {
setCaption(formatMessage("editAttribute.title.format", mba.getName()));
@ -51,7 +50,7 @@ public class AttributeEditWindow extends AbstractEditor {
}
private boolean assignValue() {
ManagedBeanAttribute mba = (ManagedBeanAttribute) getItem();
ManagedBeanAttribute mba = getItem();
Object oldValue = mba.getValue();
try {

View File

@ -6,7 +6,7 @@
<window
xmlns="http://schemas.haulmont.com/cuba/4.1/window.xsd"
class="com.haulmont.cuba.web.app.ui.jmxcontrol.inspect.attribute.AttributeEditWindow"
messagesPack="com.haulmont.cuba.web.app.ui.jmxcontrol.inspect.attribute"
messagesPack="com.haulmont.cuba.web.app.ui.jmxcontrol"
datasource="attrDs"
caption="msg://editAttribute.title">
@ -14,24 +14,19 @@
<datasource id="attrDs" class="com.haulmont.cuba.web.jmx.entity.ManagedBeanAttribute" view="_local"/>
</dsContext>
<layout expand="windowActions">
<vbox spacing="true" id="vbox">
<scrollBox id="scrollbox" spacing="true">
<grid spacing="true" id="valueContainer">
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="msg://editAttribute.value"/>
<layout expand="windowActions" spacing="true">
<grid spacing="true" id="valueContainer">
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="msg://editAttribute.value"/>
</row>
</rows>
</grid>
<hbox></hbox>
</scrollBox>
</vbox>
</row>
</rows>
</grid>
<iframe id="windowActions" src="/com/haulmont/cuba/gui/edit-window.actions.xml"/>
</layout>
</window>

View File

@ -6,7 +6,7 @@
<window
xmlns="http://schemas.haulmont.com/cuba/4.1/window.xsd"
class="com.haulmont.cuba.web.app.ui.jmxcontrol.inspect.MbeanInspectWindow"
messagesPack="com.haulmont.cuba.web.app.ui.jmxcontrol.inspect"
messagesPack="com.haulmont.cuba.web.app.ui.jmxcontrol"
datasource="mbeanDs"
caption="msg://inspectMbean.title">
@ -19,9 +19,12 @@
</collectionDatasource>
</dsContext>
<layout expand="scrollbox" spacing="true">
<grid spacing="true" margin="true">
<columns count="2"/>
<layout expand="contentScrollbox" spacing="true">
<grid spacing="true" stylename="cuba-mbeans-information-panel" width="100%">
<columns>
<column flex="0"/>
<column flex="1"/>
</columns>
<rows>
<row>
<label value="msg://mbean.jmxConnection"/>
@ -41,7 +44,8 @@
</row>
</rows>
</grid>
<scrollBox id="scrollbox" spacing="true" margin="true" scrollBars="vertical">
<scrollBox id="contentScrollbox" spacing="true" scrollBars="vertical">
<label value="msg://mbean.attributes" stylename="h2"/>
<table id="attributesTable" width="100%" height="300px" columnControlVisible="false">
<actions>

View File

@ -18,23 +18,26 @@ import org.apache.commons.lang.BooleanUtils;
*/
public class AttributeEditor {
private CheckBox checkBox;
private TextField textField;
private BoxLayout layout;
private String type;
protected CheckBox checkBox;
protected TextField textField;
protected BoxLayout layout;
protected String type;
public AttributeEditor(IFrame frame, String type) {
this(frame, type, null);
this(frame, type, null, false);
}
public AttributeEditor(IFrame frame, String type, Object value) {
public AttributeEditor(IFrame frame, String type, Object value, boolean requestFocus) {
this.type = type;
if (AttributeHelper.isBoolean(type)) {
checkBox = new WebCheckBox();
checkBox.setFrame(frame);
checkBox.requestFocus();
if (value != null)
if (requestFocus) {
checkBox.requestFocus();
}
if (value != null) {
checkBox.setValue(value);
}
} else if (AttributeHelper.isArray(type)) {
layout = new WebVBoxLayout();
@ -43,17 +46,23 @@ public class AttributeEditor {
textField = new WebTextField();
textField.setWidth("500px");
textField.setFrame(frame);
textField.requestFocus();
if (value != null)
if (requestFocus) {
textField.requestFocus();
}
if (value != null) {
textField.setValue(value.toString());
}
}
}
public Component getComponent() {
if (checkBox != null)
if (checkBox != null) {
return checkBox;
if (textField != null)
}
if (textField != null) {
return textField;
}
return layout;
}

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2008-2013 Haulmont. All rights reserved.
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
*/
// Version: $Id$
@mixin cuba-jmx-console {
.cuba-mbeans-operation-container {
border-bottom: 1px solid #71a4d5;
}
.cuba-mbeans-information-panel {
padding: 10px;
border: 1px solid $theme_groupBoxNoCaptionBorderColor;
}
}

View File

@ -68,6 +68,7 @@
@import "app/table-presentations";
@import "app/folders-pane";
@import "app/log-control";
@import "app/jmx-console";
@mixin havana {
@include base;
@ -125,4 +126,5 @@
@include cuba-folders-pane;
@include cuba-breadcrumbs;
@include cuba-log-control;
@include cuba-jmx-console;
}