Esempio n. 1
0
 public TextDisplayBox(Composite parent, String name, BigDecimal initialDatum) {
   this(parent, name);
   text = new Text(parent, SWT.BORDER | SWT.RIGHT);
   text.setText(
       StringUtils.leftPad(DIS.isZero(initialDatum) ? "" : DIS.formatTo2Places(initialDatum), 13));
   text.setTextLimit(13);
   setText();
 }
Esempio n. 2
0
 public TextDisplayBox(Composite parent, String name, Object initialDatum) {
   this(parent, name);
   switch (initialDatum.getClass().getSimpleName()) {
     case "BigDecimal":
       BigDecimal decimal = (BigDecimal) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.RIGHT);
       text.setText(
           StringUtils.leftPad(
               decimal.compareTo(BigDecimal.ZERO) == 0 ? "" : DIS.formatTo2Places(decimal), 13));
       text.setTextLimit(13);
       setText();
       break;
     case "Integer":
       int integer = (int) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.RIGHT);
       text.setText(StringUtils.leftPad(integer == 0 ? "" : "" + integer, 7));
       setText();
       break;
     case "Long":
       long longInteger = (long) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.RIGHT);
       text.setText(StringUtils.leftPad(longInteger == 0 ? "" : "" + longInteger, 13));
       setText();
       break;
     case "Date":
       Date date = (Date) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.LEFT);
       text.setText(DIS.POSTGRES_DATE.format(date));
       text.setTextLimit(10);
       setText();
       break;
     case "Time":
       Time time = (Time) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.LEFT);
       text.setText(DIS.TIME.format(time));
       text.setTextLimit(5);
       setText();
       break;
     case "String":
       String string = (String) initialDatum;
       text = new Text(parent, SWT.BORDER | SWT.LEFT);
       text.setText(string);
       setText();
       break;
     default:
       new ErrorDialog("No DataDisplay option for\n" + initialDatum.getClass().getSimpleName());
       setText();
       break;
   }
 }
Esempio n. 3
0
  public Subheader(OrderView view, OrderData data) {
    Composite subheader = new Compo(view.getShell(), 3, GridData.FILL_HORIZONTAL).getComposite();

    Group order =
        new Grp(subheader, 2, "ORDER INFO", SWT.FILL, SWT.BEGINNING, false, true, 1, 2).getGroup();
    setOrderGroup(view, data, order);

    Group partner = new Grp(subheader, 3, "CUSTOMER INFO", GridData.FILL_HORIZONTAL).getGroup();
    int partnerId = data.getPartnerId();
    String partnerName = Customer.getName(partnerId);
    view.setPartnerIdInput(new TextInputBox(partner, "ID #", partnerId).getText());
    setListButton(view, partner);
    view.setPartnerDisplay(new TextDisplayBox(partner, "NAME", partnerName, 2).getText());

    Date post = data.getDate();
    Date due = DIS.addDays(post, data.getLeadTime());
    Group date = new Grp(subheader, 2, "DATE", GridData.FILL_VERTICAL).getGroup();
    view.setDateInput(new TextInputBox(date, "POST", post).getText());
    view.setDueDisplay(new TextDisplayBox(date, "DUE", due).getText());

    Composite address =
        new Compo(subheader, 6, SWT.FILL, SWT.BEGINNING, true, false, 4, 1).getComposite();
    view.setAddressDisplay(new TextDisplayBox(address, "ADDRESS", data.getAddress(), 2).getText());
  }