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();
}
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();
}
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;
}
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);
}
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);
}
Aggregations