public Composite createControl(final Composite parent) {
    // Form form=tk.createForm(parent);
    // form.setLayoutData(SWTHelper.getFillGridData(1,true,1,false));
    // Composite ret=form.getBody();
    Composite ret = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    ret.setLayout(layout);
    ret.setBackground(parent.getBackground());

    ImageHyperlink hClr = tk.createImageHyperlink(ret, SWT.NONE); // $NON-NLS-1$
    hClr.setImage(Images.IMG_CLEAR.getImage());
    hClr.addHyperlinkListener(
        new HyperlinkAdapter() {

          @Override
          public void linkActivated(final HyperlinkEvent e) {
            clearValues();
          }
        });
    hClr.setBackground(parent.getBackground());

    Composite inner = new Composite(ret, SWT.NONE);
    GridLayout lRet = new GridLayout(fields.length, true);
    inner.setLayout(lRet);
    inner.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    for (String l : fields) {
      Hyperlink hl = tk.createHyperlink(inner, l, SWT.NONE);
      hl.addHyperlinkListener(
          new HyperlinkAdapter() {

            @Override
            public void linkActivated(final HyperlinkEvent e) {
              Hyperlink h = (Hyperlink) e.getSource();
              fireSortEvent(h.getText());
            }
          });
      hl.setBackground(parent.getBackground());
    }

    createSelectors(fields.length);
    for (int i = 0; i < selectors.length; i++) {
      selectors[i] = new ElexisText(tk.createText(inner, "", SWT.BORDER)); // $NON-NLS-1$
      selectors[i].addModifyListener(ml);
      selectors[i].addSelectionListener(sl);
      selectors[i].setToolTipText(
          Messages.getString("DefaultControlFieldProvider.enterFilter")); // $NON-NLS-1$
      selectors[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
      SWTHelper.setSelectOnFocus((Text) selectors[i].getWidget());
    }

    return ret;
  }
Esempio n. 2
0
  @Override
  public void createPartControl(final Composite parent) {
    parent.setLayout(new GridLayout());
    display = new EpisodesDisplay(parent);
    display.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    makeActions();
    ViewMenus menu = new ViewMenus(getViewSite());

    /*
     * menu.createViewerContextMenu(display.tvEpisodes, activateEpisodeAction,
     * editEpisodeAction, null, removeEpisodeAction);
     */
    menu.createControlContextMenu(
        display.tvEpisodes.getControl(),
        new IMenuPopulator() {
          @Override
          public IAction[] fillMenu() {
            return new IAction[] {
              activateEpisodeAction,
              editEpisodeAction,
              null,
              removeEpisodeAction,
              removeDiagnosesAction
            };
          }
        });

    menu.createToolbar(konsFilterAction, addEpisodeAction, editEpisodeAction);
    GlobalEventDispatcher.addActivationListener(this, getViewSite().getPart());
  }
Esempio n. 3
0
 @Override
 protected Control createDialogArea(final Composite parent) {
   Composite ret = new Composite(parent, SWT.NONE);
   ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   ret.setLayout(new GridLayout(3, false));
   new Label(ret, SWT.NONE).setText(Messages.getString("RnFilterDialog.amount")); // $NON-NLS-1$
   miVon = new MoneyInput(ret, FROM);
   miBis = new MoneyInput(ret, UNTIL);
   new Label(ret, SWT.NONE).setText(Messages.getString("RnFilterDialog.billDate")); // $NON-NLS-1$
   diRnVon = new DateInput(ret, FROM);
   diRnBis = new DateInput(ret, UNTIL);
   new Label(ret, SWT.NONE).setText(Messages.getString("RnFilterDialog.stateDate")); // $NON-NLS-1$
   diStatVon = new DateInput(ret, FROM);
   diStatBis = new DateInput(ret, UNTIL);
   return ret;
 }
Esempio n. 4
0
  @Override
  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.SINGLE);
    TableColumn tc0 = new TableColumn(table, SWT.CENTER);
    tc0.setText(Messages.getString("BestellView.Number")); // $NON-NLS-1$
    tc0.setWidth(40);
    TableColumn tc1 = new TableColumn(table, SWT.LEFT);
    tc1.setText(Messages.getString("BestellView.Article")); // $NON-NLS-1$
    tc1.setWidth(280);
    TableColumn tc2 = new TableColumn(table, SWT.LEFT);
    tc2.setText(Messages.getString("BestellView.Dealer")); // $NON-NLS-1$
    tc2.setWidth(250);
    table.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    tv = new TableViewer(table);
    tv.setContentProvider(
        new IStructuredContentProvider() {
          public Object[] getElements(final Object inputElement) {
            if (actBestellung != null) {
              return actBestellung.asList().toArray();
            }
            return new Object[0];
          }

          public void dispose() {}

          public void inputChanged(
              final Viewer viewer, final Object oldInput, final Object newInput) {}
        });
    tv.setLabelProvider(new BestellungLabelProvider());
    tv.setSorter(
        new ViewerSorter() {
          @Override
          public int compare(final Viewer viewer, final Object e1, final Object e2) {
            String s1 = ((Item) e1).art.getName();
            String s2 = ((Item) e2).art.getName();
            return s1.compareTo(s2);
          }
        });
    Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
    tv.addDropSupport(
        DND.DROP_COPY,
        types,
        new DropTargetAdapter() {

          @Override
          public void dragEnter(final DropTargetEvent event) {
            event.detail = DND.DROP_COPY;
          }

          @Override
          public void drop(final DropTargetEvent event) {
            String drp = (String) event.data;
            String[] dl = drp.split(","); // $NON-NLS-1$
            if (actBestellung == null) {
              InputDialog dlg =
                  new InputDialog(
                      getViewSite().getShell(),
                      Messages.getString("BestellView.CreateNewOrder"), // $NON-NLS-1$
                      Messages.getString("BestellView.EnterOrderTitle"), // $NON-NLS-1$
                      StringTool.leer,
                      null);
              if (dlg.open() == Dialog.OK) {
                setBestellung(new Bestellung(dlg.getValue(), Hub.actUser));
              } else {
                return;
              }
            }
            for (String obj : dl) {
              PersistentObject dropped = Hub.poFactory.createFromString(obj);
              if (dropped instanceof Artikel) {
                actBestellung.addItem((Artikel) dropped, 1);
              }
            }
            tv.refresh();
          }
        });
    makeActions();
    viewmenus = new ViewMenus(getViewSite());
    viewmenus.createToolbar(wizardAction, saveAction, loadAction, printAction, sendAction);
    viewmenus.createMenu(
        wizardAction, saveAction, loadAction, printAction, sendAction, exportClipboardAction);
    viewmenus.createViewerContextMenu(tv, new IAction[] {removeAction, countAction});
    form.getToolBarManager().add(checkInAction);
    form.updateToolBar();
    setBestellung(null);
    tv.setInput(getViewSite());
  }
 @Override
 protected Control createDialogArea(final Composite parent) {
   kib = new KontaktImporterBlatt(parent);
   kib.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
   return kib;
 }
Esempio n. 6
0
  /**
   * Diese Methode erledigt den eigentlichen Aufbau der Seite. Here we create the contents of the
   * preference page
   */
  @SuppressWarnings("unchecked")
  @Override
  protected Control createContents(final Composite parent) {
    Composite ret = new Composite(parent, SWT.NONE);
    ret.setLayout(new GridLayout());
    ctabs = new CTabFolder(ret, SWT.NONE);
    ctabs.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    ctabs.setLayout(new FillLayout());
    setup = Messwert.getSetup();
    fields = setup.getMap("Befunde"); // $NON-NLS-1$
    names = (String) fields.get("names"); // $NON-NLS-1$
    if (!StringTool.isNothing(names)) {
      for (String f : names.split(Messwert.SETUP_SEPARATOR)) {
        CTabItem ci = new CTabItem(ctabs, SWT.NONE);
        ci.setText(f);
        PrefsPage fp = new PrefsPage(ctabs, fields, f);
        ci.setControl(fp);
      }
    }
    ctabs.setSelection(0);
    lastIDX = 0;
    ctabs.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            if (lastIDX != -1) {
              flush(lastIDX);
              lastIDX = ctabs.getSelectionIndex();
            }
          }
        });

    Composite cButtons = new Composite(ret, SWT.NONE);
    cButtons.setLayout(new FillLayout());
    Button bAdd = new Button(cButtons, SWT.PUSH);
    bAdd.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            InputDialog id =
                new InputDialog(
                    getShell(),
                    Messages.getString("BefundePrefs.enterNameCaption"),
                    Messages.getString("BefundePrefs.enterNameMessage"),
                    "",
                    null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            if (id.open() == Dialog.OK) {
              String name = id.getValue();
              if (StringTool.isNothing(names)) {
                names = name;
              } else {
                names += Messwert.SETUP_SEPARATOR + name;
              }
              fields.put("names", names); // $NON-NLS-1$
              CTabItem ci = new CTabItem(ctabs, SWT.NONE);
              ci.setText(name);
              PrefsPage fp = new PrefsPage(ctabs, fields, name);
              ci.setControl(fp);
              ctabs.setSelection(ci);
            }
          }
        });
    bAdd.setText(Messages.getString("BefundePrefs.add")); // $NON-NLS-1$

    Button bRemove = new Button(cButtons, SWT.PUSH);
    bRemove.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {
            CTabItem ci = ctabs.getSelection();
            if (ci != null) {
              PrefsPage pp = (PrefsPage) ci.getControl();
              if (pp.remove()) {
                names = names.replaceFirst(ci.getText(), ""); // $NON-NLS-1$
                names =
                    names.replaceAll(
                        Messwert.SETUP_SEPARATOR + Messwert.SETUP_SEPARATOR,
                        Messwert.SETUP_SEPARATOR);
                names.replaceFirst(Messwert.SETUP_SEPARATOR + "$", ""); // $NON-NLS-1$ //$NON-NLS-2$
                names =
                    names.replaceFirst(
                        "^" + Messwert.SETUP_SEPARATOR, ""); // $NON-NLS-1$ //$NON-NLS-2$
                fields.put("names", names); // $NON-NLS-1$
                lastIDX = -1;
                ci.dispose();
                ctabs.setSelection(0);
              }
            }
          }
        });
    bRemove.setText(Messages.getString("BefundePrefs.deleteText")); // $NON-NLS-1$
    if (!Hub.acl.request(ACLContributor.DELETE_PARAM)) {
      bRemove.setEnabled(false);
    }
    return ret;
  }