Пример #1
0
  public PrintSign(String[][] values) {
    setMembersMargin(10);
    setHeight(120);

    for (String[] item : values) { // expect size = 3
      if (item.length == 3) {
        VLayout component = new VLayout(20);
        component.setMargin(30);
        // component.setOverflow(Overflow.HIDDEN);
        component.setAlign(Alignment.CENTER);
        SignLabel item_0 = new SignLabel("");
        SignLabel item_1 =
            new SignLabel("(ลงชื่อ).............................................." + item[0]);
        SignLabel item_2 = new SignLabel("(" + item[1] + ")");
        SignLabel item_3 = new SignLabel(item[2]);
        // SignLabel item_4 = new SignLabel("วันที่ "+DateTimeFormat.getFormat( "MM/dd/yyyy"
        // ).format(new Date()));
        SignLabel item_4 = new SignLabel("วันที่ ...../...../.....");
        component.addMembers(item_0, item_1, item_2, item_3, item_4);
        addMember(component);
      }
    }
  }
Пример #2
0
  public SmsQueueWindow(final Integer smsInfoId, String sms, String name) {
    setTitle(TicketMaster.constants.sms_numbers());
    setWidth(600);
    setHeight(500);
    setIsModal(true);
    setShowModalMask(true);
    setShowMaximizeButton(true);
    setShowMinimizeButton(false);
    setShowCloseButton(true);
    setAutoDraw(true);
    centerInPage();

    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    form = new DynamicForm();
    form.setPadding(15);
    form.setWidth100();
    form.setNumCols(2);
    smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms());
    smsField.setValue(sms);
    smsField.setTitleVAlign(VerticalAlignment.TOP);

    StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name());
    nameField.setValue(name);
    form.setFields(nameField, smsField);

    Criteria c = new Criteria();
    c.setAttribute("timestamp", new Date().getTime());
    c.setAttribute("sms_info_id", smsInfoId);

    grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setDataSource(DataSource.get("SMSBroadcastDS"));
    grid.setFetchOperation("getNumbers");
    grid.setCriteria(c);
    grid.setAutoFetchData(true);
    ListGridField sendDateField =
        new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120);
    sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    ListGridField deliveryDateField =
        new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120);
    deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    grid.setFields(
        new ListGridField("id", "ID", 60),
        new ListGridField("phone_number", TicketMaster.constants.sms_number()),
        new ListGridField("state", TicketMaster.constants.sms_state()),
        sendDateField,
        deliveryDateField);

    IButton exportBtn = new IButton(TicketMaster.constants.sms_export());
    exportBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            com.google.gwt.user.client.Window.open(
                "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", "");
          }
        });
    exportBtn.setIcon("excel.gif");

    HLayout bbar = new HLayout();
    bbar.setAlign(Alignment.RIGHT);
    bbar.setMembersMargin(5);
    bbar.setPadding(5);
    bbar.addMembers(exportBtn);
    vLayout.addMembers(form, grid, bbar);

    addItem(vLayout);
  }
Пример #3
0
  private void initWidgets() {
    addGoodsCategory = new AddGoodsCategory();

    mainLayout = new VLayout();
    gridLayout = new HLayout();
    gridLayout.setBackgroundColor("BurlyWood");
    gridLayout.setHeight100();
    gridLayout.setOverflow(Overflow.SCROLL);
    controlLayout = new HLayout();
    controlLayout.setMargin(10);
    controlLayout.setHeight(buttonSizeHeight);
    goodsCategoryList = new ListGrid();
    goodsCategoryList.setDataSource(DataSource.get("goodsCategory"));
    goodsCategoryList.setCanEdit(false);
    goodsCategoryList.setAutoSaveEdits(true);
    goodsCategoryList.setAutoFetchData(true);
    ListGridField goodsCategoryId = new ListGridField();
    goodsCategoryId.setTitle(Constants.GOODSCATEGORY_GOODSCATEGORYID_TITLE);
    goodsCategoryId.setName(Constants.GOODSCATEGORY_GOODSCATEGORYID);
    goodsCategoryId.setWidth("10%");
    ListGridField goodsCategoryShortNameTH = new ListGridField();
    goodsCategoryShortNameTH.setTitle(Constants.GOODSCATEGORY_GOODSCATEGORYSHORTNAME_TH_TITLE);
    goodsCategoryShortNameTH.setName(Constants.GOODSCATEGORY_GOODSCATEGORYSHORTNAME_TH);
    goodsCategoryShortNameTH.setWidth("10%");
    ListGridField goodsCategoryDetailsTH = new ListGridField();
    goodsCategoryDetailsTH.setTitle(Constants.GOODSCATEGORY_GOODSCATEGORYDETAILS_TH_TITLE);
    goodsCategoryDetailsTH.setName(Constants.GOODSCATEGORY_GOODSCATEGORYDETAILS_TH);
    goodsCategoryDetailsTH.setWidth("60%");

    goodsCategoryList.setFields(goodsCategoryId, goodsCategoryShortNameTH, goodsCategoryDetailsTH);
    goodsCategoryList.addRecordDoubleClickHandler(
        new RecordDoubleClickHandler() {
          @Override
          public void onRecordDoubleClick(RecordDoubleClickEvent event) {
            Record record = new Record();
            record.setAttribute("goodsCategory", event.getRecord());
            AddGoods.setGoodsCategoryAsRecord(record);
          }
        });

    submit = new IButton(Constants.BUTTON_TITLE_SUBMIT);
    submit.setMargin(1);
    cancel = new IButton(Constants.BUTTON_TITLE_CANCEL);
    cancel.setMargin(1);
    search = new IButton(Constants.BUTTON_TITLE_SEARCH);
    search.setMargin(1);

    add = new IButton(Constants.BUTTON_TITLE_ADD);
    add.setMargin(1);
    edit = new IButton(Constants.BUTTON_TITLE_EDIT);
    edit.setMargin(1);

    submit.setSize(buttonSizeHeight, buttonSizeHeight);
    cancel.setSize(buttonSizeHeight, buttonSizeHeight);
    search.setSize(buttonSizeHeight, buttonSizeHeight);

    add.setSize(buttonSizeWidth, buttonSizeHeight);
    edit.setSize(buttonSizeWidth, buttonSizeHeight);

    add.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            addGoodsCategory.showAddGoodsCategory();
          }
        });

    edit.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            addGoodsCategory.showAddGoodsCategory(
                Constants.RECORD_ACTION_EDIT, goodsCategoryList.getSelectedRecord());
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });

    submit.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            Record record = new Record();
            record.setAttribute("goodsCategory", goodsCategoryList.getSelectedRecord());
            // SC.say("GoodsCategoryList:"+"goodCategory");
            AddGoods.setGoodsCategoryAsRecord(record);
            hide();
          }
        });

    addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals(KeyNames.ENTER)) {
              Record record = new Record();
              record.setAttribute("goodsCategory", goodsCategoryList.getSelectedRecord());
              AddGoods.setGoodsCategoryAsRecord(record);
              hide();
            }
            if (event.isAltKeyDown() && event.getKeyName().equals("A")) {
              addGoodsCategory.showAddGoodsCategory();
            }
            if (event.isAltKeyDown() && event.getKeyName().equals("E")) {
              addGoodsCategory.showAddGoodsCategory(
                  Constants.RECORD_ACTION_EDIT, goodsCategoryList.getSelectedRecord());
            }
          }
        });

    Canvas emptyButtonWSize = new Canvas();
    emptyButtonWSize.setSize(buttonSizeWidth, buttonSizeHeight);
    gridLayout.addMember(goodsCategoryList);
    controlLayout.addMembers(submit, cancel, search, emptyButtonWSize, add, edit);
    mainLayout.addMembers(gridLayout, controlLayout);

    setDataSectionBackgroundColor("Grey");
    addDataSection(mainLayout);
  }