protected void createControl(Composite parent, int treeStyle) { super.createControl(parent, treeStyle); // add 2px margin around filter text FormLayout layout = new FormLayout(); layout.marginHeight = 0; layout.marginWidth = 0; setLayout(layout); FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); if (showFilterControls) { FormData filterData = new FormData(); filterData.top = new FormAttachment(0, 2); filterData.left = new FormAttachment(0, 2); filterData.right = new FormAttachment(100, -2); filterComposite.setLayoutData(filterData); data.top = new FormAttachment(filterComposite, 2); } else { data.top = new FormAttachment(0, 0); } treeComposite.setLayoutData(data); }
/** Creates content Composite. */ Composite eswtConstructContent(int style) { Composite comp = super.eswtConstructContent(SWT.VERTICAL); FormLayout layout = new FormLayout(); layout.marginBottom = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTBOTTOMMARGIN); layout.marginTop = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTTOPMARGIN); layout.marginLeft = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTLEFTMARGIN); layout.marginRight = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTRIGHTMARGIN); layout.spacing = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTVERTICALSPACING); comp.setLayout(layout); eswtScrolledText = new ScrolledTextComposite(comp, comp.getVerticalBar()); eswtImgLabel = new LabelExtension(comp, SWT.NONE); FormData imageLD = new FormData(); imageLD.right = new FormAttachment(100); imageLD.top = new FormAttachment(0); eswtImgLabel.setLayoutData(imageLD); FormData scrolledTextLD = new FormData(); scrolledTextLD.left = new FormAttachment(0); scrolledTextLD.top = new FormAttachment(0); scrolledTextLD.right = new FormAttachment(eswtImgLabel); eswtScrolledText.setLayoutData(scrolledTextLD); eswtProgbarLD = new FormData(); eswtProgbarLD.left = new FormAttachment(0); eswtProgbarLD.right = new FormAttachment(100); eswtProgbarLD.bottom = new FormAttachment(100); eswtUpdateProgressbar(comp, false, false); return comp; }
public void build() { getParent().setLayout(new FormLayout()); Label leftLabel = new Label(getParent(), SWT.NONE); leftLabel.setImage(left); FormData fdLeftLabel = new FormData(); leftLabel.setLayoutData(fdLeftLabel); fdLeftLabel.left = new FormAttachment(0, 0); fdLeftLabel.top = new FormAttachment(0, 0); fdLeftLabel.width = left.getBounds().width; fdLeftLabel.height = left.getBounds().height; Label rightLabel = new Label(getParent(), SWT.NONE); rightLabel.setImage(right); FormData fdRightLabel = new FormData(); rightLabel.setLayoutData(fdRightLabel); fdRightLabel.right = new FormAttachment(100, 0); fdRightLabel.top = new FormAttachment(0, 0); fdRightLabel.height = right.getBounds().height; fdRightLabel.width = right.getBounds().width; footerCenter = new Composite(getParent(), SWT.NONE); footerCenter.setBackgroundImage(bg); FormData fdFooterCenter = new FormData(); footerCenter.setLayoutData(fdFooterCenter); fdFooterCenter.left = new FormAttachment(leftLabel); fdFooterCenter.right = new FormAttachment(rightLabel); fdFooterCenter.top = new FormAttachment(0, 0); fdFooterCenter.height = bg.getBounds().height; }
private void addFields() { int FieldsCols = 4; ColumnInfo[] colinf = new ColumnInfo[FieldsCols]; // Table with fields wlFields = new Label(shell, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "IfNullDialog.Fields.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.top = new FormAttachment(wValueTypes, margin); wlFields.setLayoutData(fdlFields); colinf[0] = new ColumnInfo( BaseMessages.getString(PKG, "IfNullDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false); colinf[1] = new ColumnInfo( BaseMessages.getString(PKG, "IfNullDialog.Value.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false); colinf[2] = new ColumnInfo( BaseMessages.getString(PKG, "IfNullDialog.Value.ConversionMask"), ColumnInfo.COLUMN_TYPE_CCOMBO, Const.getDateFormats()); colinf[1].setUsingVariables(true); colinf[3] = new ColumnInfo( BaseMessages.getString(PKG, "IfNullDialog.Value.SetEmptyString"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }); wFields = new TableView( transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldsRows, oldlsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, 0); fdFields.bottom = new FormAttachment(wOK, -2 * margin); wFields.setLayoutData(fdFields); setComboValues(); fieldColumns.add(colinf[0]); }
/** * Create widgets for join type selection * * @param lsMod */ private void createJoinTypeWidget(final ModifyListener lsMod) { Label joinTypeLabel = new Label(shell, SWT.LEFT); joinTypeLabel.setText(BaseMessages.getString(PKG, "MultiMergeJoinDialog.Type.Label")); props.setLook(joinTypeLabel); FormData fdlType = new FormData(); fdlType.left = new FormAttachment(0, 0); fdlType.right = new FormAttachment(15, -margin); if (wInputStepArray.length > 0) { fdlType.top = new FormAttachment(wInputStepArray[wInputStepArray.length - 1], margin); } else { fdlType.top = new FormAttachment(wStepname, margin); } joinTypeLabel.setLayoutData(fdlType); joinTypeCombo = new CCombo(shell, SWT.BORDER); props.setLook(joinTypeCombo); joinTypeCombo.setItems(MultiMergeJoinMeta.join_types); joinTypeCombo.addModifyListener(lsMod); FormData fdType = new FormData(); if (wInputStepArray.length > 0) { fdType.top = new FormAttachment(wInputStepArray[wInputStepArray.length - 1], margin); } else { fdType.top = new FormAttachment(wStepname, margin); } fdType.left = new FormAttachment(15, 0); fdType.right = new FormAttachment(35, 0); joinTypeCombo.setLayoutData(fdType); }
/** * Provide layout and listeners for the controls. * * @param parent */ private void addLayout(Composite parent) { FormData data; // http://www.eclipse.org/forums/index.php/t/202738/ final FormLayout layout = new FormLayout(); layout.marginWidth = 4; layout.marginHeight = 0; layout.spacing = 10; // 100; parent.setLayout(layout); data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(nameTextVal, 0, SWT.CENTER); valueLabel.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(valueLabel, 0); // data.right = new FormAttachment(100, 0); // data.right = new FormAttachment(50, 0); data.width = 200; data.top = new FormAttachment(0, VSPACE); // data.width = SWT.BORDER; nameTextVal.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0, 0); data.width = 200; // data.right = new FormAttachment(100, 0); // data.right = new FormAttachment(50, 0); data.top = new FormAttachment(nameTextVal, VSPACE); // data.width = SWT.BORDER; allowedModes.setLayoutData(data); }
/** * @see * org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) */ public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { super.createControls(parent, factory); Composite composite = getWidgetFactory().createFlatFormComposite(parent); // Create label first then attach other control to it CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); int labelWidth = Math.max(p.x, 98); FormData data = new FormData(labelWidth, SWT.DEFAULT); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); nameText = getWidgetFactory().createText(composite, ""); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); data.right = new FormAttachment(100); data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); nameText.setLayoutData(data); nameText.addListener(SWT.Modify, this); // listener.startListeningForEnter(nameText); // listener.startListeningTo(nameText); }
private FormData standardSpacing(Control control, Control centerControl, boolean isLabel) { FormData fd = new FormData(); if (isLabel) { fd.left = new FormAttachment(0, 0); } else { fd.left = new FormAttachment(middle, 0); } if (isLabel) { fd.right = new FormAttachment(middle, -Const.MARGIN); } else { fd.right = new FormAttachment(100, 0); } if (!isLabel && centerControl != null) { fd.top = new FormAttachment(centerControl, 0, SWT.CENTER); } else { int extraSpace; if (isLabel) { extraSpace = Const.MARGIN + verticalPadding; } else { extraSpace = 0; } if (control != null) { fd.top = new FormAttachment(control, Const.MARGIN + verticalPadding + extraSpace); } else { fd.top = new FormAttachment(0, Const.MARGIN + verticalPadding + extraSpace); } } verticalPadding = 0; return fd; }
private Composite createFileTreeArea(Composite parent) { Composite top = new Composite(parent, SWT.NULL); top.setLayout(new FormLayout()); fileBar = new ConfigFileBar(top, SWT.NULL); Composite tree = createModePropertyTree(top); fileBar.getNewFileButton().addSelectionListener(this); fileBar.getDeleteFileButton().addSelectionListener(this); FormData layoutData = new FormData(); layoutData.top = new FormAttachment(0, 0); layoutData.left = new FormAttachment(0, 5); layoutData.right = new FormAttachment(100, -5); fileBar.setLayoutData(layoutData); layoutData = new FormData(); layoutData.top = new FormAttachment(fileBar, 3); layoutData.left = new FormAttachment(0, 5); layoutData.right = new FormAttachment(100, -5); layoutData.bottom = new FormAttachment(100, 5); tree.setLayoutData(layoutData); return top; }
public static void positionControlBelow( Control control, Control widgetAbove, int topMarginHint, int leftMarginHint) { int topMargin = DEFAULT_LABEL_INPUT_MARGIN; if (topMarginHint >= 0) { topMargin = topMarginHint; } int leftMargin = LEFT_MARGIN_OFFSET; if (leftMarginHint >= 0) { leftMargin = leftMarginHint; } FormData fd = new FormData(); if (control.getLayoutData() != null && control.getLayoutData() instanceof FormData) { fd = (FormData) control.getLayoutData(); } fd.left = new FormAttachment(0, leftMargin); if (widgetAbove != null) { fd.top = new FormAttachment(widgetAbove, topMargin); } else { fd.top = new FormAttachment(0); } control.setLayoutData(fd); }
public static void positionInputLabelPairBelow( Control control, Label label, Control widgetAbove, int topMarginHint) { int topMargin = DEFAULT_LABEL_INPUT_MARGIN; if (topMarginHint >= 0) { topMargin = topMarginHint; } FormData fd = new FormData(); if (control.getLayoutData() != null && control.getLayoutData() instanceof FormData) { fd = (FormData) control.getLayoutData(); } fd.left = new FormAttachment(0, 0); if (widgetAbove == null) { fd.top = new FormAttachment(0, topMargin); } else { fd.top = new FormAttachment(widgetAbove, topMargin); } control.setLayoutData(fd); FormData fdl = new FormData(); if (label.getLayoutData() != null && label.getLayoutData() instanceof FormData) { fdl = (FormData) label.getLayoutData(); } fdl.left = new FormAttachment(control, 5, SWT.TOP); if (widgetAbove == null) { fdl.top = new FormAttachment(0, topMargin); } else { fdl.top = new FormAttachment(widgetAbove, topMargin); } label.setLayoutData(fdl); }
@Override public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); Composite composite = factory.createFlatFormComposite(parent); FormData data; cancelActivityCombo = factory.createCCombo(composite, SWT.NONE); cancelActivityCombo.setItems((String[]) cancelFormats.toArray()); data = new FormData(); data.left = new FormAttachment(0, 160); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, VSPACE); cancelActivityCombo.setLayoutData(data); cancelActivityCombo.addFocusListener(listener); createLabel(composite, "Cancel activity", cancelActivityCombo, factory); // $NON-NLS-1$ messageCombo = getWidgetFactory().createCCombo(composite, SWT.NONE); data = new FormData(); data.left = new FormAttachment(0, 160); data.right = new FormAttachment(100, -HSPACE); data.top = new FormAttachment(cancelActivityCombo, VSPACE); messageCombo.setLayoutData(data); messageCombo.addFocusListener(listener); createLabel(composite, "Message ref", messageCombo, factory); // $NON-NLS-1$ }
public StereotypeImageEditor(Composite parent, int style) { TabbedPropertySheetWidgetFactory factory = AbstractEditor.factory; composite = factory.createFlatFormComposite(parent); FormData data; browseButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$ browseButton.setImage(Activator.getDefault().getImage(addImagePath)); removeButton = factory.createButton(composite, "", SWT.PUSH); // $NON-NLS-1$ removeButton.setImage(Activator.getDefault().getImage("/icons/delete.gif")); // $NON-NLS-1$ CLabel iconLabel = factory.createCLabel(composite, "Content: "); // browseButton layout data = new FormData(); data.left = new FormAttachment(0, 85); data.top = new FormAttachment(0, ITabbedPropertyConstants.HSPACE); browseButton.setLayoutData(data); // removeButton layout data = new FormData(); data.left = new FormAttachment(browseButton, ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(browseButton, 0, SWT.CENTER); removeButton.setLayoutData(data); // iconLabel layout data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(browseButton, 0, SWT.CENTER); iconLabel.setLayoutData(data); browseButton.addSelectionListener(this); removeButton.addSelectionListener(this); }
protected void layOutPropertyPanel(int deviceTypes, SWTList rowRenderer) { Composite propertiesComposite = editor.getSWTPropertiesComposite(); addHandOnKeyboardToStart(deviceTypes, propertiesComposite); frameList = rowRenderer; frameList.setTable( new Table(propertiesComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION)); demonstrateScriptButton = new Button(propertiesComposite, SWT.NONE); demonstrateScriptButton.setText(startDemonstratingLabel); shell.setDefaultButton(demonstrateScriptButton); demonstrateScriptButton.addSelectionListener( new SWTWidgetChangeHandler(SEFrameChooserLID.OpenScriptEditor)); lIDMap.addWidget( SEFrameChooserLID.OpenScriptEditor, demonstrateScriptButton, ListenerIdentifierMap.NORMAL); closeButton = new Button(propertiesComposite, SWT.NONE); closeButton.setText(L10N.get("SE.Close", "Close")); closeButton.addSelectionListener(new SWTWidgetChangeHandler(CogToolLID.CloseWindow)); propertiesComposite.setLayout(new FormLayout()); // First thing resides at the top FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.left = new FormAttachment(0, 5); data.right = new FormAttachment(100, 0); positionStartLocParms(data); frameList.getTable().setLayoutData(data); data = new FormData(); data.bottom = new FormAttachment(100, 0); data.left = new FormAttachment(0, 5); demonstrateScriptButton.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(demonstrateScriptButton, 0, SWT.TOP); data.left = new FormAttachment(demonstrateScriptButton, 5, SWT.RIGHT); data.bottom = new FormAttachment(100, 0); closeButton.setLayoutData(data); SashUtility.createVerticalSash( editor.bodyComposite, FRAME_LIST_WIDTH, 250, SWT.RIGHT, propertiesComposite, editor.getPropFormData(), editor.scrollComposite, editor.getScrollFormData()); }
/** @param args */ public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); Button button1 = new Button(shell, SWT.PUSH); button1.setText("Button 1"); final Sash sash = new Sash(shell, SWT.VERTICAL); Button button2 = new Button(shell, SWT.PUSH); button2.setText("Button 2"); final FormLayout form = new FormLayout(); shell.setLayout(form); FormData button1Data = new FormData(); button1Data.left = new FormAttachment(0, 0); button1Data.right = new FormAttachment(sash, 0); button1Data.top = new FormAttachment(0, 0); button1Data.bottom = new FormAttachment(100, 0); button1.setLayoutData(button1Data); final int limit = 20, percent = 50; final FormData sashData = new FormData(); sashData.left = new FormAttachment(percent, 0); sashData.top = new FormAttachment(0, 0); sashData.bottom = new FormAttachment(100, 0); sash.setLayoutData(sashData); sash.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { Rectangle sashRect = sash.getBounds(); Rectangle shellRect = shell.getClientArea(); int right = shellRect.width - sashRect.width - limit; e.x = Math.max(Math.min(e.x, right), limit); if (e.x != sashRect.x) { sashData.left = new FormAttachment(0, e.x); shell.layout(); } } }); FormData button2Data = new FormData(); button2Data.left = new FormAttachment(sash, 0); button2Data.right = new FormAttachment(100, 0); button2Data.top = new FormAttachment(0, 0); button2Data.bottom = new FormAttachment(100, 0); button2.setLayoutData(button2Data); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
public void createControl(Composite parent) { int margin = Const.MARGIN; // create the composite to hold the widgets Composite composite = new Composite(parent, SWT.NONE); props.setLook(composite); FormLayout compLayout = new FormLayout(); compLayout.marginHeight = Const.FORM_MARGIN; compLayout.marginWidth = Const.FORM_MARGIN; composite.setLayout(compLayout); wSourceDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); props.setLook(wSourceDB); for (int i = 0; i < databases.size(); i++) { DatabaseMeta dbInfo = databases.get(i); wSourceDB.add(dbInfo.getName()); } fdSourceDB = new FormData(); fdSourceDB.top = new FormAttachment(0, 0); fdSourceDB.left = new FormAttachment(0, 0); fdSourceDB.bottom = new FormAttachment(100, 0); fdSourceDB.right = new FormAttachment(50, 0); wSourceDB.setLayoutData(fdSourceDB); wSourceDB.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setPageComplete(false); } }); wTargetDB = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); props.setLook(wTargetDB); for (int i = 0; i < databases.size(); i++) { DatabaseMeta dbInfo = databases.get(i); wTargetDB.add(dbInfo.getName()); } fdTargetDB = new FormData(); fdTargetDB.top = new FormAttachment(0, 0); fdTargetDB.left = new FormAttachment(50, margin); fdTargetDB.bottom = new FormAttachment(100, 0); fdTargetDB.right = new FormAttachment(100, 0); wTargetDB.setLayoutData(fdTargetDB); wTargetDB.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setPageComplete(false); } }); // set the composite as the control for this page setControl(composite); }
/** Creates the control for this page of the wizard. */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new FormLayout()); // creates a label for the title field CLabel titleLabel = new CLabel(composite, SWT.LEFT); titleLabel.setText("Title: "); FormData data = new FormData(); data.left = new FormAttachment(0, 5); data.right = new FormAttachment(33, 0); data.top = new FormAttachment(0, 20); titleLabel.setLayoutData(data); // creates the title input field titleText = new Text(composite, SWT.BORDER | SWT.SINGLE); data = new FormData(); data.left = new FormAttachment(titleLabel, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 20); titleText.setLayoutData(data); // adds a modify listener to know when its valid to go to the next page titleText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { title = titleText.getText(); setPageComplete(title.length() > 0 && author.length() > 0); } }); // creates a label for the author field CLabel authorLabel = new CLabel(composite, SWT.LEFT); authorLabel.setText("Author: "); data = new FormData(); data.top = new FormAttachment(titleLabel, 10); data.left = new FormAttachment(0, 5); data.right = new FormAttachment(33, 0); authorLabel.setLayoutData(data); // creates an author input field authorText = new Text(composite, SWT.BORDER | SWT.SINGLE); data = new FormData(); data.top = new FormAttachment(titleText, 10); data.left = new FormAttachment(authorLabel, 0); data.right = new FormAttachment(100, 0); authorText.setLayoutData(data); // adds a listener to enable the ability to go to the next page authorText.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { author = authorText.getText(); setPageComplete(title.length() > 0 && author.length() > 0); } }); setControl(composite); }
/** Create contents of the window. */ protected void createContents() { shlCrisisList = new Shell(); shlCrisisList.setSize(517, 310); shlCrisisList.setText("Crisis List"); shlCrisisList.setLayout(new FormLayout()); table = new Table(shlCrisisList, SWT.BORDER | SWT.FULL_SELECTION); table.setLinesVisible(true); table.setHeaderVisible(true); FormData fd_table = new FormData(); fd_table.right = new FormAttachment(0, 507); fd_table.top = new FormAttachment(0, 10); fd_table.left = new FormAttachment(0, 10); table.setLayoutData(fd_table); TableColumn tableColumn = new TableColumn(table, SWT.NONE); tableColumn.setWidth(100); tableColumn.setText("Crisis number"); TableColumn tableColumn_1 = new TableColumn(table, SWT.NONE); tableColumn_1.setWidth(100); tableColumn_1.setText("Label"); TableColumn tableColumn_2 = new TableColumn(table, SWT.NONE); tableColumn_2.setWidth(100); tableColumn_2.setText("Place"); TableColumn tableColumn_3 = new TableColumn(table, SWT.NONE); tableColumn_3.setWidth(100); tableColumn_3.setText("State"); TableColumn tableColumn_4 = new TableColumn(table, SWT.NONE); tableColumn_4.setWidth(100); tableColumn_4.setText("Details"); Button button = new Button(shlCrisisList, SWT.NONE); button.addMouseListener( new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { NewCrisis.main(null); } }); fd_table.bottom = new FormAttachment(100, -63); button.setText("New crisis"); FormData fd_button = new FormData(); fd_button.top = new FormAttachment(table, 18); fd_button.bottom = new FormAttachment(100, -10); fd_button.left = new FormAttachment(0, 206); fd_button.right = new FormAttachment(100, -217); button.setLayoutData(fd_button); }
public static void positionLabelInputPair(Label label, Control control) { FormData fdl = new FormData(); fdl.left = new FormAttachment(0, LEFT_MARGIN_OFFSET); fdl.top = new FormAttachment(0, Const.MARGIN); label.setLayoutData(fdl); FormData fd = new FormData(); fd.top = new FormAttachment(label, Const.MARGIN); fd.left = new FormAttachment(0, LEFT_MARGIN_OFFSET); fd.left = new FormAttachment(0, LEFT_MARGIN_OFFSET); fd.right = new FormAttachment(0, LEFT_MARGIN_OFFSET + 252); control.setLayoutData(fd); }
/** * @see * org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite) */ protected void setSectionData(Composite composite) { FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(fileChooser, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE); labelText.setLayoutData(data); data = new FormData(); data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] {getLabelText()})); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(labelText, 0, SWT.CENTER); fileChooser.setLayoutData(data); }
private Text createText(Composite parent, TabbedPropertySheetWidgetFactory factory, Control top) { Text text = factory.createText(parent, ""); // $NON-NLS-1$ FormData data = new FormData(); data.left = new FormAttachment(0, 160); data.right = new FormAttachment(100, -HSPACE); if (top == null) { data.top = new FormAttachment(0, VSPACE); } else { data.top = new FormAttachment(top, VSPACE); } text.setLayoutData(data); text.addFocusListener(listener); return text; }
/** @param parent */ private void createSubTitle(Composite parent) { FormData pkgNameLabelFromData = new FormData(); pkgNameLabelFromData.top = new FormAttachment(0, 5); pkgNameLabelFromData.left = new FormAttachment(0, 5); pkgNameLabelFromData.right = new FormAttachment(100, -50); pkgNameLabelFromData.bottom = new FormAttachment(parent, 30); // 绝对位置 pkgNameText = new Text(parent, SWT.BORDER); pkgNameText.setToolTipText("在这里可以手动输入要进行测试的进程名"); pkgNameText.setBackground(new Color(Display.getCurrent(), 192, 192, 192)); pkgNameText.setLayoutData(pkgNameLabelFromData); FormData addBtnFromData = new FormData(); addBtnFromData.top = new FormAttachment(0, 5); addBtnFromData.left = new FormAttachment(pkgNameText, 5); addBtnFromData.right = new FormAttachment(100, -5); addBtnFromData.bottom = new FormAttachment(parent, 30); // 绝对位置 addBtn = new Button(parent, SWT.NONE); addBtn.setText("添加"); addBtn.setLayoutData(addBtnFromData); addBtn.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { if (isSupportAddOrDeleteOper) { APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER); String text = pkgNameText.getText().trim(); if (text.equals("")) { APTConsoleFactory.getInstance().APTPrint("请输入合法的包名"); return; } PkgInfo dataItem = new PkgInfo(); dataItem.contents[PkgInfo.NAME_INDEX] = text; dataItem.contents[PkgInfo.PID_INDEX] = Constant.PID_NOT_EXSIT; addDataItem(targetPkgTableViewer, dataItem); APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER); } else { APTConsoleFactory.getInstance().APTPrint("Operation forbid"); } } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); }
/** * Create contents of the view part. * * @param parent received by injection */ @Inject public void createPartControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FormLayout()); Group grpIdentity = new Group(container, SWT.NONE); FormData fd_grpIdentity = new FormData(); fd_grpIdentity.bottom = new FormAttachment(0, 94); fd_grpIdentity.right = new FormAttachment(0, 402); fd_grpIdentity.top = new FormAttachment(0); fd_grpIdentity.left = new FormAttachment(0); grpIdentity.setLayoutData(fd_grpIdentity); grpIdentity.setText("Identity"); grpIdentity.setLayout(new GridLayout(2, false)); Label label = new Label(grpIdentity, SWT.NONE); label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); label.setText("display Name"); label.setAlignment(SWT.CENTER); Label lblNom = new Label(grpIdentity, SWT.NONE); lblNom.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNom.setText("Nom : "); txtAName = new Text(grpIdentity, SWT.BORDER); txtAName.setText("A name"); txtAName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblPrnom = new Label(grpIdentity, SWT.NONE); lblPrnom.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblPrnom.setText("Pr\u00E9nom"); txtUnPrnom = new Text(grpIdentity, SWT.BORDER); txtUnPrnom.setText("Un pr\u00E9nom"); txtUnPrnom.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Group grpAdresse = new Group(container, SWT.NONE); grpAdresse.setText("Adresse"); grpAdresse.setLayout(new FillLayout(SWT.HORIZONTAL)); FormData fd_grpAdresse = new FormData(); fd_grpAdresse.right = new FormAttachment(grpIdentity, 0, SWT.RIGHT); fd_grpAdresse.bottom = new FormAttachment(100, -12); fd_grpAdresse.top = new FormAttachment(grpIdentity, 6); fd_grpAdresse.left = new FormAttachment(0); grpAdresse.setLayoutData(fd_grpAdresse); Label lblAdresse = new Label(grpAdresse, SWT.NONE); lblAdresse.setText("Adresse"); }
@Override protected Control createContents(Composite parent) { Composite rootArea = new Composite(parent, SWT.NONE); m_timeChooserContent = new TimeChooserContent(rootArea, m_displayDate, getEnvironment()); m_timeChooserContent.addTimeChangedListener( new AbstractDateSelectionListener() { @Override public void dateChanged(DateSelectionEvent e) { m_returnDate = (Date) e.getData(); getShell() .getDisplay() .asyncExec( new Runnable() { @Override public void run() { close(); } }); } }); m_timeChooserContent.setDate(m_displayDate); // layout rootArea.setLayout(new FormLayout()); FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); m_timeChooserContent.setLayoutData(data); return rootArea; }
@Override protected void createSearchControl( Composite searchComposite, HashMap<String, Control> bindedControls) { searchComposite.setLayout(new FormLayout()); FormData searchCompositeData = (FormData) searchComposite.getLayoutData(); searchCompositeData.bottom = new FormAttachment(0, 65); searchComposite.setLayoutData(searchCompositeData); Composite mainSearch = new Composite(searchComposite, SWT.NONE); FormData formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.top = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); formData.bottom = new FormAttachment(100, 0); mainSearch.setLayoutData(formData); String modelFilePath = "com/hhh/platform/ops/ui/run/LogRunViewSearcher.xml"; InputStream xmlis = getClass().getClassLoader().getResourceAsStream(modelFilePath); XMLModelControlsCreator controlsCreator = new XMLModelControlsCreator(xmlis); controlsCreator.createContents(mainSearch); bindedControls.putAll(controlsCreator.getBindedControls()); }
public RequestResponseViewer(SashForm parentForm) { imageCache = new ImageCache(Activator.PLUGIN_ID); this.parentForm = parentForm; parentComposite = new Composite(parentForm, SWT.NONE); parentComposite.setLayout(new FormLayout()); optionsMenu = createOptionsMenu(parentForm.getShell()); toolbarComposite = createToolbarComposite(parentComposite); FormData fd = new FormData(); fd.left = new FormAttachment(0); fd.right = new FormAttachment(100); fd.top = new FormAttachment(0); toolbarComposite.setLayoutData(fd); setTabbedMode(); IModel model = Activator.getDefault().getModel(); model.addWorkspaceListener( new IEventHandler() { @Override public void handleEvent(IEvent event) { if (event instanceof WorkspaceCloseEvent || event instanceof WorkspaceResetEvent) { handleWorkspaceCloseOrReset(); } } }); }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite = getWidgetFactory().createFlatFormComposite(parent); TableColumnLayout tableColumnLayout = new TableColumnLayout(); composite.setLayout(tableColumnLayout); FormData data; table = getWidgetFactory().createTable(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setLinesVisible(true); columns = new ArrayList(); String[] titles = UserGroupPropertySource.getPropertiesDisplayValuesTable(); int[] weights = {30, 30, 30}; for (int i = 0; i < titles.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(titles[i]); tableColumnLayout.setColumnData(column, new ColumnWeightData(weights[i])); columns.add(column); } data = new FormData(); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.top = new FormAttachment(0, 0); data.bottom = new FormAttachment(100, 0); table.setLayoutData(data); }
/** @param form2 */ private Composite getPageHeader(Composite parent) { final Composite header = new Composite(parent, SWT.FILL); final FormLayout layout = new FormLayout(); layout.marginHeight = 5; layout.marginWidth = 5; header.setLayout(layout); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header); header.setBackground(parent.getBackground()); final Label titleImage = new Label(header, SWT.FILL); final ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL( Activator.getDefault().getBundle().getResource("icons/view.png")); // $NON-NLS-1$ titleImage.setImage(new Image(parent.getDisplay(), imageDescriptor.getImageData())); final FormData titleImageData = new FormData(); final int imageOffset = -titleImage.computeSize(SWT.DEFAULT, SWT.DEFAULT).y / 2; titleImageData.top = new FormAttachment(50, imageOffset); titleImageData.left = new FormAttachment(0, 10); titleImage.setLayoutData(titleImageData); final Label title = new Label(header, SWT.WRAP); title.setText("View Editor"); // $NON-NLS-1$ titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD); title.setFont(titleFont); title.setForeground(getTitleColor(parent)); final FormData titleData = new FormData(); title.setLayoutData(titleData); titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT); return header; }
@Override public void build() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); workbenchWindow.addPerspectiveListener(perspectiveAdapter); IPerspectiveDescriptor[] descriptors = load(); for (int i = 0; i < descriptors.length; i++) { createPerspectiveButton(descriptors[i]); } // Button for the perspective dialog Composite otherBg = new Composite(background, SWT.NONE); otherBg.setLayout(new FormLayout()); otherButton = new Button(otherBg, SWT.PUSH | SWT.FLAT); FormData fdOther = new FormData(); otherButton.setLayoutData(fdOther); fdOther.left = new FormAttachment(0, left.getBounds().width); FormData buttonPos = getLayoutSet().getPosition(ILayoutSetConstants.PERSP_BUTTON_POS); fdOther.top = buttonPos.top; otherButton.setData(RWT.CUSTOM_VARIANT, "perspective"); // $NON-NLS-1$ otherButton.setText(Messages.get().PerspectiveSwitcherBuilder_Other); IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow(); final IWorkbenchAction perspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(activeWindow); otherButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { perspectiveAction.run(); } }); }
public TagItem(Composite parent, int style, int index, Tag tag, TagPanel parentTagPanel) { super(parent, style); this.tag = tag; this.index = index; this.parentTagPanel = parentTagPanel; FormLayout layout = new FormLayout(); setLayout(layout); imageLabel = new Label(this, SWT.None); imageLabel.setImage(image); FormData data = new FormData(); data.left = new FormAttachment(0, 15); imageLabel.setLayoutData(data); textLabel = new Label(this, SWT.None); textLabel.setText(tag.getName()); int rgb[] = ColorMap.get().getRGB(tag.getColorName()); if (rgb == null) { rgb = ColorMap.get().getRGB("Black"); } unselectedBackground = getBackground(); textLabel.setForeground(new Color(getDisplay(), rgb[0], rgb[1], rgb[2])); data = new FormData(); data.left = new FormAttachment(imageLabel, 5); data.top = new FormAttachment(imageLabel, 0, SWT.CENTER); data.right = new FormAttachment(100, 0); textLabel.setLayoutData(data); imageLabel.addMouseListener(this); textLabel.addMouseListener(this); addMouseListener(this); }