本文整理汇总了Java中org.eclipse.swt.widgets.Scrollable类的典型用法代码示例。如果您正苦于以下问题:Java Scrollable类的具体用法?Java Scrollable怎么用?Java Scrollable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scrollable类属于org.eclipse.swt.widgets包,在下文中一共展示了Scrollable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildLayout
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
/** Builds the layout. */
private static void buildLayout(Scrollable control, AbstractColumnLayout layout, List<? extends Widget> columns, List<? extends ColumnBuilder> columnBuilders) {
// create the layout
for (int i = 0; i < columns.size(); ++i) {
layout.setColumnData(columns.get(i), columnBuilders.get(i).dataBuilder.data);
}
control.getParent().setLayout(layout);
// update the layout on every resize
SwtMisc.asyncLayoutOnResize(control.getParent());
// sometimes complicated trees can take a long time to get settled, so we'll do some last-ditch checks
Runnable checkLayout = () -> {
control.getParent().layout(true, true);
};
SwtExec.Guarded guarded = SwtExec.async().guardOn(control);
guarded.timerExec(500, checkLayout);
guarded.timerExec(1000, checkLayout);
guarded.timerExec(2000, checkLayout);
}
示例2: applyCSSPropertyOfSchemeAfterFlatScrollbar
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyOfSchemeAfterFlatScrollbar() throws Exception {
Scrollable scrollable = createScrollable( shell, typePair.scrollableType );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
contribution.applyCSSProperty( newElement( scrollable ), ADAPTER_BACKGROUND, BACK_GROUND, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_BACKGROUND, BACK_GROUND, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_PAGE_INCREMENT, PAGE_INC, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_INCREMENT_LENGTH, INC_LENGTH, null, null );
contribution.applyCSSProperty( newElement( scrollable ), ADAPTER_DEMEANOR, FIXED_WIDTH, null, null );
assertThat( shell.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( shell.getChildren()[ 0 ].getBackground() ).isEqualTo( expectedColor( BACK_GROUND ) );
assertThat( getAdapterStyle().getBackgroundColor() ).isEqualTo( expectedColor( BACK_GROUND ) );
assertThat( getAdapterStyle().getThumbColor() ).isEqualTo( expectedColor( THUMB ) );
assertThat( getAdapterStyle().getPageIncrementColor() ).isEqualTo( expectedColor( PAGE_INC ) );
assertThat( getAdapterStyle().getDemeanor() ).isSameAs( Demeanor.FIXED_SCROLL_BAR_BREADTH );
assertThat( getAdapterStyle().getIncrementButtonLength() ).isEqualTo( expectedInt( INC_LENGTH ) );
}
示例3: applyCSSPropertyFlatScrollbarAfterScheme
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyFlatScrollbarAfterScheme() throws Exception {
Scrollable scrollable = createScrollable( shell, typePair.scrollableType );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_BACKGROUND, BACK_GROUND, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_PAGE_INCREMENT, PAGE_INC, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_INCREMENT_LENGTH, INC_LENGTH, null, null );
contribution.applyCSSProperty( newElement( scrollable ), ADAPTER_BACKGROUND, BACK_GROUND, null, null );
contribution.applyCSSProperty( newElement( scrollable ), ADAPTER_DEMEANOR, FIXED_WIDTH, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
assertThat( shell.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( shell.getChildren()[ 0 ].getBackground() ).isEqualTo( expectedColor( BACK_GROUND ) );
assertThat( getAdapterStyle().getBackgroundColor() ).isEqualTo( expectedColor( BACK_GROUND ) );
assertThat( getAdapterStyle().getThumbColor() ).isEqualTo( expectedColor( THUMB ) );
assertThat( getAdapterStyle().getPageIncrementColor() ).isEqualTo( expectedColor( PAGE_INC ) );
assertThat( getAdapterStyle().getDemeanor() ).isEqualTo( Demeanor.FIXED_SCROLL_BAR_BREADTH );
assertThat( getAdapterStyle().getIncrementButtonLength() ).isEqualTo( expectedInt( INC_LENGTH ) );
}
示例4: applyCSSPropertyOfThumbWithAlternateTopLevelWindowSelectorOnTopLevelShellAfterFlatScrollbar
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyOfThumbWithAlternateTopLevelWindowSelectorOnTopLevelShellAfterFlatScrollbar()
throws Exception
{
Scrollable scrollable = createScrollable( shell, typePair.scrollableType );
CSSPrimitiveValue colorValue = stubCssColorValue( 123, 22, 213 );
String thumbSelectorForTopLevelWindow = FLAT_SCROLL_BAR_THUMB + TOP_LEVEL_WINDOW_SELECTOR;
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), thumbSelectorForTopLevelWindow, colorValue, null, null );
assertThat( shell.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( getAdapterStyle().getThumbColor() ).isEqualTo( expectedColor( colorValue ) );
}
示例5: applyCSSPropertyFlatScrollbarThumbWithAlternateTopLevelWindowSelectorOnTopLevelShell
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyFlatScrollbarThumbWithAlternateTopLevelWindowSelectorOnTopLevelShell()
throws Exception
{
Scrollable scrollable = createScrollable( shell, typePair.scrollableType );
CSSPrimitiveValue colorValue = stubCssColorValue( 123, 22, 213 );
String thumbSelectorForTopLevelWindow = FLAT_SCROLL_BAR_THUMB + TOP_LEVEL_WINDOW_SELECTOR;
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), thumbSelectorForTopLevelWindow, colorValue, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
assertThat( shell.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( getAdapterStyle().getThumbColor() ).isEqualTo( expectedColor( colorValue ) );
}
示例6: createScrollable
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyOfThumbWithAlternateTopLevelWindowSelectorOnTopLevelShellAndReverseSettingAfterFlatBar()
throws Exception
{
Scrollable scrollable = createScrollable( shell, typePair.scrollableType );
CSSPrimitiveValue colorValue = stubCssColorValue( 123, 22, 213 );
String thumbSelectorForTopLevelWindow = FLAT_SCROLL_BAR_THUMB + TOP_LEVEL_WINDOW_SELECTOR;
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
contribution.applyCSSProperty( newElement( scrollable ), thumbSelectorForTopLevelWindow, colorValue, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
assertThat( shell.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( getAdapterStyle().getThumbColor() ).isEqualTo( expectedColor( colorValue ) );
}
示例7: applyCSSPropertyOfThumbWithAlternateTopLevelWindowSelectorOnChildShellAfterFlatScrollbar
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyOfThumbWithAlternateTopLevelWindowSelectorOnChildShellAfterFlatScrollbar()
throws Exception
{
Shell child = new Shell( shell );
Scrollable scrollable = createScrollable( child, typePair.scrollableType );
CSSPrimitiveValue colorValue = stubCssColorValue( 123, 22, 213 );
String thumbSelectorForTopLevelWindow = FLAT_SCROLL_BAR_THUMB + TOP_LEVEL_WINDOW_SELECTOR;
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), thumbSelectorForTopLevelWindow, colorValue, null, null );
assertThat( child.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( ( ( ScrollbarStyle )child.getChildren()[ 0 ] ).getThumbColor() ).isEqualTo( expectedColor( THUMB ) );
}
示例8: applyCSSPropertyFlatScrollbarThumbWithAlternateTopLevelWindowSelectorOnChildShellWithReverseSetting
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
@ConditionalIgnore( condition = NonWindowsPlatform.class )
public void applyCSSPropertyFlatScrollbarThumbWithAlternateTopLevelWindowSelectorOnChildShellWithReverseSetting()
throws Exception
{
Shell child = new Shell( shell );
Scrollable scrollable = createScrollable( child, typePair.scrollableType );
CSSPrimitiveValue colorValue = stubCssColorValue( 123, 22, 213 );
String thumbSelectorForTopLevelWindow = FLAT_SCROLL_BAR_THUMB + TOP_LEVEL_WINDOW_SELECTOR;
contribution.applyCSSProperty( newElement( scrollable ), thumbSelectorForTopLevelWindow, colorValue, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR_THUMB, THUMB, null, null );
contribution.applyCSSProperty( newElement( scrollable ), FLAT_SCROLL_BAR, TRUE, null, null );
assertThat( child.getChildren()[ 0 ] ).isInstanceOf( typePair.adapterType );
assertThat( ( ( ScrollbarStyle )child.getChildren()[ 0 ] ).getThumbColor() ).isEqualTo( expectedColor( THUMB ) );
}
示例9: adapt
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
private <A extends Scrollable & Adapter<S>, S extends Scrollable> Optional<A> adapt( S scrollable, Class<A> type ) {
Composite parent = scrollable.getParent();
int ordinalNumber = captureDrawingOrderOrdinalNumber( scrollable );
A result = createAdapter( scrollable, type );
if( platformSupport.isGranted() ) {
markAdapted( scrollable );
applyDrawingOrderOrdinalNumber( result, ordinalNumber );
}
result.adapt( scrollable, platformSupport );
if( platformSupport.isGranted() ) {
parent.layout();
result.setBackground( scrollable.getBackground() );
reflectionUtil.setField( scrollable, ControlReflectionUtil.PARENT, parent );
}
return Optional.of( result );
}
示例10: stubContext
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
static AdaptionContext<Scrollable> stubContext(
Vertical vBarVisible, Horizontal hBarVisible, Point preferredSize, Rectangle area, Demeanor demeanor )
{
@SuppressWarnings("unchecked")
AdaptionContext<Scrollable> result = mock( AdaptionContext.class );
when( result.isVerticalBarVisible() ).thenReturn( vBarVisible.value );
when( result.isHorizontalBarVisible() ).thenReturn( hBarVisible.value );
when( result.getPreferredSize() ).thenReturn( preferredSize );
when( result.getVerticalBarOffset() ).thenReturn( STUB_VERTICAL_BAR_OFFSET );
when( result.getOffset() ).thenReturn( OFFSET );
when( result.getBorderWidth() ).thenReturn( BORDER_WIDTH );
when( result.getVisibleArea() )
.thenReturn( new Rectangle( area.x, area.y, area.width + BORDER_ADJUSTMENT, area.height + BORDER_ADJUSTMENT ) );
when( result.getOriginOfScrollableOrdinates() )
.thenReturn( new Point( area.x - BORDER_WIDTH, area.y - BORDER_WIDTH ) );
when( result.get( Demeanor.class ) ).thenReturn( demeanor );
return result;
}
示例11: createListViewer
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
private void createListViewer(Composite editorComposite) {
fListViewer = new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);
fListViewer.setLabelProvider(new ColorListLabelProvider());
fListViewer.setContentProvider(new ColorListContentProvider());
GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true);
gd.heightHint = convertHeightInCharsToPixels(26);
int maxWidth = 0;
for (Iterator<List<HighlightingColorListItem>> it = content.values().iterator(); it.hasNext();) {
for (Iterator<HighlightingColorListItem> j = it.next().iterator(); j.hasNext();) {
HighlightingColorListItem item = j.next();
maxWidth = Math.max(maxWidth, convertWidthInCharsToPixels(item.getDisplayName().length()));
}
}
ScrollBar vBar = ((Scrollable) fListViewer.getControl()).getVerticalBar();
if (vBar != null) {
// scrollbars and tree indentation guess
maxWidth += vBar.getSize().x * 3;
}
gd.widthHint = maxWidth;
fListViewer.getControl().setLayoutData(gd);
fListViewer.setInput(content);
fListViewer.setSelection(new StructuredSelection(content.values().iterator().next()));
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
handleSyntaxColorListSelection();
}
});
}
示例12: constructionWithNonVirtualAndOwnerDrawnStructuredScrollable
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
public void constructionWithNonVirtualAndOwnerDrawnStructuredScrollable() {
Scrollable scrollable = createTable( shell, 10 );
scrollable.addListener( SWT.MeasureItem, evt -> {} );
newRedrawInsurance( scrollable );
assertThat( scrollable.getVerticalBar().getListeners( SWT.Selection ) ).isEmpty();
}
示例13: setColumnWidths
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @since 3.5
*/
protected void setColumnWidths(Scrollable tableTree, int[] widths) {
TableColumn[] columns = ((Table) tableTree).getColumns();
for (int i = 0; i < widths.length; i++) {
columns[i].setWidth(widths[i]);
}
}
示例14: computeWithAdapterReplacementFake
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
@Test
public void computeWithAdapterReplacementFake() {
Composite composite = new Composite( scrollable.getParent(), SWT.H_SCROLL | SWT.V_SCROLL );
AdaptionContext<Scrollable> context = new AdaptionContext<>( composite, new ScrollableControl<>( scrollable ) );
int actual = computer.compute( context );
assertThat( actual ).isEqualTo( 0 );
}
示例15: stubAdaptionContext
import org.eclipse.swt.widgets.Scrollable; //导入依赖的package包/类
private AdaptionContext<Scrollable> stubAdaptionContext(
Vertical verticalBarVisible, Horizontal horizontalBarVisible, Point preferredSize, Rectangle visibleArea )
{
AdaptionContext<Scrollable> result
= stubContext( verticalBarVisible, horizontalBarVisible, preferredSize, visibleArea, FIXED_SCROLL_BAR_BREADTH );
when( result.getScrollable() ).thenReturn( new ScrollableControl<>( scrollable ) );
when( result.getAdapter() ).thenReturn( adapter );
return result;
}