use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.
the class EditMonitorInstanceAction method run.
/**
* Override the run method in order to open an instance of status monitor
* dialog
*
*/
public void run() {
Object[] obj = this.getSelectedObj();
ICubridNode selection = (ICubridNode) obj[0];
String selectLbl = selection.getLabel();
ServerInfo serverInfo = selection.getServer().getServerInfo();
String prefix = QueryOptions.getPrefix(serverInfo);
String selectionKey = prefix + QueryOptions.MONITOR_FOLDER_NAME + selectLbl;
CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
StatusMonInstanceData monData = instance.getData(selectionKey);
AddMonitorInstanceDlg addMonitorInstanceDlg = new AddMonitorInstanceDlg(getShell());
addMonitorInstanceDlg.setSelection(selection);
addMonitorInstanceDlg.setMonData(monData);
addMonitorInstanceDlg.open();
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.
the class CubridStatusMonitorFolderLoader method createTempStatusNode.
/**
* Create temp status node
*
* @param parent the parent node
*/
private void createTempStatusNode(ICubridNode parent) {
CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
ServerInfo serverInfo = parent.getServer().getServerInfo();
String[] keys = QueryOptions.getAllStatusMonitorKey(serverInfo);
for (String key : keys) {
StatusMonInstanceData data = instance.loadSetting(key);
instance.addData(key, data);
}
Map<String, StatusMonInstanceData> map = instance.getDataMap();
for (Map.Entry<String, StatusMonInstanceData> entry : map.entrySet()) {
String key = entry.getKey();
String prefix = QueryOptions.getPrefix(serverInfo);
if (!key.startsWith(prefix)) {
continue;
}
String label = key.substring(key.lastIndexOf(".") + 1);
StatusMonInstanceData monInstaceData = entry.getValue();
String statusId = parent.getId() + NODE_SEPARATOR + label;
ICubridNode stautsNode = new DefaultCubridNode(statusId, label, "icons/navigator/status_item.png");
stautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
stautsNode.setModelObj(monInstaceData);
String viewId = "";
switch(monInstaceData.getMonitorType()) {
case BROKER:
viewId = BrokerStatusMonitorViewPart.ID;
break;
case DATABASE:
viewId = DbStatusDumpMonitorViewPart.ID;
break;
default:
}
if ("".equals(viewId)) {
return;
}
stautsNode.setViewId(viewId);
stautsNode.setContainer(false);
parent.addChild(stautsNode);
}
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.
the class CubridMonitorFolderLoader method createTempStatusNode.
/**
* Create temp status node
*
* @param parent the parent node
*/
private void createTempStatusNode(ICubridNode parent) {
CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
ServerInfo serverInfo = parent.getServer().getServerInfo();
String[] keys = QueryOptions.getAllStatusMonitorKey(serverInfo);
for (String key : keys) {
StatusMonInstanceData data = instance.loadSetting(key);
instance.addData(key, data);
}
Map<String, StatusMonInstanceData> map = instance.getDataMap();
for (Map.Entry<String, StatusMonInstanceData> entry : map.entrySet()) {
String key = entry.getKey();
String prefix = QueryOptions.getPrefix(serverInfo);
if (!key.startsWith(prefix)) {
continue;
}
String label = key.substring(key.lastIndexOf(".") + 1);
StatusMonInstanceData monInstaceData = entry.getValue();
String statusId = parent.getId() + NODE_SEPARATOR + label;
ICubridNode stautsNode = new DefaultCubridNode(statusId, label, "icons/navigator/status_item.png");
stautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
stautsNode.setModelObj(monInstaceData);
String viewId = "";
switch(monInstaceData.getMonitorType()) {
case BROKER:
viewId = BrokerStatusMonitorViewPart.ID;
break;
case DATABASE:
viewId = DbStatusDumpMonitorViewPart.ID;
break;
default:
}
if ("".equals(viewId)) {
return;
}
stautsNode.setViewId(viewId);
stautsNode.setContainer(false);
parent.addChild(stautsNode);
}
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.
the class AddMonitorInstanceDlg method okPressed.
/**
* When press "ok" button, call it.
*/
public void okPressed() {
chartSettingDlg.performGetData();
StatusMonInstanceData data = new StatusMonInstanceData();
//type
String type = typeCombo.getText().trim();
if (type.equals(MonitorType.BROKER.toString())) {
data.setMonitorType(MonitorType.BROKER);
} else if (type.equals(MonitorType.DATABASE.toString())) {
data.setMonitorType(MonitorType.DATABASE);
}
//title
data.setTitleName(chartSettingDlg.getTitleName());
data.setTitleBgColor(chartSettingDlg.getTtlBgColor());
data.setTitleFontName(chartSettingDlg.getTtlFontName());
data.setTitleFontSize(chartSettingDlg.getTtlFontSize());
data.setTitleFontColor(chartSettingDlg.getTtlFontColor());
//plot
data.setPlotBgColor(chartSettingDlg.getPlotBgColor());
data.setPlotDomainGridColor(chartSettingDlg.getPlotDomainGridColor());
data.setPlotRangGridColor(chartSettingDlg.getPlotRangGridColor());
data.setPlotDateAxisColor(chartSettingDlg.getPlotDateAxisColor());
data.setPlotNumberAxisColor(chartSettingDlg.getPlotNumberAxisColor());
//series
data.setSettingMap(chartSettingDlg.getSettingMap());
//history path
data.setHistoryPath(chartSettingDlg.getHistoryPath());
//store the data
CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
String nodeName = nodeTxt.getText().trim();
String statusId = selection.getId();
ServerInfo serverInfo = selection.getServer().getServerInfo();
String prefix = QueryOptions.getPrefix(serverInfo);
String selectionKey = prefix + QueryOptions.MONITOR_FOLDER_NAME + nodeName;
if (statusId.endsWith(nodeName)) {
instance.updateData(selectionKey, data);
selection.setModelObj(data);
String viewId = "";
switch(data.getMonitorType()) {
case BROKER:
viewId = BrokerStatusMonitorViewPart.ID;
break;
case DATABASE:
viewId = DbStatusDumpMonitorViewPart.ID;
break;
default:
}
selection.setViewId(viewId);
} else {
instance.addData(selectionKey, data);
}
//save button
if (saveBtn.getSelection()) {
instance.saveSetting(selectionKey);
}
super.okPressed();
}
Aggregations