use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart in project cubrid-manager by CUBRID.
the class DbDashboardHistoryViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(true);
xyplot.getRangeAxis().setVisible(true);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(false);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart in project cubrid-manager by CUBRID.
the class HostDashboardHistoryViewPart method loadBrokerChart.
/**
* Load an instance of ChartCompositePart stand for broker monitor info
*
* @param parent the instance of Composite
*/
private void loadBrokerChart(Composite parent) {
brokerComp = new Composite(parent, SWT.NULL);
brokerComp.setLayout(new GridLayout());
brokerComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group brokerGrp = new Group(brokerComp, SWT.NONE);
brokerGrp.setText(Messages.hostBrokerSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
brokerGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
brokerGrp.setLayoutData(gridData);
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
brokerChartPart = new ChartCompositePart(brokerGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = brokerChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER);
}
brokerChartPart.loadContent();
JFreeChart chart = (JFreeChart) brokerChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) brokerChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart in project cubrid-manager by CUBRID.
the class BrokerStatusHistoryViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
* @see IWorkbenchPart
*/
public void createPartControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.RESIZE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final HistoryComposite historyComposite = new HistoryComposite();
historyComposite.loadTimeSelection(composite);
Label sepWithResult = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_OUT);
sepWithResult.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
BrokerDiagData brokerDiagData = new BrokerDiagData();
ICubridNode selection = getCubridNode();
ServerInfo serverInfo = selection.getServer().getServerInfo();
isNewBrokerDiag = CompatibleUtil.isNewBrokerDiag(serverInfo);
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
chartPart = new ChartCompositePart(composite, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = chartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER, isNewBrokerDiag);
}
chartPart.setChartTitle(Messages.brokerHistoryChartTtl);
String hostAddress = serverInfo.getHostAddress();
int monPort = serverInfo.getHostMonPort();
String historyFileName = HistoryComposite.BROKER_HISTORY_FILE_PREFIX + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
chartPart.setHistoryFileName(historyFileName);
IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
chartPart.setHistoryPath(sHistoryPath);
chartPart.loadContent();
chartPart.addChartMouseListener();
makeActions();
historyComposite.getQueryBtn().addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent ex) {
String date = historyComposite.getDate();
String fromTime = historyComposite.getFromTime();
String toTime = historyComposite.getToTime();
// check date/fromTime/toTime
boolean timeOrder = historyComposite.checkTime(date, fromTime, toTime);
if (!timeOrder) {
CommonUITool.openErrorBox(Messages.errBrokerHistorySettingTime);
return;
}
String[] ymd = date.split("-");
int year = Integer.valueOf(ymd[0]);
int month = Integer.valueOf(ymd[1]);
int day = Integer.valueOf(ymd[2]);
String[] fromHms = fromTime.split(":");
int fromHour = Integer.valueOf(fromHms[0]);
int fromMinute = Integer.valueOf(fromHms[1]);
int fromSecond = Integer.valueOf(fromHms[2]);
Calendar calFrom = Calendar.getInstance();
calFrom.set(year, month, day, fromHour, fromMinute, fromSecond);
final long millisFrom = calFrom.getTimeInMillis();
String[] toHms = toTime.split(":");
int toHour = Integer.valueOf(toHms[0]);
int toMinute = Integer.valueOf(toHms[1]);
int toSecond = Integer.valueOf(toHms[2]);
Calendar calTo = Calendar.getInstance();
calTo.set(year, month, day, toHour, toMinute, toSecond);
final long millisTo = calTo.getTimeInMillis();
XYPlot plot = (XYPlot) chartPart.getChart().getPlot();
plot.getDomainAxis().setRange(millisFrom, millisTo);
final CounterFile countFile = chartPart.openHistoryFile();
if (countFile == null) {
return;
}
final List<String> types = new ArrayList<String>();
for (BrokerDiagEnum enumeration : BrokerDiagEnum.values()) {
String type = enumeration.getName();
types.add(type);
}
chartPart.executeQueryWithBusyCursor(countFile, types, millisFrom, millisTo);
try {
countFile.close();
} catch (IOException e1) {
LOGGER.error(e1.getMessage());
}
}
public void widgetSelected(SelectionEvent ex) {
widgetDefaultSelected(ex);
}
});
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart in project cubrid-manager by CUBRID.
the class BrokerStatusMonitorViewPart method createPartControl.
/**
* Creates the SWT controls for this workbench part.
*
* @param parent the parent control
*/
public void createPartControl(Composite parent) {
composite = new Composite(parent, SWT.RESIZE);
composite.setLayout(new FillLayout());
ICubridNode selection = getCubridNode();
ServerInfo serverInfo = selection.getServer().getServerInfo();
isNewBrokerDiag = CompatibleUtil.isNewBrokerDiag(serverInfo);
BrokerDiagData brokerDiagData = new BrokerDiagData();
TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
chartPart = new ChartCompositePart(composite, map);
String hostAddress = serverInfo.getHostAddress();
int monPort = serverInfo.getHostMonPort();
String historyFileName = HistoryComposite.BROKER_HISTORY_FILE_PREFIX + hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
chartPart.setHistoryFileName(historyFileName);
if (null == monInstaceData) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = chartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.BROKER, isNewBrokerDiag);
}
chartPart.setChartTitle(Messages.brokerMonitorChartTtl);
IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
chartPart.setHistoryPath(sHistoryPath);
} else {
String titleName = monInstaceData.getTitleName();
chartPart.setChartTitle(titleName);
chartPart.setSettingData(monInstaceData);
}
chartPart.loadContent();
makeActions();
new DataGenerator().start();
}
Aggregations