Java Code Examples for org.eclipse.swt.SWT#H_SCROLL
The following examples show how to use
org.eclipse.swt.SWT#H_SCROLL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridSnippet1.java From nebula with Eclipse Public License 2.0 | 7 votes |
public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); shell.setLayout(new FillLayout()); Grid grid = new Grid(shell,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); grid.setHeaderVisible(true); GridColumn column = new GridColumn(grid,SWT.NONE); column.setTree(true); column.setText("Column 1"); column.setWidth(100); GridItem item1 = new GridItem(grid,SWT.NONE); item1.setText("Root Item"); GridItem item2 = new GridItem(item1,SWT.NONE); item2.setText("Second item"); GridItem item3 = new GridItem(item2,SWT.NONE); item3.setText("Third Item"); shell.setSize(200,200); shell.open (); while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
Example 2
Source File: DashboardComposite.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** {@code key} defines which data source will be used for display. */ public DashboardComposite(String key, Composite parent, int style) { super(parent, style); this.key = key; this.setLayout(new FillLayout()); final SashForm sf = new SashForm(this, SWT.HORIZONTAL); sf.setLayout(new FillLayout()); this.canvas = new VisualisationCanvas(sf, SWT.NONE); this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); text.setText(""); createVisualisationControls(sf); sf.setWeights(new int[] { 45, 45, 10 }); }
Example 3
Source File: TestWithMain.java From nebula with Eclipse Public License 2.0 | 6 votes |
private static void test1() { Display display = new Display(); Shell shell = new Shell( display ); Grid grid = new Grid( shell, SWT.V_SCROLL | SWT.H_SCROLL ); grid.setSize( 200, 200 ); grid.setLinesVisible( true ); grid.setHeaderVisible( true ); GridItem[] items = createGridItems( grid, 20, 0, true ); shell.pack(); shell.open(); grid.setTopIndex( 12 ); grid.showItem( items[ 4 ] ); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) display.sleep(); } display.dispose(); }
Example 4
Source File: SellOrderTableViewer.java From offspring with MIT License | 6 votes |
public SellOrderTableViewer(Composite parent, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); this.contentProvider = new SellOrderContentProvider(sync); this.comparator = new SellOrderComparator(); setUseHashlookup(false); setContentProvider(contentProvider); setComparator(comparator); createColumns(); /* Pack the columns */ for (TableColumn column : getTable().getColumns()) column.pack(); Table table = getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); }
Example 5
Source File: ViewEditor.java From depan with Apache License 2.0 | 5 votes |
private void createDiagramPage() { Composite parent = new Composite(getContainer(), SWT.H_SCROLL | SWT.V_SCROLL); parent.setLayout(Widgets.buildContainerLayout(1)); // bottom composite containing main diagram renderer = createView(parent); renderer.setLayoutData(Widgets.buildGrabFillData()); // Configure the rendering pipe before listening for changes. prepareView(); renderer.start(); int index = addPage(parent); setPageText(index, "Graph View"); }
Example 6
Source File: AskOrdersViewer.java From offspring with MIT License | 5 votes |
public AskOrdersViewer(Composite parent, INxtService nxt, IContactsService contactsService, IStylingEngine engine, IUserService userService, UISynchronize sync) { super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); this.nxt = nxt; this.contactsService = contactsService; this.engine = engine; this.userService = userService; this.sync = sync; setGenericTable(new IGenericTable() { @Override public int getDefaultSortDirection() { return GenericComparator.ASSCENDING; } @Override public IGenericTableColumn getDefaultSortColumn() { return columnPrice; } @Override public IStructuredContentProvider getContentProvider() { return contentProvider; } @Override public IGenericTableColumn[] getColumns() { return new IGenericTableColumn[] { columnTotal, columnPrice, columnQuantity, columnSeller }; } }); refresh(); }
Example 7
Source File: SelectExamplePage.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void createTreeViewer(Composite container) { viewer = new TreeViewer(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); viewer.setContentProvider(new ExampleContentProvider()); viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ExampleLabelProvider())); viewer.addSelectionChangedListener(this); }
Example 8
Source File: MultipleSelectionCombo.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void initFloatShell() { Point p = displayText.getParent().toDisplay( displayText.getLocation() ); Point size = displayText.getSize(); Rectangle shellRect = new Rectangle( p.x, p.y + size.y, size.x, 0 ); floatShell = new Shell( MultipleSelectionCombo.this.getShell(), SWT.NO_TRIM ); GridLayout gl = new GridLayout(); gl.marginBottom = 2; gl.marginTop = 2; gl.marginRight = 0; gl.marginLeft = 0; gl.marginWidth = 0; gl.marginHeight = 0; floatShell.setLayout( gl ); list = new List( floatShell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); for ( String value : comboItems ) { list.add( value ); } GridData gd = new GridData( GridData.FILL_BOTH ); list.setLayoutData( gd ); floatShell.setSize( shellRect.width, 100 ); floatShell.setLocation( shellRect.x, shellRect.y ); list.addMouseListener( new MouseAdapter() { @Override public void mouseUp( MouseEvent event ) { super.mouseUp( event ); comboSelection = list.getSelectionIndices(); displayText(); } } ); floatShell.open(); }
Example 9
Source File: CompositeFactory.java From ermasterr with Apache License 2.0 | 5 votes |
public static ContainerCheckedTreeViewer createCheckedTreeViewer(final AbstractDialog dialog, final Composite parent, final int height, final int span) { final GridData gridData = new GridData(); gridData.heightHint = height; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = span; final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Tree tree = viewer.getTree(); tree.setLayoutData(gridData); viewer.setContentProvider(new TreeNodeContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); if (dialog != null) { viewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(final CheckStateChangedEvent event) { dialog.validate(); } }); } return viewer; }
Example 10
Source File: FilterBugsDialog.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private ContainerCheckedTreeViewer createTree(Composite parent, int style) { final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, style | SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.RESIZE) { /** * Overriden to re-set checked state of elements after filter change */ @Override public void refresh(boolean updateLabels) { super.refresh(updateLabels); setCheckedElements(checkedElements); } }; viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); viewer.setInput(allowedTypes); Object[] preselected = getPreselected(); viewer.setCheckedElements(preselected); viewer.addPostSelectionChangedListener(new TreeSelectionChangedListener()); viewer.getTree().addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { updateDescription((IStructuredSelection) viewer.getSelection()); } }); viewer.addCheckStateListener(new TreeCheckStateListener()); return viewer; }
Example 11
Source File: ImageViewer.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
public ImageViewer( Composite parent ) { scrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL ); scrolledComposite.setBackground( getBackgroundColor() ); imageLabel = new Label( scrolledComposite, SWT.NONE ); imageLabel.setBackground( getBackgroundColor() ); scrolledComposite.setContent( imageLabel ); scrolledComposite.addListener( SWT.Dispose, this::handleDispose ); }
Example 12
Source File: ColumnBrowserWidget.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Constructs a new instance of this class given its parent and a style value * describing its behavior and appearance. * <p> * The style value is either one of the style constants defined in class * <code>SWT</code> which is applicable to instances of this class, or must be * built by <em>bitwise OR</em>'ing together (that is, using the * <code>int</code> "|" operator) two or more of those <code>SWT</code> style * constants. The class description lists the style constants that are * applicable to the class. Style bits are also inherited from superclasses. * </p> * * @param parent a widget which will be the parent of the new instance (cannot * be null) * @param style the style of widget to construct * * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception SWTException * <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the parent</li> * </ul> * * @see Composite#Composite(Composite, int) * @see SWT#BORDER * @see Widget#getStyle */ public ColumnBrowserWidget(final Composite parent, final int style) { super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL); composite = new Composite(this, SWT.NONE); final RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.spacing = 1; layout.pack = false; composite.setLayout(layout); columnArrow = SWTGraphicUtil.createImageFromFile("images/columnArrow.png"); columns = new ArrayList<Table>(); for (int i = 0; i < 3; i++) { createTable(); } // Store root columns.get(0).setData(new ColumnItem(this)); setContent(composite); setExpandHorizontal(true); setExpandVertical(true); setShowFocusedControl(true); updateContent(); this.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); selectionListeners = new ArrayList<SelectionListener>(); addDisposeListener(e -> { SWTGraphicUtil.safeDispose(columnArrow); }); }
Example 13
Source File: Grid_Test.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Test public void testShowSelection() { grid = new Grid( shell, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); grid.setSize( 200, 200 ); createGridItems( grid, 20, 3 ); grid.setSelection( new int[] { 4, 8, 24 } ); grid.setTopIndex( 12 ); grid.showSelection(); assertEquals( 4, grid.getTopIndex() ); }
Example 14
Source File: TableComboViewer.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public TableComboViewer(Composite parent) { this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); }
Example 15
Source File: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
private void createSummaryFiledViewer( Composite dialogArea ) { Table table = new Table( dialogArea, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.CHECK ); table.setLinesVisible( true ); table.setHeaderVisible( true ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 250; table.setLayoutData( gd ); summaryFieldViewer = new CheckboxTableViewer( table ); SummaryFieldProvider provider = new SummaryFieldProvider( ); for ( int i = 0; i < columnNames.length; i++ ) { TableColumn column = new TableColumn( table, SWT.LEFT ); column.setText( columnNames[i] ); column.setWidth( columnWidth[i] ); } ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table, new String[0], SWT.READ_ONLY ); // TextCellEditor textCell = new TextCellEditor(table, SWT.NONE); cellEditor = new CellEditor[]{ null, comboCell }; summaryFieldViewer.setColumnProperties( columnNames ); summaryFieldViewer.setCellEditors( cellEditor ); summaryFieldViewer.setCellModifier( cellModifier ); summaryFieldViewer.setUseHashlookup( true ); summaryFieldViewer.setContentProvider( provider ); summaryFieldViewer.setLabelProvider( provider ); summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) { public void checkStateChanged( CheckStateChangedEvent event ) { MeasureInfo info = (MeasureInfo) event.getElement( ); if ( event.getChecked( ) ) { info.setShow( true ); } else { info.setShow( false ); } checkOKButtonStatus( ); } } ); }
Example 16
Source File: CTreeCombo.java From nebula with Eclipse Public License 2.0 | 4 votes |
void createPopup(Collection<CTreeComboItem> items, CTreeComboItem selectedItem) { // create shell and list popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); final int style = getStyle(); int listStyle = SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE; if ((style & SWT.FLAT) != 0) { listStyle |= SWT.FLAT; } if ((style & SWT.RIGHT_TO_LEFT) != 0) { listStyle |= SWT.RIGHT_TO_LEFT; } if ((style & SWT.LEFT_TO_RIGHT) != 0) { listStyle |= SWT.LEFT_TO_RIGHT; } tree = new Tree(popup, listStyle); tree.addTreeListener(hookListener); if (font != null) { tree.setFont(font); } if (foreground != null) { tree.setForeground(foreground); } if (background != null) { tree.setBackground(background); } final int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate }; for (int i = 0; i < popupEvents.length; i++) { popup.addListener(popupEvents[i], listener); } final int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose, SWT.Collapse, SWT.Expand }; for (int i = 0; i < listEvents.length; i++) { tree.addListener(listEvents[i], listener); } for (final CTreeComboColumn c : columns) { final TreeColumn col = new TreeColumn(tree, SWT.NONE); c.setRealTreeColumn(col); } if (items != null) { createTreeItems(items.toArray(new CTreeComboItem[0])); } if (selectedItem != null) { tree.setSelection(selectedItem.getRealTreeItem()); } }
Example 17
Source File: ProblemsDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected Control createCustomArea(Composite parent) { Collection<T> input = getInput(); Assert.isNotNull(input); if (input.isEmpty()) { return super.createCustomArea(parent); } if(messageLabel != null) { GridData layoutData = (GridData) messageLabel.getLayoutData(); layoutData.verticalAlignment = SWT.CENTER; } TableViewer problemsViewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); problemsViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(600, 100).create()); problemsViewer.setContentProvider(ArrayContentProvider.getInstance()); problemsViewer.setComparator(getComparator()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(1, false)); problemsViewer.getTable().setLayout(layout); tableViewerColumn = new TableViewerColumn(problemsViewer, SWT.NONE); TypedLabelProvider<T> typedLabelProvider = getTypedLabelProvider(); Assert.isNotNull(typedLabelProvider); tableViewerColumn.setLabelProvider(new LabelProviderBuilder<T>() .withTextProvider(typedLabelProvider::getText) .withImageProvider(typedLabelProvider::getImage) .withTooltipProvider(typedLabelProvider::getToolTipText) .createColumnLabelProvider()); problemsViewer.getTable().getShell().addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { tableViewerColumn.getColumn().pack(); } }); problemsViewer.setInput(input); ColumnViewerToolTipSupport.enableFor(problemsViewer); return problemsViewer.getControl(); }
Example 18
Source File: GridViewerSnippet7.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { try { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final ImageRegistry reg = new ImageRegistry(display); reg.put("ICON", ImageDescriptor.createFromFile( GridViewerSnippet6.class, "th_vertical.gif")); GridTableViewer v = new GridTableViewer(shell, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); v.getGrid().setLinesVisible(true); v.getGrid().setHeaderVisible(true); v.setContentProvider(new ContentProvider("birthday", "commits", "bugs")); v.getGrid().setRowHeaderVisible(true); v.setRowHeaderLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { String propertyName = ((Mediator) element) .getPropertyName(); return propertyName; } }); List<Committer> committers = new ArrayList<Committer>(); committers.add(new Committer("Tom Schindl", new Date(), 10, 5)); committers .add(new Committer("Boris Bokowski", new Date(), 1000, 35)); int i = 0; for (Committer committer : committers) { GridViewerColumn column = new GridViewerColumn(v, SWT.NONE); column.setEditingSupport(new EditingSupportImpl(v, i)); column.setLabelProvider(new LabelProviderImpl(i)); column.getColumn().setText(committer.getName()); column.getColumn().setWidth(200); i++; } v.setInput(committers); shell.setSize(500, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } catch (Exception e) { e.printStackTrace(); } }
Example 19
Source File: HistoryTableProvider.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Constructor for HistoryTableProvider. */ public HistoryTableProvider() { this(SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION, null); }
Example 20
Source File: MarkerStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
/** * Creates the table viewer for the detail view. * * @param parent * the parent composite * @return the detail table viewer */ private EnhancedTableViewer createDetailView(Composite parent) { // le tableau EnhancedTableViewer detailViewer = new EnhancedTableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION); GridData gridData = new GridData(GridData.FILL_BOTH); detailViewer.getControl().setLayoutData(gridData); // setup the table columns Table table = detailViewer.getTable(); table.setLinesVisible(true); table.setHeaderVisible(true); TableColumn severityCol = new TableColumn(table, SWT.CENTER, 0); severityCol.setWidth(20); severityCol.setResizable(false); TableColumn idCol = new TableColumn(table, SWT.LEFT, 1); idCol.setText(Messages.MarkerStatsView_fileColumn); idCol.setWidth(150); TableColumn folderCol = new TableColumn(table, SWT.LEFT, 2); folderCol.setText(Messages.MarkerStatsView_folderColumn); folderCol.setWidth(300); TableColumn countCol = new TableColumn(table, SWT.CENTER, 3); countCol.setText(Messages.MarkerStatsView_lineColumn); countCol.pack(); TableColumn messageCol = new TableColumn(table, SWT.LEFT, 4); messageCol.setText(Messages.MarkerStatsView_messageColumn); messageCol.setWidth(300); // set the providers detailViewer.setContentProvider(new DetailContentProvider()); DetailViewMultiProvider multiProvider = new DetailViewMultiProvider(); detailViewer.setLabelProvider(multiProvider); detailViewer.setTableComparableProvider(multiProvider); detailViewer.setTableSettingsProvider(multiProvider); detailViewer.installEnhancements(); // add selection listener to maintain action state detailViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { updateActions(); } }); // hooks the action to double click hookDoubleClickAction(mShowErrorAction, detailViewer); // and to the context menu too ArrayList<Object> actionList = new ArrayList<>(1); actionList.add(mDrillBackAction); actionList.add(mShowErrorAction); actionList.add(new Separator()); actionList.add(mChartAction); hookContextMenu(actionList, detailViewer); return detailViewer; }