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

The following examples show how to use org.eclipse.swt.SWT#SIMPLE . 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: nebula   File: CDateTime.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private static int convertStyle(int style) {
	int rstyle = SWT.NONE;
	if ((style & CDT.DROP_DOWN) != 0) {
		rstyle |= SWT.DROP_DOWN;
	}
	if ((style & CDT.SIMPLE) != 0) {
		rstyle |= SWT.SIMPLE;
	}
	if ((style & CDT.READ_ONLY) != 0) {
		rstyle |= SWT.READ_ONLY;
	}
	if ((style & CDT.BUTTON_LEFT) != 0) {
		rstyle |= SWT.LEFT;
	}
	if ((style & CDT.TEXT_LEAD) != 0) {
		rstyle |= SWT.LEAD;
	}
	if ((style & CDT.BORDER) != 0) {
		rstyle |= SWT.BORDER;
	}
	if (win32) {
		rstyle |= SWT.DOUBLE_BUFFERED;
	}
	return rstyle;
}
 
Example 2
Source Project: nebula   File: BaseCombo.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private static int checkStyle(int style) {
	int rstyle = SWT.NONE;
	if ((style & SWT.BORDER) != 0) {
		if (win32 || (style & SWT.SIMPLE) != 0) {
			rstyle |= SWT.BORDER;
		}
	}
	if (win32) {
		rstyle |= SWT.DOUBLE_BUFFERED;
	}
	return rstyle;
}
 
Example 3
Source Project: nebula   File: BaseCombo.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void init(int style) {
	this.style = style;
	simple = (style & SWT.SIMPLE) != 0;
	dropDown = (style & (BUTTON_ONLY | SWT.DROP_DOWN)) != 0;
	leftAlign = (style & SWT.LEFT) != 0;

	if (simple) {
		panel.setLayout(new VSimpleLayout());
	} else if (dropDown) {
		createButton(style);
		if ((style & BUTTON_ONLY) == 0) {
			createText(style);
			if (win32) {
				setPositionControl(panel);
			} else {
				setPositionControl(text);
			}
			panel.setLayout(new DropComboLayout());
		} else {
			setPositionControl(button);
			panel.setLayout(new VSimpleLayout());
		}

		shellListener = new Listener() {
			public void handleEvent(Event event) {
				switch (event.type) {
				case SWT.Close:
					event.doit = false;
					setOpen(false);
					break;
				case SWT.Deactivate:
					if (!checkContent() || content.getMenu() == null
							|| !content.getMenu().isVisible()) {
						setOpen(false);
					}
					break;
				}
			}
		};

		addListener(SWT.Move, comboListener);
		addListener(SWT.Resize, comboListener);
	} else {
		panel.setLayout(new VSimpleLayout());
		createText(style);
	}

	addListener(SWT.Dispose, disposeListener);
}
 
Example 4
Source Project: nebula   File: PShelf.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private static int checkStyle(int style)
{
    int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.BORDER | SWT.SIMPLE;
    return (style & mask) | SWT.DOUBLE_BUFFERED;
}
 
Example 5
Source Project: nebula   File: PShelf.java    License: Eclipse Public License 2.0 4 votes vote down vote up
private void openItem(PShelfItem item, boolean animation){
	PShelfItem previousOpen = openItem;
	openItem = item;
	focusItem = item;

	item.getBodyParent().setBounds(0,0,0,0);
	item.getBodyParent().setVisible(true);
	item.getBody().layout();

	if (animation && (getStyle() & SWT.SIMPLE) == 0){
 		    if(!redrawOnAnimation) {
 		      previousOpen.getBodyParent().setRedraw(false);
 		      item.getBodyParent().setRedraw(false);
 		    }
		if (items.indexOf(item) < items.indexOf(previousOpen)){
		    animateOpen(item, previousOpen, false);
		} else {
			animateOpen(previousOpen,item, true);
		}
		if(!redrawOnAnimation) {
		  previousOpen.getBodyParent().setRedraw(true);
		  item.getBodyParent().setRedraw(true);
		}
	} else {
		if (previousOpen != null && !previousOpen.isDisposed())
			previousOpen.getBodyParent().setBounds(0,0,0,0);
		if ((getStyle() & SWT.SIMPLE) != 0){
			//reorder the items
			items.remove(item);
			items.add(0,item);
		}
		onResize();
	}
	if (previousOpen != null)
		previousOpen.getBodyParent().setVisible(false);

	redraw();
	getDisplay().update();

       Event e = new Event();
       e.item = openItem;

       this.notifyListeners(SWT.Selection,e);

       computeItemYCoordinates();
       onResize();
}
 
Example 6
@Override
protected Control createDialogArea(Composite parent){
	Composite rx = (Composite) super.createDialogArea(parent);
	Composite ret = new Composite(rx, SWT.NONE);
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	ret.setLayout(new GridLayout(2, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Username); //$NON-NLS-1$
	tUsername = new Text(ret, SWT.BORDER);
	tUsername.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Password); //$NON-NLS-1$
	tPwd1 = new Text(ret, SWT.BORDER | SWT.PASSWORD);
	tPwd1.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_PasswordRepeat); //$NON-NLS-1$
	tPwd2 = new Text(ret, SWT.BORDER | SWT.PASSWORD);
	tPwd2.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Anrede); //$NON-NLS-1$
	cbAnrede = new Combo(ret, SWT.SIMPLE | SWT.SINGLE);
	cbAnrede.setItems(anreden);
	
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Title); //$NON-NLS-1$
	tTitle = new Text(ret, SWT.BORDER);
	tTitle.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Firstname); //$NON-NLS-1$
	tFirstname = new Text(ret, SWT.BORDER);
	tFirstname.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Lastname); //$NON-NLS-1$
	tLastname = new Text(ret, SWT.BORDER);
	tLastname.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_EMail); //$NON-NLS-1$
	tEmail = new Text(ret, SWT.BORDER);
	tEmail.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_Street); //$NON-NLS-1$
	tStreet = new Text(ret, SWT.BORDER);
	tStreet.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_zip); //$NON-NLS-1$
	tZip = new Text(ret, SWT.BORDER);
	tZip.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_place); //$NON-NLS-1$
	tPlace = new Text(ret, SWT.BORDER);
	tPlace.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_phone); //$NON-NLS-1$
	tPhone = new Text(ret, SWT.BORDER);
	tPhone.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.ErsterMandantDialog_fax); //$NON-NLS-1$
	tFax = new Text(ret, SWT.BORDER);
	tFax.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return rx;
}
 
Example 7
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);
}