Java Code Examples for org.eclipse.swt.widgets.Composite#pack()
The following examples show how to use
org.eclipse.swt.widgets.Composite#pack() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalMapReduceLaunchTabGroup.java From RDFS with Apache License 2.0 | 6 votes |
public void createControl(final Composite parent) { Composite panel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); panel.setLayout(layout); Label mapperLabel = new Label(panel, SWT.NONE); mapperLabel.setText("Mapper"); mapperClass = new Text(panel, SWT.SINGLE | SWT.BORDER); createRow(parent, panel, mapperClass); Label reducerLabel = new Label(panel, SWT.NONE); reducerLabel.setText("Reducer"); reducerClass = new Text(panel, SWT.SINGLE | SWT.BORDER); createRow(parent, panel, reducerClass); Label combinerLabel = new Label(panel, SWT.NONE); combinerLabel.setText("Combiner"); combinerClass = new Text(panel, SWT.SINGLE | SWT.BORDER); createRow(parent, panel, combinerClass); panel.pack(); setControl(panel); }
Example 2
Source File: ValueDesignInt.java From ldparteditor with MIT License | 6 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite cmp_Container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) cmp_Container.getLayout(); gridLayout.verticalSpacing = 10; gridLayout.horizontalSpacing = 10; IntegerSpinner spn_Value = new IntegerSpinner(cmp_Container, SWT.NONE); this.spn_Value[0] = spn_Value; GridData gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = SWT.FILL; spn_Value.setLayoutData(gd); Label lbl_Unit = new Label(cmp_Container, SWT.NONE); this.lbl_Unit[0] = lbl_Unit; lbl_Unit.setText(unitText); cmp_Container.pack(); return cmp_Container; }
Example 3
Source File: LogUploadDesign.java From ldparteditor with MIT License | 6 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite cmp_container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) cmp_container.getLayout(); gridLayout.verticalSpacing = 10; gridLayout.horizontalSpacing = 10; Label lbl_specify = new Label(cmp_container, SWT.NONE); lbl_specify.setText(I18n.E3D_LogUploadData); Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL); lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); final StyledText styledText = new StyledText(cmp_container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); styledText.setText(source); styledText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create()); cmp_container.pack(); return cmp_container; }
Example 4
Source File: SlicerProDesign.java From ldparteditor with MIT License | 6 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite cmp_container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) cmp_container.getLayout(); gridLayout.verticalSpacing = 10; gridLayout.horizontalSpacing = 10; Label lbl_specify = new Label(cmp_container, SWT.NONE); lbl_specify.setText(I18n.SLICERPRO_Title); Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL); lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Label lbl_howto = new Label(cmp_container, SWT.NONE); lbl_howto.setText(I18n.SLICERPRO_Hint); cmp_container.pack(); return cmp_container; }
Example 5
Source File: IsecalcDesign.java From ldparteditor with MIT License | 6 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite cmp_container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) cmp_container.getLayout(); gridLayout.verticalSpacing = 10; gridLayout.horizontalSpacing = 10; Label lbl_specify = new Label(cmp_container, SWT.NONE); lbl_specify.setText(I18n.ISECALC_Title); Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL); lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY); this.cmb_scope[0] = cmb_scope; cmb_scope.setItems(new String[] {I18n.ISECALC_ScopeFile, I18n.ISECALC_ScopeSelection}); cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); cmb_scope.setText(cmb_scope.getItem(is.getScope())); cmb_scope.select(is.getScope()); cmp_container.pack(); return cmp_container; }
Example 6
Source File: AttributeDesignerDialog.java From Rel with Apache License 2.0 | 5 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite)super.createDialogArea(parent); container.setLayout(new FillLayout()); attributeDesigner = new AttributeDesigner(container, connection); attributeDesigner.setHeadingDefinition(getHeadingDefinition()); container.pack(); return container; }
Example 7
Source File: DiffAttributeEditor.java From git-appraise-eclipse with Eclipse Public License 1.0 | 5 votes |
@Override public void createControl(final Composite parent, FormToolkit toolkit) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, false); composite.setLayout(layout); final String filePath = getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_NEWPATH).getValue(); Link fileLink = new Link(composite, SWT.BORDER); fileLink.setText("<a>View in Workspace</a>"); fileLink.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { AppraiseUiPlugin.openFileInEditor(filePath, getModel().getTaskRepository()); } }); final String diffText = getTaskAttribute().getAttribute(AppraiseReviewTaskSchema.DIFF_TEXT).getValue(); final StyledText text = new StyledText(composite, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY); text.setText(diffText); text.setStyleRanges(getStyleRangesForDiffText(diffText)); GridData diffTextGridData = new GridData(); diffTextGridData.grabExcessHorizontalSpace = true; diffTextGridData.horizontalAlignment = SWT.FILL; text.setLayoutData(diffTextGridData); composite.pack(); setControl(composite); }
Example 8
Source File: ExtnlResBindSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
@Override public void initialize(IManagedForm form) { super.initialize(form); // set up Composite to hold widgets in the section sectionClient = new2ColumnComposite(getSection()); tree = newTree(sectionClient); // Buttons Composite buttonContainer = newButtonContainer(sectionClient); addButton = newPushButton(buttonContainer, S_ADD, "Click to add a new External Resource definition"); editButton = newPushButton(buttonContainer, S_EDIT, "Click to edit an External Resource definition"); removeButton = newPushButton(buttonContainer, "Remove", "Click to remove selected binding or External Resource"); bindButton = newPushButton(buttonContainer, "Bind", "Click to bind selected dependency with selected Resource"); exportButton = newPushButton(buttonContainer, S_EXPORT, S_EXPORT_TIP); buttonContainer.pack(); getSection().getParent().getParent().pack(); getSection().getParent().getParent().layout(); initialFormWidth = getSection().getSize().x; ((GridData) tree.getLayoutData()).widthHint = initialFormWidth - buttonContainer.getSize().x; enableBorders(sectionClient); toolkit.paintBordersFor(sectionClient); tree.addListener(SWT.MouseDoubleClick, this); }
Example 9
Source File: RelationDialog.java From ermasterr with Apache License 2.0 | 5 votes |
private int createParentGroup(final Composite composite) { final GridLayout gridLayout = new GridLayout(); gridLayout.verticalSpacing = 10; gridLayout.marginHeight = 10; final GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; final Group group = new Group(composite, SWT.NONE); group.setLayoutData(gridData); group.setLayout(gridLayout); group.setText(ResourceString.getResourceString("label.parent")); final Composite upperComposite = new Composite(group, SWT.NONE); upperComposite.setLayoutData(gridData); upperComposite.setLayout(gridLayout); final Label label1 = new Label(upperComposite, SWT.NONE); label1.setText(ResourceString.getResourceString("label.reference.table")); parentTableNameText = new Text(upperComposite, SWT.BORDER | SWT.READ_ONLY); parentTableNameText.setLayoutData(gridData); final Label label2 = new Label(upperComposite, SWT.NONE); label2.setText(ResourceString.getResourceString("label.reference.column")); createColumnCombo(upperComposite); createParentMandatoryGroup(group); upperComposite.pack(); return upperComposite.getSize().y; }
Example 10
Source File: RelationshipDialog.java From erflute with Apache License 2.0 | 5 votes |
private int createParentGroup(Composite composite) { final GridLayout gridLayout = new GridLayout(); gridLayout.verticalSpacing = 10; gridLayout.marginHeight = 10; final GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; final Group group = new Group(composite, SWT.NONE); group.setLayoutData(gridData); group.setLayout(gridLayout); group.setText(DisplayMessages.getMessage("label.parent")); final Composite upperComposite = new Composite(group, SWT.NONE); upperComposite.setLayoutData(gridData); upperComposite.setLayout(gridLayout); final Label label1 = new Label(upperComposite, SWT.NONE); label1.setText(DisplayMessages.getMessage("label.reference.table")); parentTableNameText = new Text(upperComposite, SWT.BORDER | SWT.READ_ONLY); parentTableNameText.setLayoutData(gridData); final Label label2 = new Label(upperComposite, SWT.NONE); label2.setText("Referred Column"); createColumnCombo(upperComposite); createParentMandatoryGroup(group); upperComposite.pack(); return upperComposite.getSize().y; }
Example 11
Source File: SaveQueryAsDialog.java From Rel with Apache License 2.0 | 5 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new FormLayout()); Label lblNewLabel = new Label(container, SWT.NONE); FormData fd_lblNewLabel = new FormData(); fd_lblNewLabel.top = new FormAttachment(0, 15); fd_lblNewLabel.left = new FormAttachment(0, 10); lblNewLabel.setLayoutData(fd_lblNewLabel); lblNewLabel.setText("Query name:"); Button chkKeepOriginal = new Button(container, SWT.CHECK); chkKeepOriginal.setText("Retain original query."); FormData fd_chkKeepOriginal = new FormData(); fd_chkKeepOriginal.top = new FormAttachment(lblNewLabel, 10); fd_chkKeepOriginal.right = new FormAttachment(100); chkKeepOriginal.setLayoutData(fd_chkKeepOriginal); chkKeepOriginal.addListener(SWT.Selection, e -> keepOriginal = chkKeepOriginal.getSelection()); text = new Text(container, SWT.BORDER); FormData fd_text = new FormData(); fd_text.top = new FormAttachment(0, 10); fd_text.left = new FormAttachment(lblNewLabel, 6); fd_text.right = new FormAttachment(100, -10); text.setLayoutData(fd_text); text.setText(name); container.pack(); return container; }
Example 12
Source File: DiskInfoTab.java From AppleCommander with GNU General Public License v2.0 | 5 votes |
/** * Create the DISK INFO tab. */ public DiskInfoTab(CTabFolder tabFolder, FormattedDisk[] disks) { this.formattedDisks = disks; CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL); ctabitem.setText(textBundle.get("DiskInfoTab.Title")); //$NON-NLS-1$ tabFolder.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { getInfoTable().removeAll(); buildDiskInfoTable(getFormattedDisk(0)); // FIXME! } }); ScrolledComposite scrolledComposite = new ScrolledComposite( tabFolder, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); ctabitem.setControl(scrolledComposite); composite = new Composite(scrolledComposite, SWT.NONE); createDiskInfoTable(); if (disks.length > 1) { RowLayout layout = new RowLayout(SWT.VERTICAL); layout.wrap = false; composite.setLayout(layout); for (int i=0; i<disks.length; i++) { Label label = new Label(composite, SWT.NULL); label.setText(disks[i].getDiskName()); buildDiskInfoTable(disks[i]); } } else { composite.setLayout(new FillLayout()); buildDiskInfoTable(disks[0]); } composite.pack(); scrolledComposite.setContent(composite); scrolledComposite.setMinSize( composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }
Example 13
Source File: ExpandableItemsView.java From gama with GNU General Public License v3.0 | 5 votes |
protected ParameterExpandItem createItem(final Composite parent, final String name, final T data, final Composite control, final ParameterExpandBar bar, final boolean expanded, final GamaUIColor color) { final ParameterExpandItem i = buildConcreteItem(bar, data, color); if (name != null) { i.setText(name); } control.pack(true); control.layout(); control.setBackground(bar.getBackground()); i.setControl(control); i.setHeight(control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); i.setExpanded(expanded); parent.layout(true, true); return i; }
Example 14
Source File: MeshReducerDesign.java From ldparteditor with MIT License | 5 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite cmp_container = (Composite) super.createDialogArea(parent); GridLayout gridLayout = (GridLayout) cmp_container.getLayout(); gridLayout.verticalSpacing = 10; gridLayout.horizontalSpacing = 10; Label lbl_specify = new Label(cmp_container, SWT.NONE); lbl_specify.setText(I18n.MESHREDUCE_Title); Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL); lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); Label lbl_coordsPrec = new Label(cmp_container, SWT.NONE); lbl_coordsPrec.setText(I18n.MESHREDUCE_Mode); Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY); this.cmb_scope[0] = cmb_scope; cmb_scope.setItems(new String[] {I18n.MESHREDUCE_DestroyColours, I18n.MESHREDUCE_KeepColours}); cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); cmb_scope.setText(cmb_scope.getItem(ms.getMode())); cmb_scope.select(ms.getMode()); cmp_container.pack(); return cmp_container; }
Example 15
Source File: JobExecutorDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addResultFilesTab() { final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE ); wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Title" ) ); wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Tooltip" ) ); ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); scrolledComposite.setLayout( new FillLayout() ); Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE ); props.setLook( wInputComposite ); FormLayout tabLayout = new FormLayout(); tabLayout.marginWidth = 15; tabLayout.marginHeight = 15; wInputComposite.setLayout( tabLayout ); wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultFilesTarget ); wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) ); FormData fdlResultFilesTarget = new FormData(); fdlResultFilesTarget.top = new FormAttachment( 0, 0 ); fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left wlResultFilesTarget.setLayoutData( fdlResultFilesTarget ); wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wResultFilesTarget ); wResultFilesTarget.addModifyListener( lsMod ); FormData fdResultFilesTarget = new FormData(); fdResultFilesTarget.width = 250; fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 ); fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right wResultFilesTarget.setLayoutData( fdResultFilesTarget ); // ResultFileNameField // wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultFileNameField ); wlResultFileNameField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFileNameField.Label" ) ); FormData fdlResultFileNameField = new FormData(); fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 ); fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left wlResultFileNameField.setLayoutData( fdlResultFileNameField ); wResultFileNameField = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wResultFileNameField ); wResultFileNameField.addModifyListener( lsMod ); FormData fdResultFileNameField = new FormData(); fdResultFileNameField.width = 250; fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 ); fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right wResultFileNameField.setLayoutData( fdResultFileNameField ); wInputComposite.pack(); Rectangle bounds = wInputComposite.getBounds(); scrolledComposite.setContent( wInputComposite ); scrolledComposite.setExpandHorizontal( true ); scrolledComposite.setExpandVertical( true ); scrolledComposite.setMinWidth( bounds.width ); scrolledComposite.setMinHeight( bounds.height ); wTab.setControl( scrolledComposite ); wTabFolder.setSelection( wTab ); }
Example 16
Source File: TransExecutorDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addResultRowsTab() { final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE ); wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Title" ) ); wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Tooltip" ) ); ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); scrolledComposite.setLayout( new FillLayout() ); Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE ); props.setLook( wInputComposite ); FormLayout tabLayout = new FormLayout(); tabLayout.marginWidth = 15; tabLayout.marginHeight = 15; wInputComposite.setLayout( tabLayout ); wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultRowsTarget ); wlResultRowsTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.OutputRowsSource.Label" ) ); FormData fdlResultRowsTarget = new FormData(); fdlResultRowsTarget.top = new FormAttachment( 0, 0 ); fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left wlResultRowsTarget.setLayoutData( fdlResultRowsTarget ); wOutputRowsSource = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wOutputRowsSource ); wOutputRowsSource.addModifyListener( lsMod ); FormData fdResultRowsTarget = new FormData(); fdResultRowsTarget.width = 250; fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 ); fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right wOutputRowsSource.setLayoutData( fdResultRowsTarget ); wlOutputFields = new Label( wInputComposite, SWT.NONE ); wlOutputFields.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFields.Label" ) ); props.setLook( wlOutputFields ); FormData fdlResultFields = new FormData(); fdlResultFields.left = new FormAttachment( 0, 0 ); fdlResultFields.top = new FormAttachment( wOutputRowsSource, 10 ); wlOutputFields.setLayoutData( fdlResultFields ); int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 ); ColumnInfo[] ciResultFields = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Field" ), ColumnInfo.COLUMN_TYPE_TEXT, false, false ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Type" ), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Length" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Precision" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), }; wOutputFields = new TableView( transMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false ); FormData fdResultFields = new FormData(); fdResultFields.left = new FormAttachment( 0, 0 ); fdResultFields.top = new FormAttachment( wlOutputFields, 5 ); fdResultFields.right = new FormAttachment( 100, 0 ); fdResultFields.bottom = new FormAttachment( 100, 0 ); wOutputFields.setLayoutData( fdResultFields ); wOutputFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) ); wInputComposite.pack(); Rectangle bounds = wInputComposite.getBounds(); scrolledComposite.setContent( wInputComposite ); scrolledComposite.setExpandHorizontal( true ); scrolledComposite.setExpandVertical( true ); scrolledComposite.setMinWidth( bounds.width ); scrolledComposite.setMinHeight( bounds.height ); wTab.setControl( scrolledComposite ); wTabFolder.setSelection( wTab ); }
Example 17
Source File: WorkflowExecutorDialog.java From hop with Apache License 2.0 | 4 votes |
private void addResultRowsTab() { final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE ); wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Title" ) ); wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Tooltip" ) ); ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); scrolledComposite.setLayout( new FillLayout() ); Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE ); props.setLook( wInputComposite ); FormLayout tabLayout = new FormLayout(); tabLayout.marginWidth = 15; tabLayout.marginHeight = 15; wInputComposite.setLayout( tabLayout ); wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultRowsTarget ); wlResultRowsTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRowsTarget.Label" ) ); FormData fdlResultRowsTarget = new FormData(); fdlResultRowsTarget.top = new FormAttachment( 0, 0 ); fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left wlResultRowsTarget.setLayoutData( fdlResultRowsTarget ); wResultRowsTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wResultRowsTarget ); wResultRowsTarget.addModifyListener( lsMod ); FormData fdResultRowsTarget = new FormData(); fdResultRowsTarget.width = 250; fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 ); fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right wResultRowsTarget.setLayoutData( fdResultRowsTarget ); wlResultFields = new Label( wInputComposite, SWT.NONE ); wlResultFields.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFields.Label" ) ); props.setLook( wlResultFields ); FormData fdlResultFields = new FormData(); fdlResultFields.left = new FormAttachment( 0, 0 ); fdlResultFields.top = new FormAttachment( wResultRowsTarget, 10 ); wlResultFields.setLayoutData( fdlResultFields ); int nrRows = ( workflowExecutorMeta.getResultRowsField() != null ? workflowExecutorMeta.getResultRowsField().length : 1 ); ColumnInfo[] ciResultFields = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Field" ), ColumnInfo.COLUMN_TYPE_TEXT, false, false ), new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Type" ), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ), new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Length" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Precision" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), }; wResultRowsFields = new TableView( pipelineMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false ); FormData fdResultFields = new FormData(); fdResultFields.left = new FormAttachment( 0, 0 ); fdResultFields.top = new FormAttachment( wlResultFields, 5 ); fdResultFields.right = new FormAttachment( 100, 0 ); fdResultFields.bottom = new FormAttachment( 100, 0 ); wResultRowsFields.setLayoutData( fdResultFields ); wResultRowsFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) ); wInputComposite.pack(); Rectangle bounds = wInputComposite.getBounds(); scrolledComposite.setContent( wInputComposite ); scrolledComposite.setExpandHorizontal( true ); scrolledComposite.setExpandVertical( true ); scrolledComposite.setMinWidth( bounds.width ); scrolledComposite.setMinHeight( bounds.height ); wTab.setControl( scrolledComposite ); wTabFolder.setSelection( wTab ); }
Example 18
Source File: DragButtonMouseEvents.java From codeexamples-eclipse with Eclipse Public License 1.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); final Composite composite = new Composite(shell, SWT.NONE); composite.setEnabled(false); composite.setLayout(new FillLayout()); Button button = new Button(composite, SWT.PUSH); button.setText("Button"); composite.pack(); composite.setLocation(10, 10); final Point[] offset = new Point[1]; Listener listener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.MouseDown: Rectangle rect = composite.getBounds(); if (rect.contains(event.x, event.y)) { Point pt1 = composite.toDisplay(0, 0); Point pt2 = shell.toDisplay(event.x, event.y); offset[0] = new Point(pt2.x - pt1.x, pt2.y - pt1.y); } break; case SWT.MouseMove: if (offset[0] != null) { Point pt = offset[0]; composite.setLocation(event.x - pt.x, event.y - pt.y); } break; case SWT.MouseUp: offset[0] = null; break; } } }; shell.addListener(SWT.MouseDown, listener); shell.addListener(SWT.MouseUp, listener); shell.addListener(SWT.MouseMove, listener); shell.setSize(300, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example 19
Source File: DeleteConfirmDialog.java From Rel with Apache License 2.0 | 4 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new FormLayout()); Label image = new Label(container, SWT.TRANSPARENT); FormData fd_composite = new FormData(); fd_composite.top = new FormAttachment(0, 10); fd_composite.left = new FormAttachment(0, 10); image.setLayoutData(fd_composite); Image question = IconLoader.loadIcon("question"); image.setImage(question); image.setSize(question.getBounds().width, question.getBounds().height); Label lblPrompt = new Label(container, SWT.NONE); FormData fd_lblPrompt = new FormData(); fd_lblPrompt.top = new FormAttachment(0, 10); fd_lblPrompt.left = new FormAttachment(image, 10); fd_lblPrompt.right = new FormAttachment(100, -10); lblPrompt.setLayoutData(fd_lblPrompt); if (count > 0) lblPrompt.setText("Press OK to delete " + count + " " + whatToDelete + ((count > 1) ? "s" : "") + ". Press Cancel to do nothing."); else lblPrompt.setText("No " + whatToDelete + "s selected. Press Ok to optionally confirm the checkbox below, or Cancel to do nothing."); Button btnNoAsk = new Button(container, SWT.CHECK); FormData fd_btnNoAsk = new FormData(); fd_btnNoAsk.top = new FormAttachment(lblPrompt, 10); fd_btnNoAsk.bottom = new FormAttachment(100, -10); fd_btnNoAsk.right = new FormAttachment(100, -10); btnNoAsk.setLayoutData(fd_btnNoAsk); btnNoAsk.setSelection(noAskAgain); btnNoAsk.setText("Don't ask me again."); btnNoAsk.addListener(SWT.Selection, e -> { noAskAgain = btnNoAsk.getSelection(); }); container.pack(); return container; }
Example 20
Source File: DbTab.java From Rel with Apache License 2.0 | 4 votes |
public DbTab() { super(Core.getTabFolder(), SWT.None); crashTrap = new CrashTrap(this.getParent().getShell(), Version.getVersion()); setImage(IconLoader.loadIcon("plusIcon")); Composite core = new Composite(Core.getTabFolder(), SWT.None); core.setLayout(new FormLayout()); CBanner bannerDbLocationMode = new CBanner(core, SWT.NONE); FormData fd_bannerDbLocationMode = new FormData(); fd_bannerDbLocationMode.right = new FormAttachment(100); fd_bannerDbLocationMode.top = new FormAttachment(0); fd_bannerDbLocationMode.left = new FormAttachment(0); bannerDbLocationMode.setLayoutData(fd_bannerDbLocationMode); Composite compDbLocation = new Composite(bannerDbLocationMode, SWT.NONE); bannerDbLocationMode.setLeft(compDbLocation); GridLayout gl_compDbLocation = new GridLayout(2, false); gl_compDbLocation.verticalSpacing = 0; gl_compDbLocation.marginWidth = 0; gl_compDbLocation.marginHeight = 0; compDbLocation.setLayout(gl_compDbLocation); ManagedToolbar toolBarDatabase = new ManagedToolbar(compDbLocation); if (DBrowser.hasLocalRel()) { new CommandActivator(null, toolBarDatabase, "NewDBIcon", SWT.NONE, "New database", e -> Core.newDatabase()); new CommandActivator(null, toolBarDatabase, "database_restore", SWT.NONE, "New database from a backup", e -> Core.restoreDatabase()); new CommandActivator(null, toolBarDatabase, "OpenDBLocalIcon", SWT.NONE, "Open local database", e -> Core.openLocalDatabase()); } new CommandActivator(null, toolBarDatabase, "OpenDBRemoteIcon", SWT.NONE, "Open remote database", e -> Core.openRemoteDatabase()); textDbLocation = new Text(compDbLocation, SWT.BORDER); textDbLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); textDbLocation.addListener(SWT.KeyUp, e -> { if (e.character == 0xD && !textDbLocation.getText().trim().equals(oldText)) { oldText = textDbLocation.getText().trim(); if (textDbLocation.getText().trim().length() == 0) textDbLocation.setText(lastURI); else { openDatabaseAtURI(textDbLocation.getText(), false); } } }); toolBarMode = new ManagedToolbar(bannerDbLocationMode); toolBarMode.setEnabled(false); bannerDbLocationMode.setRight(toolBarMode); modeContent = new Composite(core, SWT.NONE); contentStack = new StackLayout(); modeContent.setLayout(contentStack); FormData fd_modeContent = new FormData(); fd_modeContent.bottom = new FormAttachment(100); fd_modeContent.top = new FormAttachment(bannerDbLocationMode); fd_modeContent.right = new FormAttachment(100); fd_modeContent.left = new FormAttachment(0); modeContent.setLayoutData(fd_modeContent); tltmModeRel = new CommandActivator(null, toolBarMode, "ModeRelIcon", SWT.RADIO, "Rel", e -> showRel()); tltmModeRev = new CommandActivator(null, toolBarMode, "ModeRevIcon", SWT.RADIO, "Rev", e -> showRev()); tltmModeCmd = new CommandActivator(null, toolBarMode, "ModeCmdIcon", SWT.RADIO, "Command line", e -> showCmd()); setControl(core); preferenceChangeListener = new PreferenceChangeAdapter("DbTab") { @Override public void preferenceChange(PreferenceChangeEvent evt) { if (connection != null && connection.client != null) setImage(IconLoader.loadIcon("DatabaseIcon")); else setImage(IconLoader.loadIcon("plusIcon")); } }; Preferences.addPreferenceChangeListener(PreferencePageGeneral.LARGE_ICONS, preferenceChangeListener); showRecentlyUsedList(); core.pack(); }