Here are the examples of the java api com.vaadin.ui.Alignment.MIDDLE_CENTER taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6 Examples
18
Source : AbstractEntityTablePanel.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
protected Alignment alignmentForProperty(String propertyId) {
if (propertyId.matches("(selected)")) {
return Alignment.MIDDLE_CENTER;
}
if (propertyId.matches("(is|should|has)[A-Z].*")) {
return Alignment.MIDDLE_LEFT;
}
if (propertyId.matches("(cost|price|sum|amount|percent)")) {
return Alignment.MIDDLE_RIGHT;
}
if (propertyId.matches("(cost|price|sum|amount|percent)[A-Z].*")) {
return Alignment.MIDDLE_RIGHT;
}
if (propertyId.matches(".*(Cost|Price|Sum|Amount|Percent)")) {
return Alignment.MIDDLE_RIGHT;
}
return Alignment.MIDDLE_LEFT;
}
17
Source : LoginComponent.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
public Component build(TextField userNameField, PreplacedwordField preplacedwordField, Button loginButton) {
MVerticalLayout mainLayout = null;
if (mainLayout == null) {
mainLayout = new MVerticalLayout();
mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
addLoginListener(listener -> {
UserLoginRequestedEvent userLoginRequestedEvent = new UserLoginRequestedEvent(listener.getLoginParameter(USERNAME), listener.getLoginParameter(PreplacedWORD));
// clear preplacedword field...
preplacedwordField.clear();
preplacedwordField.focus();
DashboardEventBus.sessionInstance().post(userLoginRequestedEvent);
});
setSizeFull();
Component loginForm = buildLoginForm(userNameField, preplacedwordField, loginButton);
mainLayout.setSizeFull();
mainLayout.addComponent(loginForm);
postBuild();
}
return mainLayout;
}
16
Source : VaadinAbstractLoginComponent.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
public Component build(TextField userNameField, PreplacedwordField preplacedwordField, Button loginButton) {
MVerticalLayout mainLayout = null;
if (mainLayout == null) {
mainLayout = new MVerticalLayout();
mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
addLoginListener(listener -> {
UserLoginRequestedEvent userLoginRequestedEvent = new UserLoginRequestedEvent(listener.getLoginParameter(USERNAME), listener.getLoginParameter(PreplacedWORD));
DashboardEventBus.sessionInstance().post(userLoginRequestedEvent);
});
setSizeFull();
Component loginForm = buildLoginForm(userNameField, preplacedwordField, loginButton);
mainLayout.setSizeFull();
mainLayout.addComponent(loginForm);
postBuild();
}
return mainLayout;
}
16
Source : AbstractDashboardMenu.java
with Apache License 2.0
from ijazfx
with Apache License 2.0
from ijazfx
private Component buildreplacedle() {
MVerticalLayout layout = new MVerticalLayout();
Image logo = dashboardSetup().dashboardLogo();
if (logo != null) {
layout.setStyleName("valo-menu-replacedle-with-image");
logo.setHeight("80px");
layout.addComponent(logo);
}
Component replacedle = new Label(dashboardSetup().dashboardreplacedle(), ContentMode.HTML);
MHorizontalLayout replacedleWrapper = new MHorizontalLayout(replacedle);
replacedleWrapper.setComponentAlignment(replacedle, Alignment.MIDDLE_CENTER);
replacedleWrapper.addStyleName("valo-menu-replacedle");
layout.addComponents(replacedleWrapper);
return layout;
}
15
Source : JobView.java
with Apache License 2.0
from opensecuritycontroller
with Apache License 2.0
from opensecuritycontroller
@SuppressWarnings("serial")
private void buildGraph() {
try {
this.embeddedImage = new Embedded();
this.embeddedImage.setSizeFull();
refreshGraph();
Button refresh = new Button("Refresh");
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
refreshGraph();
} catch (Exception e) {
ViewUtil.showError("Error while building task graph DOT file.", e);
}
}
});
final HorizontalLayout toolbarLayout = new HorizontalLayout();
toolbarLayout.addComponent(refresh);
toolbarLayout.setSizeFull();
toolbarLayout.setMargin(true);
final VerticalLayout imageLayout = new VerticalLayout();
imageLayout.addComponent(this.embeddedImage);
imageLayout.setComponentAlignment(this.embeddedImage, Alignment.MIDDLE_CENTER);
imageLayout.setSizeUndefined();
final VerticalLayout layout = new VerticalLayout();
layout.addComponent(refresh);
layout.setComponentAlignment(refresh, Alignment.TOP_LEFT);
layout.addComponent(imageLayout);
layout.setSizeUndefined();
final Window window = new Window();
window.setContent(layout);
window.setModal(true);
window.setHeight("80%");
window.setWidth("80%");
window.setClosable(true);
window.setResizable(true);
window.setCaption("Task Graph for Job " + getParenreplacedemId());
window.center();
window.setWindowMode(WindowMode.MAXIMIZED);
window.addCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null);
ViewUtil.addWindow(window);
window.focus();
} catch (Exception e) {
ViewUtil.showError("Error while building task graph DOT file.", e);
}
}
9
Source : MainUI.java
with Apache License 2.0
from opensecuritycontroller
with Apache License 2.0
from opensecuritycontroller
private void buildLoginForm() {
addStyleName("login");
this.loginLayout = new VerticalLayout();
this.loginLayout.setSizeFull();
this.loginLayout.addStyleName("login-layout");
this.root.addComponent(this.loginLayout);
final CssLayout loginPanel = new CssLayout();
loginPanel.addStyleName("login-panel");
HorizontalLayout labels = new HorizontalLayout();
labels.setWidth("100%");
labels.setMargin(true);
labels.addStyleName("labels");
loginPanel.addComponent(labels);
Label product = new Label(this.server.getProductName());
product.addStyleName("product-label-login");
labels.addComponent(new Image(null, new ThemeResource("img/logo.png")));
labels.addComponent(product);
labels.setComponentAlignment(product, Alignment.MIDDLE_LEFT);
labels.setExpandRatio(product, 1);
HorizontalLayout fields = new HorizontalLayout();
fields.setSpacing(true);
fields.setMargin(true);
fields.addStyleName("fields");
final TextField username = new TextField("Login ID");
username.focus();
username.setImmediate(true);
username.setRequired(true);
username.setRequiredError("Login ID or Preplacedword cannot be empty");
fields.addComponent(username);
final PreplacedwordField preplacedword = new PreplacedwordField("Preplacedword");
preplacedword.setRequired(true);
preplacedword.setImmediate(true);
preplacedword.setRequiredError("Login ID or Preplacedword cannot be empty");
fields.addComponent(preplacedword);
final Button login = new Button("Log In");
login.addStyleName("default");
fields.addComponent(login);
fields.setComponentAlignment(login, Alignment.BOTTOM_LEFT);
final ShortcutListener enter = new ShortcutListener("Login", KeyCode.ENTER, null) {
@Override
public void handleAction(Object sender, Object target) {
login.click();
}
};
login.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
username.validate();
preplacedword.validate();
LoginRequest request = new LoginRequest();
request.setLoginName(username.getValue().trim());
request.setPreplacedword(preplacedword.getValue());
LoginResponse response = MainUI.this.loginService.dispatch(request);
if (response != null) {
login.removeShortcutListener(enter);
if (getSession() != null) {
getSession().setAttribute("user", username.getValue());
}
MainUI.this.root.removeComponent(MainUI.this.loginLayout);
buildMainView();
}
} catch (EmptyValueException e) {
ViewUtil.iscNotification(e.getMessage() + ".", Notification.Type.ERROR_MESSAGE);
username.focus();
} catch (Exception e) {
username.focus();
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
});
login.addShortcutListener(enter);
loginPanel.addComponent(fields);
this.loginLayout.addComponent(loginPanel);
this.loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
}