예제 #1
0
  @SuppressWarnings("serial")
  private void initButtonLinkCcBcc() {
    btnLinkCc = new Button("Add Cc");
    btnLinkCc.setStyleName(UIConstants.BUTTON_LINK);
    inputLayout.addComponent(btnLinkCc, 1, 0);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);

    btnLinkBcc = new Button("Add Bcc");
    btnLinkBcc.setStyleName(UIConstants.BUTTON_LINK);
    inputLayout.addComponent(btnLinkBcc, 2, 0);
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);

    btnLinkCc.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            buttonLinkCcClick(event);
          }
        });

    btnLinkBcc.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            butonLinkBccClick(event);
          }
        });
  }
예제 #2
0
  private void addFullInputFieldByOrder() {
    inputLayout.addComponent(ccField, 0, 1);
    inputLayout.addComponent(btnLinkCc, 1, 1);

    inputLayout.addComponent(bccField, 0, 2);
    inputLayout.addComponent(btnLinkBcc, 1, 2);

    inputLayout.addComponent(subjectField, 0, 3);
  }
예제 #3
0
  private GridLayout getLayout() {

    final GridLayout layout = new GridLayout(4, 5);
    layout.setSpacing(true);
    TextField postalAddress = getTextField("Postal PersonAddress", "postalAddress");
    TextField postalCode = getTextField("Postal Code", "postalCode");
    TextField physicalAddress = getTextField("Physical PersonAddress", "physicalAddress");
    TextField addressType = getTextField("PersonAddress Type", "addressTypeId");

    layout.addComponent(postalAddress, 0, 0);
    layout.addComponent(physicalAddress, 1, 0);
    layout.addComponent(addressType, 0, 1);
    layout.addComponent(postalCode, 1, 1);
    layout.addComponent(getButtons(), 0, 2, 1, 2);
    return layout;
  }
예제 #4
0
  public LoginModule() {

    setMargin(true);
    setSpacing(true);
    grid.setSizeFull();
    grid.setSpacing(true);

    final TextField username = new TextField();
    username.setValue("username");
    username.setWidth("120px");
    username.setStyleName("small");
    grid.addComponent(username, 0, 0);

    final PasswordField password = new PasswordField();
    password.setValue("password");
    password.setWidth("120px");
    password.setStyleName("small");
    grid.addComponent(password, 0, 1);

    Button button = new Button("Login");
    button.setWidth("120px");
    button.setStyleName("small");
    button.addListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            login.setUsername(username.getValue().toString());
            login.setPassword(password.getValue().toString());
            String user = login.getUsername();
            String pass = login.getPassword();
            // login.setResult(authLog.login(user, pass));
            boolean result = authLog.login(user, pass);
            if (result == true) {
              label.setCaption("Successfully Login");
            } else {
              label.setCaption("SQL Error");
            }
          }
        });
    grid.addComponent(button, 0, 2);
    panel.addComponent(grid);
    addComponent(panel);
    addComponent(label);
  }
 private Panel addPanelMenu(Menu menu) {
   panel = new Panel();
   initComponents();
   for (int i = 1; i <= NUMBER_OF_SERVICE_DAYS; i++) {
     weekdayLabel = new Label(Weekday.getWeekday(i).toString());
     gridLayout.addComponent(locateLayoutWeek(weekdayLabel));
     for (MenuItem menuItem : menu.getItems().get(Weekday.getWeekday(i))) {
       ShowDayMenusPanel showDayMenusPanel =
           new ShowDayMenusPanel(menuItem.getDescription(), menuItem.getCost());
       showDayMenusPanel.setId(menuItem.getId());
       showDayMenusPanel.setWeekday(menuItem.getWeekday());
       currentWeekMenusPanels.add(showDayMenusPanel);
       gridLayout.addComponent(showDayMenusPanel);
       panel.addComponent(gridLayout);
     }
   }
   return panel;
 }
 private GridLayout locateLayoutWeek(Label label) {
   layoutWeek = new GridLayout();
   label.setWidth(40, UNITS_PIXELS);
   layoutWeek.setWidth(100, UNITS_PERCENTAGE);
   layoutWeek.setHeight(40, UNITS_PIXELS);
   layoutWeek.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
   layoutWeek.addComponent(label);
   return layoutWeek;
 }
예제 #7
0
 private void checkToReInitCcBcc() {
   if ((!isAddCc) && (!isAddBcc)) {
     inputLayout.removeComponent(btnLinkCc);
     inputLayout.removeComponent(btnLinkBcc);
     initButtonLinkCcBcc();
     inputLayout.removeComponent(subjectField);
     inputLayout.removeComponent(0, 1);
     inputLayout.addComponent(subjectField, 0, 1);
   }
 }
예제 #8
0
  private void butonLinkBccClick(ClickEvent event) {
    removeAllInputField();

    if (!isAddBcc) {
      btnLinkBcc.setCaption("Remove Bcc");
      if (!isAddCc) {
        inputLayout.addComponent(bccField, 0, 1);
        inputLayout.addComponent(btnLinkCc, 1, 1);
        inputLayout.addComponent(btnLinkBcc, 2, 1);
        inputLayout.addComponent(subjectField, 0, 2);
      } else {
        addFullInputFieldByOrder();
      }
    } else {
      btnLinkBcc.setCaption("Add Bcc");

      if (isAddCc) {
        inputLayout.addComponent(ccField, 0, 1);
        inputLayout.addComponent(btnLinkCc, 1, 1);
        inputLayout.addComponent(btnLinkBcc, 2, 1);
        inputLayout.addComponent(subjectField, 0, 2);
      } else {
        inputLayout.addComponent(btnLinkBcc, 1, 0);
        inputLayout.addComponent(btnLinkCc, 2, 0);
        inputLayout.addComponent(subjectField, 0, 1);
      }
    }
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);
    isAddBcc = !isAddBcc;
    checkToReInitCcBcc();
  }
예제 #9
0
  private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
      for (String mail : lstMail) {
        if (StringUtils.isNotBlank(mail)) {
          if (mail.indexOf("<") > -1) {
            String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
            if (strMail != null && !strMail.equalsIgnoreCase("null")) {}

          } else {

          }
        }
      }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                MailFormWindow.this.close();
              }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn =
        new Button(
            "Send",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {

                if (tokenFieldMailTo.getListRecipient().size() <= 0
                    || subject.getValue().equals("")) {
                  NotificationUtil.showErrorNotification(
                      "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                  return;
                }
                if (AppContext.getUser().getEmail() != null
                    && AppContext.getUser().getEmail().length() > 0) {
                  ExtMailService systemMailService =
                      ApplicationContextUtil.getSpringBean(ExtMailService.class);

                  List<File> listFile = attachments.files();
                  List<EmailAttachementSource> emailAttachmentSource = null;
                  if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<>();
                    for (File file : listFile) {
                      emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                  }

                  systemMailService.sendHTMLMail(
                      AppContext.getUser().getEmail(),
                      AppContext.getUser().getDisplayName(),
                      tokenFieldMailTo.getListRecipient(),
                      tokenFieldMailCc.getListRecipient(),
                      tokenFieldMailBcc.getListRecipient(),
                      subject.getValue().toString(),
                      noteArea.getValue().toString(),
                      emailAttachmentSource);
                  MailFormWindow.this.close();
                } else {
                  NotificationUtil.showErrorNotification(
                      "Your email is empty value, please fulfil it before sending email!");
                }
              }
            });
    sendBtn.setIcon(FontAwesome.SEND);
    sendBtn.setStyleName(UIConstants.BUTTON_ACTION);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
  }