org.eclipse.ui.forms.widgets.TableWrapLayout Java Examples

The following examples show how to use org.eclipse.ui.forms.widgets.TableWrapLayout. 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: FormHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Create TableWrapLayout for the whole page 
 * @param makeColumnsEqualWidth
 * @param numColumns
 * @return
 */
public static TableWrapLayout createFormTableWrapLayout(boolean makeColumnsEqualWidth, int numColumns)
{
    TableWrapLayout layout = new TableWrapLayout();

    layout.topMargin = FORM_BODY_MARGIN_TOP;
    layout.bottomMargin = FORM_BODY_MARGIN_BOTTOM;
    layout.leftMargin = FORM_BODY_MARGIN_LEFT;
    layout.rightMargin = FORM_BODY_MARGIN_RIGHT;

    layout.horizontalSpacing = FORM_BODY_HORIZONTAL_SPACING;
    layout.verticalSpacing = FORM_BODY_VERTICAL_SPACING;

    layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
    layout.numColumns = numColumns;

    return layout;
}
 
Example #2
Source File: EigendiagnoseDetailDisplay.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createDisplay(Composite parent, IViewSite site){
	form = UiDesk.getToolkit().createForm(parent);
	TableWrapLayout twl = new TableWrapLayout();
	form.getBody().setLayout(twl);
	
	tblPls = new LabeledInputField.AutoForm(form.getBody(), data);
	tblPls.setModelService(ModelServiceHolder.get());
	
	TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
	twd.grabHorizontal = true;
	tblPls.setLayoutData(twd);
	TableWrapData twd2 = new TableWrapData(TableWrapData.FILL_GRAB);
	tComment = UiDesk.getToolkit().createText(form.getBody(), StringTool.leer, SWT.BORDER);
	tComment.setLayoutData(twd2);
	return form.getBody();
}
 
Example #3
Source File: Artikeldetail.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	parent.setLayout(new FillLayout());
	form = tk.createScrolledForm(parent);
	TableWrapLayout twl = new TableWrapLayout();
	form.getBody().setLayout(twl);
	
	tblArtikel =
		new LabeledInputField.AutoForm(form.getBody(), getFieldDefs(parent.getShell()));
	
	TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
	twd.grabHorizontal = true;
	tblArtikel.setLayoutData(twd);
	GlobalEventDispatcher.addActivationListener(this, this);
	
}
 
Example #4
Source File: NodeInfoViewer.java    From jbt with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 */
public NodeInfoViewer(Composite parent, int style) {
	super(parent, style);
	this.setLayout(new FillLayout());

	this.toolkit = new FormToolkit(Utilities.getDisplay());
	this.global = this.toolkit.createScrolledForm(this);
	TableWrapLayout layout = new TableWrapLayout();
	layout.numColumns = 2;
	this.global.getBody().setLayout(layout);

	/* For disposing the toolkit. */
	this.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			toolkit.dispose();
		}
	});

	/* For the wheel event. */
	this.global.addListener(SWT.Activate, new Listener() {
		public void handleEvent(Event event) {
			global.setFocus();
		}
	});
}
 
Example #5
Source File: FormUtils.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
public static TableWrapLayout createClearTableWrapLayout(
		boolean makeColumnsEqualWidth, int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();

	layout.topMargin = CLEAR_MARGIN_TOP;
	layout.bottomMargin = CLEAR_MARGIN_BOTTOM;
	layout.leftMargin = CLEAR_MARGIN_LEFT;
	layout.rightMargin = CLEAR_MARGIN_RIGHT;

	layout.horizontalSpacing = CLEAR_HORIZONTAL_SPACING;
	layout.verticalSpacing = CLEAR_VERTICAL_SPACING;

	layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
	layout.numColumns = numColumns;

	return layout;
}
 
Example #6
Source File: FormLayoutFactory.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * For composites set as section clients. For composites containg form text.
 * 
 * @param makeColumnsEqualWidth
 * @param numColumns
 * @return
 */
public static TableWrapLayout createSectionClientTableWrapLayout(boolean makeColumnsEqualWidth, int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();

	layout.topMargin = SECTION_CLIENT_MARGIN_TOP;
	layout.bottomMargin = SECTION_CLIENT_MARGIN_BOTTOM;
	layout.leftMargin = SECTION_CLIENT_MARGIN_LEFT;
	layout.rightMargin = SECTION_CLIENT_MARGIN_RIGHT;

	layout.horizontalSpacing = SECTION_CLIENT_HORIZONTAL_SPACING;
	layout.verticalSpacing = SECTION_CLIENT_VERTICAL_SPACING;

	layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
	layout.numColumns = numColumns;

	return layout;
}
 
Example #7
Source File: FormLayoutFactory.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * For composites used to group sections in left and right panes.
 * 
 * @param makeColumnsEqualWidth
 * @param numColumns
 * @return
 */
public static TableWrapLayout createFormPaneTableWrapLayout(boolean makeColumnsEqualWidth, int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();

	layout.topMargin = FORM_PANE_MARGIN_TOP;
	layout.bottomMargin = FORM_PANE_MARGIN_BOTTOM;
	layout.leftMargin = FORM_PANE_MARGIN_LEFT;
	layout.rightMargin = FORM_PANE_MARGIN_RIGHT;

	layout.horizontalSpacing = FORM_PANE_HORIZONTAL_SPACING;
	layout.verticalSpacing = FORM_PANE_VERTICAL_SPACING;

	layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
	layout.numColumns = numColumns;

	return layout;
}
 
Example #8
Source File: FormLayoutFactory.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * For form bodies.
 * 
 * @param makeColumnsEqualWidth
 * @param numColumns
 * @return
 */
public static TableWrapLayout createFormTableWrapLayout(boolean makeColumnsEqualWidth, int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();

	layout.topMargin = FORM_BODY_MARGIN_TOP;
	layout.bottomMargin = FORM_BODY_MARGIN_BOTTOM;
	layout.leftMargin = FORM_BODY_MARGIN_LEFT;
	layout.rightMargin = FORM_BODY_MARGIN_RIGHT;

	layout.horizontalSpacing = FORM_BODY_HORIZONTAL_SPACING;
	layout.verticalSpacing = FORM_BODY_VERTICAL_SPACING;

	layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
	layout.numColumns = numColumns;

	return layout;
}
 
Example #9
Source File: FormHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Constructs a section and returns a section client composite
 * 
 * the section layout is TableWrapLayout
 * 
 * 
 * @param parent parent container for the section
 * @param title title of the section
 * @param description description of the section
 * @param toolkit toolkit to create the composite
 * @param sectionFlags parameters of the section
 * @param expansionListener 
 * @return a section client (the content container of the section)
 */
public static Section createSectionComposite(Composite parent, String title, String description,
        FormToolkit toolkit, int sectionFlags, IExpansionListener expansionListener)
{
    final Section section = toolkit.createSection(parent, sectionFlags);

    section.setData(SECTION_IS_NOT_SPACE_GRABBING, new Object());
    section.setText(title);
    section.setDescription(description);

    if (expansionListener != null)
    {
        section.addExpansionListener(expansionListener);
    }

    // create section client
    Composite sectionClient = toolkit.createComposite(section);
    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 1;
    sectionClient.setLayout(layout);
    section.setClient(sectionClient);

    // draw flat borders
    toolkit.paintBordersFor(sectionClient);
    return section;
}
 
Example #10
Source File: FormUtils.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
public static TableWrapLayout createFormTableWrapLayout(int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();
	layout.topMargin = FORM_BODY_MARGIN_TOP;
	layout.bottomMargin = FORM_BODY_MARGIN_BOTTOM;
	layout.leftMargin = FORM_BODY_MARGIN_LEFT;
	layout.rightMargin = FORM_BODY_MARGIN_RIGHT;

	layout.horizontalSpacing = FORM_BODY_HORIZONTAL_SPACING;
	layout.verticalSpacing = FORM_BODY_VERTICAL_SPACING;

	layout.makeColumnsEqualWidth = true;
	layout.numColumns = numColumns;
	return layout;
}
 
Example #11
Source File: FormUtils.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
public static TableWrapLayout createFormPaneTableWrapLayout(int numColumns) {
	TableWrapLayout layout = new TableWrapLayout();

	layout.topMargin = FORM_PANE_MARGIN_TOP;
	layout.bottomMargin = FORM_PANE_MARGIN_BOTTOM;
	layout.leftMargin = FORM_PANE_MARGIN_LEFT;
	layout.rightMargin = FORM_PANE_MARGIN_RIGHT;

	layout.horizontalSpacing = FORM_PANE_HORIZONTAL_SPACING;
	layout.verticalSpacing = FORM_PANE_VERTICAL_SPACING;

	layout.numColumns = numColumns;

	return layout;
}
 
Example #12
Source File: StickerComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static StickerComposite createWrappedStickerComposite(Composite parent, FormToolkit tk){
	Composite wrapper = new Composite(parent, SWT.NONE);
	TableWrapLayout wlayout = new TableWrapLayout();
	wlayout.bottomMargin = 0;
	wlayout.topMargin = 0;
	wrapper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	wrapper.setLayout(wlayout);
	wrapper.setBackground(UiDesk.getColor(UiDesk.COL_WHITE));
	StickerComposite stickerComposite = new StickerComposite(wrapper, SWT.NONE, tk);
	stickerComposite.setBackground(UiDesk.getColor(UiDesk.COL_WHITE));
	return stickerComposite;
}
 
Example #13
Source File: SWTHelper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor wrapper for TableWrapLayout, so that parameters are identical to
 * GridLayout(numColumns, makeColumnsEqualWidth)
 */
public static TableWrapLayout createTableWrapLayout(final int numColumns,
	final boolean makeColumnsEqualWidth){
	TableWrapLayout layout = new TableWrapLayout();
	
	layout.numColumns = numColumns;
	layout.makeColumnsEqualWidth = makeColumnsEqualWidth;
	
	return layout;
}
 
Example #14
Source File: TextDropComponent.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createContent() {
	toolkit.adapt(this);
	TableWrapLayout layout = createLayout();
	setLayout(layout);
	// order of the method calls is important (fills from left to right)
	createAddButton();
	createTextField();
	addDropToText();
	createRemoveButton();
}
 
Example #15
Source File: TextDropComponent.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private TableWrapLayout createLayout() {
	TableWrapLayout layout = new TableWrapLayout();
	layout.numColumns = 3;
	layout.leftMargin = 0;
	layout.rightMargin = 0;
	layout.topMargin = 0;
	layout.bottomMargin = 0;
	layout.horizontalSpacing = 0;
	layout.verticalSpacing = 0;
	return layout;
}
 
Example #16
Source File: DBImportFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	DBImportWizard wiz = (DBImportWizard) getWizard();
	
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBImportFirstPage_Connection); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$
	dbTypes = new List(body, SWT.BORDER);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case MYSQL:
			case POSTGRESQL:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = ""; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			case H2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa";
				defaultPassword = "";
				break;
			case ODBC:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBImportFirstPage_serverAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBImportFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	if (wiz.preset != null && wiz.preset.length > 1) {
		int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
		if (idx < dbTypes.getItemCount()) {
			dbTypes.select(idx);
		}
		server.setText(wiz.preset[1]);
		dbName.setText(wiz.preset[2]);
	}
	setControl(form);
}
 
Example #17
Source File: DBConnectFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBConnectFirstPage_connectioNDetails); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	FormText alt = tk.createFormText(body, false);
	StringBuilder old = new StringBuilder();
	old.append("<form>"); //$NON-NLS-1$
	String driver = "";
	String user = "";
	String typ = "";
	String connectString = "";
	Hashtable<Object, Object> hConn = null;
	String cnt = CoreHub.localCfg.get(Preferences.CFG_FOLDED_CONNECTION, null);
	if (cnt != null) {
		hConn = PersistentObject.fold(StringTool.dePrintable(cnt));
		if (hConn != null) {
			driver =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_DRIVER));
			connectString =
				PersistentObject.checkNull(hConn
					.get(Preferences.CFG_FOLDED_CONNECTION_CONNECTSTRING));
			user =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_USER));
			typ = PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_TYPE));
		}
	}
	// Check whether we were overridden
	String dbUser = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_USERNAME);
	String dbPw = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_PASSWORD);
	String dbFlavor = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_FLAVOR);
	String dbSpec = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_SPEC);
	if (dbUser != null && dbPw != null && dbFlavor != null && dbSpec != null) {
		old.append("<br/><li><b>Aktuelle Verbindung wurde via Übergabeparameter ans Programm gesetzt!</b></li><br/>"); //$NON-NLS-1$
	}
	if (ch.rgw.tools.StringTool.isNothing(connectString)) {
		old.append("<br/>"); //$NON-NLS-1$
		old.append("Keine konfigurierte Verbindung."); //$NON-NLS-1$
	} else {
		old.append("Konfigurierte Verbindung ist:<br/>"); //$NON-NLS-1$
		old.append("<li><b>Typ:</b>       ").append(typ).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Treiber</b>    ").append(driver).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Verbinde</b>   ").append(connectString).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Username</b>   ").append(user).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
	}
	if (PersistentObject.getConnection() != null
		&& PersistentObject.getConnection().getConnectString() != null) {
		old.append("<li><b>Effektiv</b> verwendet wird:").append( //$NON-NLS-1$
			PersistentObject.getConnection().getConnectString()).append("</li>"); //$NON-NLS-1$
	}
	old.append("</form>"); //$NON-NLS-1$
	alt.setText(old.toString(), true, false);
	// Composite form=new Composite(parent, SWT.BORDER);
	Label sep = tk.createSeparator(body, SWT.NONE);
	TableWrapData twd = new TableWrapData();
	twd.heightHint = 5;
	sep.setLayoutData(twd);
	tk.createLabel(body, Messages.DBConnectFirstPage_enterType); //$NON-NLS-1$
	dbTypes = new Combo(body, SWT.BORDER | SWT.SIMPLE);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case 0:
			case 1:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = "elexis"; //$NON-NLS-1$
				defaultPassword = "elexisTest"; //$NON-NLS-1$
				break;
			case 2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBConnectSecondPage sec = (DBConnectSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBConnectFirstPage_serevrAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBConnectFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	setControl(form);
}
 
Example #18
Source File: MechanicDialog.java    From workspacemechanic with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Add a form to the supplied Composite.
 */
private Control createForm(Composite parent) {

  final FormToolkit toolkit = new FormToolkit(parent.getDisplay());
  final ScrolledForm form = toolkit.createScrolledForm(parent);

  /*
   * For the life of me I can't understand why I have to supply
   * a GridData instance to the form object in order to get the form
   * to fill the dialog area.
   * 
   * BTW, I only found this out through trial and error.
   */
  form.setLayoutData(new GridData(GridData.FILL_BOTH));

  TableWrapLayout layout = new TableWrapLayout();
  layout.numColumns = 2;
  layout.horizontalSpacing = 15;
  layout.verticalSpacing = 10;

  form.getBody().setLayout(layout);
  form.getBody().setLayoutData(new TableWrapData(
      TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 3));

  for (Task item : items) {

    // add an expandable description of the task, with a pretty title
    ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(),
        ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    ec.setText(item.getTitle());
    Label label = toolkit.createLabel(ec, item.getDescription(), SWT.WRAP);
    ec.setClient(label);
    ec.addExpansionListener(new ExpansionAdapter() {
      @Override 
      public void expansionStateChanged(ExpansionEvent e) {
        form.reflow(true);
      }
    });
    ec.setExpanded(true);
    ec.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

    // add a combo box allowing the user to select the repair action to take
    createDecisionCombo(form.getBody(), item);
  }

  return parent;
}