Java Code Examples for org.eclipse.swt.SWT#VERTICAL

The following examples show how to use org.eclipse.swt.SWT#VERTICAL . 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: CommitSetDialog.java    From APICloud-Studio with GNU General Public License v3.0 7 votes vote down vote up
private void createOptionsArea(Composite composite) {
Composite radioArea = new Composite(composite, SWT.NONE);
RowLayout radioAreaLayout = new RowLayout(SWT.VERTICAL);
radioAreaLayout.marginLeft = 0;
radioAreaLayout.marginRight = 0;
radioAreaLayout.marginTop = 0;
radioAreaLayout.marginBottom = 0;
radioArea.setLayout(radioAreaLayout);

      useTitleButton = createRadioButton(radioArea, Policy.bind("CommitSetDialog_2")); 
      enterCommentButton = createRadioButton(radioArea, Policy.bind("CommitSetDialog_3")); 
      SelectionAdapter listener = new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
              updateEnablements();
          }
      };
      useTitleButton.addSelectionListener(listener);
      enterCommentButton.addSelectionListener(listener);
      
  }
 
Example 2
Source File: TaskSelectType.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void placeComponents( )
{
	foSashForm = new SashForm( topControl, SWT.VERTICAL );
	{
		GridLayout layout = new GridLayout( );
		foSashForm.setLayout( layout );
		GridData gridData = new GridData( GridData.FILL_BOTH );
		// TODO verify Bug 194391 in Linux
		gridData.heightHint = 680;
		foSashForm.setLayoutData( gridData );
	}
	createTopPreviewArea( foSashForm );
	createBottomTypeArea( foSashForm );
	
	initUIPropertiesAndData( );
}
 
Example 3
Source File: SWTSeparator.java    From tuxguitar with GNU Lesser General Public License v2.1 6 votes vote down vote up
public UIRectangle createTargetBounds() {
	float x = this.bounds.getX();
	float y = this.bounds.getY();
	float width = this.bounds.getWidth();
	float height = this.bounds.getHeight();
	
	Point computedSize = this.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
	if((this.orientationStyle & SWT.VERTICAL) != 0) {
		x = (x + (width / 2) - (computedSize.x / 2));
		width = computedSize.x;
	} else {
		y = (y + (height / 2) - (computedSize.y / 2));
		height = computedSize.y;
	}
	
	return new UIRectangle(x, y, width, height);
}
 
Example 4
Source File: TestViewLayoutHelper.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Updates the sash layout to match the layout state.
 */
void updateSashLayout() {
	int sashLayout = SWT.VERTICAL;
	switch (orientation) {
	case TestViewLayoutHelper.VIEW_ORIENTATION_VERTICAL:
		break;
	case TestViewLayoutHelper.VIEW_ORIENTATION_HORIZONTAL:
		sashLayout = SWT.HORIZONTAL;
		break;
	default: // TestViewLayoutHelper.VIEW_ORIENTATION_AUTOMATIC:
		Point size = sash.getParent().getSize();
		sashLayout = size.x > size.y ? SWT.HORIZONTAL : SWT.VERTICAL;
	}
	if (sashLayout != sash.getOrientation()) {
		sash.setOrientation(sashLayout);
	}
}
 
Example 5
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	parent.setLayout(new FillLayout(SWT.VERTICAL));
	Composite top = kit.createComposite(parent);
	top.setLayout(new GridLayout(2, false));
	SashForm sash = new SashForm(top, SWT.VERTICAL | SWT.SMOOTH);
	sash.setSashWidth(2);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(sash);
	createSimulationSessionViewer(sash);
	createExecutionContextViewer(sash);
	sash.setWeights(new int[] { 1, 5 });
	IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
	addSimulationSessionActions(mgr);
	super.createPartControl(parent);
}
 
Example 6
Source File: SearchDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private Composite createOptionsPanel(final Composite composite) {
	final Composite row = new Composite(composite, SWT.NONE);
	row.setLayout(new GridLayout(2,true));
	
	final Group directionGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(directionGroup);
	directionGroup.setText("Direction");
	final RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
	rowLayout.marginHeight = rowLayout.marginWidth = 3;
	directionGroup.setLayout(rowLayout);
	forwardButton = new Button(directionGroup, SWT.RADIO);
	forwardButton.setText("F&orward");
	forwardButton.setSelection(true);
	final Button backwardButton = new Button(directionGroup, SWT.RADIO);
	backwardButton.setText("&Backward");

	final Group optionsGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsGroup);
	optionsGroup.setText("Options");
	optionsGroup.setLayout(rowLayout);
	caseSensitiveButton = new Button(optionsGroup, SWT.CHECK);
	caseSensitiveButton.setText("&Case Sensitive");
	wrapSearchButton = new Button(optionsGroup, SWT.CHECK);
	wrapSearchButton.setText("&Wrap Search");
	wrapSearchButton.setSelection(true);
	
	return row;
}
 
Example 7
Source File: CustomXmlParserOutputWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout());

    sash = new SashForm(container, SWT.VERTICAL);
    sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_GRAY));

    outputsScrolledComposite = new ScrolledComposite(sash, SWT.V_SCROLL);
    outputsScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    outputsContainer = new Composite(outputsScrolledComposite, SWT.NONE);
    final GridLayout outputsLayout = new GridLayout(4, false);
    outputsLayout.marginHeight = 10;
    outputsLayout.marginWidth = 0;
    outputsContainer.setLayout(outputsLayout);
    outputsScrolledComposite.setContent(outputsContainer);
    outputsScrolledComposite.setExpandHorizontal(true);
    outputsScrolledComposite.setExpandVertical(true);

    outputsContainer.layout();

    outputsScrolledComposite.setMinSize(outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-5);

    tableContainer = new Composite(sash, SWT.NONE);
    final GridLayout tableLayout = new GridLayout();
    tableLayout.marginHeight = 0;
    tableLayout.marginWidth = 0;
    tableContainer.setLayout(tableLayout);
    previewTable = new TmfEventsTable(tableContainer, 0, CustomEventAspects.generateAspects(new CustomXmlTraceDefinition()));
    previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    if (wizard.definition != null) {
        loadDefinition(wizard.definition);
    }
    setControl(container);

}
 
Example 8
Source File: StarRating.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static int checkStyle(int style) {
	if ((style & SWT.VERTICAL) != 0) {
		style = style & ~SWT.VERTICAL;
	}

	if ((style & SWT.HORIZONTAL) != 0) {
		style = style & ~SWT.HORIZONTAL;
	}
	return style;
}
 
Example 9
Source File: SelectArtifactToDeployPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createToolbarComposite(DataBindingContext ctx, Composite parent) {
    Composite composite = new Composite(parent, SWT.INHERIT_FORCE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(0, 0, 8, 0).create());
    composite.setLayoutData(
            GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).create());

    Button onlyLatestProcessVersionButton = new Button(composite, SWT.CHECK);
    onlyLatestProcessVersionButton.setText(Messages.selectLatestVersion);

    ctx.bindValue(WidgetProperties.selection().observe(onlyLatestProcessVersionButton),
            PojoProperties.value("latestVersionOnly").observe(this));

    ToolBar toolBar = new ToolBar(composite, SWT.HORIZONTAL | SWT.RIGHT | SWT.NO_FOCUS | SWT.FLAT);

    new ToolItem(toolBar, SWT.SEPARATOR | SWT.VERTICAL);

    ToolItem expandAll = new ToolItem(toolBar, SWT.PUSH);
    expandAll.setImage(Pics.getImage(PicsConstants.expandAll));
    expandAll.setToolTipText(Messages.expandAll);
    expandAll.addListener(SWT.Selection, e -> fileStoreViewer.expandAll());

    ToolItem collapseAll = new ToolItem(toolBar, SWT.PUSH);
    collapseAll.setImage(Pics.getImage(PicsConstants.collapseAll));
    collapseAll.setToolTipText(Messages.collapseAll);
    collapseAll.addListener(SWT.Selection, e -> fileStoreViewer.collapseAll());
}
 
Example 10
Source File: ItemView.java    From http4e with Apache License 2.0 5 votes vote down vote up
private Control buildBottomControl( final Composite parent){
   Composite bottom = new Composite(parent, SWT.NULL);
   FillLayout layout = new FillLayout();
   bottom.setLayout(layout);
   bottom.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));

   vSash = new SashForm(bottom, SWT.HORIZONTAL);
   vSash.setLayout(layout);

   Composite leftBottom = new Composite(vSash, SWT.NULL);
   leftBottom.setLayout(new FillLayout(SWT.VERTICAL));
   hSash = new SashForm(leftBottom, SWT.VERTICAL);
   hSash.setLayout(layout);

   requestView = new RequestView(model, vSash);
   responseView = new ResponseView(model, vSash);

   vSash.setWeights(model.getVSashWeights());

   headerView = new HeaderView(model, hSash);
   paramView = new ParamView(model, hSash);
   bodyView = new BodyView(model, hSash);

   hSash.setWeights(model.getHSashWeights());

   return bottom;
}
 
Example 11
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void createControl(Composite parent) {
	initializeDialogUnits(parent);

	Composite supercomposite= new Composite(parent, SWT.NONE);
	supercomposite.setFont(parent.getFont());
	supercomposite.setLayout(new GridLayout());

	createIsEclipseNLSCheckbox(supercomposite);

	createKeyPrefixField(supercomposite);

	SashForm composite= new SashForm(supercomposite, SWT.VERTICAL);
	composite.setFont(supercomposite.getFont());

	GridData data= new GridData(GridData.FILL_BOTH);
	composite.setLayoutData(data);

	createTableViewer(composite);
	createSourceViewer(composite);

	createAccessorInfoComposite(supercomposite);

	composite.setWeights(new int[]{65, 45});

	validateKeys(false);
	updateButtonStates(StructuredSelection.EMPTY);

	// promote control
	setControl(supercomposite);
	Dialog.applyDialogFont(supercomposite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(supercomposite, IJavaHelpContextIds.EXTERNALIZE_WIZARD_KEYVALUE_PAGE);
}
 
Example 12
Source File: TmfRawEventViewer.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void createSlider(int style) {
    fSlider = new Slider(this, SWT.VERTICAL);
    fSlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
    fSlider.setValues(0, 0, SLIDER_MAX, SLIDER_MAX, 1, 1);
    fSlider.addSelectionListener(this);
    fSlider.addMouseListener(this);
    if ((style & SWT.V_SCROLL) == 0) {
        fSlider.setVisible(false);
    }
}
 
Example 13
Source File: SWTFactory.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SuppressWarnings("unchecked")
public UIScale createVerticalScale(UIContainer parent) {
	String alternative = SWTEnvironment.getInstance().getVerticalScaleAlternative();
	if( SWTCustomScale.class.getName().equals(alternative) ) {
		return new SWTCustomScale((SWTContainer<Composite>) parent, false);
	}
	return new SWTScale((SWTContainer<Composite>) parent, SWT.VERTICAL);
}
 
Example 14
Source File: TmDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
	final Sash sash = new Sash(composite, SWT.VERTICAL);
	sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
	sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
	// the following listener resizes the tree control based on sash deltas.
	// If necessary, it will also grow/shrink the dialog.
	sash.addListener(SWT.Selection, new Listener() {
		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
		 */
		public void handleEvent(Event event) {
			if (event.detail == SWT.DRAG) {
				return;
			}
			int shift = event.x - sash.getBounds().x;
			GridData data = (GridData) rightControl.getLayoutData();
			int newWidthHint = data.widthHint + shift;
			if (newWidthHint < 20) {
				return;
			}
			Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
			Point currentSize = getShell().getSize();
			// if the dialog wasn't of a custom size we know we can shrink
			// it if necessary based on sash movement.
			boolean customSize = !computedSize.equals(currentSize);
			data.widthHint = newWidthHint;
			setLastTreeWidth(newWidthHint);
			composite.layout(true);
			// recompute based on new widget size
			computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
			// if the dialog was of a custom size then increase it only if
			// necessary.
			if (customSize) {
				computedSize.x = Math.max(computedSize.x, currentSize.x);
			}
			computedSize.y = Math.max(computedSize.y, currentSize.y);
			if (computedSize.equals(currentSize)) {
				return;
			}
			setShellSize(computedSize.x, computedSize.y);
			lastShellSize = getShell().getSize();
		}
	});
	return sash;
}
 
Example 15
Source File: TmDbManagerDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
	final Sash sash = new Sash(composite, SWT.VERTICAL);
	sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
	sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
	// the following listener resizes the tree control based on sash deltas.
	// If necessary, it will also grow/shrink the dialog.
	sash.addListener(SWT.Selection, new Listener() {
		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
		 */
		public void handleEvent(Event event) {
			if (event.detail == SWT.DRAG) {
				return;
			}
			int shift = event.x - sash.getBounds().x;
			GridData data = (GridData) rightControl.getLayoutData();
			int newWidthHint = data.widthHint + shift;
			if (newWidthHint < 20) {
				return;
			}
			Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
			Point currentSize = getShell().getSize();
			// if the dialog wasn't of a custom size we know we can shrink
			// it if necessary based on sash movement.
			boolean customSize = !computedSize.equals(currentSize);
			data.widthHint = newWidthHint;
			setLastTreeWidth(newWidthHint);
			composite.layout(true);
			// recompute based on new widget size
			computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
			// if the dialog was of a custom size then increase it only if
			// necessary.
			if (customSize) {
				computedSize.x = Math.max(computedSize.x, currentSize.x);
			}
			computedSize.y = Math.max(computedSize.y, currentSize.y);
			if (computedSize.equals(currentSize)) {
				return;
			}
			setShellSize(computedSize.x, computedSize.y);
			lastShellSize = getShell().getSize();
		}
	});
	return sash;
}
 
Example 16
Source File: GridPrintVerticalAlignmentExample.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static Print createPrint() {
	DefaultGridLook look = new DefaultGridLook(5, 5);
	look.setHeaderGap(5);
	GridPrint grid = new GridPrint("d:g, d, d:g, d, d:g, d, d:g", look);

	ImageData imageData = new ImageData(
			GridPrintVerticalAlignmentExample.class
					.getResourceAsStream("logo.png"));
	ImagePrint image = new ImagePrint(imageData);
	image.setDPI(300, 300);

	Print verticalRule = new LinePrint(SWT.VERTICAL);

	grid.addHeader(SWT.CENTER, SWT.DEFAULT, new TextPrint("Column 1"));
	grid.addHeader(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.addHeader(SWT.CENTER, SWT.DEFAULT, new TextPrint("Column 2"));
	grid.addHeader(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.addHeader(SWT.CENTER, SWT.DEFAULT, new TextPrint("Column 3"));
	grid.addHeader(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.addHeader(SWT.CENTER, SWT.DEFAULT, new TextPrint("Column 4"));

	grid.addHeader(new LinePrint(SWT.HORIZONTAL), GridPrint.REMAINDER);

	grid.add(SWT.LEFT, SWT.CENTER, image);
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.DEFAULT, SWT.DEFAULT,
			new TextPrint("triple\nline\nleft\n"));
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.CENTER, SWT.CENTER,
			new TextPrint("double line\ncenter", SWT.CENTER));
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.RIGHT, SWT.BOTTOM, new TextPrint("single line right"));

	grid.add(new LinePrint(SWT.HORIZONTAL), GridPrint.REMAINDER);

	grid.add(SWT.CENTER, SWT.CENTER,
			new TextPrint("several\nlines\nof\ntext\nhere", SWT.CENTER));
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.LEFT, SWT.FILL, verticalRule);
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.CENTER, SWT.FILL, verticalRule);
	grid.add(SWT.DEFAULT, SWT.FILL, verticalRule);
	grid.add(SWT.RIGHT, SWT.FILL, verticalRule);

	return grid;
}
 
Example 17
Source File: TransHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public TransHistoryLogTab( CTabFolder tabFolder, LogTableInterface logTable ) {
  super( tabFolder, SWT.NONE );
  setLogTable( logTable );

  setText( logTable.getLogTableType() );

  Composite logTableComposite = new Composite( tabFolder, SWT.NONE );
  logTableComposite.setLayout( new FormLayout() );
  spoon.props.setLook( logTableComposite );

  setControl( logTableComposite );

  SashForm sash = new SashForm( logTableComposite, SWT.VERTICAL );
  sash.setLayout( new FillLayout() );
  FormData fdSash = new FormData();
  fdSash.left = new FormAttachment( 0, 0 ); // First one in the left top corner
  fdSash.top = new FormAttachment( 0, 0 );
  fdSash.right = new FormAttachment( 100, 0 );
  fdSash.bottom = new FormAttachment( 100, 0 );
  sash.setLayoutData( fdSash );

  logDisplayTableView = createTransLogTableView( sash );

  if ( logTable.getLogField() != null ) {
    logDisplayText = new Text( sash, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY );
    spoon.props.setLook( logDisplayText );
    logDisplayText.setVisible( true );

    FormData fdText = new FormData();
    fdText.left = new FormAttachment( 0, 0 );
    fdText.top = new FormAttachment( 0, 0 );
    fdText.right = new FormAttachment( 100, 0 );
    fdText.bottom = new FormAttachment( 100, 0 );
    logDisplayText.setLayoutData( fdText );

    sash.setWeights( new int[] { 70, 30, } );
  } else {
    logDisplayText = null;
    sash.setWeights( new int[] { 100, } );
  }
}
 
Example 18
Source File: BonitaSashForm.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void getNewSashArray(SashInfo sashInfo, int[] addArrowTypes, int[] drawArrowTypes) {

        //		int[][] thisSash = sashInfo.sashLocs;
        //		if (thisSash == null)
        sashInfo.sashLocs = new int[addArrowTypes.length][];
        int[][] thisSash = sashInfo.sashLocs;

        int aSize = ARROW_WIDTH;	// Width of arrow
        int tSize = aSize+2*ARROW_MARGIN;		// Total Width (arrow + margin)
        int neededSize = tSize*addArrowTypes.length;

        boolean vertical = getOrientation() == SWT.VERTICAL;
        Point s = sashInfo.sash.getSize();
        int start = 0;
        int x = 0;
        int y = 0;
        int width = 0;
        int height = 0;
        if (vertical) {
            start = (s.x - neededSize) / 2;
            x = start;
            y = (s.y - ARROW_HEIGHT) / 2;	// Center vertically, no margin required.
            width = tSize;
            height = aSize;
        } else {
            start = (s.y - neededSize) / 2;
            y = start;
            x = (s.x - ARROW_HEIGHT) / 2;	// Center horizontally, no margin required.
            width = aSize;
            height = tSize;
        }
        for (int j=0; j<addArrowTypes.length; j++) {
            if (thisSash[j] == null) {
                thisSash[j] = new int[] {addArrowTypes[j], drawArrowTypes[j], x, y, width, height};
            } else {
                // Reuse the array
                thisSash[j][ARROW_TYPE_INDEX] = addArrowTypes[j];
                thisSash[j][ARROW_DRAWN_INDEX] = drawArrowTypes[j];
                thisSash[j][X_INDEX] = x;
                thisSash[j][Y_INDEX] = y;
                thisSash[j][WIDTH_INDEX] = width;
                thisSash[j][HEIGHT_INDEX] = height;
            }
            if (vertical) {
                x+=tSize;
            } else {
                y+=tSize;
            }
        }
    }
 
Example 19
Source File: DatePicker.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * create the Calendar's body, which contains the dayLabels and dayButtons
 */
private void createBody() {
    body = new VPanel(this, SWT.NONE);
    body.setData(CDT.PickerPart, PickerPart.BodyPanel);
    body.setPainter(cdt.getPainter());
    cdt.getPainter().update(body);
    VGridLayout layout = new VGridLayout(1, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    body.setLayout(layout);
    body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    addBodyPanel();

    for (Body b : cdt.builder.getBodies()) {
        if (b.newColumn) {
            VLabel sep = new VLabel(body, SWT.SEPARATOR | SWT.VERTICAL);
            sep.setLayoutData(
                    new GridData(SWT.FILL, SWT.FILL, false, false));
            body.getLayout(VGridLayout.class).numColumns++;
            addBodyPanel();
        }
        switch (b.type) {
        case Body.DAYS:
            createDays(b);
            break;
        case Body.MONTHS:
            createMonths(b);
            break;
        case Body.TIME:
            createTime(b);
            break;
        case Body.YEARS:
            createYears(b);
            break;
        }
    }

    for (VPanel bodyPanel : bodyPanels) {
        bodyPanel.getLayout(VStackLayout.class).setTopControl(null);
    }
}
 
Example 20
Source File: UrbanSashForm.java    From http4e with Apache License 2.0 2 votes vote down vote up
/**
 * Returns SWT.HORIZONTAL if the controls in the SashForm are laid out side
 * by side or SWT.VERTICAL if the controls in the SashForm are laid out top
 * to bottom.
 * 
 * @return SWT.HORIZONTAL or SWT.VERTICAL
 */
public int getOrientation(){
    // checkWidget();
    return (sashStyle & SWT.VERTICAL) != 0 ? SWT.HORIZONTAL : SWT.VERTICAL;
}