List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer
public ComboViewer(Composite parent, int style)
From source file:ch.elexis.core.ui.stock.dialogs.ImportArticleDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { reportBuilder = null;//from w ww . ja va2 s . co m Composite ret = new Composite(parent, SWT.NONE); ret.setLayout(new GridLayout(3, false)); ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); new Label(ret, SWT.NONE).setText("Import in Lager"); comboStockType = new ComboViewer(ret, SWT.BORDER | SWT.READ_ONLY); comboStockType.setContentProvider(ArrayContentProvider.getInstance()); comboStockType.setInput(new Query<Stock>(Stock.class).execute()); comboStockType.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof StructuredSelection) { if (!selection.isEmpty()) { Object o = ((StructuredSelection) selection).getFirstElement(); } } } }); comboStockType.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof Stock) { Stock stock = (Stock) element; return stock.getLabel(); } return super.getText(element); } }); comboStockType.getCombo().setLayoutData(SWTHelper.getFillGridData(2, false, 1, false)); comboStockType.setSelection(new StructuredSelection(Stock.load(Stock.DEFAULT_STOCK_ID))); new Label(ret, SWT.NONE).setText("Quelldatei auswhlen"); tFilePath = new Text(ret, SWT.BORDER); tFilePath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); tFilePath.setText(""); Button btnBrowse = new Button(ret, SWT.NONE); btnBrowse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog fd = new FileDialog(getShell(), SWT.OPEN); fd.setFilterExtensions(new String[] { "*.xls" }); String selected = fd.open(); tFilePath.setText(selected); } }); btnBrowse.setText("auswhlen.."); reportLink = new Link(ret, SWT.NONE); reportLink.setText(""); reportLink.setVisible(false); reportLink.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 3, 1)); // Event handling when users click on links. reportLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog fd = new FileDialog(getShell(), SWT.SAVE); fd.setFilterExtensions(new String[] { "*.csv" }); fd.setFileName("report.csv"); String path = fd.open(); if (path != null) { try { FileUtils.writeStringToFile(new File(path), reportBuilder.toString(), "UTF-8"); } catch (IOException e1) { MessageDialog.openError(getShell(), "Report Error", "Report konnte nicht gespeichert werden.\n\n" + e1.getMessage()); LoggerFactory.getLogger(ImportArticleDialog.class).error("report save error", e1); } } } }); return ret; }
From source file:ch.elexis.core.ui.util.LabeledInputField.java
License:Open Source License
/** * creates a LabeledInputField of the desired Type. * //from w w w . jav a 2s . c om * @param parent * @param label * the label to show above the field * @param typ * the type of field to create. One of LabeledInputField.Typ */ public LabeledInputField(Composite parent, String label, Typ typ, int limit) { super(parent, SWT.NONE); setLayout(new GridLayout(1, false)); this.inputFieldType = typ; lbl = new Label(this, SWT.BOLD); switch (typ) { case CHECKBOX: case CHECKBOXTRISTATE: // just a a spacer for nice alignment - label is shown behind the checkbox as usual break; default: lbl.setText(label); break; } switch (typ) { case LINK: lbl.setForeground(UiDesk.getColorRegistry().get(UiDesk.COL_BLUE)); //$NON-NLS-1$ ctl = tk.createText(this, "", SWT.NONE); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); break; case TEXT: case MONEY: ctl = tk.createText(this, "", SWT.BORDER); ((Text) ctl).setTextLimit(limit); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); break; case LIST: ctl = new List(this, SWT.MULTI | SWT.BORDER); ctl.setLayoutData(new GridData(GridData.FILL_BOTH/* |GridData.GRAB_VERTICAL */)); break; case DATE: ctl = new DatePickerCombo(this, SWT.NONE); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); setText(""); break; case COMBO: ctl = new Combo(this, SWT.SINGLE | SWT.BORDER); ctl.setLayoutData(new GridData(GridData.FILL_BOTH/* |GridData.GRAB_VERTICAL */)); break; case COMBO_VIEWER: viewer = new ComboViewer(this, SWT.SINGLE | SWT.BORDER); ctl = viewer.getControl(); ctl.setLayoutData(new GridData(GridData.FILL_BOTH/* |GridData.GRAB_VERTICAL */)); break; case CHECKBOX: ctl = tk.createButton(this, label, SWT.CHECK); ((Button) ctl).setText(label); ctl.setBackground(this.getBackground()); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); break; case CHECKBOXTRISTATE: ctl = new TristateCheckbox(this, SWT.NONE, true); ((Button) ctl).setText(label); ctl.setBackground(this.getBackground()); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); break; case EXECLINK: lbl.setForeground(UiDesk.getColorRegistry().get(UiDesk.COL_BLUE)); ctl = tk.createText(this, StringConstants.EMPTY, SWT.BORDER); ctl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); break; default: break; } lbl.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); }
From source file:ch.elexis.core.ui.views.KonsDetailView.java
License:Open Source License
@Override public void createPartControl(final Composite p) { setTitleImage(Images.IMG_VIEW_CONSULTATION_DETAIL.getImage()); sash = new SashForm(p, SWT.VERTICAL); tk = UiDesk.getToolkit();// w ww .j av a 2 s .c om form = tk.createForm(sash); form.getBody().setLayout(new GridLayout(1, true)); form.setText(NO_CONS_SELECTED); cEtiketten = new Composite(form.getBody(), SWT.NONE); cEtiketten.setLayout(new RowLayout(SWT.HORIZONTAL)); cEtiketten.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); cDesc = new Composite(form.getBody(), SWT.NONE); cDesc.setLayout(new RowLayout(SWT.HORIZONTAL)); cDesc.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); lBeh = tk.createLabel(cDesc, NO_CONS_SELECTED); emFont = UiDesk.getFont("Helvetica", 11, SWT.BOLD); //$NON-NLS-1$ lBeh.setFont(emFont); defaultBackground = p.getBackground(); // lBeh.setBackground(); hlMandant = tk.createHyperlink(cDesc, "--", SWT.NONE); //$NON-NLS-1$ hlMandant.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { KontaktSelektor ksl = new KontaktSelektor(getSite().getShell(), Mandant.class, Messages.KonsDetailView_SelectMandatorCaption, // $NON-NLS-1$ Messages.KonsDetailView_SelectMandatorBody, new String[] { Mandant.FLD_SHORT_LABEL, Mandant.FLD_NAME1, Mandant.FLD_NAME2 }); // $NON-NLS-1$ if (ksl.open() == Dialog.OK) { actKons.setMandant((Mandant) ksl.getSelection()); setKons(actKons); } } }); hlMandant.setBackground(p.getBackground()); comboViewerFall = new ComboViewer(form.getBody(), SWT.SINGLE); comboViewerFall.setContentProvider(ArrayContentProvider.getInstance()); comboViewerFall.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((Fall) element).getLabel(); } }); comboFallSelectionListener = new ComboFallSelectionListener(); comboViewerFall.addSelectionChangedListener(comboFallSelectionListener); GridData gdFall = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); comboViewerFall.getCombo().setLayoutData(gdFall); text = new EnhancedTextField(form.getBody()); hXrefs = new Hashtable<String, IKonsExtension>(); @SuppressWarnings("unchecked") List<IKonsExtension> xrefs = Extensions.getClasses( Extensions.getExtensions(ExtensionPointConstantsUi.KONSEXTENSION), "KonsExtension", false); //$NON-NLS-1$ //$NON-NLS-2$ for (IKonsExtension x : xrefs) { String provider = x.connect(text); hXrefs.put(provider, x); } text.setXrefHandlers(hXrefs); @SuppressWarnings("unchecked") List<IKonsMakro> makros = Extensions .getClasses(Extensions.getExtensions(ExtensionPointConstantsUi.KONSEXTENSION), "KonsMakro", false); //$NON-NLS-1$ //$NON-NLS-2$ text.setExternalMakros(makros); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL); text.setLayoutData(gd); tk.adapt(text); diagAndChargeSash = new SashForm(sash, SWT.HORIZONTAL); Composite botleft = tk.createComposite(diagAndChargeSash); botleft.setLayout(new GridLayout(1, false)); Composite botright = tk.createComposite(diagAndChargeSash); botright.setLayout(new GridLayout(1, false)); dd = new DiagnosenDisplay(getSite().getPage(), botleft, SWT.NONE); dd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); vd = new VerrechnungsDisplay(getSite().getPage(), botright, SWT.NONE); vd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); getSite().registerContextMenu(ID + ".VerrechnungsDisplay", vd.contextMenuManager, vd.viewer); getSite().setSelectionProvider(vd.viewer); diagAndChargeSash .setWeights(diagAndChargeSashWeights == null ? new int[] { 40, 60 } : diagAndChargeSashWeights); makeActions(); ViewMenus menu = new ViewMenus(getViewSite()); menu.createMenu(versionDisplayAction, versionFwdAction, versionBackAction, GlobalActions.neueKonsAction, GlobalActions.delKonsAction, GlobalActions.redateAction, assignStickerAction, purgeAction); sash.setWeights(sashWeights == null ? new int[] { 80, 20 } : sashWeights); menu.createToolbar(GlobalActions.neueKonsAction, saveAction); GlobalEventDispatcher.addActivationListener(this, this); ElexisEventDispatcher.getInstance().addListeners(eeli_kons, eeli_kons_sync, eeli_pat, eeli_user, eeli_fall); text.connectGlobalActions(getViewSite()); adaptMenus(); setKons((Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class)); }
From source file:ch.elexis.core.ui.views.PatHeuteView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { parent.setLayout(new GridLayout()); this.parent = parent; makeActions();// w w w .ja v a2 s . c om ldFilter = new ListDisplay<IVerrechenbar>(parent, SWT.NONE, new ListDisplay.LDListener() { public String getLabel(final Object o) { return ((IVerrechenbar) o).getCode(); } public void hyperlinkActivated(final String l) { if (l.equals(LEISTUNG_HINZU)) { try { if (StringTool.isNothing(LeistungenView.ID)) { SWTHelper.alert(Messages.PatHeuteView_error, //$NON-NLS-1$ "LeistungenView.ID"); //$NON-NLS-1$ } getViewSite().getPage().showView(LeistungenView.ID); CodeSelectorHandler.getInstance().setCodeSelectorTarget(dropTarget); } catch (Exception ex) { ExHandler.handle(ex); } } else if (l.equals(STAT_LEEREN)) { ldFilter.clear(); } } }); ldFilter.addHyperlinks(LEISTUNG_HINZU, STAT_LEEREN); ldFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); ((GridData) ldFilter.getLayoutData()).heightHint = 0; dropTarget = new PersistentObjectDropTarget("Statfilter", ldFilter, //$NON-NLS-1$ new DropReceiver()); Composite top = new Composite(parent, SWT.BORDER); top.setLayout(new RowLayout()); final DatePickerCombo dpc = new DatePickerCombo(top, SWT.BORDER); dpc.setDate(datVon.getTime()); dpc.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { datVon.setTimeInMillis(dpc.getDate().getTime()); } }); final DatePickerCombo dpb = new DatePickerCombo(top, SWT.BORDER); dpb.setDate(datBis.getTime()); dpb.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { datBis.setTimeInMillis(dpb.getDate().getTime()); } }); final Button bOpenKons = new Button(top, SWT.CHECK); bOpenKons.setText(Messages.PatHeuteView_open); //$NON-NLS-1$ bOpenKons.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { bOpen = bOpenKons.getSelection(); } }); final Button bClosedKons = new Button(top, SWT.CHECK); bClosedKons.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { bClosed = bClosedKons.getSelection(); } }); ComboViewer cAccountingSys = new ComboViewer(top, SWT.READ_ONLY); cAccountingSys.setContentProvider(ArrayContentProvider.getInstance()); cAccountingSys.setLabelProvider(new LabelProvider()); String allCases = Messages.PatHeuteView_all; List<String> faelle = Arrays.asList(Fall.getAbrechnungsSysteme()); List<String> accountingSys = new ArrayList<String>(); accountingSys.add(allCases); accountingSys.addAll(faelle); cAccountingSys.setInput(accountingSys); cAccountingSys.setSelection(new StructuredSelection(allCases)); cAccountingSys.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); accountSys = (String) selection.getFirstElement(); // call reload if (kons != null) { kload.schedule(); } } }); bClosedKons.setText(Messages.PatHeuteView_billed); //$NON-NLS-1$ bOpenKons.setSelection(bOpen); bClosedKons.setSelection(bClosed); cv = new CommonViewer(); vc = new ViewerConfigurer(new DefaultContentProvider(cv, Patient.class) { @Override public Object[] getElements(final Object inputElement) { if (!CoreHub.acl.request(AccessControlDefaults.ACCOUNTING_STATS)) { return new Konsultation[0]; } if (kons == null) { kons = new Konsultation[0]; kload.schedule(); } return kons; } }, new DefaultLabelProvider() { @Override public String getText(final Object element) { if (element instanceof Konsultation) { Fall fall = ((Konsultation) element).getFall(); if (fall == null) { return Messages.PatHeuteView_noCase + ((Konsultation) element).getLabel(); //$NON-NLS-1$ } Patient pat = fall.getPatient(); return pat.getLabel(); } return super.getText(element); } }, null, new ViewerConfigurer.DefaultButtonProvider(), new SimpleWidgetProvider(SimpleWidgetProvider.TYPE_LIST, SWT.V_SCROLL, cv)); cv.create(vc, parent, SWT.BORDER, getViewSite()); form = tk.createForm(parent); form.setText(Messages.PatHeuteView_all); //$NON-NLS-1$ form.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Composite bottom = form.getBody(); bottom.setLayout(new GridLayout(2, false)); tk.createLabel(bottom, Messages.PatHeuteView_consultations); //$NON-NLS-1$ tPat = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tPat.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tPat.setEditable(false); tk.createLabel(bottom, Messages.PatHeuteView_accTime); //$NON-NLS-1$ tTime = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tTime.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tTime.setEditable(false); tk.createLabel(bottom, Messages.PatHeuteView_accAmount); //$NON-NLS-1$ tMoney = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tMoney.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tMoney.setEditable(false); // Group grpSel=new Group(parent,SWT.BORDER); // grpSel.setText("Markierte"); // grpSel.setLayoutData(SWTHelper.getFillGridData(1,true,1,true)); Form fSel = tk.createForm(parent); fSel.setText(Messages.PatHeuteView_marked); //$NON-NLS-1$ fSel.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Composite cSel = fSel.getBody(); cSel.setLayout(new GridLayout(2, false)); tk.createLabel(cSel, Messages.PatHeuteView_accTime); //$NON-NLS-1$ tTime2 = tk.createText(cSel, "", SWT.BORDER); //$NON-NLS-1$ tTime2.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tk.createLabel(cSel, Messages.PatHeuteView_accAmount); //$NON-NLS-1$ tMoney2 = tk.createText(cSel, "", SWT.BORDER); //$NON-NLS-1$ tMoney2.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tTime2.setEditable(false); tMoney2.setEditable(false); ViewMenus menus = new ViewMenus(getViewSite()); menus.createMenu(printAction, reloadAction, statAction); menus.createToolbar(reloadAction, filterAction); // setFocus(); cv.getConfigurer().getContentProvider().startListening(); GlobalEventDispatcher.addActivationListener(this, this); kload.schedule(); cv.addDoubleClickListener(new DoubleClickListener() { @Override public void doubleClicked(PersistentObject obj, CommonViewer cv) { Konsultation k = (Konsultation) obj; ElexisEventDispatcher.fireSelectionEvent(k); ElexisEventDispatcher.fireSelectionEvent(k.getFall()); ElexisEventDispatcher.fireSelectionEvent(k.getFall().getPatient()); try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(KonsDetailView.ID); } catch (PartInitException e) { ExHandler.handle(e); } } }); }
From source file:ch.elexis.core.ui.wizards.DBConnectNewOrEditConnectionWizardPage.java
License:Open Source License
/** * Create contents of the wizard./* w w w.j a va 2s .c o m*/ * * @param parent */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Group group = new Group(container, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); group.setText(Messages.DBConnectFirstPage_connectioNDetails); group.setLayout(new GridLayout(4, false)); Label lblTyp = new Label(group, SWT.NONE); lblTyp.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblTyp.setText("Typ"); comboViewerDBType = new ComboViewer(group, SWT.READ_ONLY); comboViewerDBType.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { DBType selection = (DBType) ((StructuredSelection) comboViewerDBType.getSelection()) .getFirstElement(); txtDBPort.setText(selection.defaultPort); if (selection.equals(DBType.H2)) { String h2Username = "sa"; //$NON-NLS-1$ String h2DBName = "elexis"; //$NON-NLS-1$ getDBConnectWizard().getTargetedConnection().username = h2Username; getDBConnectWizard().getTargetedConnection().databaseName = h2DBName; txtDBUsername.setText(h2Username); txtDBName.setText(h2DBName); } getDBConnectWizard().getTargetedConnection().rdbmsType = selection; getDBConnectWizard().getTargetedConnection().port = selection.defaultPort; } }); Combo comboDBType = comboViewerDBType.getCombo(); comboDBType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboViewerDBType.setContentProvider(ArrayContentProvider.getInstance()); comboViewerDBType.setInput(DBConnection.DBType.values()); Label lblDBName = new Label(group, SWT.NONE); lblDBName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDBName.setText(Messages.DBImportFirstPage_databaseName); txtDBName = new Text(group, SWT.BORDER); txtDBName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDBName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getDBConnectWizard().getTargetedConnection().databaseName = txtDBName.getText(); } }); Label lblHost = new Label(group, SWT.NONE); lblHost.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblHost.setText(Messages.DBImportFirstPage_serverAddress); txtDBHost = new Text(group, SWT.BORDER); txtDBHost.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDBHost.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getDBConnectWizard().getTargetedConnection().hostName = txtDBHost.getText(); } }); Label lblPort = new Label(group, SWT.NONE); lblPort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblPort.setText("Port"); txtDBPort = new Text(group, SWT.BORDER); txtDBPort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDBPort.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getDBConnectWizard().getTargetedConnection().port = txtDBPort.getText(); } }); Label lblDBUsername = new Label(group, SWT.NONE); lblDBUsername.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDBUsername.setText(Messages.DBConnectSecondPage_databaseUsername); txtDBUsername = new Text(group, SWT.BORDER); txtDBUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDBUsername.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getDBConnectWizard().getTargetedConnection().username = txtDBUsername.getText(); } }); Label lblDBPassword = new Label(group, SWT.NONE); lblDBPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblDBPassword.setText(Messages.DBConnectSecondPage_databasePassword); txtDBPassword = new Text(group, SWT.PASSWORD); txtDBPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtDBPassword.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getDBConnectWizard().getTargetedConnection().password = txtDBPassword.getText(); } }); new Label(group, SWT.NONE); new Label(group, SWT.NONE); new Label(group, SWT.NONE); new Label(group, SWT.NONE); // // new Label(group, SWT.NONE); // new Label(group, SWT.NONE); // new Label(group, SWT.NONE); // new Label(group, SWT.NONE); // Button btnCreateDB = new Button(group, SWT.CHECK); // btnCreateDB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1)); // btnCreateDB.setText("Datenbank erstellen"); // new Label(group, SWT.NONE); // Group grpRootCredentials = new Group(group, SWT.NONE); // grpRootCredentials.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); // grpRootCredentials.setText("Administrator / Root Credentials"); // grpRootCredentials.setLayout(new GridLayout(2, false)); // // Label lblRootUsername = new Label(grpRootCredentials, SWT.NONE); // lblRootUsername.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); // lblRootUsername.setText("Username"); // // txtRootUsername = new Text(grpRootCredentials, SWT.BORDER); // txtRootUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); // // Label lblRootPassword = new Label(grpRootCredentials, SWT.NONE); // lblRootPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); // lblRootPassword.setText("Passwort"); // // txtRootPassword = new Text(grpRootCredentials, SWT.BORDER); // txtRootPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); tdbg = new TestDBConnectionGroup(container, SWT.NONE, getDBConnectWizard()); tdbg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); }
From source file:ch.elexis.core.ui.wizards.DBConnectSelectionConnectionWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite area = new Composite(parent, SWT.NONE); area.setLayout(new GridLayout(1, false)); setControl(area);/*w w w.j a v a2 s.com*/ Group grpStatCurrentConnection = new Group(area, SWT.NONE); grpStatCurrentConnection.setLayout(new GridLayout(2, true)); grpStatCurrentConnection.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); grpStatCurrentConnection.setText(Messages.DBConnectWizardPage_grpStatCurrentConnection_text); createEntityArea(grpStatCurrentConnection); Composite cmpExistConnSelector = new Composite(area, SWT.BORDER); cmpExistConnSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); cmpExistConnSelector.setLayout(new GridLayout(3, false)); Label lblGespeicherteVerbindungen = new Label(cmpExistConnSelector, SWT.NONE); lblGespeicherteVerbindungen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1)); lblGespeicherteVerbindungen.setText(Messages.DBConnectWizardPage_lblGespeicherteVerbindungen_text); cViewerConns = new ComboViewer(cmpExistConnSelector, SWT.READ_ONLY); Combo combo = cViewerConns.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); cViewerConns.setContentProvider(ArrayContentProvider.getInstance()); cViewerConns.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { DBConnection dbc = (DBConnection) element; if (dbc.username != null && dbc.connectionString != null) { return dbc.username + "@" + dbc.connectionString; } else { return "Neue Verbindung erstellen"; } } }); cViewerConns.setInput(getDBConnectWizard().getStoredConnectionList()); btnDelStoredConn = new Button(cmpExistConnSelector, SWT.FLAT); btnDelStoredConn.setImage(Images.IMG_DELETE.getImage()); btnDelStoredConn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) cViewerConns.getSelection(); if (selection.size() > 0) { Object firstElement = selection.getFirstElement(); if (firstElement != null) { getDBConnectWizard().removeConnection((DBConnection) firstElement); cViewerConns.setInput(getDBConnectWizard().getStoredConnectionList()); setCurrentSelection(); } } } }); btnCopyStoredConn = new Button(cmpExistConnSelector, SWT.FLAT); btnCopyStoredConn.setImage(Images.IMG_COPY.getImage()); btnCopyStoredConn.setToolTipText("Verbindungsdaten in Zwischenablage kopieren"); btnCopyStoredConn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) cViewerConns.getSelection(); if (selection.size() > 0) { Object firstElement = selection.getFirstElement(); if (firstElement != null) { DBConnection dbc = (DBConnection) firstElement; Clipboard cb = new Clipboard(UiDesk.getDisplay()); TextTransfer textTransfer = TextTransfer.getInstance(); try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { dbc.marshall(bos); cb.setContents(new Object[] { bos.toString() }, new Transfer[] { textTransfer }); } catch (JAXBException | IOException e1) { MessageDialog.openError(UiDesk.getTopShell(), "Error", e1.getMessage()); } } } } }); cViewerConns.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.size() > 0) { Object firstElement = selection.getFirstElement(); if (firstElement != null) { DBConnection targetedConnection = (DBConnection) firstElement; getDBConnectWizard().setTargetedConnection(targetedConnection); btnDelStoredConn.setEnabled( !targetedConnection.equals(getDBConnectWizard().getCurrentConnection())); } } } }); setCurrentSelection(); Label lblOderAufDer = new Label(cmpExistConnSelector, SWT.NONE); lblOderAufDer.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1)); lblOderAufDer.setText(Messages.DBConnectSelectionConnectionWizardPage_lblOderAufDer_text); tdbg = new TestDBConnectionGroup(area, SWT.NONE, getDBConnectWizard()); tdbg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); }
From source file:ch.elexis.data.TarmedImporter.java
License:Open Source License
@Override public Composite createPage(final Composite parent) { FileBasedImporter fis = new ImporterPage.FileBasedImporter(parent, this); fis.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); Composite updateIDsComposite = new Composite(fis, SWT.NONE); updateIDsComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); updateIDsComposite.setLayout(new FormLayout()); Label lbl = new Label(updateIDsComposite, SWT.NONE); lbl.setText("Gesetz des Datensatz (relevant ab Tarmed 1.09)"); final ComboViewer lawCombo = new ComboViewer(updateIDsComposite, SWT.BORDER); lawCombo.setContentProvider(ArrayContentProvider.getInstance()); lawCombo.setInput(availableLaws);//from w w w . jav a 2s . co m lawCombo.setSelection(new StructuredSelection(selectedLaw)); lawCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); if (selection != null && !selection.isEmpty()) { selectedLaw = (String) selection.getFirstElement(); } else { selectedLaw = ""; } } }); FormData fd = new FormData(); fd.top = new FormAttachment(0, 5); fd.left = new FormAttachment(0, 0); lbl.setLayoutData(fd); fd = new FormData(); fd.top = new FormAttachment(0, 0); fd.left = new FormAttachment(lbl, 5); lawCombo.getCombo().setLayoutData(fd); lbl = new Label(updateIDsComposite, SWT.NONE); lbl.setText(Messages.TarmedImporter_updateOldIDEntries); final Button updateIDsBtn = new Button(updateIDsComposite, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(lawCombo.getControl(), 5); fd.left = new FormAttachment(0, 0); lbl.setLayoutData(fd); fd = new FormData(); fd.top = new FormAttachment(lawCombo.getControl(), 5); fd.left = new FormAttachment(lbl, 5); updateIDsBtn.setLayoutData(fd); updateIDsBtn.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { updateIDs = updateIDsBtn.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { updateIDs = updateIDsBtn.getSelection(); } }); return fis; }
From source file:ch.elexis.preferences.LabGroupPrefs.java
License:Open Source License
protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); composite.setLayout(new GridLayout(1, false)); Label label;/* w ww . java2 s . c om*/ GridLayout layout; Composite topArea = new Composite(composite, SWT.NONE); topArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); layout = new GridLayout(3, false); layout.verticalSpacing = 20; topArea.setLayout(layout); label = new Label(topArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_ExplanationsLine1 + Messages.LabGroupPrefs_ExplanationsLine2 + Messages.LabGroupPrefs_ExplanationsLine3); label.setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); GridData gd; label = new Label(topArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_group); gd = SWTHelper.getFillGridData(1, false, 1, false); gd.verticalAlignment = GridData.BEGINNING; label.setLayoutData(gd); groupsViewer = new ComboViewer(topArea, SWT.READ_ONLY); gd = SWTHelper.getFillGridData(1, true, 1, false); gd.verticalAlignment = GridData.BEGINNING; groupsViewer.getControl().setLayoutData(gd); groupsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection sel = (IStructuredSelection) groupsViewer.getSelection(); Object element = sel.getFirstElement(); if (element instanceof LabGroup) { actGroup = (LabGroup) element; itemsViewer.refresh(); } updateButtonsState(); } }); groupsViewer.setContentProvider(new GroupsContentProvider()); groupsViewer.setLabelProvider(new DefaultLabelProvider()); groupsViewer.setInput(this); Composite groupButtonArea = new Composite(topArea, SWT.PUSH); layout = new GridLayout(1, false); layout.marginHeight = 0; groupButtonArea.setLayout(layout); newButton = new Button(groupButtonArea, SWT.PUSH); newButton.setText(Messages.LabGroupPrefs_new); newButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.LabGroupPrefs_newLabGroup, Messages.LabGroupPrefs_selectNameForLabGroup, "", null); //$NON-NLS-1$ int rc = dialog.open(); if (rc == Window.OK) { String name = dialog.getValue(); LabGroup group = new LabGroup(name, null); groupsViewer.refresh(); groupsViewer.setSelection(new StructuredSelection(group)); } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); removeButton = new Button(groupButtonArea, SWT.PUSH); removeButton.setText(Messages.LabGroupPrefs_delete); removeButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { if (SWTHelper.askYesNo(Messages.LabGroupPrefs_deleteGroup, MessageFormat.format(Messages.LabGroupPrefs_reallyDeleteGroup, actGroup.getLabel()))) ; { actGroup.delete(); actGroup = null; groupsViewer.refresh(); itemsViewer.refresh(); selectFirstGroup(); } } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); Composite bottomArea = new Composite(composite, SWT.NONE); bottomArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); bottomArea.setLayout(new GridLayout(1, false)); label = new Label(bottomArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_containingLabItems); itemsViewer = new ListViewer(bottomArea, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); itemsViewer.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); itemsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateItemButtonsState(); } }); itemsViewer.setContentProvider(new GroupItemsContentProvider()); itemsViewer.setLabelProvider(new ItemsLabelProvider()); itemsViewer.setInput(this); Composite buttonArea = new Composite(bottomArea, SWT.NONE); buttonArea.setLayoutData(SWTHelper.getFillGridData(1, false, 1, false)); buttonArea.setLayout(new GridLayout(2, true)); addItemButton = new Button(buttonArea, SWT.PUSH); addItemButton.setText(Messages.LabGroupPrefs_add); addItemButton.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); removeItemButton = new Button(buttonArea, SWT.PUSH); removeItemButton.setText(Messages.LabGroupPrefs_remove); removeItemButton.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); addItemButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { ItemsSelectionDialog dialog = new ItemsSelectionDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), actGroup); if (dialog.open() == ItemsSelectionDialog.OK) { itemsViewer.refresh(); } } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); removeItemButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { IStructuredSelection sel = (IStructuredSelection) itemsViewer.getSelection(); for (Object obj : sel.toList()) { if (obj instanceof LabItem) { LabItem item = (LabItem) obj; actGroup.removeItem(item); } } itemsViewer.refresh(); } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); selectFirstGroup(); return composite; }
From source file:ch.elexis.views.TarmedDetailDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { TarmedLeistung tl = (TarmedLeistung) verrechnet.getVerrechenbar(); Composite ret = (Composite) super.createDialogArea(parent); ret.setLayout(new GridLayout(8, false)); Label lTitle = new Label(ret, SWT.WRAP); lTitle.setText(tl.getText());/* w w w. jav a 2 s . c om*/ lTitle.setLayoutData(SWTHelper.getFillGridData(8, true, 1, true)); double primaryScale = verrechnet.getPrimaryScaleFactor(); double secondaryScale = verrechnet.getSecondaryScaleFactor(); double tpAL = TarmedLeistung.getAL(verrechnet) / 100.0; double tpTL = TarmedLeistung.getTL(verrechnet) / 100.0; double tpw = verrechnet.getTPW(); Money mAL = new Money(tpAL * tpw * primaryScale * secondaryScale); Money mTL = new Money(tpTL * tpw * primaryScale * secondaryScale); double tpAll = Math.round((tpAL + tpTL) * 100.0) / 100.0; Money mAll = new Money(tpAll * tpw * primaryScale * secondaryScale); new Label(ret, SWT.NONE).setText("TP AL"); new Label(ret, SWT.NONE).setText(Double.toString(tpAL)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF AL"); new Label(ret, SWT.NONE).setText(mAL.getAmountAsString()); new Label(ret, SWT.NONE).setText("TP TL"); new Label(ret, SWT.NONE).setText(Double.toString(tpTL)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF TL"); new Label(ret, SWT.NONE).setText(mTL.getAmountAsString()); Label sep = new Label(ret, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(SWTHelper.getFillGridData(8, true, 1, false)); new Label(ret, SWT.NONE).setText("TP "); new Label(ret, SWT.NONE).setText(Double.toString(tpAll)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF "); new Label(ret, SWT.NONE).setText(mAll.getAmountAsString()); Label sep2 = new Label(ret, SWT.SEPARATOR | SWT.HORIZONTAL); sep2.setLayoutData(SWTHelper.getFillGridData(8, true, 1, false)); String mins = Integer.toString(tl.getMinutes()); new Label(ret, SWT.NONE).setText("Zeit:"); new Label(ret, SWT.NONE).setText(mins + " min."); new Label(ret, SWT.NONE).setText("Seite"); cSide = new Combo(ret, SWT.SINGLE); cSide.setItems(new String[] { "egal", "links", "rechts" }); new Label(ret, SWT.NONE).setText("Pflichtleist."); bPflicht = new Button(ret, SWT.CHECK); String sPflicht = verrechnet.getDetail(TarmedLeistung.PFLICHTLEISTUNG); if ((sPflicht == null) || (Boolean.parseBoolean(sPflicht))) { bPflicht.setSelection(true); } String side = verrechnet.getDetail(TarmedLeistung.SIDE); if (side == null) { cSide.select(0); } else if (side.equalsIgnoreCase("l")) { cSide.select(1); } else { cSide.select(2); } if (tl.getServiceTyp().equals("Z") || tl.getServiceTyp().equals("R") || tl.getServiceTyp().equals("B")) { new Label(ret, SWT.NONE); new Label(ret, SWT.NONE); new Label(ret, SWT.NONE).setText("Bezug"); cBezug = new ComboViewer(ret, SWT.BORDER); cBezug.setContentProvider(ArrayContentProvider.getInstance()); cBezug.setLabelProvider(new LabelProvider()); List<BezugComboItem> input = new ArrayList<>(); input.add(BezugComboItem.noBezug()); for (Verrechnet kVerr : verrechnet.getKons().getLeistungen()) { if (!kVerr.getCode().equals(tl.getCode())) { input.add(BezugComboItem.of(kVerr.getCode())); } } cBezug.setInput(input); String bezug = verrechnet.getDetail("Bezug"); if (bezug != null) { cBezug.setSelection(new StructuredSelection(BezugComboItem.of(bezug)), true); } else { cBezug.setSelection(new StructuredSelection(BezugComboItem.noBezug()), true); } cBezug.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) cBezug.getSelection(); if (selection != null && !selection.isEmpty()) { BezugComboItem selected = (BezugComboItem) selection.getFirstElement(); if (selected.isNoBezug) { verrechnet.setDetail("Bezug", ""); } else { verrechnet.setDetail("Bezug", selected.getCode()); } } } }); } ret.pack(); return ret; }
From source file:ch.uzh.ifi.seal.permo.performance.timeseries.ui.view.TimeSeriesToolbar.java
License:Apache License
private void createIntervalCombo() { final ComboViewer intervalComboViewer = new ComboViewer(this, SWT.NONE); intervalComboViewer.setContentProvider(ArrayContentProvider.getInstance()); intervalComboViewer.setInput(TimeRange.values()); final IViewerObservableValue intervalComboViewerObservable = ViewersObservables .observeSingleSelection(intervalComboViewer); DataBindings.createBinding(intervalComboViewerObservable, viewModel.getVisibleRange(), VisibleRangeViewModel.PROPERTY__RANGE); }