コード例 #1
0
  private void addComponents() {
    getWidgetLayout().numColumns = 2;
    getWidgetLayout().makeColumnsEqualWidth = false;
    getContainer().setLayout(getWidgetLayout());

    CIDescriptor desc = new CIDescriptor();
    desc.setClazz(Valuta.class);
    desc.setInput(BorgCache.getValute());
    desc.setTextMethodName(Valuta.EXTERNAL_REFLECT_GET_ACRONIM);
    desc.setImageMethodName(Valuta.EXTERNAL_REFLECT_GET_IMAGE);
    desc.setToolItemStyle(ComboImage.ADD_ADD);
    desc.setAddContentProposal(isViewEnabled());

    new Label(getContainer(), SWT.NONE).setText("Valuta");
    this.comboValuta = new ComboImage(getContainer(), desc);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(this.comboValuta);
    this.comboValuta.getItemAdd().addListener(SWT.Selection, this);
    this.comboValuta.getItemAdd().setToolTipText("Adaugare valuta");

    desc = new CIDescriptor();
    desc.setClazz(Banca.class);
    desc.setInput(this.mapBanci);
    desc.setTextMethodName(Banca.EXTERNAL_REFLECT_GET_COD);
    desc.setImageMethodName(Banca.EXTERNAL_REFLECT_GET_SIGLA);
    desc.setToolItemStyle(ComboImage.ADD_ADD);
    desc.setAddContentProposal(isViewEnabled());

    new Label(getContainer(), SWT.NONE).setText("Banca");
    this.comboBanca = new ComboImage(getContainer(), desc);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(this.comboBanca);
    this.comboBanca.getItemAdd().addListener(SWT.Selection, this);
    this.comboBanca.getItemAdd().setToolTipText("Adaugare banca");

    new Label(getContainer(), SWT.NONE).setText("Data");
    this.textData = new Text(getContainer(), SWT.BORDER);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(this.textData);
    this.textData.setEnabled(false);
    this.textData.setText(EncodeLive.getSQLDateLogin().toString());

    new Label(getContainer(), SWT.NONE).setText("Curs");
    this.textCurs = new FormattedText(getContainer(), SWT.BORDER);
    GridDataFactory.fillDefaults()
        .grab(true, false)
        .align(SWT.FILL, SWT.CENTER)
        .span(getWidgetLayout().numColumns - 1, 1)
        .applyTo(this.textCurs.getControl());
    this.textCurs.setFormatter(NumberUtil.getFormatter(4, false));
    ((NumberFormatter) this.textCurs.getFormatter()).setFixedLengths(false, true);

    WidgetCompositeUtil.addColoredFocusListener2Childrens(getContainer());
  }
コード例 #2
0
  public CursValutarView(final Shell parent, final CursValuta cursValutar, final int mode) {
    super(parent, SWT.MIN | SWT.CLOSE, mode);

    this.mapValute.addAll(BorgCache.getValute().values());
    this.mapBanci.addAll(BorgCache.getBanci().values());

    Collections.sort(
        this.mapValute,
        AbstractDB.getComparator(Valuta.class, Valuta.EXTERNAL_REFLECT_GET_ACRONIM));
    Collections.sort(
        this.mapBanci, AbstractDB.getComparator(Banca.class, Banca.EXTERNAL_REFLECT_GET_COD));

    if (cursValutar != null) {
      this.cursValutar = cursValutar.cloneObject();
      setModifiedObject(this.cursValutar);
    } else {
      this.cursValutar = new CursValuta();
    }

    addComponents();
    populateFields();

    if (!isViewEnabled()) {
      WidgetCompositeUtil.enableGUI(getContainer(), false);
    }
  }