本文整理匯總了Java中org.eclipse.swt.widgets.Button.getLayoutData方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.getLayoutData方法的具體用法?Java Button.getLayoutData怎麽用?Java Button.getLayoutData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Button
的用法示例。
在下文中一共展示了Button.getLayoutData方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createControl
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Button btnDef = getDefaultsButton();
btnDef.setText(Messages.dbStorePrefPage_clear_db_store);
GridData defGd = (GridData) btnDef.getLayoutData();
defGd.widthHint = Math.max(defGd.widthHint,
btnDef.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
btnDef.getParent().layout();
}
示例2: attachToPropertySubGroup
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
ELTDefaultSubgroupComposite exportFieldComposite = new ELTDefaultSubgroupComposite(
container.getContainerControl());
exportFieldComposite.createContainerWidget();
// Create Label and into Composite.
AbstractELTWidget exportXSDLableWidget = new ELTDefaultLable("Export XSD");
exportFieldComposite.attachWidget(exportXSDLableWidget);
setPropertyHelpWidget((Control) exportXSDLableWidget.getSWTWidgetControl());
// Create export button and into Composite.
AbstractELTWidget exportXSDButtonWidget = new ELTDefaultButton("Export").grabExcessHorizontalSpace(false);
exportFieldComposite.attachWidget(exportXSDButtonWidget);
exportButton = (Button) exportXSDButtonWidget.getSWTWidgetControl();
GridData gridData = (GridData) exportButton.getLayoutData();
gridData.widthHint = 90;
// On export button click.
exportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// Validation : Check whether schema is define or not before
// exporting the file.
Schema schema = (Schema) getComponent().getProperties().get(Constants.SCHEMA_PROPERTY_NAME);
if ((null == schema || (schema != null && schema.getGridRow().size() == 0))) {
// Show message dialog and return.
MessageDialog.openError(exportButton.getShell(), "Error", "Schema not defined in Schema tab.");
return;
}
exportSchemaFile();
}
});
}
示例3: update
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
public void update(String currentPageId) {
if (composite == null || composite.isDisposed())
return;
GC metricsGC = new GC(composite);
FontMetrics metrics = metricsGC.getFontMetrics();
metricsGC.dispose();
List buttons = (List) buttonMap.get(currentPageId);
Control[] children = composite.getChildren();
int visibleChildren = 0;
Button closeButton = getButton(IDialogConstants.CLOSE_ID);
for (int i = 0; i < children.length; i++) {
Control control = children[i];
if (closeButton == control)
closeButton.dispose();
else {
control.setVisible(false);
setButtonLayoutData(metrics, control, false);
}
}
if (buttons != null) {
for (int i = 0; i < buttons.size(); i++) {
Button button = (Button) buttons.get(i);
button.setVisible(true);
setButtonLayoutData(metrics, button, true);
GridData data = (GridData) button.getLayoutData();
data.exclude = false;
visibleChildren++;
}
}
GridLayout compositeLayout = (GridLayout) composite.getLayout();
compositeLayout.numColumns = visibleChildren;
composite.layout(true);
}
示例4: createSQLQueryComposite
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
/**
* Creates the stack layout composite for SQLQuery
* @param selectionComposite
*/
private void createSQLQueryComposite(ELTSubGroupCompositeWithStack selectionComposite) {
Utils.INSTANCE.loadProperties();
cursor = selectionComposite.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);
sqlQueryComposite = new ELTSubGroupCompositeWithStack(selectionComposite.getContainerControl());
sqlQueryComposite.createContainerWidget();
sqlQueryComposite.numberOfBasicWidgets(3);
AbstractELTWidget createWidgetlabel = createWidgetlabel(Messages.SQL_QUERY, sqlQueryComposite);
selectLable.getSWTWidgetControl().setData(String.valueOf(key_value++), createWidgetlabel.getSWTWidgetControl());
AbstractELTWidget sqlQueryWgt = createWidgetTextbox(Messages.SQL_QUERY, sqlQueryComposite);
sqlQueryDecorator = attachDecoratorToTextbox(Messages.SQL_QUERY, sqlQueryWgt, sqlQueryDecorator);
sqlQueryTextBox = (Text) sqlQueryWgt.getSWTWidgetControl();
attachListeners(sqlQueryWgt);
ELTDefaultButton sqlQueryButtonWgt = new ELTDefaultButton("...");
sqlQueryButtonWgt.buttonWidth(25);
sqlQueryButtonWgt.buttonHeight(20);
sqlQueryButtonWgt.grabExcessHorizontalSpace(false);
sqlQueryComposite.attachWidget(sqlQueryButtonWgt);
Button buttonAlignment = ((Button) sqlQueryButtonWgt.getSWTWidgetControl());
GridData data = (GridData) buttonAlignment.getLayoutData();
data.verticalIndent = 5;
buttonAlignment.addSelectionListener(buttonWidgetSelectionListener(sqlQueryTextBox));
buttonWidgetSelectionListener(sqlQueryTextBox);
AbstractELTWidget createWidgetlabel2 = createWidgetlabel(Messages.EXTRACT_FROM_METASTORE, sqlQueryComposite);
selectLable.getSWTWidgetControl().setData(String.valueOf(key_value++), createWidgetlabel2.getSWTWidgetControl());
ELTDefaultButton editButton = new ELTDefaultButton(Messages.EXTRACT);
sqlQueryComposite.attachWidget(editButton);
Button button = (Button) editButton.getSWTWidgetControl();
GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 0, 0);
gridData.widthHint = 92;
gridData.horizontalIndent = 15;
button.setLayoutData(gridData);
button.addSelectionListener(attachExtractButtonSelectionListner());
//TODO Below code commented for future use
/*
* Currently, we are not showing SQL_QUERY_COUNTER widget. So, below code will be comment out.
*/
/*createWidgetlabel(Messages.SQL_QUERY_COUNTER, sqlQueryComposite);
AbstractELTWidget sqlQueryCounterWgt = createWidgetTextbox(Messages.SQL_QUERY_COUNTER, sqlQueryComposite);
sqlQueryCountertextbox = (Text) sqlQueryCounterWgt.getSWTWidgetControl();
attachListeners(sqlQueryCounterWgt);
ELTDefaultButton sqlQueryCounterButtonWgt = new ELTDefaultButton("...");
sqlQueryCounterButtonWgt.buttonWidth(25);
sqlQueryCounterButtonWgt.buttonHeight(20);
sqlQueryCounterButtonWgt.grabExcessHorizontalSpace(false);
sqlQueryComposite.attachWidget(sqlQueryCounterButtonWgt);
Button sqlQueryCounterButton = ((Button) sqlQueryCounterButtonWgt.getSWTWidgetControl());
GridData sqlQueryCounterData = (GridData) sqlQueryCounterButton.getLayoutData();
sqlQueryCounterData.verticalIndent = 5;
sqlQueryCounterButton.addSelectionListener(buttonWidgetSelectionListener(sqlQueryCountertextbox));*/
}
示例5: tabSelected
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
private void tabSelected(CTabItem item) {
if (item.getData() instanceof IConfigurationElement) {
final IConfigurationElement element = (IConfigurationElement) item
.getData();
Composite pageComposite = (Composite) item.getControl();
try {
final InstallationPage page = (InstallationPage) element
.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
page.createControl(pageComposite);
// new controls created since the dialog font was applied, so
// apply again.
Dialog.applyDialogFont(pageComposite);
page.setPageContainer(this);
// Must be done before creating the buttons because the control
// button creation methods
// use this map.
pageToId.put(page, element
.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
createButtons(page);
item.setData(page);
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
page.dispose();
}
});
pageComposite.layout(true, true);
} catch (CoreException e1) {
Label label = new Label(pageComposite, SWT.NONE);
label.setText(e1.getMessage());
item.setData(null);
}
}
String id = (String) item.getData(ID);
rememberSelectedTab(id);
buttonManager.update(id);
Button button = createButton(buttonManager.getParent(),
IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
GridData gd = (GridData) button.getLayoutData();
gd.horizontalAlignment = SWT.BEGINNING;
gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) / 2;
// Layout the button bar's parent and all of its children. We must
// cascade through all children because the buttons have changed and
// because tray dialog inserts an extra composite in the button bar
// hierarchy.
getButtonBar().getParent().layout(true, true);
}