Example usage for com.vaadin.server FontAwesome SAVE

List of usage examples for com.vaadin.server FontAwesome SAVE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome SAVE.

Prototype

FontAwesome SAVE

To view the source code for com.vaadin.server FontAwesome SAVE.

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java

License:Open Source License

private ComponentContainer createButtonControls() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*from  w ww  .j av a2s .  c  om*/
    layout.setMargin(true);

    HorizontalLayout buttonWrapper = new HorizontalLayout();
    buttonWrapper.setWidthUndefined();
    buttonWrapper.setSpacing(true);

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

        @Override
        public void buttonClick(ClickEvent event) {
            updateContactRoles();
        }
    });
    updateBtn.setIcon(FontAwesome.SAVE);
    updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    buttonWrapper.addComponent(updateBtn);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    ViewState viewState = HistoryViewManager.back();

                    if (viewState instanceof NullViewState) {
                        EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null));
                    }

                }
            });
    cancelBtn.setIcon(FontAwesome.TIMES);
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    buttonWrapper.addComponent(cancelBtn);

    layout.addComponent(buttonWrapper);
    layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER);

    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.kanban.AddNewColumnWindow.java

License:Open Source License

public AddNewColumnWindow(final IKanbanView kanbanView, final String type, final String fieldGroup) {
    super(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN));
    this.setWidth("800px");
    this.setModal(true);
    this.setResizable(false);
    this.center();
    MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false));
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4);
    this.setContent(layout);

    final TextField stageField = new TextField();
    final CheckBox defaultProject = new CheckBox();
    defaultProject.setEnabled(AppContext.canBeYes(RolePermissionCollections.GLOBAL_PROJECT_SETTINGS));
    final ColorPicker colorPicker = new ColorPicker("", new com.vaadin.shared.ui.colorpicker.Color(
            DEFAULT_COLOR.getRed(), DEFAULT_COLOR.getGreen(), DEFAULT_COLOR.getBlue()));
    final TextArea description = new TextArea();

    gridFormLayoutHelper.addComponent(stageField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 0);
    gridFormLayoutHelper.addComponent(defaultProject,
            AppContext.getMessage(TaskI18nEnum.FORM_COLUMN_DEFAULT_FOR_NEW_PROJECT), 0, 1);
    gridFormLayoutHelper.addComponent(colorPicker, AppContext.getMessage(TaskI18nEnum.FORM_COLUMN_COLOR), 0, 2);
    gridFormLayoutHelper.addComponent(description, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0,
            3);//from   w w w . ja va  2  s . c  om

    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            OptionVal optionVal = new OptionVal();
            optionVal.setCreatedtime(new GregorianCalendar().getTime());
            optionVal.setCreateduser(AppContext.getUsername());
            optionVal.setDescription(description.getValue());
            com.vaadin.shared.ui.colorpicker.Color color = colorPicker.getColor();
            String cssColor = color.getCSS();
            if (cssColor.startsWith("#")) {
                cssColor = cssColor.substring(1);
            }
            optionVal.setColor(cssColor);
            if (defaultProject.getValue()) {
                optionVal.setIsdefault(true);
            } else {
                optionVal.setIsdefault(false);
                optionVal.setExtraid(CurrentProjectVariables.getProjectId());
            }
            optionVal.setSaccountid(AppContext.getAccountId());
            optionVal.setType(type);
            optionVal.setTypeval(stageField.getValue());
            optionVal.setFieldgroup(fieldGroup);
            OptionValService optionService = AppContextUtil.getSpringBean(OptionValService.class);
            int optionValId = optionService.saveWithSession(optionVal, AppContext.getUsername());

            if (optionVal.getIsdefault()) {
                optionVal.setId(null);
                optionVal.setIsdefault(false);
                optionVal.setRefoption(optionValId);
                optionVal.setExtraid(CurrentProjectVariables.getProjectId());
                optionService.saveWithSession(optionVal, AppContext.getUsername());
            }
            kanbanView.addColumn(optionVal);
            close();
        }
    });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);

    MHorizontalLayout controls = new MHorizontalLayout().with(cancelBtn, saveBtn)
            .withMargin(new MarginInfo(false, true, false, false));
    layout.with(gridFormLayoutHelper.getLayout(), controls).withAlign(controls, Alignment.BOTTOM_RIGHT);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneAddWindow.java

License:Open Source License

public MilestoneAddWindow(final SimpleMilestone milestone) {
    if (milestone.getId() == null) {
        setCaption("New milestone");
    } else {//from ww  w.ja v a2s.  c o m
        setCaption("Edit milestone");
    }
    this.setWidth("800px");
    this.setModal(true);
    this.setResizable(false);
    VerticalLayout content = new VerticalLayout();
    this.setContent(content);
    final AdvancedEditBeanForm<SimpleMilestone> editForm = new AdvancedEditBeanForm<>();
    content.addComponent(editForm);
    editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.MILESTONE,
            MilestoneDefaultFormLayoutFactory.getForm(), Milestone.Field.id.name()));
    final MilestoneEditFormFieldFactory milestoneEditFormFieldFactory = new MilestoneEditFormFieldFactory(
            editForm);
    editForm.setBeanFormFieldFactory(milestoneEditFormFieldFactory);
    editForm.setBean(milestone);

    MHorizontalLayout buttonControls = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, true, true, false));
    buttonControls.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);

    Button updateAllBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_OTHER_FIELDS),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    EventBusFactory.getInstance()
                            .post(new MilestoneEvent.GotoAdd(MilestoneAddWindow.this, milestone));
                    close();
                }
            });
    updateAllBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            if (editForm.validateForm()) {
                MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
                Integer milestoneId;
                if (milestone.getId() == null) {
                    milestoneId = milestoneService.saveWithSession(milestone, AppContext.getUsername());
                } else {
                    milestoneService.updateWithSession(milestone, AppContext.getUsername());
                    milestoneId = milestone.getId();
                }

                AttachmentUploadField uploadField = milestoneEditFormFieldFactory.getAttachmentUploadField();
                String attachPath = AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(),
                        milestone.getProjectid(), ProjectTypeConstants.MILESTONE, "" + milestone.getId());
                uploadField.saveContentsToRepo(attachPath);

                EventBusFactory.getInstance()
                        .post(new MilestoneEvent.NewMilestoneAdded(MilestoneAddWindow.this, milestoneId));
                EventBusFactory.getInstance().post(new AssignmentEvent.NewAssignmentAdd(MilestoneAddWindow.this,
                        ProjectTypeConstants.MILESTONE, milestoneId));
                close();
            }
        }
    });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);
    saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(updateAllBtn, cancelBtn, saveBtn);
    content.addComponent(buttonControls);
    content.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT);
}

From source file:com.esofthead.mycollab.module.project.view.ProjectAddBaseTemplateWindow.java

License:Open Source License

public ProjectAddBaseTemplateWindow() {
    super(AppContext.getMessage(ProjectI18nEnum.OPT_CREATE_PROJECT_FROM_TEMPLATE));
    this.setModal(true);
    this.setClosable(true);
    this.setResizable(false);
    this.setWidth("550px");
    MVerticalLayout content = new MVerticalLayout();
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3);
    final TemplateProjectComboBox templateProjectComboBox = new TemplateProjectComboBox();
    Button helpBtn = new Button("");
    helpBtn.setIcon(FontAwesome.QUESTION_CIRCLE);
    helpBtn.addStyleName(UIConstants.BUTTON_ACTION);
    helpBtn.setDescription(AppContext.getMessage(ProjectI18nEnum.OPT_MARK_TEMPLATE_HELP));
    gridFormLayoutHelper//from w ww .  jav  a 2 s. c o m
            .addComponent(
                    new MHorizontalLayout().withFullWidth().with(templateProjectComboBox, helpBtn)
                            .expand(templateProjectComboBox),
                    AppContext.getMessage(ProjectI18nEnum.FORM_TEMPLATE), 0, 0);
    final TextField prjNameField = new TextField();
    gridFormLayoutHelper.addComponent(prjNameField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 1);
    final TextField prjKeyField = new TextField();
    gridFormLayoutHelper.addComponent(prjKeyField, AppContext.getMessage(ProjectI18nEnum.FORM_SHORT_NAME), 0,
            2);
    MHorizontalLayout buttonControls = new MHorizontalLayout();
    content.with(gridFormLayoutHelper.getLayout(), buttonControls).withAlign(buttonControls,
            Alignment.MIDDLE_RIGHT);
    Button okBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OK), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            SimpleProject templatePrj = (SimpleProject) templateProjectComboBox.getValue();
            if (templatePrj == null) {
                NotificationUtil.showErrorNotification(
                        AppContext.getMessage(ProjectI18nEnum.ERROR_MUST_CHOOSE_TEMPLATE_PROJECT));
                return;
            }
            String newPrjName = prjNameField.getValue();
            if (newPrjName.length() == 0) {
                NotificationUtil.showErrorNotification("Project name must be not null");
                return;
            }
            String newPrjKey = prjKeyField.getValue();
            if (newPrjKey.length() > 3 || newPrjKey.length() == 0) {
                NotificationUtil
                        .showErrorNotification("Project key must be not null and less than 3 characters");
                return;
            }
            ProjectTemplateService projectTemplateService = AppContextUtil
                    .getSpringBean(ProjectTemplateService.class);
            if (projectTemplateService != null) {
                Integer newProjectId = projectTemplateService.cloneProject(templatePrj.getId(), newPrjName,
                        newPrjKey, AppContext.getAccountId(), AppContext.getUsername());
                EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this,
                        new PageActionChain(new ProjectScreenData.Goto(newProjectId))));
                close();
            }
        }
    });
    okBtn.setIcon(FontAwesome.SAVE);
    okBtn.addStyleName(UIConstants.BUTTON_ACTION);
    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(cancelBtn, okBtn);
    this.setContent(content);
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java

License:Open Source License

public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) {

    final VerticalLayout taskLayout = new VerticalLayout();
    taskLayout.addStyleName("taskadd-popup");

    final VerticalLayout popupHeader = new VerticalLayout();
    popupHeader.setWidth("100%");
    popupHeader.setMargin(true);//  w  w  w .  j a  v  a2  s  .co  m
    popupHeader.addStyleName("popup-header");

    final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE));
    titleLbl.addStyleName("bold");
    popupHeader.addComponent(titleLbl);
    taskLayout.addComponent(popupHeader);

    this.task = new SimpleTask();
    TabSheet taskContainer = new TabSheet();
    final TaskInputForm taskInputForm = new TaskInputForm();
    taskInputForm.setWidth("100%");
    taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE));

    this.taskNoteComponent = new TaskNoteLayout();
    taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT));

    taskLayout.addComponent(taskContainer);

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true);
    controlsLayout.addStyleName("popup-footer");

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskDisplayComp.closeTaskAdd();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    if (taskInputForm.validateForm()) {
                        final ProjectTaskService taskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);

                        task.setTasklistid(taskList.getId());
                        task.setProjectid(CurrentProjectVariables.getProjectId());
                        task.setSaccountid(AppContext.getAccountId());
                        task.setNotes(taskNoteComponent.getNote());

                        taskService.saveWithSession(task, AppContext.getUsername());
                        taskNoteComponent.saveContentsToRepo(task.getId());
                        taskDisplayComp.saveTaskSuccess(task);
                        taskDisplayComp.closeTaskAdd();
                    }
                }
            });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    taskLayout.addComponent(controlsLayout);
    taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT);

    this.setCompositionRoot(taskLayout);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.customize.view.AccountInfoChangeWindow.java

License:Open Source License

AccountInfoChangeWindow() {
    super(AppContext.getMessage(AdminI18nEnum.OPT_CHANGE_ACCOUNT_INFO));
    this.setModal(true);
    this.setResizable(false);
    this.setWidth("700px");

    billingAccount = BeanUtility.deepClone(AppContext.getBillingAccount());
    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);
    editForm = new AdvancedEditBeanForm<>();
    editForm.setFormLayoutFactory(new AbstractFormLayoutFactory() {
        private GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 9,
                "200px");

        @Override/*from   ww w . j av a  2s  .  com*/
        public ComponentContainer getLayout() {
            return gridFormLayoutHelper.getLayout();
        }

        @Override
        public Component onAttachField(Object propertyId, Field<?> field) {
            if (BillingAccount.Field.sitename.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0);
            } else if (BillingAccount.Field.subdomain.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1);
            } else if (BillingAccount.Field.defaulttimezone.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2);
            } else if (BillingAccount.Field.defaultcurrencyid.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3);
            } else if (BillingAccount.Field.defaultyymmddformat.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT),
                        AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4);
            } else if (BillingAccount.Field.defaultmmddformat.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT),
                        AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5);
            } else if (BillingAccount.Field.defaulthumandateformat.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT),
                        AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 6);
            } else if (BillingAccount.Field.defaultlanguagetag.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7);
            } else if (BillingAccount.Field.displayemailpublicly.equalTo(propertyId)) {
                return gridFormLayoutHelper.addComponent(field,
                        AppContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY),
                        AppContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY_HELP), 0, 8);
            }
            return null;
        }
    });

    editForm.setBeanFormFieldFactory(
            new AbstractBeanFieldGroupEditFieldFactory<SimpleBillingAccount>(editForm) {
                @Override
                protected Field<?> onCreateField(Object propertyId) {
                    if (BillingAccount.Field.subdomain.equalTo(propertyId)) {
                        return new SubDomainField();
                    } else if (BillingAccount.Field.defaulttimezone.equalTo(propertyId)) {
                        return new TimeZoneSelectionField(false);
                    } else if (BillingAccount.Field.defaultcurrencyid.equalTo(propertyId)) {
                        return new CurrencyComboBoxField();
                    } else if (BillingAccount.Field.defaultyymmddformat.equalTo(propertyId)) {
                        return new DateFormatField(billingAccount.getDateFormatInstance());
                    } else if (BillingAccount.Field.defaultmmddformat.equalTo(propertyId)) {
                        return new DateFormatField(billingAccount.getShortDateFormatInstance());
                    } else if (BillingAccount.Field.defaulthumandateformat.equalTo(propertyId)) {
                        return new DateFormatField(billingAccount.getLongDateFormatInstance());
                    } else if (BillingAccount.Field.defaultlanguagetag.equalTo(propertyId)) {
                        return new LanguageSelectionField();
                    }
                    return null;
                }

            });

    editForm.setBean(billingAccount);

    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true);
    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            if (editForm.validateForm()) {
                BillingAccountService billingAccountService = AppContextUtil
                        .getSpringBean(BillingAccountService.class);
                billingAccountService.updateSelectiveWithSession(billingAccount, AppContext.getUsername());
                close();
                String siteUrl = SiteConfiguration.getSiteUrl(billingAccount.getSubdomain());
                String assignExec = String.format("window.location.assign(\'%s\');", siteUrl);
                Page.getCurrent().getJavaScript().execute(assignExec);
            }
        }
    });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.BUTTON_ACTION);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(cancelBtn, saveBtn);

    content.with(editForm, buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.AdvancedInfoChangeWindow.java

License:Open Source License

private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout()
            .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%");

    final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 4, "100%", "150px", Alignment.TOP_LEFT);

    passInfo.addComponent(txtWebsite, AppContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0);
    passInfo.addComponent(txtCompany, AppContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1);
    passInfo.addComponent(cboCountry, AppContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2);

    this.txtWebsite.setValue(this.user.getWebsite() == null ? "" : this.user.getWebsite());
    this.txtCompany.setValue(this.user.getCompany() == null ? "" : this.user.getCompany());
    this.cboCountry.setValue(this.user.getCountry() == null ? "" : this.user.getCountry());

    passInfo.getLayout().setMargin(false);
    passInfo.getLayout().setWidth("100%");
    passInfo.getLayout().addStyleName("colored-gridlayout");
    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT);

    final MHorizontalLayout hlayoutControls = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, true, false, true));

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

                @Override//from w ww . j ava 2  s.  c om
                public void buttonClick(final ClickEvent event) {
                    AdvancedInfoChangeWindow.this.close();
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    changeInfo();
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);

    hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setModal(true);
    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.BasicInfoChangeWindow.java

License:Open Source License

private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout()
            .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%");

    final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 6, "100%", "150px", Alignment.TOP_LEFT);

    passInfo.addComponent(txtFirstName, AppContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0);
    passInfo.addComponent(txtLastName, AppContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1);
    this.txtLastName.setRequired(true);
    passInfo.addComponent(txtEmail, AppContext.getMessage(UserI18nEnum.FORM_EMAIL), 0, 2);
    this.txtEmail.setRequired(true);
    passInfo.addComponent(birthdayField, AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 3);
    this.birthdayField.setDate(this.user.getDateofbirth());

    passInfo.addComponent(timeZoneField, AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 4);
    this.timeZoneField.setTimeZone(TimezoneMapper.getTimezoneExt(this.user.getTimezone()));

    passInfo.addComponent(languageBox, AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 5);
    this.languageBox.setValue(this.user.getLanguage());

    this.txtFirstName.setValue(this.user.getFirstname() == null ? "" : this.user.getFirstname());
    this.txtLastName.setValue(this.user.getLastname() == null ? "" : this.user.getLastname());
    this.txtEmail.setValue(this.user.getEmail() == null ? "" : this.user.getEmail());
    this.birthdayField.setValue(this.user.getDateofbirth());

    passInfo.getLayout().setMargin(false);
    passInfo.getLayout().setWidth("100%");
    passInfo.getLayout().addStyleName("colored-gridlayout");
    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT);

    final MHorizontalLayout hlayoutControls = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, true, false, true));
    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override// w w  w.ja va 2s . c om
                public void buttonClick(final ClickEvent event) {
                    BasicInfoChangeWindow.this.close();
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    changeUserInfo();
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);

    hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setModal(true);
    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ContactInfoChangeWindow.java

License:Open Source License

private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout()
            .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%");

    final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 6, "100%", "150px", Alignment.TOP_LEFT);

    passInfo.addComponent(txtWorkPhone, AppContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0);
    passInfo.addComponent(txtHomePhone, AppContext.getMessage(UserI18nEnum.FORM_HOME_PHONE), 0, 1);
    passInfo.addComponent(txtFaceBook, "Facebook", 0, 2);
    passInfo.addComponent(txtTwitter, "Twitter", 0, 3);
    passInfo.addComponent(txtSkype, "Skype", 0, 4);

    this.txtWorkPhone.setValue(this.user.getWorkphone() == null ? "" : this.user.getWorkphone());
    this.txtHomePhone.setValue(this.user.getHomephone() == null ? "" : this.user.getHomephone());
    this.txtFaceBook.setValue(this.user.getFacebookaccount() == null ? "" : this.user.getFacebookaccount());
    this.txtTwitter.setValue(this.user.getTwitteraccount() == null ? "" : this.user.getTwitteraccount());
    this.txtSkype.setValue(this.user.getSkypecontact() == null ? "" : this.user.getSkypecontact());

    passInfo.getLayout().setMargin(false);
    passInfo.getLayout().setWidth("100%");
    passInfo.getLayout().addStyleName("colored-gridlayout");
    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT);

    final MHorizontalLayout hlayoutControls = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, true, false, true));

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

                @Override/*www.j a v a  2 s.  c  o  m*/
                public void buttonClick(final ClickEvent event) {
                    ContactInfoChangeWindow.this.close();
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    changeUserInfo();
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);

    hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setModal(true);
    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.PasswordChangeWindow.java

License:Open Source License

private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout().withWidth("100%");

    final Label lbInstruct1 = new Label(AppContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1));
    mainLayout.addComponent(lbInstruct1);
    mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT);

    final Label lbInstruct2 = new Label(AppContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2));
    mainLayout.addComponent(lbInstruct2);
    mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT);

    final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 3, "300px", "180px");

    txtNewPassword = new PasswordField();
    passInfo.addComponent(txtNewPassword, "New Password", 0, 0);

    txtConfirmPassword = new PasswordField();
    passInfo.addComponent(txtConfirmPassword, "Confirmed New Password", 0, 1);

    passInfo.getLayout().setSpacing(true);
    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.MIDDLE_CENTER);

    final MHorizontalLayout hlayoutControls = new MHorizontalLayout().withMargin(true);

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

                @Override//from w ww  .ja v  a  2s .c  om
                public void buttonClick(final ClickEvent event) {
                    PasswordChangeWindow.this.close();
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    PasswordChangeWindow.this.changePassword();
                }
            });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);

    hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setModal(true);
    this.setContent(mainLayout);
}