Skip to content

Commit

Permalink
Merge branch 'master' into 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
col-panic authored Aug 12, 2024
2 parents 1ca87e2 + d0c7692 commit e431376
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import ch.elexis.core.findings.IAllergyIntolerance;
import ch.elexis.core.findings.IAllergyIntolerance.AllergyIntoleranceCategory;
import ch.elexis.core.findings.ui.model.AbstractBeanAdapter;
import ch.elexis.core.findings.ui.model.AllergyIntoleranceBeanAdapter;
import ch.elexis.core.findings.ui.services.FindingsServiceComponent;

Expand All @@ -31,7 +30,7 @@ public class AllergyIntoleranceComposite extends Composite {

private StyledText textOberservation = null;

protected WritableValue<AbstractBeanAdapter<IAllergyIntolerance>> item = new WritableValue<>();
protected WritableValue<AllergyIntoleranceBeanAdapter> item = new WritableValue<>();

public AllergyIntoleranceComposite(Composite parent, int style) {
super(parent, style);
Expand Down Expand Up @@ -61,8 +60,11 @@ public String getText(Object element) {

public void setAllergyIntolerance(Optional<IAllergyIntolerance> input) {
if (textOberservation != null) {
item.setValue(new AllergyIntoleranceBeanAdapter(input.isPresent() ? input.get()
: FindingsServiceComponent.getService().create(IAllergyIntolerance.class)).autoSave(true));
AllergyIntoleranceBeanAdapter adapter = new AllergyIntoleranceBeanAdapter(
input.isPresent() ? input.get()
: FindingsServiceComponent.getService().create(IAllergyIntolerance.class));
adapter.autoSave(true);
item.setValue(adapter);
}
}

Expand All @@ -77,12 +79,13 @@ protected void initDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();

IViewerObservableValue<Object> targetObservable = ViewerProperties.singleSelection().observe(categoryViewer);
IObservableValue<Object> modelObservable = PojoProperties.value(AbstractBeanAdapter.class, "category")
IObservableValue<Object> modelObservable = PojoProperties.value(AllergyIntoleranceBeanAdapter.class, "category")
.observeDetail(item);
bindingContext.bindValue(targetObservable, modelObservable);

ISWTObservableValue<String> target = WidgetProperties.text(SWT.Modify).observeDelayed(1500, textOberservation);
IObservableValue<Object> model = PojoProperties.value(AbstractBeanAdapter.class, "text").observeDetail(item);
IObservableValue<Object> model = PojoProperties.value(AllergyIntoleranceBeanAdapter.class, "text")
.observeDetail(item);
bindingContext.bindValue(target, model, null, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ public class Messages extends NLS {
public static String BestellView_loadEarlierOrder;
public static String BestellView_saveOrder;
public static String BestellView_transmitOrder;
public static String BestellView_inventory;
public static String BestellView_delivered;
public static String BezugsKonktat_FormalerReference;
public static String BezugsKontakt_ContactDoesntExist;
public static String Bezugskontakt_ConfirmDelete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,10 @@ BestellView_saveOrder = save order
BestellView_transmitOrder = transmit order automatically
BestellView_inventory = inventory
BestellView_delivered = delivered
BezugsKonktat_FormalerReference = formal reference
BezugsKontakt_ContactDoesntExist = This contact does not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ BestellView_saveOrder = Bestellung speichern
BestellView_transmitOrder = Bestellung automatisch \u00FCbermitteln
BestellView_inventory = Bestand
BestellView_delivered = Geliefert
BezugsKonktat_FormalerReference = Formaler Bezug
BezugsKontakt_ContactDoesntExist = Angegebener Kontakt nicht vorhanden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ BestellView_saveOrder = Save order
BestellView_transmitOrder = Submit order automatically
BestellView_inventory = Inventory
BestellView_delivered = Delivered
BezugsKonktat_FormalerReference = Formal reference
BezugsKontakt_ContactDoesntExist = Specified contact not available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,10 @@ BestellView_saveOrder = Sauver commande

BestellView_transmitOrder = Envoyer automatiquement la commande

BestellView_inventory = Inventaire

BestellView_delivered = Livré

BezugsKonktat_FormalerReference = R\u00E9f\u00E9rence formelle

BezugsKontakt_ContactDoesntExist = Aucun contact d\u00E9clar\u00E9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,10 @@ BestellView_saveOrder = Salva ordine
BestellView_transmitOrder = Inviare automaticamente ordine
BestellView_inventory = Inventario
BestellView_delivered = Consegnato
BezugsKonktat_FormalerReference = Riferimento formale
BezugsKontakt_ContactDoesntExist = Detto Contatto No
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public List<LabResult> getSelectedResults() {
}

private List<LabResult> getSelectedResults(ViewerCell cell) {
if (cell != null && cell.getColumnIndex() > 2) {
if (cell != null && cell.getColumnIndex() > 3) {
TreeViewerColumn column = resultColumns.get(cell.getColumnIndex() - 4);
TimeTool time = (TimeTool) column.getColumn().getData(COLUMN_DATE_KEY);
if ((time != null) && (cell.getElement() instanceof LaborItemResults)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,12 @@ public class Messages {
public static String DailyOrderMandantOnlyFollowing = ch.elexis.core.l10n.Messages.DailyOrderMandantOnlyFollowing;
public static String DailyOrderMandantNone = ch.elexis.core.l10n.Messages.DailyOrderMandantNone;

public static String Core_ok = ch.elexis.core.l10n.Messages.Core_Ok;
public static String BestellView_delivered = ch.elexis.core.l10n.Messages.BestellView_delivered;
public static String BestellView_inventory = ch.elexis.core.l10n.Messages.BestellView_inventory;
public static String Core_Phamacode = ch.elexis.core.l10n.Messages.Core_Phamacode;
public static String Core_EAN = ch.elexis.core.l10n.Messages.Core_EAN;
public static String UI_description = ch.elexis.core.l10n.Messages.UI_description;
public static String Core_Stock = ch.elexis.core.l10n.Messages.Core_Stock;

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnViewerEditor;
import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
Expand Down Expand Up @@ -120,6 +122,8 @@ public class OrderImportDialog extends TitleAreaDialog {

private int actionMode;

private TableColumnLayout tcLayout;

/**
* @wbp.parser.constructor
*/
Expand Down Expand Up @@ -225,6 +229,8 @@ public void widgetDefaultSelected(SelectionEvent e) {
viewer = new TableViewer(tableArea, SWT.FULL_SELECTION);
Table table = viewer.getTable();
table.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
tcLayout = new TableColumnLayout();
tableArea.setLayout(tcLayout);
table.setLinesVisible(true);
table.setHeaderVisible(true);

Expand Down Expand Up @@ -320,8 +326,8 @@ private void createViewerColumns() {

/* OK (checkbox column) */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("OK");
column.getColumn().setWidth(50);
column.getColumn().setText(Messages.Core_ok);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(50, true, true));
column.setLabelProvider(new CheckboxLabelProvider());
column.setEditingSupport(new EditingSupport(viewer) {
public boolean canEdit(Object element) {
Expand Down Expand Up @@ -355,8 +361,8 @@ public void setValue(Object element, Object value) {

/* Amount delivered */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("Geliefert");
column.getColumn().setWidth(60);
column.getColumn().setText(Messages.BestellView_delivered);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(60, true, true));
column.setLabelProvider(new AmountLabelProvider());
column.setEditingSupport(new EditingSupport(viewer) {
public boolean canEdit(Object element) {
Expand Down Expand Up @@ -396,28 +402,33 @@ public void setValue(Object element, Object value) {

/* Amount on stock */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("Lager");
column.getColumn().setWidth(60);
column.getColumn().setText(Messages.BestellView_inventory);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(60, true, true));
column.setLabelProvider(new StockLabelProvider());

/* Pharamcode */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("Pharmacode"); //$NON-NLS-1$
column.getColumn().setWidth(80);
column.getColumn().setText(Messages.Core_Phamacode);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(70, true, true));
column.setLabelProvider(new PharamcodeLabelProvider());

/* EAN */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("EAN"); //$NON-NLS-1$
column.getColumn().setWidth(110);
column.getColumn().setText(Messages.Core_EAN);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(70, true, true));
column.setLabelProvider(new EANLabelProvider());

/* Description */
column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText("Beschreibung");
column.getColumn().setWidth(300);
column.getColumn().setText(Messages.UI_description);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(200, true, true));
column.setLabelProvider(new DescriptionLabelProvider());

column = new TableViewerColumn(viewer, SWT.LEFT);
column.getColumn().setText(Messages.Core_Stock);
tcLayout.setColumnData(column.getColumn(), new ColumnPixelData(100, true, true));
column.setLabelProvider(new StockNameLabelProvider());

}

@Override
Expand Down Expand Up @@ -748,6 +759,17 @@ public String getText(Object element) {
}
}

private class StockNameLabelProvider extends BaseLabelProvider {
public String getText(Object element) {
if (element instanceof OrderElement) {
OrderElement orderElement = (OrderElement) element;
IStock stock = orderElement.getStockEntry().getStock();
return stock.getId().contains("PatientStock-") ? stock.getDescription() : stock.getCode();
}
return null;
}
}

private class TransientStockEntry implements IStockEntry {

private IArticle article;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
Expand All @@ -52,7 +54,6 @@
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbenchPage;
Expand Down Expand Up @@ -125,28 +126,29 @@ public void createPartControl(final Composite parent) {
parent.setLayout(new FillLayout());
form = tk.createForm(parent);
Composite body = form.getBody();
body.setLayout(new GridLayout());
Table table = new Table(body, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
table.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
TableColumnLayout tcLayout = new TableColumnLayout();
body.setLayout(tcLayout);
table.setHeaderVisible(true);
table.setLinesVisible(false);
tv = new TableViewer(table);

TableViewerColumn tvcNumber = new TableViewerColumn(tv, SWT.CENTER);
tvcNumber.getColumn().setText(Messages.Core_Number);
tvcNumber.getColumn().setWidth(40);
tcLayout.setColumnData(tvcNumber.getColumn(), new ColumnPixelData(40, true, true));
ReflectiveEditingSupport poes = new ReflectiveEditingSupport(tv,
ModelPackage.Literals.IORDER_ENTRY__AMOUNT.getName());
poes.setModelService(CoreModelServiceHolder.get());
tvcNumber.setEditingSupport(poes);

TableViewerColumn tvcArticle = new TableViewerColumn(tv, SWT.LEFT);
tvcArticle.getColumn().setText(Messages.Core_Article);
tvcArticle.getColumn().setWidth(280);
tcLayout.setColumnData(tvcArticle.getColumn(), new ColumnPixelData(280, true, true));

TableViewerColumn tvcDealer = new TableViewerColumn(tv, SWT.LEFT);
tvcDealer.getColumn().setText(Messages.Core_Article_provider);
tvcDealer.getColumn().setWidth(250);
tcLayout.setColumnData(tvcDealer.getColumn(), new ColumnPixelData(250, true, true));
tvcDealer.setEditingSupport(new EditingSupport(tv) {

@Override
Expand Down Expand Up @@ -181,9 +183,9 @@ protected boolean canEdit(Object element) {
return (be != null);
}
});
TableViewerColumn tvc3 = new TableViewerColumn(tv, SWT.LEFT);
tvc3.getColumn().setText("Lager"); //$NON-NLS-1$
tvc3.getColumn().setWidth(50);
TableViewerColumn tvcStock = new TableViewerColumn(tv, SWT.LEFT);
tvcStock.getColumn().setText(Messages.Core_Stock);
tcLayout.setColumnData(tvcStock.getColumn(), new ColumnPixelData(150, true, true));

tv.setContentProvider(new BestellungContentProvider());
blp = new BestellungLabelProvider();
Expand Down Expand Up @@ -363,7 +365,8 @@ public String getColumnText(final Object element, final int columnIndex) {
return (k != null) ? k.getLabel() : Messages.Core_Unknown;
case 3:
IStock s = entry.getStock();
return (s != null) ? s.getCode() : StringConstants.EMPTY;
return (s != null) ? (s.getId().contains("PatientStock-") ? s.getDescription() : s.getCode())
: StringConstants.EMPTY;
default:
return "?"; //$NON-NLS-1$
}
Expand Down
Loading

0 comments on commit e431376

Please sign in to comment.