use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType in project cubrid-manager by CUBRID.
the class EditSingleHostStatisticItemDialog method createDialogArea.
/**
* Creates and returns the contents of the upper part of this dialog (above
* the button bar).
*
* @param parent The parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
final Composite parentComp = (Composite) super.createDialogArea(parent);
parentComp.setLayout(new GridLayout(1, false));
GridData gdParent = new GridData(SWT.FILL);
gdParent.widthHint = DIALOG_AREA_WIDTH;
gdParent.heightHint = LINE_HEIGHT * 11;
parentComp.setLayoutData(gdParent);
//init data
StatisticType statisticType = StatisticType.DB;
if (!isNew && statisticChartItem != null) {
statisticType = statisticChartItem.getType();
oldDataType = statisticType;
dataTypeValue = statisticType.getMessage();
TimeType timeType = TimeType.getEnumByType(statisticChartItem.getDType());
timeValue = timeType == null ? TimeType.DAILY.getMessage() : timeType.getMessage();
switch(statisticType) {
case DB:
dbNameValue = ((SingleHostChartItem) statisticChartItem).getDbName();
break;
case DB_VOL:
dbNameValue = ((SingleHostChartItem) statisticChartItem).getDbName();
dbVolNameValue = ((SingleHostChartItem) statisticChartItem).getVolName();
break;
case BROKER:
brokerNameValue = ((SingleHostChartItem) statisticChartItem).getBrokerName();
break;
case OS:
break;
default:
}
}
compDataType = new Composite(parentComp, SWT.RESIZE);
GridLayout layoutCompDataType = new GridLayout(4, false);
compDataType.setLayout(layoutCompDataType);
final Label lblDataType = new Label(compDataType, SWT.NONE);
GridData gdlblDataType = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gdlblDataType.widthHint = 120;
lblDataType.setText(Messages.lblDataType);
comboDataType = new Combo(compDataType, SWT.NONE | SWT.READ_ONLY);
GridData gdComboDataType = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gdComboDataType.widthHint = 180;
comboDataType.setLayoutData(gdComboDataType);
comboDataType.setItems(itemsDataType);
comboDataType.setText(dataTypeValue);
comboDataType.addSelectionListener(new ComboDataTypeSelectionAdapter());
final Label lblTimeType = new Label(compDataType, SWT.NONE);
GridData gdlblTimeType = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gdlblTimeType.widthHint = 120;
lblTimeType.setText(Messages.lblTimeType);
comboTimeType = new Combo(compDataType, SWT.NONE | SWT.READ_ONLY);
GridData gdComboTimeType = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gdComboTimeType.widthHint = 180;
comboTimeType.setLayoutData(gdComboTimeType);
comboTimeType.setItems(itemsTimeType);
comboTimeType.setText(timeValue);
compMetrics = new Composite(parentComp, SWT.RESIZE);
refreshChangeableItems(statisticType);
if (!isNew && statisticChartItem != null) {
List<String> metricList = ((SingleHostChartItem) statisticChartItem).getMetricList();
for (Group grp : grpMetricList) {
if (grp.getChildren() == null) {
continue;
}
boolean isFindInGroup = false;
for (Control control : grp.getChildren()) {
if (control instanceof Button) {
Button btn = ((Button) control);
btn.setEnabled(false);
String msg = btn.getText();
MetricType metricType = MetricType.getEnumByMessage(msg);
for (String metric : metricList) {
if (metric.equals(metricType.getMetric())) {
btn.setSelection(true);
isFindInGroup = true;
break;
}
}
}
}
if (isFindInGroup) {
for (Control control : grp.getChildren()) {
if (control instanceof Button) {
((Button) control).setEnabled(true);
}
}
}
}
}
//add btn
final Composite btnComp = new Composite(parentComp, SWT.NONE);
btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
{
GridLayout layout = new GridLayout();
layout.marginRight = 5;
layout.numColumns = 1;
layout.marginWidth = 0;
btnComp.setLayout(layout);
}
btnClearAll = new Button(btnComp, SWT.NONE);
btnClearAll.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
btnClearAll.setText(Messages.btnCleanSelected);
btnClearAll.addSelectionListener(new ButtonCleanAllSelectionAdapter());
return parentComp;
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType in project cubrid-manager by CUBRID.
the class EditStatisticHostDialog method init.
public void init(StatisticType dataType, TimeType timeType, StatisticChartHost hostInfo) {
if (hostInfo == null) {
return;
}
this.oldHostItem = hostInfo;
this.hostValue = hostInfo.getCubridServerId();
this.dataType = dataType;
this.timeValue = timeType == null ? VALUE_DEFAULT : timeType.getMessage();
MetricType metricType = MetricType.getEnumByMetric(hostInfo.getMetric());
this.metricValue = metricType != null ? metricType.getMessage() : VALUE_DEFAULT;
switch(dataType) {
case DB:
dbNameValue = hostInfo.getDbName();
break;
case DB_VOL:
dbNameValue = hostInfo.getDbName();
dbVolNameValue = hostInfo.getVolName();
break;
case BROKER:
brokerNameValue = hostInfo.getBrokerName();
case OS:
break;
default:
break;
}
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType in project cubrid-manager by CUBRID.
the class StatisticData method getDescription.
public String getDescription(boolean isMultiHost) {
StringBuilder sb = new StringBuilder();
MetricType metricType = MetricType.getEnumByMetric(metric);
sb.append(metricType.getMessage());
switch(getType()) {
case DB:
sb.append(":").append(dbName);
break;
case DB_VOL:
sb.append(":").append(dbName);
sb.append(":").append(volName);
break;
case BROKER:
sb.append(":").append(bName);
break;
case OS:
break;
default:
break;
}
if (isMultiHost && serverInfo != null) {
if (serverInfo.getServerName() != null) {
sb.append("@").append(serverInfo.getServerName());
} else {
sb.append("@").append(serverInfo.getHostAddress());
sb.append(":").append(serverInfo.getHostMonPort());
}
}
return sb.toString();
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType in project cubrid-manager by CUBRID.
the class StatisticData method getSimpleDescription.
public String getSimpleDescription(boolean isMultiHost) {
StringBuilder sb = new StringBuilder();
MetricType metricType = MetricType.getEnumByMetric(metric);
sb.append(metricType.getMessage());
if (isMultiHost && serverInfo != null) {
if (serverInfo.getServerName() != null) {
sb.append("@").append(serverInfo.getServerName());
} else {
sb.append("@").append(serverInfo.getHostAddress());
sb.append(":").append(serverInfo.getHostMonPort());
}
}
return sb.toString();
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType in project cubrid-manager by CUBRID.
the class EditStatisticHostDialog method refreshMetricData.
private void refreshMetricData(StatisticType type, boolean isRefreshMetricValue) {
if (type == null) {
itemsMetric = ITEMS_EMPTY;
if (isRefreshMetricValue) {
metricValue = VALUE_DEFAULT;
}
} else {
Set<MetricType> metricTypeSet = null;
if (isFirstHost) {
metricTypeSet = StatisticParamUtil.getSupportedMetricTypes(type);
} else {
metricTypeSet = StatisticParamUtil.getCompatibleMetricsForDisplay(firstMetric);
}
if (metricTypeSet != null)
itemsMetric = new String[metricTypeSet.size()];
int index = 0;
for (MetricType metricType : metricTypeSet) {
itemsMetric[index] = metricType.getMessage();
index++;
}
if (isRefreshMetricValue) {
metricValue = itemsMetric[0];
}
}
comboMetric.setItems(itemsMetric);
if (isRefreshMetricValue || metricValue != null) {
comboMetric.setText(metricValue);
}
}
Aggregations