private void createControlsPanel(Composite theParent) { ScrolledComposite scroller = new ScrolledComposite(theParent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); GridLayout scrolledLayout = new GridLayout(); scrolledLayout.marginLeft = 5; scrolledLayout.marginRight = 5; scroller.setLayout(scrolledLayout); scroller.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); scroller.setExpandHorizontal(true); scroller.setExpandVertical(true); scroller.setMinWidth(900); scroller.setMinHeight(270); Group controlsGroup = WidgetFactory.createGroup(scroller, EDIT_TXT); GridLayout controlsLayout = new GridLayout(); controlsLayout.marginLeft = 0; controlsLayout.marginRight = 0; controlsGroup.setLayout(controlsLayout); controlsGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); createResolveAttributePanel(controlsGroup); createResolveSqlPanel(controlsGroup); scroller.setContent(controlsGroup); }
/** @param tabFolder */ private void createControl(CTabFolder tabFolder) { // Create Container ScrolledComposite scrolledContainer = new ScrolledComposite(tabFolder, SWT.BORDER | SWT.V_SCROLL); Composite container = new Composite(scrolledContainer, SWT.NONE); GridLayout glayout = new GridLayout(); glayout.numColumns = 1; glayout.marginTop = 0; glayout.marginBottom = 0; glayout.marginRight = 4; glayout.verticalSpacing = 20; container.setLayout(glayout); // General createGeneralGroup(container); // SSL createSSLGroup(container); // HA createHAGroup(container); // LWT createLWTGroup(container); scrolledContainer.setContent(container); scrolledContainer.setExpandHorizontal(true); scrolledContainer.setExpandVertical(true); // scrolledContainer.setMinWidth( 1600 ); scrolledContainer.setMinHeight(900); setControl(scrolledContainer); }
/** * Create contents of the wizard. * * @param parent */ @Override public void createControl(Composite parent) { ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); setControl(scrolledComposite); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); Composite composite = new Composite(scrolledComposite, SWT.NONE); scrolledComposite.setSize(500, 500); composite.setLayout(new GridLayout(1, false)); radioButtons = new Button[imNames.length]; for (int i = 0; i < imNames.length; i++) { radioButtons[i] = new Button(composite, SWT.RADIO); radioButtons[i].setImage( sia.ui.org.eclipse.wb.swt.SWTResourceManager.getImage( ImportChooseIM.class, "/sia/ui/resources/ims/" + Dictionaries.getInstance().getDataSources().get(imNames[i]) + ".png")); radioButtons[i].setText(imNames[i]); radioButtons[i].addSelectionListener((ImportWizard) getWizard()); } scrolledComposite.setContent(composite); scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); final ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite c = new Composite(sc, SWT.NONE); c.setLayout(new GridLayout(10, true)); for (int i = 0; i < 300; i++) { Button b = new Button(c, SWT.PUSH); b.setText("Button " + i); } sc.setContent(c); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setShowFocusedControl(true); shell.setSize(300, 500); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
public void createPartControl(Composite parent) { final ScrolledComposite scomposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); swtDisplay = (SWTRemoteDisplay) RemoteDisplayFactory.getDisplay(SWTDISPLAY, scomposite); running = true; scomposite.setContent(swtDisplay); scomposite.setExpandHorizontal(true); scomposite.setExpandVertical(true); swtDisplay .getCanvas() .addControlListener( new ControlListener() { public void controlMoved(ControlEvent e) {} public void controlResized(ControlEvent e) { Point size = swtDisplay.getCanvas().getSize(); scomposite.setMinSize(swtDisplay.getParent().computeSize(size.x, size.y)); } }); swtDisplay.getCanvas().setSize(0, 0); if (VNCViewerView.protocolHandle != null) { try { swtDisplay.start(protocolHandle); } catch (Exception e) { // TODO handle properly e.printStackTrace(); } } }
/** Leert die Anzeige. Wird beim Wechsel von einem Dialog auf den naechsten aufgerufen. */ protected void cleanContent() { if (content != null && !content.isDisposed()) content.dispose(); if (scroll != null && !scroll.isDisposed()) scroll.dispose(); if (Customizing.SETTINGS.getBoolean("application.scrollview", false)) { scroll = new ScrolledComposite(view, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(GridData.FILL_BOTH)); scroll.setLayout(SWTUtil.createGrid(1, true)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); scroll.setMinHeight(Customizing.SETTINGS.getInt("application.scrollview.minheight", 580)); content = new Composite(scroll, SWT.NONE); scroll.setContent(content); } else { content = new Composite(view, SWT.NONE); } content.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout l = new GridLayout(); l.marginHeight = 6; l.marginWidth = 6; content.setLayout(l); if (this.titlePart != null) { this.titlePart.clearButtons(); this.titlePart.addButton(new PanelButtonBack()); // Zurueckbutton ist immer dabei } if (notifications != null) notifications.reset(); setTitle(null); }
@Override protected Control createDialogArea(final Composite parent) { // parent has GridLayout with 1 column ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); scrolledComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); Composite mainArea = new Composite(scrolledComposite, SWT.NONE); scrolledComposite.setContent(mainArea); GridLayout gridLayout = new GridLayout(1, false); gridLayout.verticalSpacing = 10; mainArea.setLayout(gridLayout); /* * createViewer(mainArea); */ createWidgetRows(mainArea); // 1) // mainArea.setSize(mainArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); // 2) scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setMinSize(mainArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); return scrolledComposite; }
/** * Implement the user interface for the preference page. Returns a control that should be used as * the main control for the page. * * <p>User interface defined here supports the definition of preference settings used by the * management logic. {@inheritDoc} */ protected Control createContents(Composite parent) { /** Add layer to parent widget */ final ScrolledComposite scrollComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); final Composite composite = new Composite(scrollComposite, SWT.NONE); /** Define laout rules for widget placement */ compositeGridData(composite, 1); // add widgets to composite createShowContainerCount(composite); createShortCutsArea(composite); // context sensitive help Plugin.getHelpSystem().setHelp(parent, ContextHelpIds.PREFPAGE_OBJECT_MAP); initPreferences(); scrollComposite.setContent(composite); scrollComposite.setExpandHorizontal(true); scrollComposite.setExpandVertical(true); scrollComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrollComposite.addControlListener( new ControlAdapter() { public void controlResized(ControlEvent e) { scrollComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); return scrollComposite; }
@Override public void createPartControl(Composite parent) { // Creates toolkit and form toolkit = createFormBodySection(parent, "Senate Crawler"); Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(section); section.setExpanded(true); // Create a composite to hold the other widgets ScrolledComposite sc = new ScrolledComposite(section, SWT.H_SCROLL | SWT.V_SCROLL); sc.setExpandHorizontal(true); sc.setExpandVertical(true); GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(sc); // Creates an empty to create a empty space TacitFormComposite.createEmptyRow(toolkit, sc); // Create a composite that can hold the other widgets Composite client = toolkit.createComposite(form.getBody()); GridLayoutFactory.fillDefaults() .equalWidth(true) .numColumns(1) .applyTo(client); // Align the composite section to one column GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(client); GridLayout layout = new GridLayout(); // Layout creation layout.numColumns = 2; createSenateInputParameters(client); TacitFormComposite.createEmptyRow(toolkit, client); outputLayout = TacitFormComposite.createOutputSection(toolkit, client, form.getMessageManager()); // Add run and help button on the toolbar addButtonsToToolBar(); }
/** * Set the major UI features of this basic view composite * * @param textEditor * @param parentComposite * @param styleBit */ public Transition(final XMLEditor textEditor, final Composite parentComposite, int styleBit) { super(parentComposite, SWT.BORDER); setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_MAGENTA)); this.textEditor = textEditor; addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { toolkit.dispose(); } }); toolkit.adapt(this); toolkit.paintBordersFor(this); setLayout(new FormLayout()); setLayoutData(new GridData(GridData.FILL_BOTH)); final ScrolledComposite parentScrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL); parentScrolledComposite.setAlwaysShowScrollBars(true); parentScrolledComposite.setExpandHorizontal(true); parentScrolledComposite.setExpandVertical(true); FormData parentScrolledCompositeFormLayoutData = new FormData(); parentScrolledCompositeFormLayoutData.right = new FormAttachment(100); parentScrolledCompositeFormLayoutData.bottom = new FormAttachment(100); parentScrolledCompositeFormLayoutData.top = new FormAttachment(0, 5); parentScrolledCompositeFormLayoutData.left = new FormAttachment(0, 5); parentScrolledComposite.setLayoutData(parentScrolledCompositeFormLayoutData); this.setData(parentScrolledComposite); baseContainer = new Composite(parentScrolledComposite, SWT.NONE); baseContainer.setBackground(SWTResourceManager.getColor(204, 153, 255)); parentScrolledComposite.setContent(baseContainer); baseContainer.setLayout(new GridLayout(1, true)); try { CentralUtils centralUtils = CentralUtils.getCentralUtils(textEditor); centralUtils.setBasicUI(parentScrolledComposite, baseContainer); centralUtils.unmarshal(textEditor); } catch (JAXBException e) { LOG.info(e.getMessage()); } // create a THumanInteractions object if humanInteractions variable is // null if (textEditor.getRootElement() == null) { humanInteractions = new THumanInteractions(); textEditor.setRootElement(humanInteractions); } try { // create the biggest xml element- UI section humanInteractionsUI = new THumanInteractionsUI( textEditor, baseContainer, this, SWT.NONE, textEditor.getRootElement(), 0, 0); } catch (JAXBException e1) { LOG.info(e1.getMessage()); } }
/** * DOC ocarbone Comment method "addTreeNavigator". * * @param parent * @param width * @param height */ private void addTreeNavigator(Composite parent, int width, int height) { // Group Group group = Form.createGroup( parent, 1, Messages.getString("DatabaseTableForm.navigatorTree"), height); //$NON-NLS-1$ // ScrolledComposite ScrolledComposite scrolledCompositeFileViewer = new ScrolledComposite(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE); scrolledCompositeFileViewer.setExpandHorizontal(true); scrolledCompositeFileViewer.setExpandVertical(true); GridData gridData1 = new GridData(GridData.FILL_BOTH); gridData1.widthHint = width + 12; gridData1.heightHint = height; gridData1.horizontalSpan = 2; scrolledCompositeFileViewer.setLayoutData(gridData1); tableViewerCreator = new TableViewerCreator(scrolledCompositeFileViewer); tableViewerCreator.setHeaderVisible(false); tableViewerCreator.setColumnsResizableByDefault(false); tableViewerCreator.setBorderVisible(false); tableViewerCreator.setLinesVisible(false); tableViewerCreator.setLayoutMode(LAYOUT_MODE.NONE); tableViewerCreator.setCheckboxInFirstColumn(false); tableViewerCreator.setFirstColumnMasked(false); tableNavigator = tableViewerCreator.createTable(); tableNavigator.setLayoutData(new GridData(GridData.FILL_BOTH)); TableColumn tableColumn = new TableColumn(tableNavigator, SWT.NONE); tableColumn.setText( Messages.getString("DatabaseTableForm.tableColumnText.talbe")); // $NON-NLS-1$ tableColumn.setWidth(width + 120); scrolledCompositeFileViewer.setContent(tableNavigator); scrolledCompositeFileViewer.setSize(width + 12, height); // // Button Add metadata Table Composite button = Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER); addTableButton = new UtilsButton( button, Messages.getString("DatabaseTableForm.AddTable"), width - 30, HEIGHT_BUTTON_PIXEL); //$NON-NLS-1$ Composite rmButton = Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER); removeTableButton = new UtilsButton(rmButton, "Remove Schema", width - 30, HEIGHT_BUTTON_PIXEL); // $NON-NLS-1$ }
private void initialize(Composite composite) { panel = new Composite(composite, SWT.NULL); panel.setLayout(new GridLayout(2, false)); legend_panel_sc = new ScrolledComposite(panel, SWT.V_SCROLL); legend_panel_sc.setExpandHorizontal(true); legend_panel_sc.setExpandVertical(true); GridLayout layout = new GridLayout(); layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; legend_panel_sc.setLayout(layout); GridData gridData = new GridData(GridData.FILL_VERTICAL); legend_panel_sc.setLayoutData(gridData); legend_panel = new Group(legend_panel_sc, SWT.NULL); legend_panel.setText(MessageText.getString("label.tags")); legend_panel.setLayout(new GridLayout()); legend_panel_sc.setContent(legend_panel); legend_panel_sc.addControlListener( new ControlAdapter() { public void controlResized(ControlEvent e) { legend_panel_sc.setMinSize(legend_panel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); speed_panel = new Composite(panel, SWT.NULL); speed_panel.setLayout(new GridLayout()); gridData = new GridData(GridData.FILL_BOTH); speed_panel.setLayoutData(gridData); build(); TagManager tm = TagManagerFactory.getTagManager(); tm.addTagManagerListener(this, false); for (TagType tt : tm.getTagTypes()) { tt.addTagTypeListener(this, false); } panel.addListener( SWT.Activate, new Listener() { public void handleEvent(Event event) { refresh(true); } }); }
private void createEditArea(Composite parent) { containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); containerSC.setExpandHorizontal(true); containerSC.setExpandVertical(true); // Add a container for the build settings page settingsPageContainer = new Composite(containerSC, SWT.NONE); settingsPageContainer.setLayout(new PageLayout()); containerSC.setContent(settingsPageContainer); // containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); settingsPageContainer.layout(); }
@Override protected Control createDialogArea(Composite parent) { updateTitle(); final Composite composite = (Composite) super.createDialogArea(parent); composite.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL); scrolledComposite.setBackground(composite.getBackground()); scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scrolledComposite.setExpandVertical(true); scrolledComposite.setExpandHorizontal(true); final Composite content = new Composite(scrolledComposite, SWT.NONE); content.setBackground(composite.getBackground()); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(content); GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(content); try { if (view == null) { ECPSWTViewRenderer.INSTANCE.render(content, selection); } else { ECPSWTViewRenderer.INSTANCE.render(content, selection, view); } } catch (final ECPRendererException ex) { Activator.log(ex); } scrolledComposite.setContent(content); final Point point = content.computeSize(SWT.DEFAULT, SWT.DEFAULT); content.setSize(point); scrolledComposite.setMinSize(point); objectChangeAdapter = new AdapterImpl() { /** * {@inheritDoc} * * @see * org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification) */ @Override public void notifyChanged(Notification msg) { super.notifyChanged(msg); updateTitle(); } }; selection.eAdapters().add(objectChangeAdapter); return composite; }
private void createJFreeChartComposite() { final ScrolledComposite scrollComp = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS); scrollComp.setLayout(new GridLayout()); Composite innerComp = new Composite(scrollComp, SWT.NONE); GridData innerGD = new GridData(); innerGD.grabExcessVerticalSpace = true; innerComp.setLayoutData(innerGD); innerComp.setLayout(new FillLayout()); scrollComp.setContent(innerComp); scrollComp.setExpandVertical(true); scrollComp.setExpandHorizontal(true); jfreeChartComp = new ChartComposite(innerComp, SWT.NONE, computeChart(), true); }
/** This is a callback that will allow us to create the viewer and initialize it. */ public void createPartControl(Composite parent) { this.parent = parent; final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); sc.setExpandHorizontal(true); sc.setExpandVertical(true); CrtVerViewComposite c = new CrtVerViewComposite(sc, SWT.NONE, this); sc.setContent(c); sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT)); c.setText(); PlatformUI.getWorkbench() .getHelpSystem() .setHelp( parent.getShell(), "org.jcryptool.visual.crtverification.views.CrtVerView"); //$NON-NLS-1$ }
/** * Creates the composite holding the details. * * @param parent the parent * @return the right panel/detail composite */ protected ScrolledComposite createRightPanelContent(Composite parent) { rightPanel = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); rightPanel.setShowFocusedControl(true); rightPanel.setExpandVertical(true); rightPanel.setExpandHorizontal(true); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(rightPanel); rightPanel.setLayout(GridLayoutFactory.fillDefaults().create()); rightPanel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); container = new Composite(rightPanel, SWT.FILL); container.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container); container.setBackground(rightPanel.getBackground()); /* The header */ final Composite header = new Composite(container, SWT.FILL); final GridLayout headerLayout = GridLayoutFactory.fillDefaults().create(); headerLayout.marginWidth = 5; header.setLayout(headerLayout); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header); header.setBackground(rightPanel.getBackground()); final Label label = new Label(header, SWT.WRAP); label.setText("Details"); // $NON-NLS-1$ detailsFont = new Font(label.getDisplay(), getDefaultFontName(label), 10, SWT.BOLD); label.setFont(detailsFont); label.setForeground(getTitleColor(parent)); label.setBackground(header.getBackground()); rightPanelContainerComposite = new Composite(container, SWT.FILL); rightPanelContainerComposite.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.FILL) .grab(true, true) .applyTo(rightPanelContainerComposite); rightPanelContainerComposite.setBackground(rightPanel.getBackground()); rightPanel.setContent(container); rightPanel.layout(); container.layout(); final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT); rightPanel.setMinSize(point); return rightPanel; }
/** * Creates and associates the required composites to present the parameters and the demo image for * the spatial operation. * * @param builder */ @Override protected void createContents() { assert this.presenterFactory != null : "builder cannot not be null"; GridLayout gridLayout = new GridLayout(); setLayout(gridLayout); this.sash = new SashForm(this, SWT.NONE); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = GridData.FILL; this.sash.setLayoutData(gridData); this.dataScrollComposite = new ScrolledComposite(this.sash, SWT.BORDER | SWT.H_SCROLL); this.dataScrollComposite.setLayout(new FillLayout()); this.dataComposite = (Composite) this.presenterFactory.createDataComposite(this.dataScrollComposite, SWT.BORDER); dataComposite.setLayoutData(gridData); this.dataScrollComposite.setContent(dataComposite); this.dataScrollComposite.setExpandHorizontal(true); this.dataScrollComposite.setExpandVertical(true); this.dataScrollComposite.setMinSize(dataComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); ScrolledComposite demoScrollComposite = new ScrolledComposite(sash, SWT.BORDER | SWT.H_SCROLL); demoScrollComposite.setLayout(new FillLayout()); IImageOperation demoImages = this.presenterFactory.createDemoImages(); this.demoComposite = new DemoComposite(demoScrollComposite, SWT.BORDER, demoImages); this.demoComposite.setLayoutData(gridData); demoScrollComposite.setContent(this.demoComposite); demoScrollComposite.setExpandHorizontal(true); demoScrollComposite.setExpandVertical(true); demoScrollComposite.setMinSize(demoComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sash.setWeights(new int[] {70, 30}); super.addPresenter((AggregatedPresenter) dataComposite); }
protected void setSize(Composite composite) { if (composite != null) { // Note: The font is set here in anticipation that the class inheriting // this base class may add widgets to the dialog. setSize // is assumed to be called just before we go live. applyDialogFont(composite); Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); composite.setSize(minSize); // set scrollbar composite's min size so page is expandable but // has scrollbars when needed if (composite.getParent() instanceof ScrolledComposite) { ScrolledComposite sc1 = (ScrolledComposite) composite.getParent(); sc1.setMinSize(minSize); sc1.setExpandHorizontal(true); sc1.setExpandVertical(true); } } }
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { setMessage("Icon Selection"); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); Composite composite = new Composite(scrolledComposite, SWT.NONE); composite.setLayout(new GridLayout(9, true)); for (Descriptor i : IconRegistry.getRegisteredImages()) { Button btnCheckButton = new Button(composite, SWT.RADIO); btnCheckButton.setImage(IconRegistry.getImage(i.id)); btnCheckButton.setData(i); btnCheckButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Object source = e.getSource(); if (source instanceof Button) { Button btn = (Button) source; Object data = btn.getData(); if (data instanceof Descriptor) { Descriptor desc = (Descriptor) data; imageSelected = desc.id; } } } }); } scrolledComposite.setContent(composite); scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); return area; }
@Override protected void createWorkarea(Composite parent) { parent.setLayout(new FillLayout()); final Color bgColor = LnfManager.getLnf().getColor(LnfKeyConstants.SUB_MODULE_BACKGROUND); final ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); scrolled.setBackground(bgColor); final Composite newParent = new Composite(scrolled, SWT.DOUBLE_BUFFERED); scrolled.setContent(newParent); newParent.setBackground(bgColor); basicCreatePartControl(newParent); afterBasicCreatePartControl(newParent); scrolled.setMinSize(newParent.computeSize(640, 480)); }
@Override public void createPartControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.None); mainComposite.setLayout(new GridLayout(1, false)); mainComposite.setLayoutData( new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); Group connectionsGroup = new Group(mainComposite, SWT.BORDER | SWT.SHADOW_ETCHED_IN); connectionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); connectionsGroup.setLayout(new GridLayout(3, true)); connectionsGroup.setText(Messages.DatabaseView__connections); Composite connectionsListComposite = new Composite(connectionsGroup, SWT.NONE); connectionsListComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); connectionsListComposite.setLayout(new GridLayout(2, false)); connectionsViewer = createTableViewer(connectionsListComposite); connectionsViewer.setInput(availableDatabaseConnectionProperties); addFilterButtons(connectionsListComposite, connectionsViewer); ScrolledComposite scrolledComposite = new ScrolledComposite(connectionsGroup, SWT.BORDER | SWT.V_SCROLL); scrolledComposite.setLayout(new GridLayout(1, false)); propertiesComposite = new Composite(scrolledComposite, SWT.NONE); propertiesStackLayout = new StackLayout(); propertiesComposite.setLayout(propertiesStackLayout); GridData propertiesCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true); // propertiesCompositeGD.horizontalSpan = 2; propertiesComposite.setLayoutData(propertiesCompositeGD); Label l = new Label(propertiesComposite, SWT.SHADOW_ETCHED_IN); l.setText(Messages.DatabaseView__no_item_selected); propertiesStackLayout.topControl = l; scrolledComposite.setContent(propertiesComposite); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); // scrolledComposite.setMinWidth(400); scrolledComposite.setMinHeight(300); GridData scrolledCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true); scrolledCompositeGD.horizontalSpan = 2; scrolledComposite.setLayoutData(scrolledCompositeGD); }
protected void initGui(Composite parent) { final int gdMinimumWidth = 550; final int gdHeightHint = 200; createFilterPanel(parent); group = new Group(parent, SWT.NONE); if (getTitle() != null) { group.setText(getTitle()); } GridLayout groupOrganizationLayout = new GridLayout(1, true); group.setLayout(groupOrganizationLayout); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.minimumWidth = gdMinimumWidth; gd.heightHint = gdHeightHint; group.setLayoutData(gd); scrolledComposite = new ScrolledComposite(group, SWT.V_SCROLL); scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); scrolledComposite.setExpandHorizontal(true); innerComposite = new Composite(scrolledComposite, SWT.NONE); scrolledComposite.setContent(innerComposite); innerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); innerComposite.setLayout(new GridLayout(1, false)); if (selection != null && !selection.isEmpty()) { Iterator<T> iter = selection.iterator(); while (iter.hasNext()) { preSelectedElements.add(iter.next()); } } else if (selectedElement != null) { preSelectedElements.add(selectedElement); } checkboxMap = new HashMap<T, Button>(); addCheckboxes(); }
@Override protected Control createDialogArea(Composite parent) { GridData grData = null; final ScrolledComposite scrolledContainer = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FILL); scrolledContainer.setExpandHorizontal(true); scrolledContainer.setExpandVertical(true); scrolledContainer.setAlwaysShowScrollBars(true); scrolledContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Composite container = new Composite(scrolledContainer, SWT.NONE); scrolledContainer.setContent(container); GridLayout layout = new GridLayout(); layout.numColumns = 3; container.setLayout(layout); Label lbPrefix = new Label(container, SWT.NULL); lbPrefix.setText("Name"); txtName = new Text(container, SWT.BORDER | SWT.SINGLE); grData = new GridData(GridData.FILL_HORIZONTAL); grData.horizontalSpan = 2; txtName.setLayoutData(grData); txtName.setText(name); Label lbNamespace = new Label(container, SWT.NULL); lbNamespace.setText("Value"); txtValue = new Text(container, SWT.BORDER | SWT.SINGLE); grData = new GridData(GridData.FILL_HORIZONTAL); grData.horizontalSpan = 2; txtValue.setLayoutData(grData); txtValue.setText(value); container.layout(); scrolledContainer.setSize(100, 80); container.layout(); return super.createDialogArea(scrolledContainer); }
public void createControl(Composite parent) { ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); sc.setExpandHorizontal(true); sc.setExpandVertical(true); setControl(sc); Composite comp = new Composite(sc, SWT.NONE); sc.setContent(comp); GridLayout layout = new GridLayout(); comp.setLayout(layout); Group group = new Group(comp, SWT.NONE); layout = new GridLayout(); group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); group.setText(Messages.getString("GDBJtagDebuggerTab.gdbSetupGroup_Text")); createCommandControl(group); createRemoteControl(comp); fUpdateThreadlistOnSuspend = new Button(comp, SWT.CHECK); fUpdateThreadlistOnSuspend.setText( Messages.getString("GDBJtagDebuggerTab.update_thread_list_on_suspend")); fUpdateThreadlistOnSuspend.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); // This checkbox needs an explanation. Attach context help to it. PlatformUI.getWorkbench() .getHelpSystem() .setHelp( fUpdateThreadlistOnSuspend, "org.eclipse.cdt.dsf.gdb.ui.update_threadlist_button_context"); //$NON-NLS-1$ }
private static void createEmoticonsGroup(final Composite main, String protocol) { final Group group = new Group(main, SWT.NONE); group.setLayoutData(new GridData(GridData.FILL_BOTH)); group.setText("Emoticons"); group.setLayout(new FillLayout()); emoticonsScroll = new ScrolledComposite(group, SWT.V_SCROLL); emoticonsComposite = new Composite(emoticonsScroll, SWT.NONE); emoticonsComposite.setLayout(new GridLayout(4, false)); createBoldLabel(emoticonsComposite, "Protocol:", gridData(2, 1)); createProtoCombo(emoticonsComposite, protocol, main, group); for (final Emoticon emo : mep.emoticons) { EmoticonImage icon = emo.icons.get(protocol); if (icon == null) continue; createEmoticonNameLabel(emoticonsComposite, icon); createIconCombo(emoticonsComposite, icon); createFramesHolder(emoticonsComposite, icon); } emoticonsScroll.setContent(emoticonsComposite); emoticonsScroll.setExpandHorizontal(true); emoticonsScroll.setExpandVertical(true); emoticonsScroll.addControlListener( new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = emoticonsScroll.getClientArea(); emoticonsScroll.setMinSize(emoticonsComposite.computeSize(r.width, SWT.DEFAULT)); } }); // emoticonsComposite.pack(); emoticonsScroll.setMinSize(emoticonsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, false)); }
public ECContentReal(Composite parent, int style, ECView view) { super(parent, style); this.view = view; this.setLayout(new FillLayout()); ScrolledComposite scrolledComposite = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); content = new Composite(scrolledComposite, SWT.NONE); GridLayout gridLayout = new GridLayout(2, false); gridLayout.verticalSpacing = 2; content.setLayout(gridLayout); createCompositeIntro(); createGroupCurve(); createGroupSettings(); scrolledComposite.setContent(content); scrolledComposite.setMinSize(content.computeSize(862, 664)); createGroupAttributesR(); Display.getCurrent() .asyncExec( new Runnable() { public void run() { try { Thread.sleep(10); } catch (InterruptedException e) { } updateCurve(true); } }); }
/** * Creates the inner page container. * * @param parent * @return Composite */ protected Composite createPageContainer(Composite parent) { Composite outer = new Composite(parent, SWT.NONE); GridData outerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; outer.setLayout(new GridLayout()); outer.setLayoutData(outerData); // Create an outer composite for spacing scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL); // always show the focus control scrolled.setShowFocusedControl(true); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); GridData scrolledData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); scrolled.setLayoutData(scrolledData); Composite result = new Composite(scrolled, SWT.NONE); GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); result.setLayout(getPageLayout()); result.setLayoutData(resultData); scrolled.setContent(result); return result; }
/** @wbp.parser.entryPoint */ public void showType2Document() { final Display display = Display.getDefault(); shlTypeDocument = new Shell(display); shlTypeDocument.setText("Type 2 Document"); shlTypeDocument.setSize(780, 634); shlTypeDocument.setLocation(display.getBounds().x + 200, display.getBounds().y + 100); Composite composite = new Composite(shlTypeDocument, SWT.NONE); composite.setBounds(0, 0, 759, 557); TabFolder tabFolder = new TabFolder(composite, SWT.NONE); tabFolder.setBounds(10, 10, 742, 545); TabItem tbtmText = new TabItem(tabFolder, SWT.NONE); tbtmText.setText("Text"); Group grpText = new Group(tabFolder, SWT.NONE); grpText.setText("Text"); tbtmText.setControl(grpText); // The first tab! --> Text Label lblLeadingIndentionOf = new Label(grpText, SWT.NONE); lblLeadingIndentionOf.setBounds(10, 82, 374, 15); lblLeadingIndentionOf.setText("Leading indention of other paragraph:"); text = new Text(grpText, SWT.BORDER); text.setBounds(422, 79, 76, 21); Label lblCharacters = new Label(grpText, SWT.NONE); lblCharacters.setBounds(504, 82, 85, 15); lblCharacters.setText("characters"); Label lblSpacingBetweenCharacters = new Label(grpText, SWT.NONE); lblSpacingBetweenCharacters.setBounds(10, 116, 374, 15); lblSpacingBetweenCharacters.setText("Spacing between paragraphs:"); text_1 = new Text(grpText, SWT.BORDER); text_1.setBounds(422, 113, 76, 21); Label lblLines = new Label(grpText, SWT.NONE); lblLines.setBounds(504, 116, 85, 15); lblLines.setText("lines"); Label lblstParagraph = new Label(grpText, SWT.NONE); lblstParagraph.setBounds(10, 47, 374, 15); lblstParagraph.setText("1st Paragraph:"); text_2 = new Text(grpText, SWT.BORDER); text_2.setBounds(422, 47, 76, 21); Label label_2 = new Label(grpText, SWT.NONE); label_2.setBounds(504, 47, 85, 15); label_2.setText("characters"); Label lblEstimatedAverageLengths = new Label(grpText, SWT.NONE); lblEstimatedAverageLengths.setBounds(10, 154, 374, 15); lblEstimatedAverageLengths.setText("Estimated average length(s) of a line:"); text_3 = new Text(grpText, SWT.BORDER); text_3.setBounds(422, 148, 76, 21); Label label_3 = new Label(grpText, SWT.NONE); label_3.setBounds(504, 154, 85, 15); label_3.setText("characters"); Label lblPageNumberForms = new Label(grpText, SWT.NONE); lblPageNumberForms.setBounds(10, 194, 141, 15); lblPageNumberForms.setText("Page number forms:"); text_4 = new Text(grpText, SWT.BORDER); text_4.setBounds(161, 191, 477, 21); Label lblSectionHeadings = new Label(grpText, SWT.NONE); lblSectionHeadings.setBounds(10, 237, 141, 15); lblSectionHeadings.setText("Section headings:"); Button btnCapitalized = new Button(grpText, SWT.RADIO); btnCapitalized.setBounds(169, 236, 90, 16); btnCapitalized.setText("Capitalized"); Button btnAllCapital = new Button(grpText, SWT.RADIO); btnAllCapital.setBounds(263, 237, 90, 16); btnAllCapital.setText("ALL CAPITAL"); text_5 = new Text(grpText, SWT.BORDER); text_5.setBounds(366, 231, 272, 21); Label lblFooterTokens = new Label(grpText, SWT.NONE); lblFooterTokens.setBounds(10, 283, 85, 15); lblFooterTokens.setText("Footer tokens:"); Button btnHasFooters = new Button(grpText, SWT.CHECK); btnHasFooters.setBounds(123, 282, 93, 16); btnHasFooters.setText("Has footers"); text_6 = new Text(grpText, SWT.BORDER); text_6.setBounds(222, 280, 98, 21); Label lblHeaderTokens = new Label(grpText, SWT.NONE); lblHeaderTokens.setBounds(337, 283, 85, 15); lblHeaderTokens.setText("Header tokens:"); Button btnHasHeaders = new Button(grpText, SWT.CHECK); btnHasHeaders.setBounds(428, 282, 93, 16); btnHasHeaders.setText("Has headers"); text_7 = new Text(grpText, SWT.BORDER); text_7.setBounds(523, 277, 98, 21); textBean = new TextBean( text_2, text, text_1, text_3, text_4, btnCapitalized, btnAllCapital, text_5, new SpecialBean(btnHasFooters, btnHasHeaders, text_6, text_7)); TabItem tbtmNomenclature = new TabItem(tabFolder, SWT.NONE); tbtmNomenclature.setText("Nomenclature"); Group grpNomenclature = new Group(tabFolder, SWT.NONE); grpNomenclature.setText("Nomenclature"); tbtmNomenclature.setControl(grpNomenclature); Label lblWhatIsIn = new Label(grpNomenclature, SWT.NONE); lblWhatIsIn.setBounds(10, 28, 111, 15); lblWhatIsIn.setText("What is in a name?"); Label lblFamily = new Label(grpNomenclature, SWT.NONE); lblFamily.setBounds(233, 28, 55, 15); lblFamily.setText("Family"); Label lblGenus = new Label(grpNomenclature, SWT.NONE); lblGenus.setBounds(399, 28, 55, 15); lblGenus.setText("Genus"); Label lblSpecies = new Label(grpNomenclature, SWT.NONE); lblSpecies.setBounds(569, 28, 55, 15); lblSpecies.setText("Species"); nomenScrolledComposite = new ScrolledComposite(grpNomenclature, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); nomenScrolledComposite.setBounds(10, 53, 714, 278); nomenScrolledComposite.setExpandHorizontal(true); nomenScrolledComposite.setExpandVertical(true); nomenclatureGroup = new Group(nomenScrolledComposite, SWT.NONE); nomenclatureGroup.setLayoutData(new RowData()); Label lblName = new Label(nomenclatureGroup, SWT.NONE); lblName.setBounds(10, 20, 75, 15); lblName.setText("Name"); Group group_2 = new Group(nomenclatureGroup, SWT.NONE); group_2.setBounds(100, 10, 182, 40); Button button = new Button(group_2, SWT.RADIO); button.setText("Yes"); button.setBounds(10, 13, 39, 16); Button button_1 = new Button(group_2, SWT.RADIO); button_1.setText("No"); button_1.setBounds(55, 13, 39, 16); text_14 = new Text(group_2, SWT.BORDER); text_14.setBounds(100, 11, 76, 21); nomenclatures.put( new Integer(nomenCount), new NomenclatureBean(group_2, button, button_1, text_14, lblName)); nomenCount++; Group group_1 = new Group(nomenclatureGroup, SWT.NONE); group_1.setBounds(300, 10, 182, 40); Button button_2 = new Button(group_1, SWT.RADIO); button_2.setText("Yes"); button_2.setBounds(10, 13, 39, 16); Button button_3 = new Button(group_1, SWT.RADIO); button_3.setText("No"); button_3.setBounds(55, 13, 39, 16); text_15 = new Text(group_1, SWT.BORDER); text_15.setBounds(100, 11, 76, 21); nomenclatures.put( new Integer(nomenCount), new NomenclatureBean(group_1, button_2, button_3, text_15, lblName)); nomenCount++; /////////////// Group group_4 = new Group(nomenclatureGroup, SWT.NONE); group_4.setBounds(500, 10, 182, 40); Button button_4 = new Button(group_4, SWT.RADIO); button_4.setText("Yes"); button_4.setBounds(10, 13, 39, 16); Button button_5 = new Button(group_4, SWT.RADIO); button_5.setText("No"); button_5.setBounds(55, 13, 39, 16); text_16 = new Text(group_4, SWT.BORDER); text_16.setBounds(100, 11, 76, 21); nomenclatures.put( new Integer(nomenCount), new NomenclatureBean(group_4, button_4, button_5, text_16, lblName)); nomenCount++; String[] nomenclatureArray = {"Authors", "Date", "Publication", "Taxon Rank"}; for (String name : nomenclatureArray) { addNomenclatureRow(name); } nomenScrolledComposite.setContent(nomenclatureGroup); // When you add a row, reset the size of scrolledComposite nomenScrolledComposite.setMinSize(nomenclatureGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Button btnAddARow = new Button(grpNomenclature, SWT.NONE); btnAddARow.setBounds(10, 337, 75, 25); btnAddARow.setText("Add a Row"); btnAddARow.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { identifier = null; showInputBox(); if (identifier != null && !identifier.equals("")) { addNomenclatureRow(identifier); } } }); TabItem tbtmExpressions = new TabItem(tabFolder, SWT.NONE); tbtmExpressions.setText("Expressions"); Group grpExpressionsUsedIn = new Group(tabFolder, SWT.NONE); grpExpressionsUsedIn.setText("Expressions used in Nomenclature"); tbtmExpressions.setControl(grpExpressionsUsedIn); Label lblUseCapLetters = new Label(grpExpressionsUsedIn, SWT.NONE); lblUseCapLetters.setBounds(10, 22, 426, 15); lblUseCapLetters.setText("Use CAP words for fixed tokens; use small letters for variables"); Label lblHononyms = new Label(grpExpressionsUsedIn, SWT.NONE); lblHononyms.setBounds(348, 22, 99, 15); lblHononyms.setText("Hononyms:"); expScrolledComposite = new ScrolledComposite(grpExpressionsUsedIn, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); expScrolledComposite.setBounds(10, 43, 714, 440); expScrolledComposite.setExpandHorizontal(true); expScrolledComposite.setExpandVertical(true); expressionGroup = new Group(expScrolledComposite, SWT.NONE); expressionGroup.setLayoutData(new RowData()); // count of number of rows expCount = 0; Label lblSpecialTokensUsed = new Label(expressionGroup, SWT.NONE); lblSpecialTokensUsed.setBounds(10, 20, 120, 15); lblSpecialTokensUsed.setText("Special tokens used:"); text_29 = new Text(expressionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); text_29.setBounds(135, 20, 550, 70); expressions.put(new Integer(expCount), new ExpressionBean(lblSpecialTokensUsed, text_29)); expCount++; String[] expressionArray = {"Minor Amendment:", "Past name:", "Name origin:", "Homonyms:"}; for (String name : expressionArray) { addExpressionRow(name); } expScrolledComposite.setContent(expressionGroup); expScrolledComposite.setMinSize(expressionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Button btnAddARow_2 = new Button(grpExpressionsUsedIn, SWT.NONE); btnAddARow_2.setBounds(10, 489, 75, 25); btnAddARow_2.setText("Add a row"); btnAddARow_2.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { identifier = null; showInputBox(); if (identifier != null && !identifier.equals("")) { addExpressionRow(identifier); } } }); TabItem tbtmDescription = new TabItem(tabFolder, SWT.NONE); tbtmDescription.setText("Description"); Group grpMorphologicalDescriptions = new Group(tabFolder, SWT.NONE); tbtmDescription.setControl(grpMorphologicalDescriptions); Label lblAllInOne = new Label(grpMorphologicalDescriptions, SWT.NONE); lblAllInOne.setBounds(10, 53, 160, 15); lblAllInOne.setText("All in one paragraph"); Button btnYes = new Button(grpMorphologicalDescriptions, SWT.RADIO); btnYes.setBounds(241, 52, 90, 16); btnYes.setText("Yes"); Button btnNo = new Button(grpMorphologicalDescriptions, SWT.RADIO); btnNo.setBounds(378, 52, 90, 16); btnNo.setText("No"); Label lblOtherInformationMay = new Label(grpMorphologicalDescriptions, SWT.NONE); lblOtherInformationMay.setBounds(10, 85, 438, 15); lblOtherInformationMay.setText( "Other information may also be included in a description paragraph:"); Combo combo = new Combo(grpMorphologicalDescriptions, SWT.NONE); combo.setItems(new String[] {"Nomenclature", "Habitat", "Distribution", "Discussion", "Other"}); combo.setBounds(496, 82, 177, 23); descriptionBean = new DescriptionBean(btnYes, btnNo, combo, sections); Label lblMorphological = new Label(grpMorphologicalDescriptions, SWT.NONE); lblMorphological.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblMorphological.setBounds(10, 25, 242, 15); lblMorphological.setText("Morphological Descriptions: "); Label lblOrder = new Label(grpMorphologicalDescriptions, SWT.NONE); lblOrder.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblOrder.setBounds(22, 142, 55, 15); lblOrder.setText("Order"); Label lblSection = new Label(grpMorphologicalDescriptions, SWT.NONE); lblSection.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblSection.setBounds(140, 142, 55, 15); lblSection.setText("Section"); Label lblStartTokens = new Label(grpMorphologicalDescriptions, SWT.NONE); lblStartTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblStartTokens.setBounds(285, 142, 90, 15); lblStartTokens.setText("Start tokens"); Label lblEndTokens = new Label(grpMorphologicalDescriptions, SWT.NONE); lblEndTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblEndTokens.setBounds(443, 142, 68, 15); lblEndTokens.setText("End tokens"); Label lblEmbeddedTokens = new Label(grpMorphologicalDescriptions, SWT.NONE); lblEmbeddedTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblEmbeddedTokens.setBounds(592, 142, 132, 15); lblEmbeddedTokens.setText("Embedded tokens"); descScrolledComposite = new ScrolledComposite( grpMorphologicalDescriptions, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); descScrolledComposite.setBounds(10, 169, 714, 310); descScrolledComposite.setExpandHorizontal(true); descScrolledComposite.setExpandVertical(true); descriptionGroup = new Group(descScrolledComposite, SWT.NONE); descriptionGroup.setLayoutData(new RowData()); text_33 = new Text(descriptionGroup, SWT.BORDER); text_33.setBounds(10, 20, 75, 20); Label lblNomenclature = new Label(descriptionGroup, SWT.NONE); lblNomenclature.setBounds(120, 20, 145, 20); lblNomenclature.setText("Nomenclature"); text_40 = new Text(descriptionGroup, SWT.BORDER); text_40.setBounds(270, 20, 115, 20); text_41 = new Text(descriptionGroup, SWT.BORDER); text_41.setBounds(420, 20, 115, 20); text_42 = new Text(descriptionGroup, SWT.BORDER); text_42.setBounds(570, 20, 115, 20); sections.put( new Integer(secCount), new SectionBean(text_33, lblNomenclature, text_40, text_41, text_42)); secCount++; String[] sectionArray = { "Morph. description", "Habitat", "Distribution", "Discussion", "Keys", "References" }; for (String name : sectionArray) { addDescriptionRow(name); } descScrolledComposite.setContent(descriptionGroup); descScrolledComposite.setMinSize(descriptionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Button btnAddARow_1 = new Button(grpMorphologicalDescriptions, SWT.NONE); btnAddARow_1.setBounds(10, 482, 75, 25); btnAddARow_1.setText("Add a row"); btnAddARow_1.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { identifier = null; showInputBox(); if (identifier != null && !identifier.equals("")) { addDescriptionRow(identifier); } } }); Label lblSectionIndicationsAnd = new Label(grpMorphologicalDescriptions, SWT.NONE); lblSectionIndicationsAnd.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblSectionIndicationsAnd.setBounds(10, 116, 222, 15); lblSectionIndicationsAnd.setText("Section indications and order:"); TabItem tbtmSpecial = new TabItem(tabFolder, SWT.NONE); tbtmSpecial.setText("Special"); Group grpSpecialSections = new Group(tabFolder, SWT.NONE); grpSpecialSections.setText("Special Sections"); tbtmSpecial.setControl(grpSpecialSections); Label lblGlossaries = new Label(grpSpecialSections, SWT.NONE); lblGlossaries.setBounds(10, 51, 55, 15); lblGlossaries.setText("Glossaries:"); Button btnHasGlossaries = new Button(grpSpecialSections, SWT.CHECK); btnHasGlossaries.setBounds(96, 51, 93, 16); btnHasGlossaries.setText("has glossaries"); Label lblGlossaryHeading = new Label(grpSpecialSections, SWT.NONE); lblGlossaryHeading.setBounds(257, 51, 93, 15); lblGlossaryHeading.setText("Glossary heading"); text_9 = new Text(grpSpecialSections, SWT.BORDER); text_9.setBounds(377, 48, 76, 21); Label lblReferences = new Label(grpSpecialSections, SWT.NONE); lblReferences.setBounds(10, 102, 69, 15); lblReferences.setText("References :"); Button btnHasReferences = new Button(grpSpecialSections, SWT.CHECK); btnHasReferences.setBounds(96, 102, 93, 16); btnHasReferences.setText("has references"); Label lblReferencesHeading = new Label(grpSpecialSections, SWT.NONE); lblReferencesHeading.setBounds(257, 102, 114, 15); lblReferencesHeading.setText("References heading:"); text_10 = new Text(grpSpecialSections, SWT.BORDER); text_10.setBounds(377, 99, 76, 21); special = new SpecialBean(btnHasGlossaries, btnHasReferences, text_9, text_10); TabItem tbtmAbbreviations = new TabItem(tabFolder, SWT.NONE); tbtmAbbreviations.setText("Abbreviations"); Group grpAbbreviationsUsedIn = new Group(tabFolder, SWT.NONE); tbtmAbbreviations.setControl(grpAbbreviationsUsedIn); text_11 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); text_11.setBounds(10, 52, 691, 69); abbreviations.put("Text", text_11); Label lblAbbreviationsUsedIn = new Label(grpAbbreviationsUsedIn, SWT.NONE); lblAbbreviationsUsedIn.setBounds(10, 31, 272, 15); lblAbbreviationsUsedIn.setText("Abbreviations used in text:"); Label lblAbbreviationsUsedIn_1 = new Label(grpAbbreviationsUsedIn, SWT.NONE); lblAbbreviationsUsedIn_1.setBounds(10, 150, 272, 15); lblAbbreviationsUsedIn_1.setText("Abbreviations used in bibliographical citations:"); text_12 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); text_12.setBounds(10, 175, 691, 69); abbreviations.put("Bibliographical Citations", text_12); Label lblAbbreviationsUsedIn_2 = new Label(grpAbbreviationsUsedIn, SWT.NONE); lblAbbreviationsUsedIn_2.setBounds(10, 275, 272, 15); lblAbbreviationsUsedIn_2.setText("Abbreviations used in authorities:"); text_13 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); text_13.setBounds(10, 296, 691, 69); abbreviations.put("Authorities", text_13); Label lblAbbreviationsUsedIn_3 = new Label(grpAbbreviationsUsedIn, SWT.NONE); lblAbbreviationsUsedIn_3.setBounds(10, 395, 204, 15); lblAbbreviationsUsedIn_3.setText("Abbreviations used in others:"); text_8 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI); text_8.setBounds(10, 416, 691, 69); abbreviations.put("Others", text_8); final Type2Bean bean = new Type2Bean( textBean, nomenclatures, expressions, descriptionBean, special, abbreviations); Button btnSave = new Button(shlTypeDocument, SWT.NONE); btnSave.setBounds(670, 563, 75, 25); btnSave.setText("Save"); btnSave.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { if (configDb.saveType2Details(bean)) { ApplicationUtilities.showPopUpWindow( ApplicationUtilities.getProperty("popup.info.savetype3"), ApplicationUtilities.getProperty("popup.header.info"), SWT.ICON_INFORMATION); shlTypeDocument.dispose(); } } catch (SQLException exe) { } } }); /* Load previously saved details here */ try { configDb.retrieveType2Details(bean, this); } catch (SQLException exe) { exe.printStackTrace(); } shlTypeDocument.open(); shlTypeDocument.layout(); while (!shlTypeDocument.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
/** * @param composite * @return */ private Composite createLiteralsConfigurationComposite(final Composite composite) { final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL); scrolledComposite.setLayout(new FillLayout()); final Composite typeComposite = new Composite(scrolledComposite, SWT.NONE); typeComposite.setLayout(new GridLayout(1, false)); DynamicAddRemoveLineComposite literalsComposite = new DynamicAddRemoveLineComposite(typeComposite, SWT.NONE) { @Override protected void lineRemoved(int i) { literals.remove(i); getShell().pack(true); getShell().layout(true, true); scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolledComposite.setAlwaysShowScrollBars(false); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setContent(typeComposite); getContainer().updateButtons(); } @Override protected void lineAdded(int i) { getShell().pack(true); getShell().layout(true, true); scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolledComposite.setAlwaysShowScrollBars(false); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setContent(typeComposite); if (getContainer().getCurrentPage() != null) { getContainer().updateButtons(); } } @Override protected Button createAddButton(Composite parent) { Button button = new Button(parent, SWT.FLAT); button.setText(Messages.addALiteral); return button; } @Override protected TabbedPropertySheetWidgetFactory getWidgetFactory() { return null; } @Override protected Composite getTopComposite() { return scrolledComposite; } @SuppressWarnings("restriction") @Override protected Control createLineComposite(Composite parent, Object object) { SimulationLiteral literal; if (object == null) { literal = SimulationFactory.eINSTANCE.createSimulationLiteral(); literals.add(literal); } else { literal = (SimulationLiteral) object; } Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(4, false)); Label literalLabel = new Label(composite, SWT.NONE); literalLabel.setText(Messages.dataNameLabel); Text literalText = new Text(composite, SWT.BORDER); literalText.setLayoutData( GridDataFactory.swtDefaults() .align(SWT.FILL, SWT.CENTER) .grab(false, false) .hint(200, SWT.DEFAULT) .create()); // literalText.addModifyListener(updateButtonModifyListener) ; Label probaLabel = new Label(composite, SWT.NONE); probaLabel.setText(Messages.AddSimulationDataWizardPage_probability); Text probaText = new Text(composite, SWT.BORDER); probaText.setLayoutData( GridDataFactory.swtDefaults() .align(SWT.FILL, SWT.CENTER) .grab(false, false) .hint(60, SWT.DEFAULT) .create()); // ControlDecoration controlDecoration = new ControlDecoration(probaText, // SWT.LEFT|SWT.TOP); // FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault() // .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR); // controlDecoration.setImage(fieldDecoration.getImage()); // controlDecoration.setDescriptionText(Messages.mustBeAPercentage); context.bindValue( SWTObservables.observeText(literalText, SWT.Modify), EMFObservables.observeValue( literal, SimulationPackage.Literals.SIMULATION_LITERAL__VALUE)); UpdateValueStrategy targetToModel = new UpdateValueStrategy(); targetToModel.setConverter( StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true)); targetToModel.setAfterGetValidator( new ProbabilityValidator( new StringToDoubleValidator( StringToNumberConverter.toDouble( BonitaNumberFormat.getPercentInstance(), false)))); Binding provider = context.bindValue( SWTObservables.observeText(probaText, SWT.Modify), EMFObservables.observeValue( literal, SimulationPackage.Literals.SIMULATION_LITERAL__PROBABILITY), targetToModel, new UpdateValueStrategy() .setConverter( NumberToStringConverter.fromDouble( BonitaNumberFormat.getPercentInstance(), false))); ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT); probaText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { if (getContainer().getCurrentPage() != null) { getContainer().updateButtons(); } } }); return composite; } }; for (SimulationLiteral literal : literals) { literalsComposite.addLine(literal); } literalsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolledComposite.setAlwaysShowScrollBars(false); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); scrolledComposite.setContent(typeComposite); return scrolledComposite; }