Example #1
0
 public void visible(final boolean mode) {
   if (mode) {
     tv.refresh(true);
     ElexisEventDispatcher.getInstance().addListeners(eeli_fall, eeli_pat);
   } else {
     ElexisEventDispatcher.getInstance().removeListeners(eeli_fall, eeli_pat);
   }
 }
 public void visible(boolean mode) {
   if (mode) {
     ElexisEventDispatcher.getInstance().addListeners(this);
     catchElexisEvent(template);
   } else {
     ElexisEventDispatcher.getInstance().removeListeners(this);
   }
 }
Example #3
0
 @Override
 public void visible(boolean mode) {
   if (mode == true) {
     Problem problem = IatrixEventHelper.getSelectedProblem();
     if (problem != null) {
       // check whether Problem matches the currently selected patient
       Patient selectedPatient = ElexisEventDispatcher.getSelectedPatient();
       if (selectedPatient != null
           && problem.getPatient().getId().equals(selectedPatient.getId())) {
         setProblem(problem);
       } else {
         setProblem(null);
       }
     } else {
       setProblem(null);
     }
     ElexisEventDispatcher.getInstance().addListeners(eeli_problem, eeli_patient);
   } else {
     ElexisEventDispatcher.getInstance().removeListeners(eeli_problem, eeli_patient);
   }
 }
  public VerrechnungsDisplay(final IWorkbenchPage p, Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout());
    this.page = p;
    defaultRGB = UiDesk.createColor(new RGB(255, 255, 255));

    hVer =
        UiDesk.getToolkit()
            .createHyperlink(this, Messages.VerrechnungsDisplay_billing, SWT.NONE); // $NON-NLS-1$
    hVer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    hVer.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            try {
              if (StringTool.isNothing(LeistungenView.ID)) {
                SWTHelper.alert(
                    Messages.VerrechnungsDisplay_error,
                    "LeistungenView.ID"); //$NON-NLS-1$ //$NON-NLS-2$
              }
              page.showView(LeistungenView.ID);
              CodeSelectorHandler.getInstance().setCodeSelectorTarget(dropTarget);
            } catch (Exception ex) {
              ElexisStatus status =
                  new ElexisStatus(
                      ElexisStatus.ERROR,
                      Hub.PLUGIN_ID,
                      ElexisStatus.CODE_NONE,
                      Messages.VerrechnungsDisplay_errorStartingCodeWindow + ex.getMessage(),
                      ex,
                      ElexisStatus.LOG_ERRORS);
              StatusManager.getManager().handle(status, StatusManager.SHOW);
            }
          }
        });
    makeActions();
    tVerr = UiDesk.getToolkit().createTable(this, SWT.MULTI);
    tVerr.setLayoutData(new GridData(GridData.FILL_BOTH));
    tVerr.setMenu(createVerrMenu());
    // dummy table viewer needed for SelectionsProvider for Menu
    viewer = new TableViewer(tVerr);
    // add selection event to table which provides selection to ElexisEventDispatcher
    tVerr.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            TableItem[] selection = tVerr.getSelection();
            Verrechnet verrechnet = (Verrechnet) selection[0].getData();
            ElexisEventDispatcher.fireSelectionEvent(verrechnet);

            applyMedicationAction.setEnabled(false);

            IVerrechenbar verrechenbar = verrechnet.getVerrechenbar();
            if (verrechenbar != null && (verrechenbar instanceof Artikel)) {
              applyMedicationAction.setEnabled(true);
            }
          }
        });
    tVerr.addKeyListener(
        new KeyListener() {
          @Override
          public void keyReleased(KeyEvent e) {}

          @Override
          public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.DEL) {
              if (tVerr.getSelectionIndices().length >= 1 && removeAction != null) {
                removeAction.run();
              }
            }
          }
        });
    dropTarget =
        new PersistentObjectDropTarget(
            Messages.VerrechnungsDisplay_doBill, tVerr, new DropReceiver()); // $NON-NLS-1$
    // refresh the table if a update to a Verrechnet occurs
    ElexisEventDispatcher.getInstance()
        .addListeners(
            new ElexisUiEventListenerImpl(Verrechnet.class, ElexisEvent.EVENT_UPDATE) {
              @Override
              public void runInUi(ElexisEvent ev) {
                Konsultation actKons =
                    (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
                setLeistungen(actKons);
              }
            });

    ElexisEventDispatcher.getInstance().addListeners(eeli_update);
  }