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

The following examples show how to use org.eclipse.swt.SWT#BOTTOM . These examples are extracted from open source projects. 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 Project: SWET   File: ImageLabel.java    License: MIT License 6 votes vote down vote up
@Override
protected void onLayout(Composite composite, boolean flushCache) {

	Rectangle bounds = composite.getBounds();

	Point imgPrefSize = image.computeSize(SWT.DEFAULT, bounds.height);
	Point textPrefSize = text.computeSize(bounds.width - imgPrefSize.x,
			SWT.DEFAULT);

	int y = 0;
	if (alignment == SWT.CENTER)
		y = (bounds.height - textPrefSize.y) / 2;
	else if (alignment == SWT.BOTTOM)
		y = bounds.height - textPrefSize.y;

	image.setBounds(0, 0, imgPrefSize.x, imgPrefSize.y);
	text.setBounds(imgPrefSize.x + hgap, y, textPrefSize.x, textPrefSize.y);

}
 
Example 2
Source Project: birt   File: SortingFormPage.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Layouts widgets for simple UI type.
 * 
 */
protected void normallLayout( )
{
	FormLayout layout = new FormLayout( );
	layout.marginHeight = WidgetUtil.SPACING;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	setLayout( layout );
	// int height = QUICK_BUTTON_HEIGHT - 2;
	FormData data = new FormData( );
	data.right = new FormAttachment( 100 );
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnDel, 0, SWT.LEFT );
	// data.height = height;
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnDel, 0, SWT.BOTTOM );
	data.left = new FormAttachment( title, 0, SWT.LEFT );
	data.right = new FormAttachment( 100 );
	data.bottom = new FormAttachment( 100 );
	table.setLayoutData( data );

}
 
Example 3
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
	shell = new Shell(parentShell, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout());
	shell.setImage(imageManager.get(ImageManager.ICON_DISK));
	setStandardWindowTitle();
	shell.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent event) {
				dispose(event);
			}
		});
		
	CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
	new DiskExplorerTab(tabFolder, disks, imageManager, this);
	diskMapTabs = new DiskMapTab[disks.length];
	for (int i=0; i<disks.length; i++) {
		if (disks[i].supportsDiskMap()) {
			diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
		}
	}
	diskInfoTab = new DiskInfoTab(tabFolder, disks);
	tabFolder.setSelection(tabFolder.getItems()[0]);
	
	
	shell.open();
}
 
Example 4
Source Project: birt   File: FormPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected void simpleLayout( )
{
	FormLayout layout = new FormLayout( );
	layout.marginHeight = WidgetUtil.SPACING;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	setLayout( layout );
	// int height = QUICK_BUTTON_HEIGHT - 2;
	FormData data = new FormData( );
	data.left = new FormAttachment( title, 50, SWT.RIGHT );
	// data.height = Math.max( btnAdd.computeSize( -1, -1 ).y, height );
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.left = new FormAttachment( btnAdd, 0, SWT.RIGHT );
	// data.height = data.height = Math.max( btnDel.computeSize( -1, -1 ).y,
	// height );
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( title, 0, SWT.LEFT );
	int width[] = provider.getColumnWidths( );
	int dataWidth = 0;
	for ( int i = 0; i < width.length; i++ )
	{
		dataWidth += width[i];
	}
	data.right = new FormAttachment( title, dataWidth + 15, SWT.LEFT );
	data.bottom = new FormAttachment( 100 );
	table.setLayoutData( data );
}
 
Example 5
Source Project: birt   File: FormPage.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected void simpleLayout( )
{
	FormLayout layout = new FormLayout( );
	layout.marginHeight = WidgetUtil.SPACING;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	setLayout( layout );
	// int height = QUICK_BUTTON_HEIGHT - 2;
	FormData data = new FormData( );
	data.left = new FormAttachment( 0, 50, SWT.RIGHT );
	// data.height = Math.max( btnAdd.computeSize( -1, -1 ).y, height );
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.left = new FormAttachment( btnAdd, 0, SWT.RIGHT );
	// data.height = data.height = Math.max( btnDel.computeSize( -1, -1 ).y,
	// height );
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( 0, 0, SWT.LEFT );
	int width[] = provider.getColumnWidths( );
	int dataWidth = 0;
	for ( int i = 0; i < width.length; i++ )
	{
		dataWidth += width[i];
	}
	data.right = new FormAttachment( 0, dataWidth + 15, SWT.LEFT );
	data.bottom = new FormAttachment( 100 );
	table.setLayoutData( data );
}
 
Example 6
Source Project: jframe   File: JframeApp.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param content
 */
private void createTabFolder(Composite content) {
    CTabFolder folder = new CTabFolder(content, SWT.BORDER | SWT.BOTTOM);
    // folder.setSimple(false);
    // folder.setUnselectedImageVisible(false);
    // folder.setUnselectedCloseVisible(false);
    // folder.setMinimizeVisible(true);
    // folder.setMaximizeVisible(true);
    // configuration
    CTabItem startTab = new CTabItem(folder, SWT.NONE);
    startTab.setText("TAB1");
    Composite config = createMonitorConfig(folder);
    startTab.setControl(config);

    // monitor info
    CTabItem item = new CTabItem(folder, SWT.NONE);
    item.setText("TAB2");
    Text text = new Text(folder, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    text.setEditable(false);
    showRecvMsg(text);
    item.setControl(text);

    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(CTabFolderEvent event) {
            // if (event.item.equals(specialItem)) {
            // event.doit = false;
            // }
        }
    });
    folder.setSelection(item);

}
 
Example 7
Source Project: http4e   File: BalloonWindow.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set the location of the anchor. This must be one of the following values:
 * SWT.NONE, SWT.LEFT|SWT.TOP, SWT.RIGHT|SWT.TOP, SWT.LEFT|SWT.BOTTOM,
 * SWT.RIGHT|SWT.BOTTOM
 */

public void setAnchor( int anchor){
   switch (anchor) {
      case SWT.NONE:
      case SWT.LEFT | SWT.TOP:
      case SWT.RIGHT | SWT.TOP:
      case SWT.LEFT | SWT.BOTTOM:
      case SWT.RIGHT | SWT.BOTTOM:
         break;
      default:
         throw new IllegalArgumentException("Illegal anchor value " + anchor);
   }
   this.preferredAnchor = anchor;
}
 
Example 8
/**
 * Set the layout values for the messageLabel, messageImageLabel and
 * fillerLabel for the case where there is a normal message.
 * 
 * @param verticalSpacing
 *            int The spacing between widgets on the vertical axis.
 * @param horizontalSpacing
 *            int The spacing between widgets on the horizontal axis.
 */
private void setLayoutsForNormalMessage(int verticalSpacing,
		int horizontalSpacing) {
	FormData messageImageData = new FormData();
	messageImageData.top = new FormAttachment(titleLabel, verticalSpacing);
	messageImageData.left = new FormAttachment(0, H_GAP_IMAGE);
	messageImageLabel.setLayoutData(messageImageData);
	FormData messageLabelData = new FormData();
	messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
	messageLabelData.right = new FormAttachment(titleImageLabel);
	messageLabelData.left = new FormAttachment(messageImageLabel,
			horizontalSpacing);
	messageLabelData.height = messageLabelHeight;
	if (titleImageLargest)
		messageLabelData.bottom = new FormAttachment(titleImageLabel, 0,
				SWT.BOTTOM);
	messageLabel.setLayoutData(messageLabelData);
	FormData fillerData = new FormData();
	fillerData.left = new FormAttachment(0, horizontalSpacing);
	fillerData.top = new FormAttachment(messageImageLabel, 0);
	fillerData.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
	bottomFillerLabel.setLayoutData(fillerData);
	FormData data = new FormData();
	data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
	data.left = new FormAttachment(0, 0);
	data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
	data.right = new FormAttachment(messageImageLabel, 0);
	leftFillerLabel.setLayoutData(data);
}
 
Example 9
Source Project: nebula   File: VControlPainter.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static double getY(VControl control, double height) {
	double y;

	if(control.yAlign == SWT.TOP) {
		y = control.marginTop;
	} else if(control.yAlign == SWT.BOTTOM) {
		y = control.bounds.height - height - control.marginBottom;
	} else { // CENTERED / Default
		y = ((control.bounds.height - height) / 2.0);
	}

	y += control.bounds.y;

	return y;
}
 
Example 10
Source Project: nebula   File: VGridLayout.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private int getY(GridData data, int cellStart, int cellSpan, int controlSpan) {
	switch(data.verticalAlignment) {
	case SWT.FILL:
	case SWT.TOP:
	case SWT.BEGINNING:
		return cellStart + data.verticalIndent;
	case SWT.BOTTOM:
	case SWT.END:
		return cellStart + cellSpan - controlSpan;
	case SWT.CENTER:
	default:
		return cellStart + ((cellSpan - controlSpan) / 2);
	}
}
 
Example 11
Source Project: nebula   File: GridIterator.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static int getVertAlignmentOffset(final int alignment,
		final int pieceHeight, final int cellHeight) {
	int offset = 0;
	if (alignment == SWT.CENTER) {
		offset = (cellHeight - pieceHeight) / 2;
	} else if (alignment == SWT.BOTTOM) {
		offset = cellHeight - pieceHeight;
	}
	return offset;
}
 
Example 12
Source Project: nebula   File: AlignPrint.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public PrintPiece next(int width, int height) {
	PrintPiece piece = PaperClips.next(target, width, height);
	if (piece == null)
		return null;

	Point size = piece.getSize();
	Point offset = new Point(0, 0);

	if (hAlign == SWT.CENTER)
		offset.x = (width - size.x) / 2;
	else if (hAlign == SWT.RIGHT)
		offset.x = width - size.x;

	if (hAlign != SWT.LEFT)
		size.x = width;

	if (vAlign == SWT.CENTER)
		offset.y = (height - size.y) / 2;
	else if (vAlign == SWT.BOTTOM)
		offset.y = height - size.y;

	if (vAlign != SWT.TOP)
		size.y = height;

	CompositeEntry entry = new CompositeEntry(piece, offset);

	return new CompositePiece(new CompositeEntry[] { entry }, size);
}
 
Example 13
protected void fullLayout( )
{
	FormLayout layout = new FormLayout( );
	layout.marginBottom = WidgetUtil.SPACING;
	layout.marginTop = 1;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	formPanel.setLayout( layout );

	FormData data = new FormData( );
	data.right = new FormAttachment( 90 );
	data.top = new FormAttachment( 0, 0 );
	data.width = Math.max( btnWidth, btnAdd.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( btnAdd, 0, SWT.LEFT );
	data.width = Math.max( btnWidth, btnEdit.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	btnEdit.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnEdit, 0, SWT.BOTTOM );
	data.left = new FormAttachment( btnEdit, 0, SWT.LEFT );
	data.width = Math.max( btnWidth, btnDel.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.TOP );
	data.bottom = new FormAttachment( 100 );
	data.left = new FormAttachment( 0, 0 );
	data.right = new FormAttachment( btnAdd, 0, SWT.LEFT );
	table.setLayoutData( data );
}
 
Example 14
protected void fullLayoutHorizontal( )
{
	FormLayout layout = new FormLayout( );
	layout.marginBottom = WidgetUtil.SPACING;
	layout.marginTop = 0;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	formPanel.setLayout( layout );
	// int height = QUICK_BUTTON_HEIGHT - 2;
	FormData data = new FormData( );
	data.right = new FormAttachment( 100 );
	data.width = Math.max( btnWidth, btnEdit.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	// data.height = height;
	btnEdit.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnEdit, 0, SWT.LEFT );
	data.width = Math.max( btnWidth, btnDel.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	// data.height = height;
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnDel, 0, SWT.LEFT );
	data.width = Math.max( btnWidth, btnAdd.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	// data.height = height;
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( 0, 0 );
	data.right = new FormAttachment( 100 );
	data.bottom = new FormAttachment( 100 );
	table.setLayoutData( data );
}
 
Example 15
protected void fullLayout( )
{
	super.fullLayout( );

	btnEdit.setVisible( false );

	FormData data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( btnAdd, 0, SWT.LEFT );
	data.width = Math.max( 60, btnDel.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	btnDel.setLayoutData( data );
}
 
Example 16
/**
 * {@inheritDoc}
 */
@Override
public Control createContents(Composite ancestor) {

  noDefaultAndApplyButton();

  //
  // Build the top level composite with one colume.
  //
  Composite parentComposite = new Composite(ancestor, SWT.NULL);
  FormLayout layout = new FormLayout();
  parentComposite.setLayout(layout);

  //
  // Create the general section of the screen.
  //
  final Composite generalComposite = createGeneralContents(parentComposite);
  FormData fd = new FormData();
  fd.left = new FormAttachment(0);
  fd.top = new FormAttachment(0);
  fd.right = new FormAttachment(100);
  generalComposite.setLayoutData(fd);

  //
  // Create the check configuration section of the screen.
  //
  final Composite configComposite = createCheckConfigContents(parentComposite);
  fd = new FormData();
  fd.left = new FormAttachment(0);
  fd.top = new FormAttachment(generalComposite, 3, SWT.BOTTOM);
  fd.right = new FormAttachment(100);
  fd.bottom = new FormAttachment(100);
  configComposite.setLayoutData(fd);

  return parentComposite;
}
 
Example 17
protected void fullLayoutHorizontal( )
{
	FormLayout layout = new FormLayout( );
	layout.marginBottom = WidgetUtil.SPACING;
	layout.marginTop = 0;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	formPanel.setLayout( layout );
	// int height = QUICK_BUTTON_HEIGHT - 2;
	FormData data = new FormData( );
	data.right = new FormAttachment( 100 );
	data.width = Math.max( btnWidth,
			btnDown.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	// data.height = height;
	btnDown.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnDown, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnUp.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	// data.height = height;
	btnUp.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnUp, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnEdit.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	// data.height = height;
	btnEdit.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnEdit, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnDel.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	// data.height = height;
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.right = new FormAttachment( btnDel, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnAdd.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	// data.height = height;
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnUp, 0, SWT.BOTTOM );
	data.left = new FormAttachment( 0, 0 );
	data.right = new FormAttachment( 100 );
	data.bottom = new FormAttachment( 100 );
	table.setLayoutData( data );
}
 
Example 18
Source Project: uima-uimaj   File: INSDEnvironmentPage.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * See IDialogPage#createControl(Composite).
 *
 * @param parent the parent
 */
@Override
public void createControl(Composite parent) {

  try {

    Composite container = new Composite(parent, SWT.NULL);

    FormLayout formLayout = new FormLayout();
    container.setLayout(formLayout);

    gr = new Group(container, SWT.NONE);
    gr.setText("Environment Options");
    FormData data = new FormData();
    data.width = 450;
    data.left = new FormAttachment(0, 10);
    data.top = new FormAttachment(0, 10);
    gr.setLayoutData(data);

    GridLayout grLayout = new GridLayout();
    grLayout.numColumns = 2;
    grLayout.verticalSpacing = 4;
    gr.setLayout(grLayout);

    osCombo = addCombo(gr, "Operating System:");
    jdkVersionCombo = addCombo(gr, "JDK level (Minimum):");

    gr1 = new Group(container, SWT.NONE);
    gr1.setText("System Properties");
    data = new FormData();
    data.width = 450;
    data.height = 150;
    data.left = new FormAttachment(0, 10);
    data.top = new FormAttachment(gr, 20, SWT.BOTTOM);
    gr1.setLayoutData(data);

    initialize();
    viewer = new VarValViewerHandler(gr1, VarVal.fieldNames, 3, envVarList);
    initializeCombos();

    dialogChanged();
    setControl(container);
  } catch (Throwable e) {
    PearException subEx = new PearException(
            "The operation failed because the wizard's pages could not be initialized properly.",
            e);
    subEx.openErrorDialog(getShell());
    this.dispose();
  }
}
 
Example 19
Source Project: nebula   File: Stepbar.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private static int checkStyle(final int style) {
	final int mask = SWT.BORDER | SWT.BOTTOM | SWT.TOP;
	int newStyle = style & mask;
	newStyle |= SWT.DOUBLE_BUFFERED;
	return newStyle;
}
 
Example 20
Source Project: birt   File: CGridData.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns a string containing a concise, human-readable
 * description of the receiver.
 *
 * @return a string representation of the GridData object
 */
public String toString () {
	String hAlign = "";
	switch (horizontalAlignment) {
		case SWT.FILL: hAlign = "SWT.FILL"; break;
		case SWT.BEGINNING: hAlign = "SWT.BEGINNING"; break;
		case SWT.LEFT: hAlign = "SWT.LEFT"; break;
		case SWT.END: hAlign = "SWT.END"; break;
		case END: hAlign = "GridData.END"; break;
		case SWT.RIGHT: hAlign = "SWT.RIGHT"; break;
		case SWT.CENTER: hAlign = "SWT.CENTER"; break;
		case CENTER: hAlign = "GridData.CENTER"; break;
		default: hAlign = "Undefined "+horizontalAlignment; break;
	}
	String vAlign = "";
	switch (verticalAlignment) {
		case SWT.FILL: vAlign = "SWT.FILL"; break;
		case SWT.BEGINNING: vAlign = "SWT.BEGINNING"; break;
		case SWT.TOP: vAlign = "SWT.TOP"; break;
		case SWT.END: vAlign = "SWT.END"; break;
		case END: vAlign = "GridData.END"; break;
		case SWT.BOTTOM: vAlign = "SWT.BOTTOM"; break;
		case SWT.CENTER: vAlign = "SWT.CENTER"; break;
		case CENTER: vAlign = "GridData.CENTER"; break;
		default: vAlign = "Undefined "+verticalAlignment; break;
	}
 	String string = getName()+" {";
 	string += "horizontalAlignment="+hAlign+" ";
 	if (horizontalIndent != 0) string += "horizontalIndent="+horizontalIndent+" ";
 	if (horizontalSpan != 1) string += "horizontalSpan="+horizontalSpan+" ";
 	if (grabExcessHorizontalSpace) string += "grabExcessHorizontalSpace="+grabExcessHorizontalSpace+" ";
 	if (widthHint != SWT.DEFAULT) string += "widthHint="+widthHint+" ";
 	if (minimumWidth != 0) string += "minimumWidth="+minimumWidth+" ";
 	string += "verticalAlignment="+vAlign+" ";
 	if (verticalIndent != 0) string += "verticalIndent="+verticalIndent+" ";
	if (verticalSpan != 1) string += "verticalSpan="+verticalSpan+" ";
 	if (grabExcessVerticalSpace) string += "grabExcessVerticalSpace="+grabExcessVerticalSpace+" ";
 	if (heightHint != SWT.DEFAULT) string += "heightHint="+heightHint+" ";
 	if (minimumHeight != 0) string += "minimumHeight="+minimumHeight+" ";
 	if (exclude) string += "exclude="+exclude+" ";
 	string = string.trim();
 	string += "}";
	return string;
}