List of usage examples for com.vaadin.ui Button setWidthUndefined
@Override
public void setWidthUndefined()
From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java
License:Open Source License
private void initUI() { noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService, NoteRowDisplayHandler.class); noteList.setDisplayEmptyListText(false); noteList.setStyleName("noteList"); noteListContainer = new VerticalLayout(); this.setContent(noteListContainer); displayNotes();//from ww w . j a v a 2 s .c om HorizontalLayout commentBox = new HorizontalLayout(); commentBox.setSizeFull(); commentBox.setStyleName("comment-box"); commentBox.setSpacing(true); commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final TextArea noteInput = new TextArea(); noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); noteInput.setSizeFull(); commentBox.addComponent(noteInput); commentBox.setExpandRatio(noteInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -5095455325725786794L; @Override public void buttonClick(Button.ClickEvent event) { final Note note = new Note(); note.setCreateduser(AppContext.getUsername()); note.setNote(noteInput.getValue()); note.setSaccountid(AppContext.getAccountId()); note.setSubject(""); note.setType(type); note.setTypeid(typeid); note.setCreatedtime(new GregorianCalendar().getTime()); note.setLastupdatedtime(new GregorianCalendar().getTime()); noteService.saveWithSession(note, AppContext.getUsername()); // Save Relay Email -- having time must refact to // Aop // ------------------------------------------------------ RelayEmailNotification relayNotification = new RelayEmailNotification(); relayNotification.setChangeby(AppContext.getUsername()); relayNotification.setChangecomment(noteInput.getValue()); relayNotification.setSaccountid(AppContext.getAccountId()); relayNotification.setType(type); relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION); relayNotification.setTypeid("" + typeid); if (type.equals(CrmTypeConstants.ACCOUNT)) { relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CONTACT)) { relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CAMPAIGN)) { relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.LEAD)) { relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) { relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CASE)) { relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.TASK)) { relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.MEETING)) { relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CALL)) { relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName()); } RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil .getSpringBean(RelayEmailNotificationService.class); relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername()); noteInput.setValue(""); displayNotes(); } }); commentBox.addComponent(postBtn); this.setToolbar(commentBox); }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java
License:Open Source License
private void constructUI() { this.setWidth("100%"); statusWrapper = new CssLayout(); statusWrapper.setWidth("100%"); statusWrapper.setStyleName("upload-status-wrap"); this.addComponent(statusWrapper); inputWrapper = new HorizontalLayout(); inputWrapper.setWidth("100%"); inputWrapper.setStyleName("comment-box"); inputWrapper.setSpacing(true);//from w ww . j a va 2s .c o m inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.prepareUploadField(); inputWrapper.addComponent(uploadField); commentInput = new TextArea(); commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); commentInput.setSizeFull(); inputWrapper.addComponent(commentInput); inputWrapper.setExpandRatio(commentInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 6687918902751556313L; @Override public void buttonClick(Button.ClickEvent arg0) { final Comment comment = new Comment(); comment.setComment(commentInput.getValue()); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid("" + typeid); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandlerClass); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId); if (!"".equals(attachmentPath)) { saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentInput.setValue(""); statusWrapper.removeAllComponents(); component.reload(); } }); inputWrapper.addComponent(postBtn); this.addComponent(inputWrapper); }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java
License:Open Source License
public CrmPreviewFormControlsGenerator(final AdvancedPreviewBeanForm<T> editForm) { this.previewForm = editForm; layout = new HorizontalLayout(); Button editButtons = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . j a va 2 s.c om*/ public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(true); } }); editButtons.setWidthUndefined(); editButtons.addStyleName(UIConstants.THEME_GRAY_LINK); optionBtn = new SplitButton(editButtons); optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK); }
From source file:com.esofthead.mycollab.vaadin.web.ui.AttachmentPanel.java
License:Open Source License
private void displayFileName(File file, final String fileName) { final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth(); Button removeBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//ww w . ja v a 2 s . c om public void buttonClick(ClickEvent event) { File file = fileStores.get(fileName); if (file != null) { file.delete(); } fileStores.remove(fileName); AttachmentPanel.this.removeComponent(fileAttachmentLayout); if (multiFileUpload != null) { multiFileUpload.removeAndReInitMultiUpload(); } } }); removeBtn.setIcon(FontAwesome.TRASH_O); removeBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); removeBtn.setWidthUndefined(); ELabel fileLbl = new ELabel(fileName, ContentMode.HTML).withDescription(fileName) .withStyleName(UIConstants.TEXT_ELLIPSIS); fileAttachmentLayout.with( new ELabel(FileAssetsUtil.getFileIconResource(fileName).getHtml(), ContentMode.HTML) .withWidthUndefined(), fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length())) .withStyleName(UIConstants.META_INFO).withWidthUndefined(), removeBtn).expand(fileLbl); this.addComponent(fileAttachmentLayout); }
From source file:com.esofthead.mycollab.vaadin.web.ui.MultiSelectComp.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout content = new MHorizontalLayout().withSpacing(true).withWidth(widthVal) .with(componentsText).withAlign(componentsText, Alignment.MIDDLE_LEFT); componentPopupSelection.addStyleName(UIConstants.MULTI_SELECT_BG); componentPopupSelection.setDirection(Alignment.TOP_LEFT); MHorizontalLayout multiSelectComp = new MHorizontalLayout().withSpacing(false) .with(componentsText, componentPopupSelection).expand(componentsText); content.with(multiSelectComp);/* w w w . j av a 2s . c o m*/ if (canAddNew) { Button newBtn = new Button("New", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { requestAddNewComp(); } }); newBtn.setStyleName(UIConstants.BUTTON_LINK); newBtn.setWidthUndefined(); content.with(newBtn); } content.expand(multiSelectComp); return content; }
From source file:com.etest.view.notification.NotificationMainUI.java
public NotificationMainUI() { setSizeFull();/*from w w w .j a v a 2 s . com*/ setSpacing(true); if (VaadinSession.getCurrent().getAttribute("userId") == null) { Page.getCurrent().setLocation("http://localhost:8080/"); } else { addComponent(populateNoficationTable()); } HorizontalLayout h = new HorizontalLayout(); h.setWidth("950px"); Button sendMsgBtn = new Button("Send Message"); sendMsgBtn.setWidthUndefined(); sendMsgBtn.addStyleName(ValoTheme.BUTTON_SMALL); sendMsgBtn.addStyleName(ValoTheme.BUTTON_PRIMARY); sendMsgBtn.addClickListener((Button.ClickEvent event) -> { Notification.show("Send Message!"); }); h.addComponent(sendMsgBtn); h.setComponentAlignment(sendMsgBtn, Alignment.MIDDLE_RIGHT); addComponent(h); }
From source file:com.etest.view.notification.NotificationMainUI.java
Table populateNoficationTable() {
notificationTable.removeAllItems();//from w ww . j a va 2s .co m
int i = 0;
for (EtestNotification en : ns.getAllNotificationByUser(
CommonUtilities.convertStringToInt(VaadinSession.getCurrent().getAttribute("userId").toString()))) {
VerticalLayout v = new VerticalLayout();
v.setWidth("100%");
Button read = new Button();
read.setWidthUndefined();
read.setCaption((en.getStatus() == 0) ? "unread" : "read");
read.setData(en.getNotificationId());
read.setIcon(FontAwesome.VIDEO_CAMERA);
read.addStyleName(ValoTheme.BUTTON_LINK);
read.addStyleName(ValoTheme.BUTTON_TINY);
read.addStyleName(ValoTheme.BUTTON_QUIET);
read.addStyleName("button-container");
read.addClickListener(buttonClickListener);
v.addComponent(read);
v.setComponentAlignment(read, Alignment.MIDDLE_LEFT);
message.setContentMode(ContentMode.HTML);
String[] split = en.getNotice().split(" ");
int cellCaseId;
if (split[0].equals("CellCaseID")) {
message.setCaption(en.getRemarks() + en.getNotice());
cellCaseId = CommonUtilities.convertStringToInt(split[1].replace("#", ""));
} else {
cellCaseId = cis.getCellItemById(CommonUtilities.convertStringToInt(split[1].replace("#", "")))
.getCellCaseId();
message.setCaption(en.getRemarks() + en.getNotice() + " from CellCaseID #" + cellCaseId);
}
Button approve = new Button("status");
approve.setSizeFull();
approve.addStyleName(ValoTheme.BUTTON_LINK);
approve.addStyleName(ValoTheme.BUTTON_TINY);
approve.addStyleName(ValoTheme.BUTTON_QUIET);
approve.addStyleName("button-container");
v.addComponent(approve);
v.setComponentAlignment(approve, Alignment.MIDDLE_LEFT);
if (ccs.getCellCaseById(cellCaseId).getApprovalStatus() == 0) {
approve.setIcon(FontAwesome.THUMBS_DOWN);
} else {
approve.setIcon(FontAwesome.THUMBS_UP);
}
notificationTable.addItem(new Object[] { message.getCaption().toString(),
ss.getUsernameById(en.getSenderId()), en.getNoteDate(), v }, i);
i++;
}
notificationTable.setPageLength(0);
notificationTable.setHeight("100%");
return notificationTable;
}
From source file:com.etest.view.notification.ViewCaseNotificationWindow.java
VerticalLayout buildForms() {
VerticalLayout v = new VerticalLayout();
v.setWidth("700px");
v.setMargin(true);//www . ja v a2s.c o m
v.setSpacing(true);
Label cellCase = new Label();
cellCase.setValue("<b>Case</b>: " + ccs.getCellCaseById(getCellCaseId()).getCaseTopic());
cellCase.setContentMode(ContentMode.HTML);
v.addComponent(cellCase);
Label cellItem = new Label();
cellItem.setContentMode(ContentMode.HTML);
Button approvalBtn = new Button();
approvalBtn.setCaption("Approve CASE");
approvalBtn.setWidthUndefined();
approvalBtn.addStyleName(ValoTheme.BUTTON_TINY);
approvalBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
approvalBtn.addClickListener(buttonClickListener);
if (ccs.getCellCaseById(getCellCaseId()).getApprovalStatus() == 0) {
approvalBtn.setVisible(true);
} else {
approvalBtn.setVisible(false);
}
v.addComponent(approvalBtn);
HorizontalLayout h1 = new HorizontalLayout();
h1.setWidth("100%");
approvalItemBtn.setVisible(false);
approvalItemBtn.setWidthUndefined();
approvalItemBtn.addStyleName(ValoTheme.BUTTON_TINY);
approvalItemBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
if (getCellItemId() != 0) {
approvalBtn.setCaption("Approve ITEM");
CellItem ci = cis.getCellItemById(getCellItemId());
keyList = k.getAllItemKey(getCellItemId());
keyIndexSize = keyList.size();
if (keyList.isEmpty()) {
ShowErrorNotification.error("No Item Key was found for STEM: \n" + ci.getItem());
return null;
}
stem = ci.getItem().replace("{key}", "<u>" + keyList.get(getKeyIndex()) + "</u>");
cellItem.setValue("<b>STEM</b>: " + getStem());
OptionGroup options = new OptionGroup();
options.addItems(cis.getCellItemById(getCellItemId()).getOptionA(),
cis.getCellItemById(getCellItemId()).getOptionB(),
cis.getCellItemById(getCellItemId()).getOptionC(),
cis.getCellItemById(getCellItemId()).getOptionD());
h1.addComponent(options);
h1.setComponentAlignment(options, Alignment.MIDDLE_CENTER);
if (cis.getCellItemById(getCellItemId()).getCellItemStatus() == 0) {
approvalItemBtn.setVisible(true);
} else {
approvalItemBtn.setVisible(false);
}
approvalItemBtn.addClickListener(buttonClickListener);
approvalItemBtn.setVisible(true);
}
v.addComponent(approvalBtn);
v.addComponent(cellItem);
v.addComponent(h1);
v.addComponent(approvalItemBtn);
Label separator = new Label("<HR>");
separator.setContentMode(ContentMode.HTML);
v.addComponent(separator);
return v;
}
From source file:com.etest.view.systemadministration.HousekeepingMainUI.java
Table populateDataTable() {
table.removeAllItems();/* w ww. j ava2 s .c o m*/
int i = 0;
for (CellItem ci : hs.getAllItemsFromArchive()) {
VerticalLayout v = new VerticalLayout();
v.setWidth("100%");
Button recycle = new Button("recycle");
recycle.setWidthUndefined();
recycle.setData(ci.getCellItemId());
recycle.setIcon(FontAwesome.RECYCLE);
recycle.addStyleName(ValoTheme.BUTTON_LINK);
recycle.addStyleName(ValoTheme.BUTTON_TINY);
recycle.addStyleName(ValoTheme.BUTTON_QUIET);
recycle.addStyleName("button-container");
v.addComponent(recycle);
v.setComponentAlignment(recycle, Alignment.MIDDLE_LEFT);
Button view = new Button("view");
view.setWidthUndefined();
view.setData(ci.getCellItemId());
view.setIcon(FontAwesome.COFFEE);
view.addStyleName(ValoTheme.BUTTON_LINK);
view.addStyleName(ValoTheme.BUTTON_TINY);
view.addStyleName(ValoTheme.BUTTON_QUIET);
view.addStyleName("button-container");
view.addClickListener(buttonClickListener);
v.addComponent(view);
v.setComponentAlignment(view, Alignment.MIDDLE_LEFT);
table.addItem(new Object[] { ci.getCellItemId(), ci.getItem(), v }, i);
i++;
}
table.setPageLength(table.size());
return table;
}
From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java
Table populateDataTable() {
table.removeAllItems();//from w ww .j a va 2 s. c o m
int i = 0;
for (TeamTeach tt : tts.getAllMembersFromTeam(getTeamTeachId())) {
String position;
boolean isFacultyTeamLeader = tts.isFacultyTeamLeader(getTeamTeachId(), tt.getFacultyId());
if (isFacultyTeamLeader) {
position = "Team Leader";
} else {
position = "Member";
}
HorizontalLayout hlayout = new HorizontalLayout();
hlayout.setWidth("100%");
Button editPositionBtn = new Button("edit");
editPositionBtn.setWidthUndefined();
editPositionBtn.setData(tt.getFacultyId());
editPositionBtn.setIcon(FontAwesome.EDIT);
editPositionBtn.addStyleName(ValoTheme.BUTTON_LINK);
editPositionBtn.addStyleName(ValoTheme.BUTTON_TINY);
editPositionBtn.addClickListener(modifyBtnClickListener);
hlayout.addComponent(editPositionBtn);
Button removeMemberBtn = new Button("del");
removeMemberBtn.setWidthUndefined();
removeMemberBtn.setData(tt.getFacultyId());
removeMemberBtn.setIcon(FontAwesome.TRASH_O);
removeMemberBtn.addStyleName(ValoTheme.BUTTON_LINK);
removeMemberBtn.addStyleName(ValoTheme.BUTTON_TINY);
removeMemberBtn.addClickListener(modifyBtnClickListener);
hlayout.addComponent(removeMemberBtn);
if (!position.equals("Member")) {
editPositionBtn.setEnabled(false);
removeMemberBtn.setEnabled(false);
}
table.addItem(new Object[] { tt.getFacultyId(), tt.getName(), position, hlayout }, i);
i++;
}
table.setPageLength(table.size());
return table;
}