Example #1
0
  public Composite createForm(Composite parent) {
    Composite ret = new Composite(parent, SWT.NONE);
    ret.setLayout(new GridLayout(2, false));
    Image img = getImage();

    GridData gd1 = null;
    GridData gd2 = null;

    Composite cImg = new Composite(ret, SWT.NONE);
    if (img != null) {
      cImg.setBackgroundImage(img);
      gd1 = new GridData(img.getBounds().width, img.getBounds().height);
      gd2 = new GridData(SWT.DEFAULT, img.getBounds().height);
    } else {
      gd1 = new GridData(10, 10);
      gd2 = new GridData(SWT.DEFAULT, SWT.DEFAULT);
    }
    cImg.setLayoutData(gd1);
    Label lbl = new Label(ret, SWT.NONE);
    lbl.setLayoutData(gd2);
    lbl.setText(sticker.getLabel());
    lbl.setForeground(UiDesk.getColorFromRGB(sticker.getForeground()));
    lbl.setBackground(UiDesk.getColorFromRGB(sticker.getBackground()));
    return ret;
  }
  public void setLeistungen(Konsultation b) {
    List<Verrechnet> lgl = Collections.emptyList();
    if (b != null) {
      lgl = b.getLeistungen();
    }
    tVerr.setRedraw(false);
    tVerr.removeAll();
    StringBuilder sdg = new StringBuilder();
    Money sum = new Money(0);
    for (Verrechnet lst : lgl) {
      sdg.setLength(0);
      int z = lst.getZahl();
      Money preis = lst.getNettoPreis().multiply(z);
      sum.addMoney(preis);
      sdg.append(z)
          .append(" ")
          .append(lst.getCode())
          .append(" ")
          .append(lst.getText()) // $NON-NLS-1$ //$NON-NLS-2$
          .append(" (")
          .append(preis.getAmountAsString())
          .append(")"); // $NON-NLS-1$ //$NON-NLS-2$
      TableItem ti = new TableItem(tVerr, SWT.WRAP);
      ti.setText(sdg.toString());
      ti.setData(lst);

      IVerrechenbar vr = lst.getVerrechenbar();
      if (vr instanceof Artikel) {
        Artikel a = (Artikel) vr;
        int abgabeEinheit = a.getAbgabeEinheit();
        if (abgabeEinheit > 0 && abgabeEinheit < a.getPackungsGroesse()) {
          ti.setImage(Images.IMG_BLOCKS_SMALL.getImage());
        }
      }

      // set table item color
      IVerrechenbar verrBar = lst.getVerrechenbar();
      if (verrBar != null) {
        Color color = UiDesk.getColorFromRGB(defaultRGB);
        String codeName = verrBar.getCodeSystemName();

        if (codeName != null) {
          String rgbColor =
              CoreHub.globalCfg.get(Preferences.LEISTUNGSCODES_COLOR + codeName, defaultRGB);
          color = UiDesk.getColorFromRGB(rgbColor);
        }
        ti.setBackground(color);
      }
    }
    tVerr.setRedraw(true);
    sdg.setLength(0);
    sdg.append(Messages.VerrechnungsDisplay_billed)
        .append(sum.getAmountAsString())
        .append(")"); // $NON-NLS-1$ //$NON-NLS-2$
    hVer.setText(sdg.toString());
  }
Example #3
0
  public CstCanvas(Composite parent, int style) {
    super(parent, style);

    fontSmall = createFontofSize(7);
    fontBig = createFontofSize(12);

    Font initialFont = getDisplay().getSystemFont();
    FontData[] fontData = initialFont.getFontData();
    for (int i = 0; i < fontData.length; i++) {
      fontData[i].setHeight(7);
    }
    fontA = new Font(getDisplay(), fontData);
    BLUE = UiDesk.getColorFromRGB("1E1EFF");
    GRAY = UiDesk.getColorFromRGB("DDDDDD");
    DARKGRAY = UiDesk.getColorFromRGB("AAAAAA");
    WHITE = UiDesk.getColorFromRGB("FFFFFF");
    BRIGHTGREEN = UiDesk.getColorFromRGB("68FF00");
    ORANGE = UiDesk.getColorFromRGB("FF6800");
    BLACK = UiDesk.getColorFromRGB("000000");

    setBackground(WHITE);

    addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            // TODO: is it necessary to dispose these colors (don't think so, but make sure)
            fontA.dispose();
          }
        });
  }
Example #4
0
 public Color getBackground() {
   return UiDesk.getColorFromRGB(sticker.getBackground());
 }