Search in sources :

Example 6 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project cubrid-manager by CUBRID.

the class DBSpaceLabelProvider method createBrokerInfoItem.

private void createBrokerInfoItem(ExpandBar bar, int index) {
    ExpandItem brokerInfoItem = new ExpandItem(bar, SWT.NONE, index);
    brokerInfoItem.setText(Messages.titleBrokerInfo);
    Composite brokerComposite = new Composite(bar, SWT.None);
    brokerComposite.setLayout(new FillLayout());
    brokerTableViewer = new TableViewer(brokerComposite, SWT.BORDER | SWT.FULL_SELECTION);
    brokerTableViewer.getTable().setHeaderVisible(true);
    brokerTableViewer.getTable().setLinesVisible(true);
    brokerTableViewer.setContentProvider(new BrokersStatusContentProvider());
    BrokersStatusLabelProvider brokersStatusLabelProvider = new BrokersStatusLabelProvider();
    brokersStatusLabelProvider.setServerInfo(serverInfo);
    brokerTableViewer.setLabelProvider(brokersStatusLabelProvider);
    TableColumn tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblBrokerName);
    tblColumn.setToolTipText(Messages.tipBrokerName);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.CENTER);
    tblColumn.setText(Messages.tblBrokerStatus);
    tblColumn.setToolTipText(Messages.tipBrokerStatus);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblBrokerProcess);
    tblColumn.setToolTipText(Messages.tipBrokerProcess);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblPort);
    tblColumn.setToolTipText(Messages.tipPort);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblServer);
    tblColumn.setToolTipText(Messages.tipServer);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblQueue);
    tblColumn.setToolTipText(Messages.tipQueue);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblRequest);
    tblColumn.setToolTipText(Messages.tipRequest);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblTps);
    tblColumn.setToolTipText(Messages.tipTps);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblQps);
    tblColumn.setToolTipText(Messages.tipQps);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblLongTran);
    tblColumn.setToolTipText(Messages.tipLongTran);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblLongQuery);
    tblColumn.setToolTipText(Messages.tipLongQuery);
    tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
    tblColumn.setText(Messages.tblErrQuery);
    tblColumn.setToolTipText(Messages.tipErrQuery);
    brokerInfoItem.setHeight(120);
    brokerInfoItem.setExpanded(true);
    brokerInfoItem.setControl(brokerComposite);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) BrokersStatusContentProvider(com.cubrid.cubridmanager.ui.broker.editor.BrokersStatusContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) TableViewer(org.eclipse.jface.viewers.TableViewer) BrokersStatusLabelProvider(com.cubrid.cubridmanager.ui.broker.editor.BrokersStatusLabelProvider) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 7 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_ExpandBar method test_getItems.

@Test
public void test_getItems() {
    int number = 5;
    ExpandItem[] items = new ExpandItem[number];
    for (int i = 0; i < number; i++) {
        items[i] = new ExpandItem(expandBar, 0);
    }
    assertArrayEquals(items, expandBar.getItems());
    expandBar.getItems()[0].dispose();
    assertArrayEquals(new ExpandItem[] { items[1], items[2], items[3], items[4] }, expandBar.getItems());
    expandBar.getItems()[3].dispose();
    assertArrayEquals(new ExpandItem[] { items[1], items[2], items[3] }, expandBar.getItems());
    expandBar.getItems()[1].dispose();
    assertArrayEquals(new ExpandItem[] { items[1], items[3] }, expandBar.getItems());
}
Also used : ExpandItem(org.eclipse.swt.widgets.ExpandItem) Test(org.junit.Test)

Example 8 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_ExpandBar method test_indexOfLorg_eclipse_swt_widgets_ExpandItem.

@Test
public void test_indexOfLorg_eclipse_swt_widgets_ExpandItem() {
    int number = 10;
    ExpandItem[] items = new ExpandItem[number];
    for (int i = 0; i < number; i++) {
        items[i] = new ExpandItem(expandBar, 0);
    }
    for (int i = 0; i < number; i++) {
        assertTrue(":a:" + i, expandBar.indexOf(items[i]) == i);
    }
    items = new ExpandItem[number];
    for (int i = 0; i < number; i++) {
        items[i] = new ExpandItem(expandBar, 0);
    }
    for (int i = 0; i < number; i++) {
        try {
            expandBar.indexOf(null);
            fail("No exception thrown for expandItem == null");
        } catch (IllegalArgumentException e) {
        }
    }
}
Also used : ExpandItem(org.eclipse.swt.widgets.ExpandItem) Test(org.junit.Test)

Example 9 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_ExpandBar method test_getItemI.

@Test
public void test_getItemI() {
    int number = 5;
    ExpandItem[] items = new ExpandItem[number];
    for (int i = 0; i < number; i++) {
        items[i] = new ExpandItem(expandBar, 0);
    }
    for (int i = 0; i < number; i++) {
        assertTrue(":a:", expandBar.getItem(i) == items[i]);
    }
    expandBar = new ExpandBar(shell, 0);
    number = 5;
    items = new ExpandItem[number];
    for (int i = 0; i < number; i++) {
        items[i] = new ExpandItem(expandBar, 0);
    }
    try {
        expandBar.getItem(number);
        fail("No exception thrown for illegal index argument");
    } catch (IllegalArgumentException e) {
    }
}
Also used : ExpandBar(org.eclipse.swt.widgets.ExpandBar) ExpandItem(org.eclipse.swt.widgets.ExpandItem) Test(org.junit.Test)

Example 10 with ExpandItem

use of org.eclipse.swt.widgets.ExpandItem in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_widgets_ExpandBar method createExpandBar.

private void createExpandBar(List<String> events) {
    expandBar = new ExpandBar(shell, SWT.V_SCROLL);
    for (int i = 0; i < 3; i++) {
        ExpandItem item = new ExpandItem(expandBar, SWT.NONE);
        item.setText("ExpandBar" + i);
        hookExpectedEvents(item, getTestName(), events);
    }
    setWidget(expandBar);
}
Also used : ExpandBar(org.eclipse.swt.widgets.ExpandBar) ExpandItem(org.eclipse.swt.widgets.ExpandItem)

Aggregations

ExpandItem (org.eclipse.swt.widgets.ExpandItem)18 Composite (org.eclipse.swt.widgets.Composite)12 FillLayout (org.eclipse.swt.layout.FillLayout)10 TableViewer (org.eclipse.jface.viewers.TableViewer)7 TableContentProvider (com.cubrid.common.ui.spi.TableContentProvider)6 ExpandBar (org.eclipse.swt.widgets.ExpandBar)5 TableLabelProvider (com.cubrid.common.ui.spi.TableLabelProvider)4 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)4 Test (org.junit.Test)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Menu (org.eclipse.swt.widgets.Menu)3 MenuItem (org.eclipse.swt.widgets.MenuItem)3 TableColumn (org.eclipse.swt.widgets.TableColumn)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)2 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)2 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)2 MenuEvent (org.eclipse.swt.events.MenuEvent)2 MenuListener (org.eclipse.swt.events.MenuListener)2