ToolBar createToolbar(final MUIElement element, Composite intermediate) { int orientation = getOrientation(element); RowLayout layout = RowLayoutFactory.fillDefaults().wrap(false).spacing(0).type(orientation).create(); layout.marginLeft = 3; layout.center = true; intermediate.setLayout(layout); ToolBar separatorToolBar = new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT); new ToolItem(separatorToolBar, SWT.SEPARATOR); return new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT); }
protected void createBottomTable(Composite parent) { SashForm sash = new SashForm(parent, SWT.HORIZONTAL); // folder CTabFolder folder = new CTabFolder(sash, SWT.BORDER); // latest latest = new SecurityDetailsViewer(sash, SWT.BORDER, getClient()); latest.getControl().pack(); int width = latest.getControl().getBounds().width; sash.setWeights(new int[] {parent.getParent().getParent().getBounds().width - width, width}); // tab 1: chart CTabItem item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabChart); Composite chartComposite = new Composite(folder, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(chartComposite); item.setControl(chartComposite); chart = new TimelineChart(chartComposite); chart.getTitle().setText("..."); // $NON-NLS-1$ GridDataFactory.fillDefaults().grab(true, true).applyTo(chart); Composite buttons = new Composite(chartComposite, SWT.NONE); buttons.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, true).applyTo(buttons); RowLayoutFactory.fillDefaults().type(SWT.VERTICAL).spacing(2).fill(true).applyTo(buttons); addButton(buttons, Messages.SecurityTabChart1M, Calendar.MONTH, -1); addButton(buttons, Messages.SecurityTabChart2M, Calendar.MONTH, -2); addButton(buttons, Messages.SecurityTabChart6M, Calendar.MONTH, -6); addButton(buttons, Messages.SecurityTabChart1Y, Calendar.YEAR, -1); addButton(buttons, Messages.SecurityTabChart2Y, Calendar.YEAR, -2); addButton(buttons, Messages.SecurityTabChart3Y, Calendar.YEAR, -3); addButton(buttons, Messages.SecurityTabChart5Y, Calendar.YEAR, -5); addButton(buttons, Messages.SecurityTabChart10Y, Calendar.YEAR, -10); Button button = new Button(buttons, SWT.FLAT); button.setText(Messages.SecurityTabChartAll); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { chartPeriod = null; Security security = (Security) prices.getData(Security.class.toString()); updateChart(security); } }); // tab 2: historical quotes item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabHistoricalQuotes); item.setControl(createPricesTable(folder)); // tab 3: transactions item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabTransactions); item.setControl(createTransactionTable(folder)); folder.setSelection(0); }