Search in sources :

Example 81 with FillLayout

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;
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) MultiHostChartItem(com.cubrid.cubridmanager.core.monstatistic.model.MultiHostChartItem) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) StatisticChartHost(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartHost)

Example 82 with FillLayout

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) GridLayout(org.eclipse.swt.layout.GridLayout) Color(java.awt.Color) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint)

Example 83 with FillLayout

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 84 with FillLayout

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();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 85 with FillLayout

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));
    }
}
Also used : ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) TextTitle(org.jfree.chart.title.TextTitle) XYPlot(org.jfree.chart.plot.XYPlot) Color(java.awt.Color) CommonUITool.trimPaintColor(com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout) Font(java.awt.Font)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)298 Composite (org.eclipse.swt.widgets.Composite)180 GridData (org.eclipse.swt.layout.GridData)130 Shell (org.eclipse.swt.widgets.Shell)104 GridLayout (org.eclipse.swt.layout.GridLayout)97 Label (org.eclipse.swt.widgets.Label)69 SelectionEvent (org.eclipse.swt.events.SelectionEvent)67 Display (org.eclipse.swt.widgets.Display)63 Button (org.eclipse.swt.widgets.Button)60 Point (org.eclipse.swt.graphics.Point)55 Table (org.eclipse.swt.widgets.Table)48 Group (org.eclipse.swt.widgets.Group)40 SelectionListener (org.eclipse.swt.events.SelectionListener)38 TableColumn (org.eclipse.swt.widgets.TableColumn)38 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)37 Text (org.eclipse.swt.widgets.Text)36 Test (org.junit.Test)36 TableItem (org.eclipse.swt.widgets.TableItem)35 SashForm (org.eclipse.swt.custom.SashForm)31 Rectangle (org.eclipse.swt.graphics.Rectangle)29