Java Code Examples for org.eclipse.swt.custom.ScrolledComposite#setExpandVertical()

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite#setExpandVertical() . 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: UpdaterDialog.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
private void createFeatureListTab(TabFolder tabFolder, ActiveTab type) {
	TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
	if (type == ActiveTab.ALL_FEATURES) {
		tabItem.setText(ALL_FEATURES_TAB_TITLE);
	} else {
		tabItem.setText(UPDATES_TAB_TITLE);
	}
	ScrolledComposite scroll = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
	scroll.setLayout(new GridLayout());
	scroll.setLayoutData(new GridData());

	Group group = new Group(scroll, SWT.NONE);
	group.setLayout(new GridLayout());
	group.setLayoutData(new GridData());
	listFeatures(group, type);
	scroll.setContent(group);
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	scroll.setMinSize(group.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	tabItem.setControl(scroll);
}
 
Example 2
Source File: PipelineArgumentsTabTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void assertRunnerButtonChecked() throws CoreException {
  ILaunchConfigurationDialog dialog = mock(ILaunchConfigurationDialog.class);
  Shell shell = shellResource.getShell();
  PipelineArgumentsTab tab = new PipelineArgumentsTab();
  tab.setLaunchConfigurationDialog(dialog);
  ScrolledComposite scrolledComposite =
      new ScrolledComposite(shellResource.getShell(), SWT.V_SCROLL | SWT.H_SCROLL);
  scrolledComposite.setExpandHorizontal(true);
  scrolledComposite.setExpandVertical(true);
  tab.createControl(scrolledComposite);

  PipelineLaunchConfiguration launchConfig = PipelineLaunchConfiguration
      .fromLaunchConfiguration(testParameter.majorVersion, mock(ILaunchConfiguration.class));
  tab.updateRunnerButtons(launchConfig);
  Button runnerButton = getCheckedRunnerButton(shell);
  assertNotNull(runnerButton);
  assertEquals(testParameter.expectedButtonText, runnerButton.getText());
  assertTrue(runnerButton.getSelection());

  // Should not throw IllegalStateException:
  // https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2136
  tab.getSelectedRunner();
  testScrollbar(tab);
}
 
Example 3
Source File: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void mainLayout( Class<?> PKG, String prefix, Image img ) {
  display = parent.getDisplay();
  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX );
  props.setLook( shell );
  shell.setImage( img );
  shell.setLayout( new FormLayout() );
  shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) );

  scContainer = new ScrolledComposite( shell, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL );
  scContainer.setLayout( new FormLayout() );
  FormData fd = new FormData();
  fd.top = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.bottom = new FormAttachment( 100, -Const.FORM_MARGIN );
  fd.left = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.right = new FormAttachment( 100, -Const.FORM_MARGIN );
  scContainer.setLayoutData( fd );
  scContainer.setExpandHorizontal( true );
  scContainer.setExpandVertical( true );
  cContainer = new Composite( scContainer, SWT.NONE );
  scContainer.setContent( cContainer );
  cContainer.setLayout( new FormLayout() );
  cContainer.setBackground( shell.getBackground() );
  cContainer.setParent( scContainer );
}
 
Example 4
Source File: ArtikelDetailDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	ScrolledComposite ret = new ScrolledComposite(parent, SWT.V_SCROLL);
	Composite cnt = new Composite(ret, SWT.NONE);
	ret.setContent(cnt);
	ret.setExpandHorizontal(true);
	ret.setExpandVertical(true);
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	cnt.setLayout(new FillLayout());
	AutoForm tblArtikel = null;
	if (article instanceof Identifiable) {
		tblArtikel = new LabeledInputField.AutoForm(cnt,
			Artikeldetail.getModelFieldDefs(parent.getShell()));
	} else {
		tblArtikel =
			new LabeledInputField.AutoForm(cnt, Artikeldetail.getFieldDefs(parent.getShell()));
	}
	tblArtikel.reload(article);
	ret.setMinSize(cnt.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	return ret;
}
 
Example 5
Source File: TaskSelectType.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createBottomTypeArea( Composite parent )
{
	ScrolledComposite sc = new ScrolledComposite( parent, SWT.V_SCROLL
			| SWT.H_SCROLL );
	{
		GridLayout layout = new GridLayout( );
		sc.setLayout( layout );
		GridData gridData = new GridData( GridData.FILL_BOTH );
		sc.setLayoutData( gridData );
		sc.setExpandHorizontal( true );
		sc.setExpandVertical( true );
	}

	cmpType = new Composite( sc, SWT.NONE );
	cmpType.setLayout( new GridLayout( 2, false ) );
	cmpType.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	sc.setContent( cmpType );

	createLeftTypeTable( cmpType );
	populateChartTypes( );

	createRightDetails( cmpType );

	Point size = cmpType.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	sc.setMinSize( size );
}
 
Example 6
Source File: MainView.java    From mappwidget with Apache License 2.0 6 votes vote down vote up
private void fillTop(Composite top, ScrolledComposite scrolledComposite)
{
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;

	GridData data = new GridData();
	data.grabExcessHorizontalSpace = true;
	data.horizontalAlignment = GridData.FILL;

	top.setLayoutData(data);
	top.setLayout(layout);

	scrolledComposite.setMinSize(500, 250);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	scrolledComposite.setContent(top);
}
 
Example 7
Source File: PropertiesView.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	parent.setLayout(new FillLayout());
	addToolBarAction();
	scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	scrolledComposite.setLayout(new FillLayout());
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	compostie = new Composite(scrolledComposite, SWT.NONE);
	compostie.setLayout(new GridLayout(1, false));

	// TU 属性
	TableViewer tbvTu = createTuAttrTable(createMenuManager());
	tableViewerManager.put(TU_ATTRS, tbvTu);

	// TUV 属性
	TableViewer tbvProp = createTuPropTable(createMenuManager());
	tableViewerManager.put(TU_NODE_PROPS, tbvProp);

	// Prop 节点
	TableViewer tbvTuv = createTuvAttrTable(createMenuManager());
	tableViewerManager.put(TUV_ATTRS, tbvTuv);

	// Note 节点
	TableViewer tbvNote = createTuNoteTable(createMenuManager());
	tableViewerManager.put(TU_NODE_NOTE, tbvNote);

	scrolledComposite.setContent(compostie);
	scrolledComposite.setMinSize(compostie.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	setGlobalActionHandler();
}
 
Example 8
Source File: TestDatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void buildListOfOutputForOneRowNCols(final ScrolledComposite scrolledComposite,final EMFDataBindingContext context) {
	if(scrolledComposite.getContent() != null){
		scrolledComposite.getContent().dispose();
		scrolledComposite.setContent(null);
	}
	final Composite oneRowNColsComposite = new Composite(scrolledComposite, SWT.NONE) ;
	oneRowNColsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ;
	oneRowNColsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).create());


	final ConnectorConfiguration configuration = getConnector().getConfiguration();
	final Expression scriptExpression = (Expression) getConnectorParameter(configuration, getInput(SCRIPT_KEY)).getExpression();
	final List<Operation> operations = getOuputOperationsFor(ONEROW_NCOL_RESULT_OUTPUT,scriptExpression);
	for(final Operation op : operations){
		final Label expressionLabel = new Label(oneRowNColsComposite, SWT.READ_ONLY);
		expressionLabel.setText(Messages.connectorExpressionViewerLabel);

		final Text columnText = new Text(oneRowNColsComposite,SWT.BORDER | SWT.READ_ONLY) ;
		columnText.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create());
		columnText.setText(op.getRightOperand().getName());
	}
	scrolledComposite.setMinSize(oneRowNColsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	scrolledComposite.setContent(oneRowNColsComposite);
}
 
Example 9
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
	layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
	layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
	layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
	composite.setLayout( layout );
	composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	applyDialogFont( composite );

	new Label( composite, SWT.NONE ).setText( Messages.getString( "InputParameterDialog.msg.requiredParam" ) ); //$NON-NLS-1$

	scrollPane = new ScrolledComposite( composite, SWT.H_SCROLL
			| SWT.V_SCROLL );
	scrollPane.setExpandHorizontal( true );
	scrollPane.setExpandVertical( true );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.widthHint = 400;
	gd.heightHint = 400;
	scrollPane.setLayoutData( gd );

	createParameters( );

	UIUtil.bindHelp( parent, IHelpContextIds.INPUT_PARAMETERS_DIALOG_ID );

	return composite;
}
 
Example 10
Source File: PrintViewer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructs a PrintPreview with the given parent and style.
 *
 * @param parent
 *            the parent component of the scroll pane.
 * @param style
 *            the style of the scroll pane.
 */
public PrintViewer(Composite parent, int style) {
	sc = new ScrolledComposite(parent, style | SWT.V_SCROLL | SWT.H_SCROLL);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	sc.addListener(SWT.Resize, event -> {
		if (sc.getClientArea().width != canvasWidth)
			updateCanvas();
	});
	canvas = new PrintPieceCanvas(sc, SWT.DOUBLE_BUFFERED);
	sc.setContent(canvas);
}
 
Example 11
Source File: TemplateSelectionPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a scrolled, plain-text, preview area for the template.
 * 
 * @param composite
 *            Parent composite.
 */
protected void createPreview(Composite composite)
{
	scroll = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	scroll.setLayout(new GridLayout());
	GridData gd = new GridData(GridData.FILL_BOTH);
	scroll.setLayoutData(gd);
	templatePreview = new Text(scroll, SWT.MULTI | SWT.READ_ONLY);
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	scroll.setContent(templatePreview);
}
 
Example 12
Source File: TaskSelectionPage.java    From CogniCrypt with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createControl(final Composite parent) {
	final List<Task> tasks = TaskJSONReader.getTasks();

	final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	this.container = new Composite(sc, SWT.NONE);
	this.container.setBounds(10, 10, 450, 200);

	//To display the Help view after clicking the help icon
	PlatformUI.getWorkbench().getHelpSystem().setHelp(sc, "de.cognicrypt.codegenerator.TaskSelectionHelp");

	final GridLayout gl = new GridLayout(2, false);
	gl.verticalSpacing = -6;
	this.container.setLayout(gl);

	new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
	new Label(this.container, SWT.NONE);
	final Label useCaseDescriptionLabel = new Label(this.container, SWT.WRAP);
	final GridData gd_selectProjectLabel = new GridData(SWT.FILL, SWT.FILL, false, false, 1, tasks.size() + 1);
	gd_selectProjectLabel.heightHint = 200;
	gd_selectProjectLabel.widthHint = 600;
	useCaseDescriptionLabel.setLayoutData(gd_selectProjectLabel);
	Font a = useCaseDescriptionLabel.getFont();
	useCaseDescriptionLabel.setFont(new Font(useCaseDescriptionLabel.getDisplay(), new FontData(a.getFontData()[0].getName(), 12, SWT.None)));

	final List<Button> buttons = new ArrayList<Button>();
	final List<Image> unclickedImages = new ArrayList<Image>();
	new Label(this.container, SWT.NONE);
	for (Task ccTask : tasks) {
		final Image taskImage = loadImage(ccTask.getImage());
		unclickedImages.add(taskImage);

		final Button taskButton = createImageButton(this.container, taskImage, ccTask.getDescription());
		buttons.add(taskButton);
	}
	buttons.stream().forEach(e -> e.addListener(SWT.Selection, new SelectionButtonListener(buttons, unclickedImages, tasks, useCaseDescriptionLabel)));
	buttons.get(0).notifyListeners(SWT.Selection, new Event());

	setControl(this.container);
	new Label(this.container, SWT.NONE);
	new Label(this.container, SWT.NONE);

	sc.setContent(this.container);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	sc.setMinSize(this.container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	setControl(sc);
}
 
Example 13
Source File: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.OutputRowsSource.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wOutputRowsSource = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wOutputRowsSource );
    wOutputRowsSource.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wOutputRowsSource.setLayoutData( fdResultRowsTarget );

    wlOutputFields = new Label( wInputComposite, SWT.NONE );
    wlOutputFields.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlOutputFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wOutputRowsSource, 10 );
    wlOutputFields.setLayoutData( fdlResultFields );

    int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 );

    ColumnInfo[] ciResultFields =
      new ColumnInfo[] {
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Field" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Type" ),
          ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Length" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Precision" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ), };

    wOutputFields =
      new TableView( transMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlOutputFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wOutputFields.setLayoutData( fdResultFields );
    wOutputFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 14
Source File: GanttTester.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public GanttTester() {
    final Display display = Display.getDefault(); //new Display();
    final Monitor m = display.getMonitors()[0];
    final Shell shell = new Shell(display);
    shell.setText("GanttChart Test Application");
    shell.setLayout(new FillLayout());

    final SashForm sfVSplit = new SashForm(shell, SWT.VERTICAL);
    final SashForm sfHSplit = new SashForm(sfVSplit, SWT.HORIZONTAL);

    final ViewForm vfBottom = new ViewForm(sfVSplit, SWT.NONE);
    _vfChart = new ViewForm(sfHSplit, SWT.NONE);
    final ViewForm rightForm = new ViewForm(sfHSplit, SWT.NONE);

    final ScrolledComposite sc = new ScrolledComposite(rightForm, SWT.V_SCROLL | SWT.H_SCROLL);
    rightForm.setContent(sc);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.getVerticalBar().setPageIncrement(150);

    final Composite rightComposite = new Composite(sc, SWT.NONE);
    final GridLayout gl = new GridLayout();
    gl.marginLeft = 0;
    gl.marginTop = 0;
    gl.horizontalSpacing = 0;
    gl.verticalSpacing = 0;
    gl.marginBottom = 0;
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    rightComposite.setLayout(gl);

    sc.setContent(rightComposite);

    rightComposite.addListener(SWT.Resize, new Listener() {

        public void handleEvent(final Event event) {
            sc.setMinSize(rightComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }

    });

    sfVSplit.setWeights(new int[] { 91, 9 });
    sfHSplit.setWeights(new int[] { 70, 30 });

    // top left side
    _ganttChart = new GanttChart(_vfChart, SWT.MULTI);
    _vfChart.setContent(_ganttChart);
    _ganttComposite = _ganttChart.getGanttComposite();

    final TabFolder tfRight = new TabFolder(rightComposite, SWT.BORDER);
    final TabItem tiGeneral = new TabItem(tfRight, SWT.NONE);
    tiGeneral.setText("Creation");

    final TabItem tiAdvanced = new TabItem(tfRight, SWT.NONE);
    tiAdvanced.setText("Advanced");

    final TabItem tiEventLog = new TabItem(tfRight, SWT.NONE);
    tiEventLog.setText("Event Log");

    final Composite bottom = new Composite(rightComposite, SWT.NONE);
    bottom.setLayout(new GridLayout());
    createCreateButtons(bottom);

    vfBottom.setContent(createBottom(vfBottom));
    tiGeneral.setControl(createCreationTab(tfRight)); // NOPMD
    tiAdvanced.setControl(createAdvancedTab(tfRight));
    tiEventLog.setControl(createEventLogTab(tfRight));

    shell.setMaximized(true);
    // uncomment to put on right-hand-side monitor
    shell.setLocation(new Point(m.getClientArea().x, 0));

    sc.setMinSize(rightComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    shell.open();

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.removeListener(SWT.KeyDown, _undoRedoListener);

    shell.dispose();
}
 
Example 15
Source File: VisualizeTxtUMLPage.java    From txtUML with Eclipse Public License 1.0 4 votes vote down vote up
private void createPage(Composite parent, IProgressMonitor monitor) {
	if (monitor != null)
		monitor.beginTask("Discovering diagram descriptions...", 100);

	sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	container = new Composite(sc, SWT.NONE);

	GridLayout layout = new GridLayout(4, false);
	container.setLayout(layout);

	final Label label = new Label(container, SWT.TOP);
	label.setText("txtUML Diagrams: ");

	addInitialLayoutFields();

	// diagram descriptions tree
	ScrolledComposite treeComposite = new ScrolledComposite(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	tree = getDiagramTreeViewer(treeComposite, monitor);
	tree.addDoubleClickListener(new IDoubleClickListener() {
		@Override
		public void doubleClick(DoubleClickEvent event) {
			ISelection selection = event.getSelection();
			Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator();
			if (selectedElements.hasNext()) {
				Object selectedElement = selectedElements.next();
				if (selectedElement instanceof IJavaProject) {
					List<Object> expandedElements = new ArrayList<>(Arrays.asList(tree.getExpandedElements()));
					if (expandedElements.contains(selectedElement)) {
						expandedElements.remove(selectedElement);
					} else {
						expandedElements.add(selectedElement);
					}
					tree.setExpandedElements(expandedElements.toArray());
				} else if (selectedElement instanceof IType) {
					List<Object> checkedElements = new ArrayList<>(Arrays.asList(tree.getCheckedElements()));
					boolean isChecked = checkedElements.contains(selectedElement);
					tree.setChecked(selectedElement, !isChecked);
					IType selectedType = (IType) selectedElement;
					if (!isChecked && !txtUMLLayout.contains(selectedType)) {
						txtUMLLayout.add(selectedType);
					} else {
						txtUMLLayout.remove(selectedType);
					}
					selectElementsInDiagramTree(txtUMLLayout.toArray(), true);
				}
			}
		}
	});

	selectElementsInDiagramTree(txtUMLLayout.toArray(), false);
	setExpandedLayouts(txtUMLLayout);

	GridData treeGd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
	treeGd.heightHint = 200;
	treeGd.widthHint = 150;
	GridData labelGd = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
	labelGd.verticalIndent = 5;
	label.setLayoutData(labelGd);
	treeComposite.setLayoutData(treeGd);

	treeComposite.setContent(tree.getControl());
	treeComposite.setExpandHorizontal(true);
	treeComposite.setExpandVertical(true);
	sc.setContent(container);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	container.setSize(container.computeSize(450, 300, true));
	sc.setMinSize(container.getSize());
	sc.setSize(container.getSize());

	setControl(parent);
	setPageComplete(true);
	if (monitor != null)
		monitor.done();
}
 
Example 16
Source File: ConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control doCreateControl(final Composite parent, final EMFDataBindingContext context) {
    final DefinitionResourceProvider messageProvider = getMessageProvider();
    final String outputsDescription = messageProvider.getOutputsDescription(getDefinition());

    scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
    scrolledComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    scrolledComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final AvailableExpressionTypeFilter leftFilter = new AvailableExpressionTypeFilter(new String[] {
            ExpressionConstants.VARIABLE_TYPE,
            ExpressionConstants.DOCUMENT_REF_TYPE });
    final AvailableExpressionTypeFilter rightFilter = new ConnectorOutputAvailableExpressionTypeFilter();

    final Composite mainComposite = new Composite(scrolledComposite, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(5, 5, 5, 0).create());

    if (!Strings.isNullOrEmpty(outputsDescription)) {
        final Link description = new Link(mainComposite, SWT.WRAP);
        description.setLayoutData(GridDataFactory.fillDefaults().grab(false, false).hint(400, SWT.DEFAULT).create());
        description.setText(outputsDescription);
        description.addSelectionListener(new SelectionAdapter() {

            /*
             * (non-Javadoc)
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
            @Override
            public void widgetSelected(SelectionEvent e) {
                IWebBrowser browser;
                try {
                    browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(HELP_BROWSER_ID);
                    browser.openURL(new URL(e.text));
                } catch (final PartInitException | MalformedURLException e1) {
                    BonitaStudioLog.error(e1);
                }

            }
        });
    }

    lineComposite = new WizardPageOperationsComposite(null, mainComposite, rightFilter, leftFilter, isPageFlowContext());
    lineComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 280).create());
    final IExpressionNatureProvider storageExpressionProvider = getStorageExpressionProvider();
    if (storageExpressionProvider != null) {
        lineComposite.setStorageExpressionNatureContentProvider(storageExpressionProvider);
    }
    lineComposite.setContext(context);
    lineComposite.setContext(getElementContainer());
    lineComposite.setEObject(getConnector());
    lineComposite.fillTable();

    scrolledComposite.setContent(mainComposite);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setMinSize(lineComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    return mainComposite;
}
 
Example 17
Source File: WorkflowExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRowsTarget.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wResultRowsTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultRowsTarget );
    wResultRowsTarget.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultRowsTarget.setLayoutData( fdResultRowsTarget );

    wlResultFields = new Label( wInputComposite, SWT.NONE );
    wlResultFields.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlResultFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wResultRowsTarget, 10 );
    wlResultFields.setLayoutData( fdlResultFields );

    int nrRows = ( workflowExecutorMeta.getResultRowsField() != null ? workflowExecutorMeta.getResultRowsField().length : 1 );

    ColumnInfo[] ciResultFields =
      new ColumnInfo[] {
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Field" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Type" ),
          ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Length" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "JobExecutorDialog.ColumnInfo.Precision" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ), };

    wResultRowsFields =
      new TableView( pipelineMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlResultFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wResultRowsFields.setLayoutData( fdResultFields );
    wResultRowsFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 18
Source File: ExportFilterSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Label filterNameLabel = new Label(composite, SWT.NONE);
	filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel"));

	filterNameText = new Text(composite, SWT.BORDER);
	filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Composite optionComposite = new Composite(container, SWT.NONE);
	optionComposite.setLayout(new GridLayout(2, false));
	optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	isAllCbtn = new Button(optionComposite, SWT.RADIO);
	isAllCbtn.setSize(152, 26);
	isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn"));
	isAllCbtn.setSelection(true);

	isAnyCbtn = new Button(optionComposite, SWT.RADIO);
	isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn"));

	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER);
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	dynaComposite = new Composite(scrolledComposite, SWT.NONE);
	dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE)));
	scrolledComposite.setContent(dynaComposite);
	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	GridLayout gl_dynaComposite = new GridLayout(1, false);
	dynaComposite.setLayout(gl_dynaComposite);

	ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType);
	exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	exportFilterComponent.setDeleteButtonEnabled(false);
	dynaComposite.setData("currentNumber", 1);

	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	initData();

	return container;
}
 
Example 19
Source File: JobExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {
  final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
  wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Title" ) );
  wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Tooltip" ) );

  ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
  scrolledComposite.setLayout( new FillLayout() );

  Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
  props.setLook( wInputComposite );

  FormLayout tabLayout = new FormLayout();
  tabLayout.marginWidth = 15;
  tabLayout.marginHeight = 15;
  wInputComposite.setLayout( tabLayout );

  wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFilesTarget );
  wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) );
  FormData fdlResultFilesTarget = new FormData();
  fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
  fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

  wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFilesTarget );
  wResultFilesTarget.addModifyListener( lsMod );
  FormData fdResultFilesTarget = new FormData();
  fdResultFilesTarget.width = 250;
  fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
  fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
  wResultFilesTarget.setLayoutData( fdResultFilesTarget );

  // ResultFileNameField
  //
  wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFileNameField );
  wlResultFileNameField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFileNameField.Label" ) );
  FormData fdlResultFileNameField = new FormData();
  fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
  fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFileNameField.setLayoutData( fdlResultFileNameField );

  wResultFileNameField = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFileNameField );
  wResultFileNameField.addModifyListener( lsMod );
  FormData fdResultFileNameField = new FormData();
  fdResultFileNameField.width = 250;
  fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
  fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
  wResultFileNameField.setLayoutData( fdResultFileNameField );

  wInputComposite.pack();
  Rectangle bounds = wInputComposite.getBounds();

  scrolledComposite.setContent( wInputComposite );
  scrolledComposite.setExpandHorizontal( true );
  scrolledComposite.setExpandVertical( true );
  scrolledComposite.setMinWidth( bounds.width );
  scrolledComposite.setMinHeight( bounds.height );

  wTab.setControl( scrolledComposite );
  wTabFolder.setSelection( wTab );
}
 
Example 20
Source File: TimeGraphLegend.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Creates a states group
 *
 * @param composite
 *            the parent composite
 * @since 3.3
 */
private void addStateGroups(Composite composite) {

    StateItem[] stateTable = fProvider.getStateTable();
    if (stateTable == null) {
        return;
    }
    List<StateItem> stateItems = Arrays.asList(stateTable);
    Collection<StateItem> linkStates = Collections2.filter(stateItems, TimeGraphLegend::isLinkState);

    ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
    sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setLayout(GridLayoutFactory.swtDefaults().margins(200, 0).create());

    Composite innerComposite = new Composite(sc, SWT.NONE);
    fInnerComposite = innerComposite;
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    innerComposite.setLayoutData(gd);
    innerComposite.setLayout(new GridLayout());
    innerComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            /*
             * Find the highest number of columns that fits in the new width
             */
            Point size = innerComposite.getSize();
            List<GridLayout> gridLayouts = getGridLayouts(innerComposite);
            Point minSize = new Point(0, 0);
            for (int columns = 8; columns > 0; columns--) {
                final int numColumns = columns;
                gridLayouts.forEach(gl -> gl.numColumns = numColumns);
                minSize = innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                if (minSize.x <= size.x) {
                    break;
                }
            }
            sc.setMinSize(0, minSize.y);
        }
    });

    sc.setContent(innerComposite);

    createStatesGroup(innerComposite);
    createLinkGroup(linkStates, innerComposite);

    sc.setMinSize(0, innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}