Esempio n. 1
0
 @Override
 public void createPartControl(final Composite parent) {
   setPartName(Messages.FaelleView_partName); // $NON-NLS-1$
   parent.setLayout(new GridLayout());
   tv = new TableViewer(parent);
   tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   tv.setContentProvider(new FaelleContentProvider());
   tv.setLabelProvider(new FaelleLabelProvider());
   tv.addSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
   menus = new ViewMenus(getViewSite());
   menus.createToolbar(neuerFallAction, konsFilterAction);
   menus.createViewerContextMenu(
       tv, delFallAction, openFallaction, reopenFallAction, makeBillAction);
   GlobalEventDispatcher.addActivationListener(this, this);
   tv.setInput(getViewSite());
   tv.addDoubleClickListener(
       new IDoubleClickListener() {
         @Override
         public void doubleClick(DoubleClickEvent event) {
           try {
             FallDetailView pdv = (FallDetailView) getSite().getPage().showView(FallDetailView.ID);
           } catch (PartInitException e) {
             ExHandler.handle(e);
           }
         }
       });
 }
  @Override
  public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout());
    dmd = new FixMediDisplay(parent, getViewSite());
    dmd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    ListDisplaySelectionProvider selDisplay = new ListDisplaySelectionProvider(dmd);
    getSite().registerContextMenu(FixMediDisplay.ID, dmd.getMenuManager(), selDisplay);
    getSite().setSelectionProvider(selDisplay);

    makeActions();
    getViewSite().getActionBars().getToolBarManager().add(toClipBoardAction);
    GlobalEventDispatcher.addActivationListener(this, this);
  }
Esempio n. 3
0
 NotesList(Composite parent) {
   super(parent, SWT.NONE);
   setLayout(new GridLayout());
   this.parent = parent;
   Composite cFilter = new Composite(this, SWT.NONE);
   cFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   cFilter.setLayout(new GridLayout(3, false));
   ImageHyperlink clearSearchFieldHyperlink = new ImageHyperlink(cFilter, SWT.NONE);
   clearSearchFieldHyperlink.setImage(Images.IMG_CLEAR.getImage());
   clearSearchFieldHyperlink.addHyperlinkListener(
       new HyperlinkAdapter() {
         @Override
         public void linkActivated(HyperlinkEvent e) {
           tFilter.setText(""); // $NON-NLS-1$
           filterExpr = ""; // $NON-NLS-1$
           matches.clear();
           tv.collapseAll();
           tv.removeFilter(notesFilter);
         }
       });
   new Label(cFilter, SWT.NONE).setText(Messages.NotesList_searchLabel);
   tFilter = new Text(cFilter, SWT.SINGLE);
   tFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
   tFilter.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetDefaultSelected(SelectionEvent e) {
           filterExpr = tFilter.getText().toLowerCase();
           matches.clear();
           if (filterExpr.length() == 0) {
             tv.removeFilter(notesFilter);
             tv.collapseAll();
           } else {
             tv.addFilter(notesFilter);
             tv.expandAll();
           }
         }
       });
   tv = new TreeViewer(this, SWT.NONE);
   tv.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   tv.setContentProvider(new NotesContentProvider());
   tv.setLabelProvider(new DefaultLabelProvider());
   tv.setUseHashlookup(true);
   tv.setInput(parent);
   tv.addSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
 }
Esempio n. 4
0
 @Override
 public void dispose() {
   GlobalEventDispatcher.removeActivationListener(this, this);
   super.dispose();
 }
Esempio n. 5
0
  @Override
  public void createPartControl(Composite parent) {
    parent.setLayout(new FillLayout());
    Composite main = new Composite(parent, SWT.NONE);
    main.setLayout(new FillLayout());

    tk = UiDesk.getToolkit();
    form = tk.createScrolledForm(main);
    form.getBody().setLayout(new GridLayout(1, true));

    SashForm mainSash = new SashForm(form.getBody(), SWT.VERTICAL);
    mainSash.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    dauermedikationSection =
        tk.createExpandableComposite(
            mainSash, ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE);
    dauermedikationSection.setText("Fixmedikation");

    Composite dauermedikationComposite = tk.createComposite(dauermedikationSection);
    dauermedikationSection.setClient(dauermedikationComposite);
    Composite bottomComposite = tk.createComposite(mainSash);

    mainSash.setWeights(new int[] {25, 75});

    // Dauermedikation

    dauermedikationComposite.setLayout(new GridLayout());

    // Label lDauermedikation = tk.createLabel(dauermedikationComposite, "Fixmedikation");
    // lDauermedikation.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    dlDauerMedi = new ProblemFixMediDisplay(dauermedikationComposite, getViewSite());

    bottomComposite.setLayout(new GridLayout());

    SashForm bottomSash = new SashForm(bottomComposite, SWT.HORIZONTAL);
    bottomSash.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    diagnosenComposite = tk.createComposite(bottomSash);
    Composite konsultationenComposite = tk.createComposite(bottomSash);

    bottomSash.setWeights(new int[] {25, 75});

    diagnosenComposite.setLayout(new GridLayout(1, true));

    Hyperlink hDiagnosen = tk.createHyperlink(diagnosenComposite, "Diagnosen", SWT.NONE);
    hDiagnosen.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    hDiagnosen.addHyperlinkListener(
        new HyperlinkAdapter() {
          @Override
          public void linkActivated(HyperlinkEvent e) {
            try {
              getViewSite().getPage().showView(DiagnosenView.ID);
            } catch (Exception ex) {
              ExHandler.handle(ex);
              log.error("Fehler beim Starten des Diagnosencodes " + ex.getMessage());
            }
          }
        });

    Table diagnosenTable = tk.createTable(diagnosenComposite, SWT.SINGLE);
    diagnosenTable.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    diagnosenViewer = new TableViewer(diagnosenTable);
    diagnosenViewer.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    diagnosenViewer.setContentProvider(
        new IStructuredContentProvider() {
          @Override
          public Object[] getElements(Object inputElement) {
            if (actProblem != null) {
              List<IDiagnose> diagnosen = actProblem.getDiagnosen();
              return diagnosen.toArray();
            }
            return new Object[0];
          }

          @Override
          public void dispose() {
            // nothing to do
          }

          @Override
          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // nothing to do
          }
        });
    diagnosenViewer.setLabelProvider(
        new LabelProvider() {
          @Override
          public String getText(Object element) {
            if (!(element instanceof IDiagnose)) {
              return "";
            }

            IDiagnose diagnose = (IDiagnose) element;
            return diagnose.getLabel();
          }
        });
    diagnosenViewer.setInput(this);

    konsultationenComposite.setLayout(new GridLayout(1, true));

    Label lKonsultationen = tk.createLabel(konsultationenComposite, "Konsultationen", SWT.LEFT);
    lKonsultationen.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));

    Table konsultationenTable = tk.createTable(konsultationenComposite, SWT.SINGLE);
    konsultationenTable.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    konsultationenViewer = new TableViewer(konsultationenTable);
    konsultationenViewer.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    konsultationenViewer.setContentProvider(
        new IStructuredContentProvider() {
          @Override
          public Object[] getElements(Object inputElement) {
            if (actProblem != null) {
              List<Konsultation> konsultationen = actProblem.getKonsultationen();
              return konsultationen.toArray();
            }
            return new Object[0];
          }

          @Override
          public void dispose() {
            // nothing to do
          }

          @Override
          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // nothing to do
          }
        });
    konsultationenViewer.setLabelProvider(
        new LabelProvider() {
          @Override
          public String getText(Object element) {
            if (!(element instanceof Konsultation)) {
              return "";
            }

            Konsultation konsultation = (Konsultation) element;
            return konsultation.getLabel();
          }
        });
    konsultationenViewer.setInput(this);

    /* Implementation Drag&Drop */

    final TextTransfer textTransfer = TextTransfer.getInstance();
    Transfer[] types = new Transfer[] {textTransfer};

    // diagnosenComposite
    DropTarget dtarget = new DropTarget(diagnosenComposite, DND.DROP_COPY);
    dtarget.setTransfer(types);
    dtarget.addDropListener(
        new DropTargetListener() {
          @Override
          public void dragEnter(DropTargetEvent event) {
            /* Wir machen nur Copy-Operationen */
            event.detail = DND.DROP_COPY;
          }

          /* Mausbewegungen mit gedrückter Taste sind uns egal */
          @Override
          public void dragLeave(DropTargetEvent event) {
            /* leer */
          }

          @Override
          public void dragOperationChanged(DropTargetEvent event) {
            /* leer */
          }

          @Override
          public void dragOver(DropTargetEvent event) {
            /* leer */
          }

          /* Erst das Loslassen interessiert uns wieder */
          @Override
          public void drop(DropTargetEvent event) {
            String drp = (String) event.data;
            String[] dl = drp.split(",");
            for (String obj : dl) {
              PersistentObject dropped = CoreHub.poFactory.createFromString(obj);
              if (dropped instanceof IDiagnose) {
                IDiagnose diagnose = (IDiagnose) dropped;
                actProblem.addDiagnose(diagnose);

                // tell other viewers that something has changed
                IatrixEventHelper.updateProblem(actProblem);

                // update ourselves
                // TODO: implement ObjectListener
                diagnosenViewer.refresh();
              }
            }
          }

          @Override
          public void dropAccept(DropTargetEvent event) {
            /* leer */
          }
        });

    makeListeners();
    makeActions();
    menus = new ViewMenus(getViewSite());
    menus.createViewerContextMenu(diagnosenViewer, delDiagnoseAction);
    menus.createViewerContextMenu(konsultationenViewer, unassignProblemAction);

    GlobalEventDispatcher.addActivationListener(this, this);
  }
Esempio n. 6
0
 public void dispose() {
   tv.removeSelectionChangedListener(GlobalEventDispatcher.getInstance().getDefaultListener());
 }