Loading bundles/ch.elexis.core.documents/src/ch/elexis/core/documents/DocumentStore.java +8 −2 Original line number Diff line number Diff line Loading @@ -68,15 +68,21 @@ public class DocumentStore { } public Map<ICategory, List<IDocument>> getDocumentsByPatientId(String patientId){ Map<String, FilterCategory> categoryMap = new HashMap<>(); Map<ICategory, List<IDocument>> map = new HashMap<>(); List<IDocument> documents = getDocuments(patientId, null, null, null); for (IDocument iDocument : documents) { List<IDocument> categoryDocuments = map.get(new FilterCategory(iDocument.getCategory())); FilterCategory filterCategory = categoryMap.get(iDocument.getCategory().getName()); if (filterCategory == null) { filterCategory = new FilterCategory(iDocument.getCategory()); categoryMap.put(iDocument.getCategory().getName(), filterCategory); } List<IDocument> categoryDocuments = map.get(filterCategory); if (categoryDocuments == null) { categoryDocuments = new ArrayList<>(); } categoryDocuments.add(iDocument); map.put(new FilterCategory(iDocument.getCategory()), categoryDocuments); map.put(filterCategory, categoryDocuments); } return map; } Loading bundles/ch.elexis.core.documents/src/ch/elexis/core/documents/FilterCategory.java +10 −12 Original line number Diff line number Diff line Loading @@ -7,12 +7,7 @@ import ch.elexis.core.model.ICategory; public class FilterCategory implements ICategory { private String name; private String lbl; public FilterCategory(){ this.name = null; this.lbl = "Alle"; } private String label; public FilterCategory(ICategory category){ this.name = category.getName(); Loading @@ -20,7 +15,7 @@ public class FilterCategory implements ICategory { public FilterCategory(String name, String lbl){ this.name = name; this.lbl = lbl; this.label = lbl; } @Override Loading @@ -33,20 +28,23 @@ public class FilterCategory implements ICategory { this.name = name; } public String getLbl(){ return lbl; public String getLabel(){ return label; } public boolean isAll(){ return name == null; public void setLabel(String label){ this.label = label; } @Override public int hashCode(){ return Objects.hash(name); } public boolean isAll(){ return name == null; } @Override public boolean equals(Object obj){ if (this == obj) Loading bundles/ch.elexis.core.ui.documents/src/ch/elexis/core/ui/documents/views/DocumentsFilterBarComposite.java +3 −3 Original line number Diff line number Diff line package ch.elexis.core.ui.documents.views; import java.util.List; import java.util.Optional; import org.eclipse.core.runtime.ListenerList; import org.eclipse.jface.action.Action; Loading Loading @@ -77,7 +76,8 @@ public class DocumentsFilterBarComposite extends Composite implements ISelection if (currentSelection != null && currentSelection.getFilter() != null) { return new StructuredSelection(currentSelection.getFilter()); } return new StructuredSelection(Optional.empty()); // use all if none is selected return new StructuredSelection(filters.get(0)); } @Override Loading @@ -97,7 +97,7 @@ public class DocumentsFilterBarComposite extends Composite implements ISelection private FilterCategory filter; public DocumentTypeAction(FilterCategory filter){ super(filter.getLbl(), Action.AS_RADIO_BUTTON); super(filter.getLabel(), Action.AS_RADIO_BUTTON); this.filter = filter; } Loading bundles/ch.elexis.core.ui.documents/src/ch/elexis/core/ui/documents/views/DocumentsView.java +19 −28 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; Loading Loading @@ -79,8 +80,6 @@ import ch.elexis.core.model.BriefConstants; import ch.elexis.core.model.ICategory; import ch.elexis.core.model.IDocument; import ch.elexis.core.model.Identifiable; import ch.elexis.core.ui.actions.GlobalEventDispatcher; import ch.elexis.core.ui.actions.IActivationListener; import ch.elexis.core.ui.documents.Messages; import ch.elexis.core.ui.documents.handler.DocumentCrudHandler; import ch.elexis.core.ui.documents.service.DocumentStoreServiceHolder; Loading @@ -96,7 +95,7 @@ import ch.rgw.tools.TimeTool; * the selected patient. On double-click they are opened with their associated application. */ public class DocumentsView extends ViewPart implements IActivationListener { public class DocumentsView extends ViewPart { private static Logger logger = LoggerFactory.getLogger(DocumentsView.class); private TreeViewer viewer; Loading Loading @@ -125,6 +124,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { @Override public void runInUi(ElexisEvent ev){ viewer.setInput(ev.getObject()); viewer.expandAll(); } }; Loading Loading @@ -217,7 +217,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { class ViewContentProvider implements ITreeContentProvider { private Map<ICategory, List<IDocument>> documentsMap = new HashMap<>(); private FilterCategory selectedFilter = new FilterCategory(); private FilterCategory selectedFilter = null; public void inputChanged(Viewer v, Object oldInput, Object newInput){ documentsMap.clear(); Loading @@ -228,16 +228,14 @@ public class DocumentsView extends ViewPart implements IActivationListener { public ViewContentProvider selectFilterCategory(ISelection selection){ StructuredSelection sel = (StructuredSelection) selection; selectedFilter = new FilterCategory(); if (selection != null) { Object element = sel.getFirstElement(); if (element instanceof FilterCategory) { selectedFilter = (FilterCategory) element; viewer.refresh(true); viewer.expandAll(); } } Patient patient = ElexisEventDispatcher.getSelectedPatient(); loadByFilterCategory(patient); return this; } Loading @@ -264,12 +262,14 @@ public class DocumentsView extends ViewPart implements IActivationListener { } public void createElement(IDocument iDocument){ List<IDocument> iDocuments = documentsMap.get(iDocument.getCategory()); FilterCategory filterCategory = new FilterCategory(iDocument.getCategory()); List<IDocument> iDocuments = documentsMap.get(filterCategory); if (iDocuments == null) { iDocuments = new ArrayList<>(); } iDocuments.add(iDocument); documentsMap.put(iDocument.getCategory(), iDocuments); documentsMap.put(filterCategory, iDocuments); viewer.refresh(true); } Loading Loading @@ -349,7 +349,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { public Object getParent(Object element){ if (element instanceof IDocument) { IDocument dh = (IDocument) element; return dh.getCategory(); return new FilterCategory(dh.getCategory()); } return null; } Loading Loading @@ -583,15 +583,15 @@ public class DocumentsView extends ViewPart implements IActivationListener { } }); GlobalEventDispatcher.addActivationListener(this, this); MenuManager menuManager = new MenuManager(); viewer.getControl().setMenu(menuManager.createContextMenu(viewer.getControl())); getSite().registerContextMenu(menuManager, viewer); getSite().setSelectionProvider(viewer); ElexisEventDispatcher.getInstance().addListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); viewer.setInput(ElexisEventDispatcher.getSelectedPatient()); } Loading Loading @@ -673,7 +673,8 @@ public class DocumentsView extends ViewPart implements IActivationListener { @Override public void dispose(){ GlobalEventDispatcher.removeActivationListener(this, this); ElexisEventDispatcher.getInstance().removeListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); //saveSortSettings(); super.dispose(); } Loading Loading @@ -715,18 +716,6 @@ public class DocumentsView extends ViewPart implements IActivationListener { viewer.refresh(); } @Override public void visible(boolean mode){ if (mode) { ElexisEventDispatcher.getInstance().addListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); viewer.setInput(ElexisEventDispatcher.getSelectedPatient()); } else { ElexisEventDispatcher.getInstance().removeListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); } } private void makeActions(){ doubleClickAction = new Action() { public void run(){ Loading @@ -748,10 +737,12 @@ public class DocumentsView extends ViewPart implements IActivationListener { new ExecutionEvent(command, Collections.EMPTY_MAP, null, null)); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { MessageDialog.openError(getSite().getShell(), "Fehler", "Das Dokument konnte nicht geöffnet werden."); e.printStackTrace(); } }); viewer.refresh(); viewer.refresh(obj); } } }; Loading Loading
bundles/ch.elexis.core.documents/src/ch/elexis/core/documents/DocumentStore.java +8 −2 Original line number Diff line number Diff line Loading @@ -68,15 +68,21 @@ public class DocumentStore { } public Map<ICategory, List<IDocument>> getDocumentsByPatientId(String patientId){ Map<String, FilterCategory> categoryMap = new HashMap<>(); Map<ICategory, List<IDocument>> map = new HashMap<>(); List<IDocument> documents = getDocuments(patientId, null, null, null); for (IDocument iDocument : documents) { List<IDocument> categoryDocuments = map.get(new FilterCategory(iDocument.getCategory())); FilterCategory filterCategory = categoryMap.get(iDocument.getCategory().getName()); if (filterCategory == null) { filterCategory = new FilterCategory(iDocument.getCategory()); categoryMap.put(iDocument.getCategory().getName(), filterCategory); } List<IDocument> categoryDocuments = map.get(filterCategory); if (categoryDocuments == null) { categoryDocuments = new ArrayList<>(); } categoryDocuments.add(iDocument); map.put(new FilterCategory(iDocument.getCategory()), categoryDocuments); map.put(filterCategory, categoryDocuments); } return map; } Loading
bundles/ch.elexis.core.documents/src/ch/elexis/core/documents/FilterCategory.java +10 −12 Original line number Diff line number Diff line Loading @@ -7,12 +7,7 @@ import ch.elexis.core.model.ICategory; public class FilterCategory implements ICategory { private String name; private String lbl; public FilterCategory(){ this.name = null; this.lbl = "Alle"; } private String label; public FilterCategory(ICategory category){ this.name = category.getName(); Loading @@ -20,7 +15,7 @@ public class FilterCategory implements ICategory { public FilterCategory(String name, String lbl){ this.name = name; this.lbl = lbl; this.label = lbl; } @Override Loading @@ -33,20 +28,23 @@ public class FilterCategory implements ICategory { this.name = name; } public String getLbl(){ return lbl; public String getLabel(){ return label; } public boolean isAll(){ return name == null; public void setLabel(String label){ this.label = label; } @Override public int hashCode(){ return Objects.hash(name); } public boolean isAll(){ return name == null; } @Override public boolean equals(Object obj){ if (this == obj) Loading
bundles/ch.elexis.core.ui.documents/src/ch/elexis/core/ui/documents/views/DocumentsFilterBarComposite.java +3 −3 Original line number Diff line number Diff line package ch.elexis.core.ui.documents.views; import java.util.List; import java.util.Optional; import org.eclipse.core.runtime.ListenerList; import org.eclipse.jface.action.Action; Loading Loading @@ -77,7 +76,8 @@ public class DocumentsFilterBarComposite extends Composite implements ISelection if (currentSelection != null && currentSelection.getFilter() != null) { return new StructuredSelection(currentSelection.getFilter()); } return new StructuredSelection(Optional.empty()); // use all if none is selected return new StructuredSelection(filters.get(0)); } @Override Loading @@ -97,7 +97,7 @@ public class DocumentsFilterBarComposite extends Composite implements ISelection private FilterCategory filter; public DocumentTypeAction(FilterCategory filter){ super(filter.getLbl(), Action.AS_RADIO_BUTTON); super(filter.getLabel(), Action.AS_RADIO_BUTTON); this.filter = filter; } Loading
bundles/ch.elexis.core.ui.documents/src/ch/elexis/core/ui/documents/views/DocumentsView.java +19 −28 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import org.eclipse.core.commands.common.NotDefinedException; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; Loading Loading @@ -79,8 +80,6 @@ import ch.elexis.core.model.BriefConstants; import ch.elexis.core.model.ICategory; import ch.elexis.core.model.IDocument; import ch.elexis.core.model.Identifiable; import ch.elexis.core.ui.actions.GlobalEventDispatcher; import ch.elexis.core.ui.actions.IActivationListener; import ch.elexis.core.ui.documents.Messages; import ch.elexis.core.ui.documents.handler.DocumentCrudHandler; import ch.elexis.core.ui.documents.service.DocumentStoreServiceHolder; Loading @@ -96,7 +95,7 @@ import ch.rgw.tools.TimeTool; * the selected patient. On double-click they are opened with their associated application. */ public class DocumentsView extends ViewPart implements IActivationListener { public class DocumentsView extends ViewPart { private static Logger logger = LoggerFactory.getLogger(DocumentsView.class); private TreeViewer viewer; Loading Loading @@ -125,6 +124,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { @Override public void runInUi(ElexisEvent ev){ viewer.setInput(ev.getObject()); viewer.expandAll(); } }; Loading Loading @@ -217,7 +217,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { class ViewContentProvider implements ITreeContentProvider { private Map<ICategory, List<IDocument>> documentsMap = new HashMap<>(); private FilterCategory selectedFilter = new FilterCategory(); private FilterCategory selectedFilter = null; public void inputChanged(Viewer v, Object oldInput, Object newInput){ documentsMap.clear(); Loading @@ -228,16 +228,14 @@ public class DocumentsView extends ViewPart implements IActivationListener { public ViewContentProvider selectFilterCategory(ISelection selection){ StructuredSelection sel = (StructuredSelection) selection; selectedFilter = new FilterCategory(); if (selection != null) { Object element = sel.getFirstElement(); if (element instanceof FilterCategory) { selectedFilter = (FilterCategory) element; viewer.refresh(true); viewer.expandAll(); } } Patient patient = ElexisEventDispatcher.getSelectedPatient(); loadByFilterCategory(patient); return this; } Loading @@ -264,12 +262,14 @@ public class DocumentsView extends ViewPart implements IActivationListener { } public void createElement(IDocument iDocument){ List<IDocument> iDocuments = documentsMap.get(iDocument.getCategory()); FilterCategory filterCategory = new FilterCategory(iDocument.getCategory()); List<IDocument> iDocuments = documentsMap.get(filterCategory); if (iDocuments == null) { iDocuments = new ArrayList<>(); } iDocuments.add(iDocument); documentsMap.put(iDocument.getCategory(), iDocuments); documentsMap.put(filterCategory, iDocuments); viewer.refresh(true); } Loading Loading @@ -349,7 +349,7 @@ public class DocumentsView extends ViewPart implements IActivationListener { public Object getParent(Object element){ if (element instanceof IDocument) { IDocument dh = (IDocument) element; return dh.getCategory(); return new FilterCategory(dh.getCategory()); } return null; } Loading Loading @@ -583,15 +583,15 @@ public class DocumentsView extends ViewPart implements IActivationListener { } }); GlobalEventDispatcher.addActivationListener(this, this); MenuManager menuManager = new MenuManager(); viewer.getControl().setMenu(menuManager.createContextMenu(viewer.getControl())); getSite().registerContextMenu(menuManager, viewer); getSite().setSelectionProvider(viewer); ElexisEventDispatcher.getInstance().addListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); viewer.setInput(ElexisEventDispatcher.getSelectedPatient()); } Loading Loading @@ -673,7 +673,8 @@ public class DocumentsView extends ViewPart implements IActivationListener { @Override public void dispose(){ GlobalEventDispatcher.removeActivationListener(this, this); ElexisEventDispatcher.getInstance().removeListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); //saveSortSettings(); super.dispose(); } Loading Loading @@ -715,18 +716,6 @@ public class DocumentsView extends ViewPart implements IActivationListener { viewer.refresh(); } @Override public void visible(boolean mode){ if (mode) { ElexisEventDispatcher.getInstance().addListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); viewer.setInput(ElexisEventDispatcher.getSelectedPatient()); } else { ElexisEventDispatcher.getInstance().removeListeners(eeli_pat, eeli_doc_delete, eeli_doc_edit, eeli_doc_create, eeli_doc_reload); } } private void makeActions(){ doubleClickAction = new Action() { public void run(){ Loading @@ -748,10 +737,12 @@ public class DocumentsView extends ViewPart implements IActivationListener { new ExecutionEvent(command, Collections.EMPTY_MAP, null, null)); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { MessageDialog.openError(getSite().getShell(), "Fehler", "Das Dokument konnte nicht geöffnet werden."); e.printStackTrace(); } }); viewer.refresh(); viewer.refresh(obj); } } }; Loading