List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:com.karus.EnglishCheckerUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { VaadinServiceSession.getCurrent().setErrorHandler(this); setSizeFull();/*from w ww .j ava 2 s. c o m*/ try { DiscoveryNavigator navigator = new DiscoveryNavigator(this, getContent()); navigator.navigateTo(UI.getCurrent().getPage().getFragment()); } /** * Exception on page load */ catch (AccessDeniedException e) { Label label = new Label(e.getMessage()); label.setWidth(-1, Unit.PERCENTAGE); Link goToMain = new Link("Go to login page", new ExternalResource("/login/")); VerticalLayout layout = new VerticalLayout(); layout.addComponent(label); layout.addComponent(goToMain); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(goToMain, Alignment.MIDDLE_CENTER); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(layout); mainLayout.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); setContent(mainLayout); Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } }
From source file:com.klwork.explorer.project.MyCalendarView.java
License:Apache License
private void initLayoutContent() { initNavigationButtons();//w w w . ja va 2 s . c om initHideWeekEndButton(); initReadOnlyButton(); initDisabledButton(); initAddNewEventButton(); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); hl.setSpacing(true); hl.setMargin(new MarginInfo(false, false, true, false)); hl.addComponent(prevButton); hl.addComponent(captionLabel); hl.addComponent(monthButton); hl.addComponent(weekButton); hl.addComponent(nextButton); hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT); hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); monthButton.setVisible(viewMode == Mode.WEEK); weekButton.setVisible(viewMode == Mode.DAY); HorizontalLayout controlPanel = new HorizontalLayout(); controlPanel.setSpacing(true); controlPanel.setMargin(new MarginInfo(false, false, true, false)); controlPanel.setWidth("100%"); //controlPanel.addComponent(localeSelect); //controlPanel.addComponent(timeZoneSelect); controlPanel.addComponent(formatSelect); controlPanel.addComponent(hideWeekendsButton); //controlPanel.addComponent(readOnlyButton); //controlPanel.addComponent(disabledButton); controlPanel.addComponent(addNewEvent); /*controlPanel.setComponentAlignment(timeZoneSelect, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT); /*controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.MIDDLE_LEFT); /* controlPanel.setComponentAlignment(readOnlyButton, Alignment.MIDDLE_LEFT); controlPanel.setComponentAlignment(disabledButton, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT); GridLayout layout = (GridLayout) getContent(); layout.addComponent(controlPanel); layout.addComponent(hl); layout.addComponent(calendarComponent); layout.setRowExpandRatio(layout.getRows() - 1, 1.0f); }
From source file:com.klwork.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from w ww . j a v a 2 s .c o m*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType())); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ViewToolManager.getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType())); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }
From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java
License:Apache License
protected void initSelectUserButton() { selectUserButton = new Button(">"); selectUserButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { for (String selectedItemId : (Set<String>) matchingUsersTable.getValue()) { // Remove from left table Item originalItem = matchingUsersTable.getItem(selectedItemId); // And put it in right table selectUser(selectedItemId, (String) originalItem.getItemProperty("userName").getValue()); // Remove from left table (must be done on the end, or item // properties will be inaccessible) // matchingUsersTable.removeItem(selectedItemId); }/* w ww.j av a2 s . com*/ } }); userSelectionLayout.addComponent(selectUserButton); userSelectionLayout.setComponentAlignment(selectUserButton, Alignment.MIDDLE_CENTER); }
From source file:com.klwork.explorer.ui.custom.UploadComponent.java
License:Apache License
protected void addUpload() { this.upload = new Upload(null, receiver); upload.setButtonCaption(i18nManager.getMessage(Messages.UPLOAD_SELECT)); upload.setImmediate(true);// ww w.ja v a 2 s .co m addComponent(upload); setComponentAlignment(upload, Alignment.MIDDLE_CENTER); // register ourselves as listener for upload events upload.addListener((StartedListener) this); upload.addListener((FailedListener) this); upload.addListener((FinishedListener) this); upload.addListener((ProgressListener) this); }
From source file:com.klwork.explorer.ui.custom.UploadComponent.java
License:Apache License
protected void addOrLabel() { Label orLabel = new Label("or"); orLabel.setSizeUndefined();//w ww . j a v a2 s. co m orLabel.addStyleName(Reindeer.LABEL_SMALL); addComponent(orLabel); setComponentAlignment(orLabel, Alignment.MIDDLE_CENTER); }
From source file:com.klwork.explorer.ui.custom.UploadComponent.java
License:Apache License
protected void addDropPanel() { Panel dropPanel = new Panel(); dropPanel.setContent(new VerticalLayout()); DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel); //WW_TODO ?/* w w w . jav a 2s. c o m*/ dragAndDropWrapper.setDropHandler(this); dragAndDropWrapper.setWidth("80%"); addComponent(dragAndDropWrapper); setComponentAlignment(dragAndDropWrapper, Alignment.MIDDLE_CENTER); // Label dropLabel = new Label(i18nManager.getMessage(Messages.UPLOAD_DROP)); dropLabel.setSizeUndefined(); ((VerticalLayout) dropPanel.getContent()).addComponent(dropLabel); ((VerticalLayout) dropPanel.getContent()).setComponentAlignment(dropLabel, Alignment.MIDDLE_CENTER); }
From source file:com.klwork.explorer.ui.custom.UploadComponent.java
License:Apache License
public void uploadStarted(StartedEvent event) { removeAllComponents(); // Visible components are replaced by a progress bar this.progressIndicator = new ProgressIndicator(); progressIndicator.setPollingInterval(500); addComponent(progressIndicator);//from w w w . j av a2 s .c o m setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER); for (StartedListener startedListener : startedListeners) { startedListener.uploadStarted(event); } }
From source file:com.klwork.explorer.ui.user.ChangePasswordPopupWindow.java
License:Apache License
protected void initPasswordFields() { inputGrid = new GridLayout(2, 2); inputGrid.setSpacing(true);//from ww w . ja v a2 s .c o m layout.addComponent(inputGrid); layout.setComponentAlignment(inputGrid, Alignment.MIDDLE_CENTER); Label newPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_NEW_PASSWORD)); inputGrid.addComponent(newPasswordLabel); passwordField1 = new PasswordField(); passwordField1.setWidth(150, UNITS_PIXELS); inputGrid.addComponent(passwordField1); passwordField1.focus(); Label confirmPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_CONFIRM_PASSWORD)); inputGrid.addComponent(confirmPasswordLabel); passwordField2 = new PasswordField(); passwordField2.setWidth(150, UNITS_PIXELS); inputGrid.addComponent(passwordField2); }
From source file:com.klwork.explorer.ui.user.ChangePasswordPopupWindow.java
License:Apache License
protected void initChangePasswordButton() { errorLabel = new Label(" ", Label.CONTENT_XHTML); errorLabel.addStyleName(Reindeer.LABEL_SMALL); errorLabel.addStyleName(ExplorerLayout.STYLE_LABEL_RED); layout.addComponent(errorLabel);//from w ww .j a v a 2 s.co m Button changePasswordButton = new Button(i18nManager.getMessage(Messages.PASSWORD_CHANGE)); layout.addComponent(changePasswordButton); layout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_CENTER); changePasswordButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { handlePasswordChange(); } }); }