mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
Refs #PL-4923
Support of Date type method parameters in JMX Console > Inspect MBean
This commit is contained in:
parent
c366db52c8
commit
b38988fa3b
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package com.haulmont.cuba.web.app.ui.jmxcontrol.util;
|
package com.haulmont.cuba.web.app.ui.jmxcontrol.util;
|
||||||
|
|
||||||
|
import com.haulmont.cuba.gui.AppConfig;
|
||||||
import com.haulmont.cuba.gui.components.*;
|
import com.haulmont.cuba.gui.components.*;
|
||||||
import com.haulmont.cuba.gui.theme.ThemeConstants;
|
import com.haulmont.cuba.gui.theme.ThemeConstants;
|
||||||
import com.haulmont.cuba.web.App;
|
import com.haulmont.cuba.web.App;
|
||||||
@ -15,6 +16,8 @@ import com.haulmont.cuba.web.gui.components.WebVBoxLayout;
|
|||||||
import org.apache.commons.lang.BooleanUtils;
|
import org.apache.commons.lang.BooleanUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author budarov
|
* @author budarov
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
@ -23,6 +26,7 @@ public class AttributeEditor {
|
|||||||
|
|
||||||
protected CheckBox checkBox;
|
protected CheckBox checkBox;
|
||||||
protected TextField textField;
|
protected TextField textField;
|
||||||
|
protected DateField dateField;
|
||||||
protected BoxLayout layout;
|
protected BoxLayout layout;
|
||||||
protected String type;
|
protected String type;
|
||||||
|
|
||||||
@ -45,6 +49,13 @@ public class AttributeEditor {
|
|||||||
} else if (AttributeHelper.isArray(type)) {
|
} else if (AttributeHelper.isArray(type)) {
|
||||||
layout = new WebVBoxLayout();
|
layout = new WebVBoxLayout();
|
||||||
layout.setSpacing(true);
|
layout.setSpacing(true);
|
||||||
|
} else if (AttributeHelper.isDate(type)) {
|
||||||
|
dateField = AppConfig.getFactory().createComponent(DateField.NAME);
|
||||||
|
dateField.setWidth("500px");
|
||||||
|
dateField.setFrame(frame);
|
||||||
|
if (value != null) {
|
||||||
|
dateField.setValue(value.toString());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
textField = new WebTextField();
|
textField = new WebTextField();
|
||||||
|
|
||||||
@ -65,6 +76,9 @@ public class AttributeEditor {
|
|||||||
if (checkBox != null) {
|
if (checkBox != null) {
|
||||||
return checkBox;
|
return checkBox;
|
||||||
}
|
}
|
||||||
|
if (dateField != null) {
|
||||||
|
return dateField;
|
||||||
|
}
|
||||||
if (textField != null) {
|
if (textField != null) {
|
||||||
return textField;
|
return textField;
|
||||||
}
|
}
|
||||||
@ -75,6 +89,9 @@ public class AttributeEditor {
|
|||||||
if (checkBox != null) {
|
if (checkBox != null) {
|
||||||
Boolean value = checkBox.getValue();
|
Boolean value = checkBox.getValue();
|
||||||
return BooleanUtils.isTrue(value);
|
return BooleanUtils.isTrue(value);
|
||||||
|
} else if (dateField != null) {
|
||||||
|
Date date = dateField.getValue();
|
||||||
|
return date;
|
||||||
} else if (textField != null) {
|
} else if (textField != null) {
|
||||||
String strValue = textField.getValue();
|
String strValue = textField.getValue();
|
||||||
if (allowNull && StringUtils.isBlank(strValue)) {
|
if (allowNull && StringUtils.isBlank(strValue)) {
|
||||||
|
@ -59,6 +59,10 @@ public class AttributeHelper {
|
|||||||
return type != null && (type.startsWith("[L") || type.endsWith("[]"));
|
return type != null && (type.startsWith("[L") || type.endsWith("[]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isDate(String type) {
|
||||||
|
return type != null && Date.class.getName().endsWith(type);
|
||||||
|
}
|
||||||
|
|
||||||
public static String convertToString(Object value) {
|
public static String convertToString(Object value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user