List of usage examples for org.eclipse.swt.widgets Composite Composite
public Composite(Composite parent, int style)
From source file:tools.descartes.bungee.viewer.RunResultView.java
@Override public void createPartControl(final Composite parent) { VerifyListener numberVerifier = new VerifyListener() { @Override/*from ww w.ja va 2 s. c om*/ public void verifyText(VerifyEvent event) { switch (event.keyCode) { case SWT.BS: // Backspace case SWT.DEL: // Delete case SWT.HOME: // Home case SWT.END: // End case SWT.ARROW_LEFT: // Left arrow case SWT.ARROW_RIGHT: // Right arrow return; } if (!Character.isDigit(event.character)) { event.doit = false; // disallow the action } } }; Composite composite = new Composite(parent, SWT.NONE); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; Composite compositeChecks1 = new Composite(composite, SWT.NONE); compositeChecks1.setLayout(new GridLayout(2, false)); Text sanityText = new Text(compositeChecks1, SWT.NONE); sanityText.setText("Passed Sanity Check:"); sanityCheckValue = new Button(compositeChecks1, SWT.CHECK); sanityCheckValue.setEnabled(false); Composite compositeSChecks2 = new Composite(composite, SWT.NONE); compositeSChecks2.setLayout(new GridLayout(2, false)); Text scheduleText = new Text(compositeSChecks2, SWT.NONE); scheduleText.setText("Passed Schedule Check:"); scheduleCheckValue = new Button(compositeSChecks2, SWT.CHECK); scheduleCheckValue.setEnabled(false); Text completedText = new Text(compositeChecks1, SWT.NONE); completedText.setText("Run completed:"); completedCheckValue = new Button(compositeChecks1, SWT.CHECK); completedCheckValue.setEnabled(false); Text successText = new Text(compositeSChecks2, SWT.NONE); successText.setText("Run successful:"); successCheckValue = new Button(compositeSChecks2, SWT.CHECK); successCheckValue.setEnabled(false); Text timingMeanText = new Text(composite, SWT.NONE); timingMeanText.setText("Schedule deviation mean: "); timingMeanValue = new Text(composite, SWT.SINGLE); timingMeanValue.setText(""); Text timingStdText = new Text(composite, SWT.NONE); timingStdText.setText("Schedule deviation std: "); timingStdValue = new Text(composite, SWT.SINGLE); timingStdValue.setText(""); Text responseTimeMeanText = new Text(composite, SWT.NONE); responseTimeMeanText.setText("Responsetime mean: "); responseTimeMeanValue = new Text(composite, SWT.SINGLE); responseTimeMeanValue.setText(""); Text responseTimeStdText = new Text(composite, SWT.NONE); responseTimeStdText.setText("Responsetime std: "); responseTimeStdValue = new Text(composite, SWT.SINGLE); responseTimeStdValue.setText(""); Text chartWidthText = new Text(composite, SWT.NONE); chartWidthText.setText("Chart width: "); final Text chartWidthValue = new Text(composite, SWT.BORDER); chartWidthValue.setText("800"); chartWidthValue.addVerifyListener(numberVerifier); Text chartHeightText = new Text(composite, SWT.NONE); chartHeightText.setText("Chart height: "); final Text chartHeightValue = new Text(composite, SWT.BORDER); chartHeightValue.setText("400"); chartHeightValue.addVerifyListener(numberVerifier); showScheduleChartButton = new Button(composite, SWT.NONE); showScheduleChartButton.setText("Show Schedule Chart"); showScheduleChartButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: showScheduleChart(Integer.parseInt(chartWidthValue.getText()), Integer.parseInt(chartHeightValue.getText())); break; } } }); saveScheduleChartButton = new Button(composite, SWT.NONE); saveScheduleChartButton.setText("Save Schedule Chart"); saveScheduleChartButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { // optional window Display display = Display.getDefault(); Shell dialogShell = new Shell(display, SWT.APPLICATION_MODAL); MessageBox dialog = new MessageBox(dialogShell, SWT.ICON_WARNING | SWT.OK); dialog.setText("Licence Problem"); dialog.setMessage( "This feature is currently disabled! \n If you want to reenable it, check out the code."); dialog.open(); // end of optional window switch (e.type) { case SWT.Selection: saveScheduleChart(Integer.parseInt(chartWidthValue.getText()), Integer.parseInt(chartHeightValue.getText())); break; } } }); showResponseChartButton = new Button(composite, SWT.NONE); showResponseChartButton.setText("Show Response Chart"); showResponseChartButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: showResponseChart(Integer.parseInt(chartWidthValue.getText()), Integer.parseInt(chartHeightValue.getText())); break; } } }); saveResponseChartButton = new Button(composite, SWT.NONE); saveResponseChartButton.setText("Save Response Chart"); saveResponseChartButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { // optional window Display display = Display.getDefault(); Shell dialogShell = new Shell(display, SWT.APPLICATION_MODAL); MessageBox dialog = new MessageBox(dialogShell, SWT.ICON_WARNING | SWT.OK); dialog.setText("Licence problem"); dialog.setMessage( "This feature is currently disabled! \n If you want to reenable it, check out the code."); dialog.open(); // end of optional window switch (e.type) { case SWT.Selection: saveResponseChart(Integer.parseInt(chartWidthValue.getText()), Integer.parseInt(chartHeightValue.getText())); break; } } }); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); composite.setLayout(new GridLayout(2, false)); this.parent = parent; }
From source file:ReservationData.java
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.NULL).setText("Credit card type: "); comboCreditCardTypes = new Combo(composite, SWT.READ_ONLY | SWT.BORDER); comboCreditCardTypes.add("American Express"); comboCreditCardTypes.add("Master Card"); comboCreditCardTypes.add("Visa"); comboCreditCardTypes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.NULL).setText("Credit card number: "); textCreditCardNumber = new Text(composite, SWT.SINGLE | SWT.BORDER); textCreditCardNumber.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.NULL).setText("Expiration (MM/YY)"); textCreditCardExpiration = new Text(composite, SWT.SINGLE | SWT.BORDER); textCreditCardExpiration.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); comboCreditCardTypes.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { ((ReservationWizard) getWizard()).data.creditCardType = comboCreditCardTypes.getSelectionIndex(); if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true);/*from w w w . j a va2 s. co m*/ else setPageComplete(false); } }); textCreditCardNumber.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { ((ReservationWizard) getWizard()).data.creditCardNumber = textCreditCardNumber.getText(); if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true); else setPageComplete(false); } }); textCreditCardExpiration.addListener(SWT.Modify, new Listener() { public void handleEvent(Event event) { String text = textCreditCardExpiration.getText().trim(); if (text.length() == 5 && text.charAt(2) == '/') { ((ReservationWizard) getWizard()).data.creditCardExpiration = text; setErrorMessage(null); } else { ((ReservationWizard) getWizard()).data.creditCardExpiration = null; setErrorMessage("Invalid expiration date: " + text); } if (((ReservationWizard) getWizard()).data.creditCardNumber != null && ((ReservationWizard) getWizard()).data.creditCardExpiration != null) setPageComplete(true); else setPageComplete(false); } }); setControl(composite); }
From source file:net.sf.smbt.ui.btc.views.AbstractBlockchainView.java
@Override public void createPartControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FillLayout()); addCharts(container);/*from www .j av a 2 s . c om*/ }
From source file:GraphicsExample.java
void createTabPanel(Composite parent) { tabPanel = new Composite(parent, SWT.NONE); GridData data;//w w w .j a v a2 s . c om GridLayout layout = new GridLayout(1, false); layout.marginHeight = layout.marginWidth = 0; tabPanel.setLayout(layout); createCanvas(tabPanel); createControlPanel(tabPanel); data = new GridData(SWT.FILL, SWT.FILL, true, true); canvas.setLayoutData(data); data = new GridData(SWT.FILL, SWT.CENTER, true, false); controlPanel.setLayoutData(data); }
From source file:org.locationtech.udig.processingtoolbox.tools.BubbleChartDialog.java
private void createInputTab(final CTabFolder parentTabFolder) { inputTab = new CTabItem(parentTabFolder, SWT.NONE); inputTab.setText(Messages.ProcessExecutionDialog_tabparameters); ScrolledComposite scroller = new ScrolledComposite(parentTabFolder, SWT.NONE | SWT.V_SCROLL | SWT.H_SCROLL); scroller.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite container = new Composite(scroller, SWT.NONE); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // local moran's i Image image = ToolboxPlugin.getImageDescriptor("icons/public_co.gif").createImage(); //$NON-NLS-1$ uiBuilder.createLabel(container, Messages.ScatterPlotDialog_InputLayer, EMPTY, image, 1); cboLayer = uiBuilder.createCombo(container, 1, true); fillLayers(map, cboLayer, VectorLayerType.ALL); uiBuilder.createLabel(container, Messages.BubbleChartDialog_XField, EMPTY, image, 1); cboXField = uiBuilder.createCombo(container, 1, true); uiBuilder.createLabel(container, Messages.BubbleChartDialog_YField, EMPTY, image, 1); cboYField = uiBuilder.createCombo(container, 1, true); uiBuilder.createLabel(container, Messages.BubbleChartDialog_SizeField, EMPTY, image, 1); cboSize = uiBuilder.createCombo(container, 1, true); uiBuilder.createLabel(container, null, null, 1); chkStatistics = uiBuilder.createCheckbox(container, Messages.ScatterPlotDialog_BasicStatistics, null, 1); // register events cboLayer.addModifyListener(new ModifyListener() { @Override/*from www . ja v a2 s.c om*/ public void modifyText(ModifyEvent e) { inputLayer = MapUtils.getLayer(map, cboLayer.getText()); if (inputLayer != null) { fillFields(cboXField, inputLayer.getSchema(), FieldType.Number); fillFields(cboYField, inputLayer.getSchema(), FieldType.Number); fillFields(cboSize, inputLayer.getSchema(), FieldType.Number); } } }); // finally scroller.setContent(container); inputTab.setControl(scroller); scroller.setMinSize(450, container.getSize().y - 2); scroller.setExpandVertical(true); scroller.setExpandHorizontal(true); scroller.pack(); container.pack(); }
From source file:edu.isistan.carcha.plugin.editors.DXMIEditor.java
/** * Creates the PieChart page.// w w w . j av a 2 s. c om */ void createPieChartPage() { result = new DefaultPieDataset(); JFreeChart chart = ChartFactory.createPieChart("Design Decisions", result, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); new ChartComposite(composite, SWT.NONE, chart, true); int index = addPage(composite); setPageText(index, "Graph"); }
From source file:at.ac.tuwien.inso.subcat.ui.widgets.DistributionView.java
public DistributionView(Composite parent, int style) { super(parent, style); listeners = new LinkedList<DistributionViewListener>(); identifiers = new LinkedList<ChartIdentifier>(); initCharts();//from w w w .j a va 2 s. co m setLayout(new FillLayout()); SashForm sashForm = new SashForm(this, SWT.VERTICAL); timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER); timeChart.addChartSelectionEntry("Distribution View", SelectedChart.DISTRIBUTION); timeChart.addChartSelectionEntry("Bar View", SelectedChart.SIZE); timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH); JFreeChart chart = createChart(SelectedChart.DISTRIBUTION); setChart(chart); scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setLayout(new FillLayout()); optionComposite = new Composite(scrolledComposite, SWT.NONE); optionComposite.setLayout(new GridLayout(3, false)); scrolledComposite.setContent(optionComposite); scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolledComposite.setExpandVertical(true); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setAlwaysShowScrollBars(false); configSelectionListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Combo combo = (Combo) e.getSource(); ChartIdentifier identifier = (ChartIdentifier) combo.getData("identifier"); assert (identifier != null); for (DistributionViewListener listener : listeners) { listener.optionChanged(identifier); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }; }
From source file:at.ac.tuwien.inso.subcat.ui.widgets.DistributionChart.java
public DistributionChart(Composite parent, int style) { super(parent, style); listeners = new LinkedList<DistributionChartListener>(); identifiers = new LinkedList<ChartIdentifier>(); initCharts();/*from w w w . j a va 2s .c om*/ setLayout(new FillLayout()); SashForm sashForm = new SashForm(this, SWT.VERTICAL); timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER); timeChart.addChartSelectionEntry("Distribution View", SelectedChart.DISTRIBUTION); timeChart.addChartSelectionEntry("Bar View", SelectedChart.SIZE); timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH); JFreeChart chart = createChart(SelectedChart.DISTRIBUTION); setChart(chart); scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); scrolledComposite.setLayout(new FillLayout()); optionComposite = new Composite(scrolledComposite, SWT.NONE); optionComposite.setLayout(new GridLayout(3, false)); scrolledComposite.setContent(optionComposite); scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolledComposite.setExpandVertical(true); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setAlwaysShowScrollBars(false); configSelectionListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Combo combo = (Combo) e.getSource(); ChartIdentifier identifier = (ChartIdentifier) combo.getData("identifier"); assert (identifier != null); for (DistributionChartListener listener : listeners) { listener.optionChanged(identifier); } } @Override public void widgetDefaultSelected(SelectionEvent e) { } }; }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * {@inheritDoc}/*from w ww .ja va 2 s . c om*/ * * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { super.createPartControl(parent); // set up the main layout GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; layout.marginHeight = 0; parent.setLayout(layout); // the label mLabelDesc = new Label(parent, SWT.NONE); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; mLabelDesc.setLayoutData(gridData); // the main section mMainSection = new Composite(parent, SWT.NONE); mStackLayout = new StackLayout(); mStackLayout.marginHeight = 0; mStackLayout.marginWidth = 0; mMainSection.setLayout(mStackLayout); mMainSection.setLayoutData(new GridData(GridData.FILL_BOTH)); // create the master viewer mMasterComposite = createMasterView(mMainSection); // create the detail viewer mDetailViewer = createDetailView(mMainSection); mStackLayout.topControl = mMasterComposite; updateActions(); // initialize the view data refresh(); }
From source file:au.gov.ansto.bragg.kakadu.ui.plot.FitPlotPropertiesComposite.java
private void initialise() { GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2;//from ww w .j a v a 2 s . c om gridLayout.marginHeight = 3; gridLayout.marginWidth = 3; gridLayout.horizontalSpacing = 3; gridLayout.verticalSpacing = 3; setLayout(gridLayout); fitEnabledButton = new Button(this, SWT.CHECK); fitEnabledButton.setText("Fitting Enabled"); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.horizontalSpan = 2; data.grabExcessHorizontalSpace = true; fitEnabledButton.setLayoutData(data); fitFunctionCombo = new Combo(this, SWT.READ_ONLY); fitFunctionCombo.setEnabled(false); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.verticalIndent = 3; data.grabExcessHorizontalSpace = true; fitFunctionCombo.setLayoutData(data); // inverseLabel = new Label(this, SWT.NONE); // inverseLabel.setText("inverse function"); // data = new GridData (); // data.verticalAlignment = GridData.BEGINNING; // data.verticalIndent = 3; // inverseLabel.setLayoutData(data); // inverseLabel.setEnabled(false); inverseButton = new Button(this, SWT.CHECK); inverseButton.setText("Inverted Model"); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalIndent = 3; data.grabExcessHorizontalSpace = true; inverseButton.setLayoutData(data); inverseButton.setEnabled(false); // fitFunctionCombo.setLayoutData (data); Composite xComposite = new Composite(this, SWT.NULL); gridLayout = new GridLayout(); gridLayout.numColumns = 4; // gridLayout.marginHeight = 3; gridLayout.marginWidth = 0; // gridLayout.horizontalSpacing = 3; // gridLayout.verticalSpacing = 3; xComposite.setLayout(gridLayout); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; data.grabExcessHorizontalSpace = true; xComposite.setLayoutData(data); minXButton = new Button(xComposite, SWT.TOGGLE); minXButton.setText("X min"); minXButton.setToolTipText("Click to enable grabing a point from the plot as the beginning of fitting data"); data = new GridData(); // data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; // data.grabExcessHorizontalSpace = true; // data.grabExcessVerticalSpace = true; minXButton.setLayoutData(data); minXButton.setEnabled(false); minXText = new Text(xComposite, SWT.BORDER); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.grabExcessHorizontalSpace = true; // data.grabExcessVerticalSpace = true; minXText.setLayoutData(data); minXText.setEnabled(false); maxXButton = new Button(xComposite, SWT.TOGGLE); maxXButton.setText("X max"); maxXButton.setToolTipText("Click to enable grabing a point from the plot as the end of fitting data"); data = new GridData(); // data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; // data.grabExcessHorizontalSpace = true; // data.grabExcessVerticalSpace = true; maxXButton.setLayoutData(data); maxXButton.setEnabled(false); maxXText = new Text(xComposite, SWT.BORDER); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.grabExcessHorizontalSpace = true; // data.grabExcessVerticalSpace = true; maxXText.setLayoutData(data); maxXText.setEnabled(false); doFitButton = new Button(this, SWT.PUSH); doFitButton.setText("Fit"); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.grabExcessHorizontalSpace = true; // data.grabExcessVerticalSpace = true; doFitButton.setLayoutData(data); doFitButton.setEnabled(false); resetButton = new Button(this, SWT.PUSH); resetButton.setText("Reset"); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.BEGINNING; data.grabExcessHorizontalSpace = true; resetButton.setLayoutData(data); resetButton.setEnabled(false); parameterGroup = new Group(this, SWT.NONE); parameterGroup.setText("Parameters"); GridLayout propertiesGridLayout = new GridLayout(); propertiesGridLayout.numColumns = 2; propertiesGridLayout.marginHeight = 3; propertiesGridLayout.marginWidth = 3; propertiesGridLayout.horizontalSpacing = 3; propertiesGridLayout.verticalSpacing = 3; parameterGroup.setLayout(propertiesGridLayout); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; data.grabExcessHorizontalSpace = true; data.verticalAlignment = GridData.BEGINNING; parameterGroup.setLayoutData(data); }