public void createFileNamePanel(Shell dialog, String fileName) { Composite fileNamePanel = new Composite(dialog, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); fileNamePanel.setLayoutData(gridData); fileNamePanel.setLayout(new GridLayout(2, false)); Label fileNameLabel = new Label(fileNamePanel, SWT.NONE); fileNameLabel.setText(Messages.getString("VfsFileChooserDialog.fileName")); // $NON-NLS-1$ gridData = new GridData(SWT.FILL, SWT.CENTER, false, false); fileNameLabel.setLayoutData(gridData); fileNameText = new Text(fileNamePanel, SWT.BORDER); if (fileName != null) { fileNameText.setText(fileName); } gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); fileNameText.setLayoutData(gridData); fileNameText.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent arg0) {} public void keyReleased(KeyEvent event) { if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { okPressed(); } } }); }
public Composite create(Composite parentComp) { Composite comp = new Composite(parentComp, SWT.EMBEDDED); comp.setLayout(new MigLayout()); createGroup(comp, "车站信息浏览", "pos 0.5al 0.2al", null); return comp; }
public void createButtonPanel(Shell dialog) { Composite buttonPanel = new Composite(dialog, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); buttonPanel.setLayoutData(gridData); buttonPanel.setLayout(new GridLayout(4, false)); String buttonAlign = System.getProperty("org.pentaho.di.buttonPosition", "right") .toLowerCase(); //$NON-NLS-1$ //$NON-NLS-2$ if (!"left".equals(buttonAlign)) { // $NON-NLS-1$ Label emptyLabel = new Label(buttonPanel, SWT.NONE); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); emptyLabel.setLayoutData(gridData); } okButton = new Button(buttonPanel, SWT.PUSH); okButton.setText(Messages.getString("VfsFileChooserDialog.ok")); // $NON-NLS-1$ gridData = new GridData(SWT.FILL, SWT.FILL, false, false); gridData.widthHint = 90; okButton.setLayoutData(gridData); okButton.addSelectionListener(this); cancelButton = new Button(buttonPanel, SWT.PUSH); cancelButton.setText(Messages.getString("VfsFileChooserDialog.cancel")); // $NON-NLS-1$ cancelButton.addSelectionListener(this); gridData = new GridData(SWT.FILL, SWT.FILL, false, false); gridData.widthHint = 90; cancelButton.setLayoutData(gridData); if ("center".equals(buttonAlign)) { // $NON-NLS-1$ Label emptyLabel = new Label(buttonPanel, SWT.NONE); gridData = new GridData(SWT.FILL, SWT.FILL, true, false); emptyLabel.setLayoutData(gridData); } }
private Composite createAvailableList(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; container.setLayout(layout); container.setLayoutData(new GridData()); Label label = new Label(container, SWT.NONE); label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList); Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 200; gd.widthHint = 225; table.setLayoutData(gd); fAvailableListViewer = new TableViewer(table); fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider()); fAvailableListViewer.setContentProvider(new ContentProvider()); fAvailableListViewer.setInput(PDECore.getDefault().getModelManager()); fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR); return container; }
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = 5; layout.verticalSpacing = 10; container.setLayout(layout); createScrollArea(container); createAvailableList(container).setLayoutData(new GridData(GridData.FILL_BOTH)); createButtonArea(container); createImportList(container).setLayoutData(new GridData(GridData.FILL_BOTH)); updateCount(); // create container for buttons Composite optionComp = SWTFactory.createComposite(container, 1, 3, GridData.FILL_HORIZONTAL, 5, 0); createComputationsOption(optionComp); createFilterOptions(optionComp); addViewerListeners(); initialize(); addFilters(); setControl(container); Dialog.applyDialogFont(container); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(container, IHelpContextIds.PLUGIN_IMPORT_SECOND_PAGE); }
public void createControl(Composite parent) { Composite pageContent = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; pageContent.setLayout(layout); pageContent.setLayoutData(new GridData(GridData.FILL_BOTH)); // variable never used ... is pageContent.getLayoutData() needed? // GridData outerFrameGridData = (GridData) pageContent.getLayoutData(); // outerFrameGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL; // outerFrameGridData.verticalAlignment = GridData.VERTICAL_ALIGN_FILL; // WorkbenchHelp.setHelp( // pageContent, // B2BGUIContextIds.BTBG_SELECT_MULTI_FILE_PAGE); createLabels(pageContent); createSourceViewer(pageContent); createButtonPanel(pageContent); createSelectedListBox(pageContent); createImportButton(pageContent); setControl(pageContent); if (isFileMandatory) setPageComplete(false); }
void drawRectangles(Rectangle[] rects, boolean stippled) { int xDisplay = display.xDisplay; int color = OS.XWhitePixel(xDisplay, 0); int xWindow = OS.XDefaultRootWindow(xDisplay); if (parent != null) { xWindow = OS.XtWindow(parent.handle); if (xWindow == 0) return; int foreground = parent.getForegroundPixel(); Control control = parent.findBackgroundControl(); if (control == null) control = parent; int background = control.getBackgroundPixel(); color = foreground ^ background; } int gc = OS.XCreateGC(xDisplay, xWindow, 0, null); OS.XSetForeground(xDisplay, gc, color); OS.XSetSubwindowMode(xDisplay, gc, OS.IncludeInferiors); OS.XSetFunction(xDisplay, gc, OS.GXxor); int stipplePixmap = 0; if (stippled) { byte[] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0}; stipplePixmap = OS.XCreateBitmapFromData(xDisplay, xWindow, bits, 8, 8); OS.XSetStipple(xDisplay, gc, stipplePixmap); OS.XSetFillStyle(xDisplay, gc, OS.FillStippled); OS.XSetLineAttributes(xDisplay, gc, 3, OS.LineSolid, OS.CapButt, OS.JoinMiter); } for (int i = 0; i < rects.length; i++) { Rectangle rect = rects[i]; OS.XDrawRectangle(xDisplay, xWindow, gc, rect.x, rect.y, rect.width, rect.height); } if (stippled) { OS.XFreePixmap(xDisplay, stipplePixmap); } OS.XFreeGC(xDisplay, gc); }
protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) { fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel); fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(3, false); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMaxOccurSpinner = new Spinner(comp, SWT.BORDER); fMaxOccurSpinner.setMinimum(1); fMaxOccurSpinner.setMaximum(999); fMaxOccurSpinner.setIncrement(1); fUnboundSelect = toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK); gd = new GridData(); gd.horizontalIndent = 10; fUnboundSelect.setLayoutData(gd); fUnboundSelect.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (blockListeners()) return; fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement()); } }); return comp; }
void update() { if (parent != null) { if (parent.isDisposed()) return; parent.getShell().update(); } else { display.update(); } }
public Control createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout(3, false)); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fButton = new Button(comp, SWT.CHECK); fButton.setText(PDEUIMessages.AdvancedPluginExportPage_signButton); GridData gd = new GridData(); gd.horizontalSpan = 3; fButton.setLayoutData(gd); fButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateGroup(fButton.getSelection()); fPage.pageChanged(); } }); fKeystoreLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_keystore); fKeystoreText = createText(comp, 1); fBrowseButton = new Button(comp, SWT.PUSH); fBrowseButton.setText(PDEUIMessages.ExportWizard_browse); fBrowseButton.setLayoutData(new GridData()); SWTUtil.setButtonDimensionHint(fBrowseButton); fBrowseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(fPage.getShell(), SWT.OPEN); String path = fKeystoreText.getText(); if (path.trim().length() == 0) path = PDEPlugin.getWorkspace().getRoot().getLocation().toString(); dialog.setFileName(path); String res = dialog.open(); if (res != null) { fKeystoreText.setText(res); } } }); fKeypassLabel = createLabel(comp, PDEUIMessages.JARSigningTab_keypass); fKeypassText = createText(comp, 2); fKeypassText.setEchoChar('*'); fAliasLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_alias); fAliasText = createText(comp, 2); fPasswordLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_password); fPasswordText = createText(comp, 2); fPasswordText.setEchoChar('*'); Dialog.applyDialogFont(comp); PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.ADVANCED_PLUGIN_EXPORT); return comp; }
public TermWinUI(Shell parent) { self = new Shell(parent, SWT.SHELL_TRIM); self.setLayout(new GridLayout()); mainPane = new Composite(self, SWT.NONE); mainPane.setLayout(new GridLayout(3, false)); mainPane.setLayoutData(new GridData(GridData.FILL_BOTH)); createContent(); }
protected Control createContents(Composite parent) { initializeValues(); Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createControls(composite); return getControl(); }
public static Composite createPlaceholder(Composite parent, int columns, int spacing) { Composite ph = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(columns, false); gl.verticalSpacing = spacing; gl.horizontalSpacing = spacing; gl.marginHeight = 0; gl.marginWidth = 0; ph.setLayout(gl); return ph; }
public static void enableWithChildren(Composite composite, boolean enable) { composite.setEnabled(enable); for (Control child : composite.getChildren()) { if (child instanceof Composite) { enableWithChildren((Composite) child, enable); } else { child.setEnabled(enable); } } }
private void hideCustomPanelChildren() { Control[] children = customUIPanel.getChildren(); for (Control child : children) { if (child instanceof Composite && "donotremove".equals(((Composite) child).getData())) { // skip } else { child.setParent(fakeShell); } } customUIPanel.pack(); }
public void createContents(Composite parent) { shell = parent.getShell(); parent.setLayout(new FillLayout()); folder = new TabFolder(shell, SWT.BORDER); labelTab(); directoryDialogTab(); buttonTab(); sliderTab(); scribbleTab(); browserTab(); }
private Control createImplicitTabContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); container.setLayout(layout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); container.setFont(parent.getFont()); createImpLabel(container); createImpTable(container); createImpButtons(container); return container; }
private void createProgressBarConfig(Composite parent) { fAddBarButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressBar); fAddBarButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddBarButton.getSelection(); getSplashInfo().addProgressBar(enable, false); updateFieldEnablement(); } }); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.verticalIndent = 5; data.horizontalSpan = F_NUM_COLUMNS; fAddBarButton.setLayoutData(data); fAddBarButton.setEnabled(isEditable()); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fBarControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressX); fBarControls[1] = fBarSpinners[0] = createSpinner(parent, fToolkit); fBarControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressY); fBarControls[3] = fBarSpinners[1] = createSpinner(parent, fToolkit); fBarControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressWidth); fBarControls[5] = fBarSpinners[2] = createSpinner(parent, fToolkit); fBarControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressHeight); fBarControls[7] = fBarSpinners[3] = createSpinner(parent, fToolkit); // Add tooltips to coordinate controls addOffsetTooltips(fBarControls); for (Spinner spinner : fBarSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(true); } }); } Composite filler = fToolkit.createComposite(parent); filler.setLayout(new GridLayout()); GridData gd = new GridData(); gd.horizontalSpan = 2; filler.setLayoutData(gd); }
@NotNull public static Text createOutputFolderChooser( final Composite parent, @Nullable String label, @Nullable ModifyListener changeListener) { UIUtils.createControlLabel( parent, label != null ? label : CoreMessages.data_transfer_wizard_output_label_directory); Composite chooserPlaceholder = UIUtils.createPlaceholder(parent, 2); chooserPlaceholder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Text directoryText = new Text(chooserPlaceholder, SWT.BORDER); directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (changeListener != null) { directoryText.addModifyListener(changeListener); } final Runnable folderChooser = new Runnable() { @Override public void run() { DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.NONE); dialog.setMessage(CoreMessages.data_transfer_wizard_output_dialog_directory_message); dialog.setText(CoreMessages.data_transfer_wizard_output_dialog_directory_text); String directory = directoryText.getText(); if (!CommonUtils.isEmpty(directory)) { dialog.setFilterPath(directory); } directory = dialog.open(); if (directory != null) { directoryText.setText(directory); } } }; directoryText.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { folderChooser.run(); } }); Button openFolder = new Button(chooserPlaceholder, SWT.PUSH | SWT.FLAT); openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER)); openFolder.setLayoutData( new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER)); openFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { folderChooser.run(); } }); return directoryText; }
@Override public final void createContents(Composite parent) { // This is a hacked fix to ensure that the label columns on every details // page have the same width. SchemaDetails_translatable plus 11 pixels // represents the longest label on any field on any details page. This // occurs on SchemaStringAttributeDetails and 11 is the size of the // horizontal indent that contributes to the label's width. GC gc = new GC(parent); minLabelWeight = gc.textExtent(PDEUIMessages.SchemaDetails_translatable).x + 11; gc.dispose(); gc = null; parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1)); FormToolkit toolkit = getManagedForm().getToolkit(); fSection = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR); fSection.clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING; fSection.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData gd; if (fShowDescription) gd = new GridData(GridData.FILL_BOTH); else gd = new GridData(GridData.FILL_HORIZONTAL); fSection.setLayoutData(gd); // Align the master and details section headers (misalignment caused // by section toolbar icons) getPage().alignSectionHeaders(fElementSection.getSection(), fSection); Composite client = toolkit.createComposite(fSection); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 3)); createDetails(client); if (fShowDescription) createDescription(client, toolkit); // If the DTD Approximation section was requested, instantiate it and create it's contents // on the same parent Composite if (fShowDTD) { fDtdSection = new SchemaDtdDetailsSection(); fDtdSection.initialize(getManagedForm()); fDtdSection.createContents(parent); } toolkit.paintBordersFor(client); fSection.setClient(client); markDetailsPart(fSection); if (fShowDescription) fDescriptionViewer.createUIListeners(); hookListeners(); }
protected Composite createMinOccurComp(Composite parent, FormToolkit toolkit) { fMinLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_minOccurLabel); fMinLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMinOccurSpinner = new Spinner(comp, SWT.BORDER); fMinOccurSpinner.setMinimum(0); fMinOccurSpinner.setMaximum(999); return comp; }
protected Button[] createTrueFalseButtons(Composite parent, FormToolkit toolkit, int colSpan) { Composite comp = toolkit.createComposite(parent, SWT.NONE); GridLayout gl = new GridLayout(2, false); gl.marginHeight = gl.marginWidth = 0; comp.setLayout(gl); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = colSpan; gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; comp.setLayoutData(gd); Button tButton = toolkit.createButton(comp, BOOLS[0], SWT.RADIO); Button fButton = toolkit.createButton(comp, BOOLS[1], SWT.RADIO); gd = new GridData(); gd.horizontalIndent = 20; fButton.setLayoutData(gd); return new Button[] {tButton, fButton}; }
/** * Callback that is invoked when a property in the compare configuration ( {@link * #getCompareConfiguration()} changes. * * @param event the property change event * @since 3.3 */ protected void handlePropertyChangeEvent(PropertyChangeEvent event) { String key = event.getProperty(); if (key.equals(ICompareUIConstants.PROP_ANCESTOR_VISIBLE)) { fAncestorVisible = Utilities.getBoolean( getCompareConfiguration(), ICompareUIConstants.PROP_ANCESTOR_VISIBLE, fAncestorVisible); fComposite.layout(true); updateCursor(fLeftLabel, VERTICAL); updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL); updateCursor(fRightLabel, VERTICAL); return; } if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) { setAncestorVisibility( false, !Utilities.getBoolean( getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false)); return; } }
public SpinnerFieldEditor( String name, String labelText, Composite parent, int min, int max, int increment, int pageIncrement) { init(name, labelText); GridLayout layout = new GridLayout(); layout.numColumns = getNumberOfControls(); layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = HORIZONTAL_GAP; parent.setLayout(layout); // create label control getLabelControl(parent); spinner = new BigDecimalSpinner(parent, SWT.NONE, 0, min, max, increment, pageIncrement); spinner.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { valueChanged(); } }); doFillIntoGrid(parent, layout.numColumns); }
public static void sliderTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Sliders and Progress bars"); tab.setToolTipText("Tied Slider to ProgressBar"); Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(new GridLayout(2, true)); final Slider slider = new Slider(composite, SWT.HORIZONTAL); final ProgressBar progress = new ProgressBar(composite, SWT.HORIZONTAL); slider.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { progress.setSelection(slider.getSelection()); } }); tab.setControl(composite); }
void setOrientation(boolean create) { super.setOrientation(create); if (items != null) { for (int i = 0; i < items.length; i++) { if (items[i] != null) items[i].setOrientation(create); } } }
void removeControl(Control control) { super.removeControl(control); int count = getItemCount(); for (int i = 0; i < count; i++) { TabItem item = items[i]; if (item.control == control) item.setControl(null); } }
public void mouseDown(MouseEvent e) { Composite parent = fControl.getParent(); Point s = parent.getSize(); Point as = fAncestorLabel.getSize(); Point ys = fLeftLabel.getSize(); Point ms = fRightLabel.getSize(); fWidth1 = ys.x; fWidth2 = ms.x; fHeight1 = fLeftLabel.getLocation().y - as.y; fHeight2 = s.y - (fLeftLabel.getLocation().y + ys.y); fX = e.x; fY = e.y; fIsDown = true; }
public static void buttonTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Buttons"); tab.setToolTipText("Different kinds of Buttons"); Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(new GridLayout(4, true)); for (int dir : new int[] {SWT.UP, SWT.RIGHT, SWT.LEFT, SWT.DOWN}) { Button b = new Button(composite, SWT.ARROW | dir); b.addListener(SWT.MouseDown, listener); } newButton(composite, SWT.CHECK, "Check button"); newButton(composite, SWT.PUSH, "Push button"); newButton(composite, SWT.RADIO, "Radio button"); newButton(composite, SWT.TOGGLE, "Toggle button"); newButton(composite, SWT.FLAT, "Flat button"); tab.setControl(composite); }
private void createImpLabel(Composite container) { Label label = new Label(container, SWT.NONE); label.setText(PDEUIMessages.TargetImplicitPluginsTab_desc); label.setFont(container.getFont()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; label.setLayoutData(gd); }