List of usage examples for org.eclipse.swt.widgets Composite setLayoutData
public void setLayoutData(Object layoutData)
From source file:org.eclipse.swt.examples.ole.win32.OLEExample.java
public void open(Display display) { Shell shell = new Shell(display); shell.setText("OLE Example"); shell.setLayout(new FillLayout()); Composite parent = new Composite(shell, SWT.NONE); parent.setLayout(new GridLayout(4, true)); Composite buttons = new Composite(parent, SWT.NONE); buttons.setLayout(new GridLayout()); GridData gridData = new GridData(SWT.BEGINNING, SWT.FILL, false, false); buttons.setLayoutData(gridData); Composite displayArea = new Composite(parent, SWT.BORDER); displayArea.setLayout(new FillLayout()); displayArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); Button excelButton = new Button(buttons, SWT.RADIO); excelButton.setText("New Excel Sheet"); excelButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) newClientSite("Excel.Sheet"); }));// w ww . j a va 2 s. c om Button mediaPlayerButton = new Button(buttons, SWT.RADIO); mediaPlayerButton.setText("New MPlayer"); mediaPlayerButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) newClientSite("MPlayer"); })); Button powerPointButton = new Button(buttons, SWT.RADIO); powerPointButton.setText("New PowerPoint Slide"); powerPointButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) newClientSite("PowerPoint.Slide"); })); Button wordButton = new Button(buttons, SWT.RADIO); wordButton.setText("New Word Document"); wordButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) newClientSite("Word.Document"); })); new Label(buttons, SWT.NONE); Button openButton = new Button(buttons, SWT.RADIO); openButton.setText("Open file..."); openButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) fileOpen(); })); new Label(buttons, SWT.NONE); closeButton = new Button(buttons, SWT.RADIO); closeButton.setText("Close file"); closeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { if (((Button) e.widget).getSelection()) disposeClient(); })); closeButton.setSelection(true); oleFrame = new OleFrame(displayArea, SWT.NONE); addFileMenu(oleFrame); shell.setSize(800, 600); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
From source file:grafici.StatistichePieChart.java
/** * Default constructor./*from www . j a v a 2s .c o m*/ * * @param title the frame title. */ public StatistichePieChart(Table result, Composite parent, int style, int indexVariabile, int indexValore) { super(parent, style); try { titolo = result.getColumn(indexVariabile).getText().toUpperCase() + " - " + result.getColumn(indexValore).getText().toUpperCase(); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); JPanel chartPanel = createDemoPanel(result, indexVariabile, indexValore); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); } catch (Exception e) { alertGraficoNonDisp(); } }
From source file:grafici.PazientiTimeSeriesChart.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title.//from w w w . j a va 2s.c o m */ public PazientiTimeSeriesChart(String title, Composite parent, int style, int tipo) { super(parent, style); Label titolo = new Label(this, SWT.NONE); titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD)); titolo.setText(title); GridData gdLbl = new GridData(SWT.FILL); titolo.setLayoutData(gdLbl); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); JPanel chartPanel = createDemoPanel(tipo); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); }
From source file:tools.descartes.bungee.viewer.DemandView.java
@Override public void createPartControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); Composite chartParent = new Composite(composite, SWT.NONE); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; chartParent.setLayoutData(gridData); showIntensityButton = new Button(composite, SWT.CHECK); showIntensityButton.setText("Show Intensity"); showIntensityButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: redrawChart();/* w w w. jav a 2s . co m*/ break; } } }); doCalibrationButton = new Button(composite, SWT.CHECK); doCalibrationButton.setText("Do Calibration"); doCalibrationButton.setSelection(true); doCalibrationButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: redrawChart(); break; } } }); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(listener); composite.setLayout(new GridLayout()); chartParent.setLayout(new FillLayout()); this.parent = chartParent; }
From source file:grafici.StatisticheBarChart3D.java
/** * Creates a new demo instance.// w w w . j a v a 2 s. com * * @param title * the frame title. */ public StatisticheBarChart3D(Table risultati, Composite parent, int style, int variabile1, int variabile2, int valore) { super(parent, style); try { this.titolo = risultati.getColumn(variabile1).getText().toUpperCase() + " - " + risultati.getColumn(variabile2).getText().toUpperCase() + " - " + risultati.getColumn(valore).getText().toUpperCase(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(risultati, variabile1, variabile2, valore); JFreeChart chart = createChart(dataset, risultati, variabile1, variabile2, valore); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { alertGraficoNonDisp(); } }
From source file:grafici.FattureTimeSeriesChart.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * //from ww w . ja va2 s .c o m * @param title * the frame title. */ public FattureTimeSeriesChart(String title, Composite parent, int style, int tipo) { super(parent, style); System.out.println(2); Label titolo = new Label(this, SWT.NONE); titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD)); titolo.setText(title); GridData gdLbl = new GridData(SWT.FILL); titolo.setLayoutData(gdLbl); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); JPanel chartPanel = createPanel(tipo); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); }
From source file:org.amanzi.awe.charts.ui.ChartsView.java
@Override public void createPartControl(final Composite parent) { parent.setLayout(new GridLayout(1, false)); controlsComposite = new Composite(parent, SWT.NONE); controlsComposite.setLayout(new GridLayout(1, false)); controlsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite buttonsContainer = new Composite(controlsComposite, SWT.NONE); buttonsContainer.setLayout(new GridLayout(4, true)); buttonsContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createRadioButton(buttonsContainer, "Line", true, ChartType.TIME_CHART); createRadioButton(buttonsContainer, "Bar", false, ChartType.BAR_CHART); createRadioButton(buttonsContainer, "Stacked", false, ChartType.STACKED_CHART); createRadioButton(buttonsContainer, "Pie", false, ChartType.PIE_CHART); Composite filteringContainer = new Composite(controlsComposite, SWT.BORDER); filteringContainer.setLayout(new GridLayout(2, true)); filteringContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); groupSelectorWidget = new ItemsSelectorWidget(filteringContainer, this, GROUPS_LABEL); columnsSelectorWidget = new ItemsSelectorWidget(filteringContainer, this, CELLS_LABEL); groupSelectorWidget.initializeWidget(); columnsSelectorWidget.initializeWidget(); int width = parent.getShell().getSize().x; chartComposite = new ChartComposite(parent, SWT.FILL, null, ChartComposite.DEFAULT_WIDTH, ChartComposite.DEFAULT_HEIGHT, ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH, ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT, width, ChartComposite.DEFAULT_MAXIMUM_DRAW_HEIGHT, true, true, true, true, true, true); chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); chartComposite.setVisible(false);// www .j a v a2 s .c om chartComposite.addChartMouseListener(this); }
From source file:grafici.MediciTimeSeriesChart.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * //from w ww . j a v a2 s .c o m * @param title * the frame title. */ public MediciTimeSeriesChart(String title, Composite parent, int style, int tipo) { super(parent, style); Label titolo = new Label(this, SWT.NONE); titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD)); titolo.setText(title); GridData gdLbl = new GridData(SWT.FILL); titolo.setLayoutData(gdLbl); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); JPanel chartPanel = createDemoPanel(tipo); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); }
From source file:grafici.PrenotazioneTimeSeriesChart.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * /*from w w w . ja v a2 s . co m*/ * @param title * the frame title. */ public PrenotazioneTimeSeriesChart(String title, Composite parent, int style, int tipo) { super(parent, style); Label titolo = new Label(this, SWT.NONE); titolo.setFont(new Font(titolo.getDisplay(), "arial", 15, SWT.BOLD)); titolo.setText(title); GridData gdLbl = new GridData(SWT.FILL); titolo.setLayoutData(gdLbl); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); JPanel chartPanel = createDemoPanel(tipo); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); }
From source file:grafici.StatisticheLineChart.java
/** * Creates a new demo instance.//from w w w . j a v a 2 s . c o m * * @param title * the frame title. */ public StatisticheLineChart(Table risultati, Composite parent, int style, int variabile, int valore) { super(parent, style); try { this.titolo = risultati.getColumn(variabile).getText().toUpperCase() + " - " + risultati.getColumn(valore).getText().toUpperCase(); GridData gdThis = new GridData(SWT.FILL); gdThis.horizontalAlignment = SWT.FILL; gdThis.verticalAlignment = SWT.FILL; gdThis.grabExcessHorizontalSpace = true; gdThis.grabExcessVerticalSpace = true; this.setLayoutData(gdThis); this.setLayout(new GridLayout(1, false)); Composite cmp = new Composite(this, SWT.FILL | SWT.EMBEDDED); GridData gdCmp = new GridData(SWT.FILL); gdCmp.horizontalAlignment = SWT.FILL; gdCmp.verticalAlignment = SWT.FILL; gdCmp.grabExcessHorizontalSpace = true; gdCmp.grabExcessVerticalSpace = true; cmp.setLayoutData(gdCmp); cmp.setLayout(new GridLayout(1, false)); CategoryDataset dataset = createDataset(risultati, variabile, valore); JFreeChart chart = createChart(dataset, risultati, variabile, valore); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setFillZoomRectangle(true); // chartPanel.setMouseWheelEnabled(true); // chartPanel.setPreferredSize(new Dimension(1000, 700)); Frame graphFrame = SWT_AWT.new_Frame(cmp); graphFrame.add(chartPanel); graphFrame.pack(); } catch (Exception e) { e.printStackTrace(); } }