Java Code Examples for org.eclipse.swt.custom.ScrolledComposite#addControlListener()
The following examples show how to use
org.eclipse.swt.custom.ScrolledComposite#addControlListener() .
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: DetailsTabView.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * Create the composite. * @param parent * @param style */ public DetailsTabView() { super(SWT.NONE); setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL); fillLayout.marginWidth = 5; fillLayout.marginHeight = 5; setLayout(fillLayout); scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL); scrolledComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { ScrolledComposites.updateOnlyVerticalScrollableComposite(scrolledComposite); } }); scrolledComposite.setAlwaysShowScrollBars(true); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setExpandVertical(true); }
Example 2
Source File: AbstractCubePropertyPage.java From birt with Eclipse Public License 1.0 | 5 votes |
public Control createPageControl( Composite parent ) { sComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL ); sComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); sComposite.setExpandHorizontal( true ); sComposite.setExpandVertical( true ); sComposite.addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { computeSize( ); } } ); composite = new Composite( sComposite, SWT.NONE ); GridLayout layout = new GridLayout( ); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout( layout ); if ( getPageDescription( ) != null ) { pageDescription = new Label( composite, SWT.NONE ); pageDescription.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); pageDescription.setText( getPageDescription( ) ); pageDescription.setToolTipText( getPageDescription( ) ); } GridData data = new GridData( GridData.FILL_BOTH ); Control control = createContents( composite ); control.setLayoutData( data ); sComposite.setContent( composite ); return sComposite; }
Example 3
Source File: PreviewPage.java From birt with Eclipse Public License 1.0 | 5 votes |
public void buildUI( Composite parent ) { container = new ScrolledComposite( parent, SWT.V_SCROLL | SWT.H_SCROLL ); container.setLayoutData( new GridData( GridData.FILL_BOTH ) ); ( (ScrolledComposite) container ).setExpandHorizontal( true ); ( (ScrolledComposite) container ).setExpandVertical( true ); container.addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { computeSize( ); } } ); composite = new Composite( container, SWT.NONE ); composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); if ( sections == null ) sections = new SortMap( ); composite.setLayout( WidgetUtil.createGridLayout( 1 ) ); previewSection = new PreviewSection( provider.getDisplayName( ), composite, true, isTabbed ); previewSection.setPreview( preview ); previewSection.setProvider( provider ); previewSection.setHeight( 160 ); previewSection.setFillPreview( true ); addSection( PageSectionId.PREVIEW_PREVIEW, previewSection ); createSections( ); layoutSections( ); ( (ScrolledComposite) container ).setContent( composite ); }
Example 4
Source File: ProgressReporterWindow.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
private void createControls() { /* * Sets up the shell */ int shellStyle = SWT.DIALOG_TRIM | SWT.RESIZE; if ((style & MODAL) != 0) { shellStyle |= SWT.APPLICATION_MODAL; } shell = ShellFactory.createMainShell(shellStyle); shell.setText(MessageText.getString("progress.window.title")); Utils.setShellIcon(shell); GridLayout gLayout = new GridLayout(); gLayout.marginHeight = 0; gLayout.marginWidth = 0; shell.setLayout(gLayout); /* * Using ScrolledComposite with only vertical scroll */ scrollable = new ScrolledComposite(shell, SWT.V_SCROLL); scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); /* * Main content composite where panels will be created */ scrollChild = new Composite(scrollable, SWT.NONE); GridLayout gLayoutChild = new GridLayout(); gLayoutChild.marginHeight = 0; gLayoutChild.marginWidth = 0; gLayoutChild.verticalSpacing = 0; scrollChild.setLayout(gLayoutChild); scrollable.setContent(scrollChild); scrollable.setExpandVertical(true); scrollable.setExpandHorizontal(true); /* * Re-adjust scrollbar setting when the window resizes */ scrollable.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle r = scrollable.getClientArea(); scrollable.setMinSize(scrollChild.computeSize(r.width, SWT.DEFAULT)); } }); /* * On closing remove all reporters that was handled by this instance of the window from the registry */ shell.addListener(SWT.Close, new Listener() { @Override public void handleEvent(Event event) { /* * Remove this class as a listener to the disposal event for the panels or else * as the shell is closing the panels would be disposed one-by-one and each one would * force a re-layouting of the shell. */ Control[] controls = scrollChild.getChildren(); for (int i = 0; i < controls.length; i++) { if (controls[i] instanceof ProgressReporterPanel) { ((ProgressReporterPanel) controls[i]).removeDisposeListener(ProgressReporterWindow.this); } } /* * Removes all the reporters that is still handled by this window */ for (int i = 0; i < pReporters.length; i++) { reportersRegistry.remove(pReporters[i]); } isShowingEmpty = false; } }); if (pReporters.length == 0) { createEmptyPanel(); } else { createPanels(); } /* * Shows the toolbar if specified */ if ((style & SHOW_TOOLBAR) != 0) { createToolbar(); } isAutoRemove = COConfigurationManager.getBooleanParameter("auto_remove_inactive_items"); }
Example 5
Source File: TmfRawEventViewer.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Create the text area and add listeners */ private void createTextArea(int style) { fScrolledComposite = new ScrolledComposite(this, style); fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fTextArea = new Composite(fScrolledComposite, SWT.NONE); fTextArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fScrolledComposite.setContent(fTextArea); fScrolledComposite.setExpandHorizontal(true); fScrolledComposite.setExpandVertical(true); fScrolledComposite.setAlwaysShowScrollBars(true); fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fScrolledComposite.addControlListener(this); GridLayout textAreaGridLayout = new GridLayout(); textAreaGridLayout.marginHeight = 0; textAreaGridLayout.marginWidth = 0; fTextArea.setLayout(textAreaGridLayout); fStyledText = new StyledText(fTextArea, SWT.READ_ONLY); fStyledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); initializeFonts(); initializeColors(); PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(this); fStyledText.addCaretListener(this); fStyledText.addMouseMoveListener(this); fStyledText.addMouseTrackListener(this); fStyledText.addMouseWheelListener(this); /* disable mouse scroll of horizontal scroll bar */ fStyledText.addListener(SWT.MouseWheel, event -> event.doit = false); fStyledText.addKeyListener(this); fTextArea.setBackground(fStyledText.getBackground()); fTextArea.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { fTextArea.setFocus(); } }); }
Example 6
Source File: SQLDataSetEditorPage.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Creates the composite, for displaying the list of available db objects * * @param parent */ private Control createDBMetaDataSelectionComposite( Composite parent ) { sComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL ); sComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); sComposite.setExpandHorizontal( true ); sComposite.setExpandVertical( true ); sComposite.setMinHeight( 500 ); sComposite.setMinWidth( 250 ); sComposite.addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { computeSize( ); } } ); boolean supportsSchema = false ; boolean supportsProcedure = false; if ( continueConnect ) { supportsSchema = JdbcMetaDataProvider.getInstance( ) .isSupportSchema( ); supportsProcedure = JdbcMetaDataProvider.getInstance( ) .isSupportProcedure( ); } tablescomposite = new Composite( sComposite, SWT.NONE ); tablescomposite.setLayout( new GridLayout( ) ); GridData data = new GridData( GridData.FILL_BOTH ); data.grabExcessVerticalSpace = true; tablescomposite.setLayoutData( data ); createDBObjectTree( tablescomposite ); createObjectTreeMenu(); createSchemaFilterComposite( supportsSchema, supportsProcedure, tablescomposite ); createSQLOptionGroup( tablescomposite ); addDragSupportToTree( ); // bidi_hcg: pass value of metadataBidiFormatStr addFetchDbObjectListener( metadataBidiFormatStr ); sComposite.setContent( tablescomposite ); return tablescomposite; }
Example 7
Source File: HyperlinkBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Control createDialogArea( Composite parent ) { Composite composite = (Composite) super.createDialogArea( parent ); createSelectionArea( composite ); new Label( composite, SWT.SEPARATOR | SWT.HORIZONTAL ).setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); scrollContent = new ScrolledComposite( composite, SWT.H_SCROLL | SWT.V_SCROLL ); scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) ); scrollContent.setExpandHorizontal( true ); scrollContent.setExpandVertical( true ); scrollContent.addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { computeSize( ); } } ); Shell shell = PlatformUI.getWorkbench( ) .getActiveWorkbenchWindow( ) .getShell( ); int height = shell.getBounds( ).height < 510 + 200 ? shell.getBounds( ).height - 200 : 510; if ( !bTargetEnabled ) { height -= 70; } if ( !bTooltipEnabled ) { height -= 50; } GridData gd = new GridData( GridData.FILL_BOTH ); gd.minimumWidth = 600; gd.minimumHeight = height; scrollContent.setLayoutData( gd ); displayArea = new Composite( scrollContent, SWT.NONE ); displayArea.setLayout( new GridLayout( 3, false ) ); displayArea.setLayoutData( new GridData( GridData.FILL_BOTH ) ); scrollContent.setContent( displayArea ); new Label( composite, SWT.SEPARATOR | SWT.HORIZONTAL ).setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); UIUtil.bindHelp( parent, IHelpContextIds.HYPERLINK_BUILDER_ID ); return composite; }
Example 8
Source File: ComponentPropertySection.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * This operation draws the controls in the properties view based on the * input. */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); // Get the default background color (white). Color backgroundColor = parent.getBackground(); // Create a section for the data composites. section = getWidgetFactory().createSection(parent, ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION); section.setText("Node properties"); section.setDescription("All properties available for " + "this node can be modified here."); section.setBackground(backgroundColor); // Create the Composite that contains all DataComponentComposites. final Composite client = new Composite(section, SWT.NONE); // Set the layout of the client area so that all DataComponentComposites // are stacked on top of each other. GridLayout clientLayout = new GridLayout(); // Set the margins and spacing based on the tabbed property constants. clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN; clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN; clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN; clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN; clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE; clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE; client.setLayout(clientLayout); // Make the background of the section client white unless ICE is in // debug mode. if (System.getProperty("DebugICE") == null) { client.setBackground(backgroundColor); } else { client.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_RED)); } // Set the client area for the section. section.setClient(client); // Get the property viewer's ScrolledComposite and its first Composite // (its "client" Composite). scrollCompositeClient = section.getParent().getParent().getParent() .getParent(); scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent(); // Add a listener to resize the Section's properties and update the // ScrollComposite's minimum bounds correctly based on the displayed // properties. scrollComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { resizeProperties(); } }); return; }
Example 9
Source File: TreePropertySection.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * This operation draws the (initial) controls in the properties view based * on the input. In this case, there are initially no widgets to prepare. */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); // Get the default background color. Color backgroundColor = parent.getBackground(); // Create a section for the data composites. section = getWidgetFactory().createSection(parent, ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION); section.setText("Node properties"); section.setDescription("All properties available for " + "this node can be modified here."); section.setBackground(backgroundColor); // Create the Composite that contains all DataComponentComposites. final Composite client = new Composite(section, SWT.NONE); GridLayout clientLayout = new GridLayout(2, false); // Set the margins and spacing based on the tabbed property constants. clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN; clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN; clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN; clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN; clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE; clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE; client.setLayout(clientLayout); // Make the background of the section client white unless ICE is in // debug mode. if (System.getProperty("DebugICE") == null) { client.setBackground(backgroundColor); } else { client.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_RED)); } // Set the client area for the section. section.setClient(client); // Get the property viewer's ScrolledComposite and its first Composite // (its "client" Composite). scrollCompositeClient = section.getParent().getParent().getParent() .getParent(); scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent(); // Add a listener to resize the Section's properties and update the // ScrollComposite's minimum bounds correctly based on the displayed // properties. scrollComposite.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { resizePropertyView(); } }); // Create the type Combo Composite. typeComposite = createTypeComposite(client); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.horizontalSpan = 2; typeComposite.setLayoutData(gridData); // Refresh the contents of the type Combo and its containing Composite. refreshTypeWidgets(); // Create the table of properties. tableViewer = createTableViewer(client); // Set the table's layout data so it occupies all spare space in the // property section client. tableViewer.getControl() .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Create the add/delete buttons. Composite buttonComposite = createButtons(client); // The button Composite shouldn't grab any space. Align it along the // center and top of the space to the right of the table. buttonComposite .setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); return; }