use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class EditMultiHostStatisticItemDialog 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);
final int DEFAULT_WIDTH = 80;
Composite compHost = new Composite(parentComp, SWT.RESIZE);
compHost.setLayout(new FillLayout());
compHost.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
hostTableViewer = new TableViewer(compHost, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
hostTableViewer.getTable().setHeaderVisible(true);
hostTableViewer.getTable().setLinesVisible(true);
hostTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
TableItem[] tableItems = hostTableViewer.getTable().getSelection();
StatisticChartHost hostItem = (StatisticChartHost) tableItems[0].getData();
openAddStatisticHostDialog(hostItem, hostList.size() == 1, false);
}
});
//Host Name
final TableViewerColumn nameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
nameColumn.getColumn().setWidth(DEFAULT_WIDTH);
nameColumn.getColumn().setText(Messages.lblHostName);
//IP
final TableViewerColumn ipColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
ipColumn.getColumn().setWidth(DEFAULT_WIDTH);
ipColumn.getColumn().setText(Messages.lblIp);
//Port
final TableViewerColumn portColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
portColumn.getColumn().setWidth(50);
portColumn.getColumn().setText(Messages.lblPort);
//Data Type
final TableViewerColumn dataTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
dataTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
dataTypeColumn.getColumn().setText(Messages.lblDataType);
//Time Type
final TableViewerColumn timeTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
timeTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
timeTypeColumn.getColumn().setText(Messages.lblTimeType);
//Database Name
final TableViewerColumn dbNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
dbNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
dbNameColumn.getColumn().setText(Messages.lblDbName);
//Database Volume Name
final TableViewerColumn volNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
volNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
volNameColumn.getColumn().setText(Messages.lblVolName);
//Broker Name
final TableViewerColumn brokerColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
brokerColumn.getColumn().setWidth(DEFAULT_WIDTH);
brokerColumn.getColumn().setText(Messages.lblBrokerName);
//Metric
final TableViewerColumn metricColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
metricColumn.getColumn().setWidth(DEFAULT_WIDTH);
metricColumn.getColumn().setText(Messages.lblMetric);
hostTableViewer.setContentProvider(new HostTableViewerContentProvider());
hostTableViewer.setLabelProvider(new HostTableViewerLabelProvider());
hostTableViewer.getTable().addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(hostTableViewer.getTable());
}
});
hostTableViewer.getTable().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] items = hostTableViewer.getTable().getSelection();
btnEditHost.setEnabled(items.length > 0);
btnDeleteHost.setEnabled(items.length > 0);
}
});
Composite compBtn = new Composite(parentComp, SWT.RESIZE);
GridLayout layoutCompBtn = new GridLayout(6, false);
layoutCompBtn.marginRight = 0;
// layoutCompBtn.numColumns = 6;
layoutCompBtn.marginWidth = 0;
compBtn.setLayout(layoutCompBtn);
compBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
btnAddHost = new Button(compBtn, SWT.NONE);
btnAddHost.setText(Messages.btnAddHost);
btnAddHost.addSelectionListener(new ButtonAddHostAdapter());
btnEditHost = new Button(compBtn, SWT.NONE);
btnEditHost.setText(Messages.btnEditHost);
btnEditHost.addSelectionListener(new ButtonEditHostAdapter());
btnEditHost.setEnabled(false);
btnDeleteHost = new Button(compBtn, SWT.NONE);
btnDeleteHost.setText(Messages.btnDelHost);
btnDeleteHost.addSelectionListener(new ButtonDeleteHostAdapter());
btnDeleteHost.setEnabled(false);
if (!isNew && statisticChartItem != null) {
MultiHostChartItem multiHostChartItem = (MultiHostChartItem) statisticChartItem;
type = multiHostChartItem.getType();
timeType = TimeType.getEnumByType(multiHostChartItem.getDType());
hostList = multiHostChartItem.getHostList();
hostTableViewer.setInput(hostList);
} else {
hostList = new ArrayList<StatisticChartHost>();
}
return parentComp;
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method loadSeriesChart.
/**
* Load the series chart into the given composite
*
* @param parent the given composite
* @return the instance of composite
*/
private Composite loadSeriesChart(Composite parent) {
Group seriesGroup = new Group(parent, SWT.NONE);
seriesGroup.setText(seriesGroupName);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
seriesGroup.setLayout(layout);
seriesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
seriesChart = createSeriesChart();
int red = seriesGroup.getBackground().getRed();
int green = seriesGroup.getBackground().getGreen();
int blue = seriesGroup.getBackground().getBlue();
seriesChart.setBackgroundPaint(new Color(red, green, blue));
ChartComposite chartComposite = new ChartComposite(seriesGroup, SWT.NONE, seriesChart, false, true, false, false, false);
FillLayout chartLayout = new FillLayout();
chartLayout.marginHeight = 0;
chartLayout.marginWidth = 0;
chartComposite.setLayout(chartLayout);
chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
return parent;
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method loadBarChart.
/**
* Load the bar chart into the given composite
*
* @param parent the given composite
* @return the instance of composite
*/
private Composite loadBarChart(Composite parent) {
Group barGroup = new Group(parent, SWT.NONE);
barGroup.setText(barGroupName);
GridLayout layout = new GridLayout();
layout.marginHeight = 6;
layout.marginWidth = 6;
barGroup.setLayout(layout);
barGroup.setLayoutData(new GridData(GridData.FILL_VERTICAL));
barChart = createBarChart();
barChart.setBackgroundPaint(Color.BLACK);
ChartComposite chartComposite = new ChartComposite(barGroup, SWT.NONE, barChart, false, true, false, false, false);
chartComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
FillLayout chartLayout = new FillLayout();
chartLayout.marginHeight = 0;
chartLayout.marginWidth = 0;
chartComposite.setLayout(chartLayout);
return parent;
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method createPartControl.
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, false));
createToolBar(parent);
scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
scrolledComp.setLayout(new FillLayout());
scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
scrolledComp.getVerticalBar().setIncrement(10);
scrolledComp.addListener(SWT.Activate, new Listener() {
@Override
public void handleEvent(Event event) {
scrolledComp.setFocus();
}
});
chartAreaRootComp = new Composite(scrolledComp, SWT.NONE);
{
final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
chartAreaRootComp.setLayoutData(gd);
GridLayout layout = new GridLayout(3, false);
chartAreaRootComp.setLayout(layout);
chartAreaRootComp.setBackground(COLOR_CHART_AREA_BACKGROUND);
}
statisticDataMap = refreshData(statisticItemList);
createDataChart(chartAreaRootComp);
createAddChart(chartAreaRootComp);
createHiddenItems();
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setContent(chartAreaRootComp);
scrolledComp.setMinWidth(CHART_AREA_WIDTH);
updateScrolledCompositeHeight();
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class ChartCompositePart method createPlotUnit.
/**
* Create plot unit which show the data changing.
*
* @param parent the parent composite
*/
public void createPlotUnit(Composite parent) {
chart = createChart();
int red = parent.getBackground().getRed();
int green = parent.getBackground().getGreen();
int blue = parent.getBackground().getBlue();
chart.setBackgroundPaint(new Color(red, green, blue));
chartComposite = new ChartComposite(parent, SWT.NONE, chart, false, true, false, false, false);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
chartComposite.setLayout(fillLayout);
chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
if (null != monInstaceData) {
TextTitle title = chart.getTitle();
XYPlot plot = chart.getXYPlot();
// title
String ttlBgColor = monInstaceData.getTitleBgColor();
String ttlFontName = monInstaceData.getTitleFontName();
int ttlFontSize = monInstaceData.getTitleFontSize();
String ttlFontColor = monInstaceData.getTitleFontColor();
// plot
String plotBgColor = monInstaceData.getPlotBgColor();
String plotDomainGridColor = monInstaceData.getPlotDomainGridColor();
String plotRangGridColor = monInstaceData.getPlotRangGridColor();
String plotDateAxisColor = monInstaceData.getPlotDateAxisColor();
String plotNumberAxisColor = monInstaceData.getPlotNumberAxisColor();
// history path
historyPath = monInstaceData.getHistoryPath();
isChangedHistoryPath = true;
if (ttlBgColor != null) {
red = getColorElem(ttlBgColor, 0);
green = getColorElem(ttlBgColor, 1);
blue = getColorElem(ttlBgColor, 2);
title.setBackgroundPaint(new Color(red, green, blue));
}
if (!"".equals(ttlFontName)) {
Font titleFont = new Font(ttlFontName, 0, ttlFontSize);
title.setFont(titleFont);
}
red = getColorElem(ttlFontColor, 0);
green = getColorElem(ttlFontColor, 1);
blue = getColorElem(ttlFontColor, 2);
title.setPaint(new Color(red, green, blue));
red = getColorElem(plotBgColor, 0);
green = getColorElem(plotBgColor, 1);
blue = getColorElem(plotBgColor, 2);
plot.setBackgroundPaint(new Color(red, green, blue));
red = getColorElem(plotDomainGridColor, 0);
green = getColorElem(plotDomainGridColor, 1);
blue = getColorElem(plotDomainGridColor, 2);
plot.setDomainGridlinePaint(new Color(red, green, blue));
red = getColorElem(plotRangGridColor, 0);
green = getColorElem(plotRangGridColor, 1);
blue = getColorElem(plotRangGridColor, 2);
plot.setRangeGridlinePaint(new Color(red, green, blue));
red = getColorElem(plotDateAxisColor, 0);
green = getColorElem(plotDateAxisColor, 1);
blue = getColorElem(plotDateAxisColor, 2);
plot.getRangeAxis().setAxisLinePaint(new Color(red, green, blue));
red = getColorElem(plotNumberAxisColor, 0);
green = getColorElem(plotNumberAxisColor, 1);
blue = getColorElem(plotNumberAxisColor, 2);
plot.getDomainAxis().setAxisLinePaint(new Color(red, green, blue));
}
}
Aggregations