Search in sources :

Example 16 with TabItem

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

the class ShardWizardAllInfoPage method createControl.

/**
	 * Create the control for this page
	 *
	 * @param parent
	 *            the parent composite
	 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gridData);
    Label tipLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    tipLabel.setText(Messages.msgDbInfoList);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    tipLabel.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setLayoutData(gridData);
    tabFolder.setLayout(new GridLayout());
    gridData = new GridData(GridData.FILL_BOTH);
    shardGeneralInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardGeneralInfoText.setEditable(false);
    shardGeneralInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardBrokerInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardBrokerInfoText.setEditable(false);
    shardBrokerInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardConnectionInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardConnectionInfoText.setEditable(false);
    shardConnectionInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardKeyInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardKeyInfoText.setEditable(false);
    shardKeyInfoText.setLayoutData(gridData);
    TabItem item = new TabItem(tabFolder, SWT.NONE);
    item.setText("General");
    item.setControl(shardGeneralInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Broker");
    item.setControl(shardBrokerInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Connection");
    item.setControl(shardConnectionInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Key");
    item.setControl(shardKeyInfoText);
    initialize();
    setTitle("All Information");
    setMessage("Add a new shard broker.");
    setControl(composite);
    // TODO why this method called again?
    initialize();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) Text(org.eclipse.swt.widgets.Text)

Example 17 with TabItem

use of org.eclipse.swt.widgets.TabItem in project bndtools by bndtools.

the class AdvancedSearchDialog method getSelectedPanel.

private SearchPanel getSelectedPanel() {
    int index = tabFolder.getSelectionIndex();
    TabItem item = tabFolder.getItem(index);
    return (SearchPanel) item.getData();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem)

Example 18 with TabItem

use of org.eclipse.swt.widgets.TabItem in project bndtools by bndtools.

the class AdvancedSearchDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Advanced Search");
    setMessage("Perform a search for resource capabilities in the Repositories. Select the\ncapability namespace using the tab bar.");
    Composite area = (Composite) super.createDialogArea(parent);
    tabFolder = new TabFolder(area, SWT.TOP);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    PropertyChangeListener changeListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            updateFromPanel();
        }
    };
    final List<Image> images = new LinkedList<Image>();
    for (Entry<String, SearchPanel> panelEntry : panelMap.entrySet()) {
        String title = panelEntry.getKey();
        SearchPanel panel = panelEntry.getValue();
        Composite container = new Composite(tabFolder, SWT.NONE);
        container.setLayout(new GridLayout(1, false));
        Control control = panel.createControl(container);
        GridData controlLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
        controlLayoutData.widthHint = 200;
        control.setLayoutData(controlLayoutData);
        TabItem item = new TabItem(tabFolder, SWT.NONE);
        item.setText(title);
        item.setControl(container);
        item.setData(panel);
        Image image = panel.createImage(tabFolder.getDisplay());
        if (image != null) {
            images.add(image);
            item.setImage(image);
        }
        panel.addPropertyChangeListener(changeListener);
    }
    tabFolder.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            for (Image image : images) {
                if (!image.isDisposed())
                    image.dispose();
            }
        }
    });
    tabFolder.setSelection(activeTabIndex);
    SearchPanel currentPanel = (SearchPanel) tabFolder.getItem(activeTabIndex).getData();
    currentPanel.setFocus();
    requirement = currentPanel.getRequirement();
    tabFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            activeTabIndex = tabFolder.getSelectionIndex();
            updateFromPanel();
            getSelectedPanel().setFocus();
        }
    });
    return area;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) PropertyChangeListener(java.beans.PropertyChangeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TabFolder(org.eclipse.swt.widgets.TabFolder) Image(org.eclipse.swt.graphics.Image) DisposeEvent(org.eclipse.swt.events.DisposeEvent) LinkedList(java.util.LinkedList) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 19 with TabItem

use of org.eclipse.swt.widgets.TabItem in project GT by Tencent.

the class SettingView method createCPUTabItem.

private void createCPUTabItem(TabFolder parent) {
    TabItem cpuTabItem = new TabItem(parent, SWT.NONE);
    cpuTabItem.setText("CPU");
    Composite cpuTabRoot = new Composite(parent, SWT.NONE);
    cpuTabRoot.setLayout(new FormLayout());
    //采样间隔
    FormData testPeriodGroupFormData = new FormData();
    testPeriodGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    testPeriodGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    testPeriodGroupFormData.top = new FormAttachment(cpuTabRoot, Constant.MARGIN_WIDTH_NARROW);
    Group periodGroup = new Group(cpuTabRoot, SWT.NONE);
    periodGroup.setLayoutData(testPeriodGroupFormData);
    periodGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label cpuLabel = new Label(periodGroup, SWT.NONE);
    cpuLabel.setText("采样间隔(ms)");
    itemTestPeriod[Constant.CPU_INDEX] = new Text(periodGroup, SWT.BORDER);
    itemTestPeriod[Constant.CPU_INDEX].setText("3000");
    itemTestPeriod[Constant.CPU_INDEX].addVerifyListener(new SWTNumberVerifyListener());
    itemTestPeriod[Constant.CPU_INDEX].addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    //CPU使用率测试方法设置
    FormData cpuSwitchGroupFormData = new FormData();
    cpuSwitchGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    cpuSwitchGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    cpuSwitchGroupFormData.top = new FormAttachment(periodGroup, Constant.MARGIN_WIDTH_NARROW);
    Group testMethodGroup = new Group(cpuTabRoot, SWT.NONE);
    testMethodGroup.setLayoutData(cpuSwitchGroupFormData);
    testMethodGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label cpuTestMethodLabel = new Label(testMethodGroup, SWT.NONE);
    cpuTestMethodLabel.setText("数据源");
    cpuTestMethod = new Combo(testMethodGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    cpuTestMethod.setItems(Constant.CPU_TESTMETHOD_TITLES);
    cpuTestMethod.select(0);
    cpuTestMethod.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    FormData jiffiesGroupFormData = new FormData();
    jiffiesGroupFormData.left = new FormAttachment(0, Constant.MARGIN_WIDTH);
    jiffiesGroupFormData.right = new FormAttachment(100, -Constant.MARGIN_WIDTH);
    jiffiesGroupFormData.top = new FormAttachment(testMethodGroup, Constant.MARGIN_WIDTH_NARROW);
    Group jiffiesGroup = new Group(cpuTabRoot, SWT.NONE);
    jiffiesGroup.setLayoutData(jiffiesGroupFormData);
    jiffiesGroup.setLayout(new FillLayout(SWT.HORIZONTAL));
    Label jiffiesLabel = new Label(jiffiesGroup, SWT.NONE);
    jiffiesLabel.setText("获取jiffies值");
    jiffiesSwitch = new Combo(jiffiesGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    jiffiesSwitch.setItems(new String[] { "否", "是" });
    jiffiesSwitch.select(0);
    jiffiesSwitch.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
            APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
        }
    });
    cpuTabItem.setControl(cpuTabRoot);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) FillLayout(org.eclipse.swt.layout.FillLayout) TabItem(org.eclipse.swt.widgets.TabItem) ModifyEvent(org.eclipse.swt.events.ModifyEvent) SWTNumberVerifyListener(com.tencent.wstt.apt.ui.custom.SWTNumberVerifyListener) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 20 with TabItem

use of org.eclipse.swt.widgets.TabItem in project dbeaver by serge-rider.

the class ConnectionPageNetwork method createHandlerTab.

private void createHandlerTab(final NetworkHandlerDescriptor descriptor) throws DBException {
    IObjectPropertyConfigurator<DBWHandlerConfiguration> configurator;
    try {
        configurator = descriptor.createConfigurator();
    } catch (DBException e) {
        log.error("Can't create network configurator '" + descriptor.getId() + "'", e);
        return;
    }
    TabItem tabItem = new TabItem(handlersFolder, SWT.NONE);
    tabItem.setText(descriptor.getLabel());
    tabItem.setToolTipText(descriptor.getDescription());
    Composite composite = new Composite(handlersFolder, SWT.NONE);
    tabItem.setControl(composite);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Button useHandlerCheck = UIUtils.createCheckbox(composite, NLS.bind(CoreMessages.dialog_tunnel_checkbox_use_handler, descriptor.getLabel()), false);
    useHandlerCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            HandlerBlock handlerBlock = configurations.get(descriptor);
            DBWHandlerConfiguration handlerConfiguration = handlerBlock.loadedConfigs.get(wizard.getPageSettings().getActiveDataSource().getId());
            handlerConfiguration.setEnabled(useHandlerCheck.getSelection());
            enableHandlerContent(descriptor);
        }
    });
    Composite handlerComposite = UIUtils.createPlaceholder(composite, 1);
    configurations.put(descriptor, new HandlerBlock(configurator, handlerComposite, useHandlerCheck, tabItem));
    handlerComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    configurator.createControl(handlerComposite);
}
Also used : DBException(org.jkiss.dbeaver.DBException) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) DBWHandlerConfiguration(org.jkiss.dbeaver.model.net.DBWHandlerConfiguration) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

TabItem (org.eclipse.swt.widgets.TabItem)31 Composite (org.eclipse.swt.widgets.Composite)27 GridLayout (org.eclipse.swt.layout.GridLayout)26 GridData (org.eclipse.swt.layout.GridData)25 TabFolder (org.eclipse.swt.widgets.TabFolder)18 SelectionEvent (org.eclipse.swt.events.SelectionEvent)17 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)15 Label (org.eclipse.swt.widgets.Label)13 Button (org.eclipse.swt.widgets.Button)10 Text (org.eclipse.swt.widgets.Text)9 Combo (org.eclipse.swt.widgets.Combo)6 TableViewer (org.eclipse.jface.viewers.TableViewer)5 Group (org.eclipse.swt.widgets.Group)5 ModifyEvent (org.eclipse.swt.events.ModifyEvent)4 ModifyListener (org.eclipse.swt.events.ModifyListener)4 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)3 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)3 StyledText (org.eclipse.swt.custom.StyledText)3 SelectionListener (org.eclipse.swt.events.SelectionListener)3 FormAttachment (org.eclipse.swt.layout.FormAttachment)3