List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java
License:Open Source License
public AdminAuthView() { setSizeFull();/*from w w w .j av a2 s.c om*/ VerticalLayout header = new VerticalLayout(); header.setSizeFull(); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); addComponents(header, content); setExpandRatio(header, 1); setExpandRatio(content, 6); welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>"); welcomeText.setContentMode(ContentMode.HTML); welcomeText.setSizeUndefined(); header.addComponent(welcomeText); header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); Panel controlPanel = new Panel("Administrator control panel"); controlPanel.setSizeUndefined(); Panel addCoordPanel = new Panel("Create a new coordinator"); addCoordPanel.setSizeUndefined(); Panel messagesPanel = new Panel("Administrator messages"); messagesPanel.setWidth("580px"); Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setColumnWidth("inputEvent", 180); adminMessagesTable.setSizeFull(); VerticalLayout controlLayout = new VerticalLayout(controlPanel); controlLayout.setSizeFull(); controlLayout.setMargin(false); controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER); VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel); coordOperationsLayout.setSizeFull(); coordOperationsLayout.setMargin(false); coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER); /******************************************/ coordOperationsLayout.setVisible(true); // main layout in the middle addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator" /******************************************/ HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel); VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable); messagesExternalLayout.setSizeFull(); messagesExternalLayout.setMargin(false); messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER); messagesInternalLayout.setMargin(false); messagesInternalLayout.setSizeFull(); messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER); messagesPanel.setContent(messagesInternalLayout); TextField idCoordAdd = new TextField(); TextField loginCoord = new TextField(); PasswordField pwdCoord = new PasswordField(); Label idCaptionAdd = new Label("ID"); Label loginCaption = new Label("Login"); Label pwdCaption = new Label("Password"); idCaptionAdd.setSizeUndefined(); idCoordAdd.setSizeUndefined(); loginCaption.setSizeUndefined(); loginCoord.setSizeUndefined(); pwdCaption.setSizeUndefined(); pwdCoord.setSizeUndefined(); Button validateNewCoord = new Button("Validate"); validateNewCoord.setClickShortcut(KeyCode.ENTER); validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY); GridLayout addCoordinatorLayout = new GridLayout(2, 4); addCoordinatorLayout.setSpacing(true); addCoordinatorLayout.setMargin(true); addCoordinatorLayout.setSizeFull(); addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption, pwdCoord); addCoordinatorLayout.addComponent(validateNewCoord, 1, 3); addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT); addCoordPanel.setContent(addCoordinatorLayout); content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setExpandRatio(controlLayout, 20); content.setExpandRatio(coordOperationsLayout, 10); content.setExpandRatio(messagesExternalLayout, 28); Button addCoordinator = new Button("Add coordinator"); Button deleteCoordinator = new Button("Delete coordinator"); addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE); VerticalLayout buttons = new VerticalLayout(); buttons.setMargin(true); buttons.setSpacing(true); buttons.setSizeFull(); buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlPanel.setContent(buttons); buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn); /******* DELETE COORDINATOR PANEL BEGIN *********/ Label idCaptionDel = new Label("ID"); TextField idCoordDel = new TextField(); Panel delCoordPanel = new Panel("Delete a coordinator"); coordOperationsLayout.addComponent(delCoordPanel); delCoordPanel.setVisible(false); coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER); delCoordPanel.setSizeUndefined(); GridLayout delCoordinatorLayout = new GridLayout(2, 2); delCoordinatorLayout.setSpacing(true); delCoordinatorLayout.setMargin(true); delCoordinatorLayout.setSizeFull(); Button deleteCoordBtn = new Button("Delete"); deleteCoordBtn.setClickShortcut(KeyCode.ENTER); deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY); delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel); delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1); delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT); delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT); delCoordPanel.setContent(delCoordinatorLayout); /******* DELETE COORDINATOR PANEL END *********/ /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/ addCoordinator.addClickListener(event -> { if (!addCoordPanel.isVisible()) { delCoordPanel.setVisible(false); addCoordPanel.setVisible(true); idCoordAdd.focus(); } else addCoordPanel.setVisible(false); }); deleteCoordinator.addClickListener(event -> { if (!delCoordPanel.isVisible()) { addCoordPanel.setVisible(false); delCoordPanel.setVisible(true); idCoordDel.focus(); } else delCoordPanel.setVisible(false); }); /************************************************* MAIN BUTTONS LOGIC END *************************************************/ /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/ validateNewCoord.addClickListener(event -> { String currentURL = Page.getCurrent().getLocation().toString(); int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName); String iCrashURL = currentURL.substring(0, strIndexCreator); String googleShebang = "#!"; String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang; try { sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())), new DtLogin(new PtString(loginCoord.getValue())), new DtPassword(new PtString(pwdCoord.getValue()))); // open new browser tab with the newly created coordinator console... // "_blank" instructs the browser to open a new tab instead of a new window... // unhappily not all browsers interpret it correctly, // some versions of some browsers might still open a new window instead (notably Firefox)! Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank"); } catch (Exception e) { e.printStackTrace(); } idCoordAdd.setValue(""); loginCoord.setValue(""); pwdCoord.setValue(""); idCoordAdd.focus(); }); /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/ /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/ deleteCoordBtn.addClickListener(event -> { IcrashSystem sys = IcrashSystem.getInstance(); try { sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue()))); } catch (Exception e) { e.printStackTrace(); } idCoordDel.setValue(""); idCoordDel.focus(); }); /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/ }
From source file:lv.polarisit.demosidemenu.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items/* w ww . j a v a 2s .c o m*/ menuItems.put("MessageView", "First Message"); menuItems.put("MessageView1", "Second Message"); /* menuItems.put("labels", "Labels"); menuItems.put("buttons-and-links", "Buttons & Links"); menuItems.put("textfields", "Text Fields"); menuItems.put("datefields", "Date Fields"); menuItems.put("comboboxes", "Combo Boxes"); menuItems.put("selects", "Selects"); menuItems.put("checkboxes", "Check Boxes & Option Groups"); menuItems.put("sliders", "Sliders & Progress Bars"); menuItems.put("colorpickers", "Color Pickers"); menuItems.put("menubars", "Menu Bars"); menuItems.put("trees", "Trees"); menuItems.put("tables", "Tables"); menuItems.put("dragging", "Drag and Drop"); menuItems.put("panels", "Panels"); menuItems.put("splitpanels", "Split Panels"); menuItems.put("tabs", "Tabs"); menuItems.put("accordions", "Accordions"); menuItems.put("popupviews", "Popup Views"); // menuItems.put("calendar", "Calendar"); menuItems.put("forms", "Forms"); */ final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); menu.addComponent(createThemeSelect()); final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); /* final StringGenerator sg = new StringGenerator(); final MenuItem settingsItem = settings.addItem(sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false), new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null); settingsItem.addItem("Edit Profile", null); settingsItem.addItem("Preferences", null); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", null); */ menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); Label label = null; int count = -1; for (final Entry<String, String> item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("panels")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Containers", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("forms")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Other", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } final Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); if (count == 2) { b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>"); } b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); // b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; } if (label != null) label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:me.uni.emuseo.view.common.paging.PagedTableLayout.java
License:Open Source License
protected void buildNavPanel() { navigationLayout = new HorizontalLayout(); HorizontalLayout extraLayout = new HorizontalLayout(); createItemsPeerPageComboBox();//from w w w. java2 s . c o m itemsPerPageComboBox.setWidth(100, Unit.PIXELS); middleLayout = new HorizontalLayout(); middleLayout.setSpacing(true); buildNavButtons(); extraLayout.addComponent(firstPageButton); extraLayout.addComponent(prevPageButton); extraLayout.addComponents(middleLayout); extraLayout.addComponent(nextPageButton); extraLayout.addComponent(lastPageButton); extraLayout.setSpacing(true); navigationLayout.addComponent(itemsPerPageComboBox); navigationLayout.addComponent(extraLayout); navigationLayout.setExpandRatio(itemsPerPageComboBox, 0); navigationLayout.setExpandRatio(extraLayout, 1); navigationLayout.setComponentAlignment(itemsPerPageComboBox, Alignment.MIDDLE_LEFT); navigationLayout.setComponentAlignment(extraLayout, Alignment.BOTTOM_CENTER); navigationLayout.setWidth(100, Unit.PERCENTAGE); navigationLayout.setMargin(new MarginInfo(false, true, false, true)); }
From source file:me.uni.emuseo.view.menu.MenuView.java
License:Open Source License
private CssLayout buildMenu() { // Add items//from w w w . ja va 2s. c o m if (authManager.isAuthorizedTo(Permissions.MENU_USERS_VIEW)) { menuItems.put(Permissions.MENU_USERS_VIEW, "Uytkownicy"); } if (authManager.isAuthorizedTo(Permissions.MENU_EXHIBIT_VIEW)) { menuItems.put(Permissions.MENU_EXHIBIT_VIEW, "Katalog eksponatw"); } if (authManager.isAuthorizedTo(Permissions.MENU_CATEGORIES_VIEW)) { menuItems.put(Permissions.MENU_CATEGORIES_VIEW, "Kategorie"); } if (authManager.isAuthorizedTo(Permissions.MENU_RESOURCES_VIEW)) { menuItems.put(Permissions.MENU_RESOURCES_VIEW, "Zasoby"); } final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); final Button showMenu = new Button("Menu", new ClickListener() { private static final long serialVersionUID = -719702284721453362L; @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>e<strong>Museo</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settingsItem = settings.addItem("Jan Kowalski", defaultIcon, null); if (authManager.isAuthorizedTo(Permissions.MENU_MY_ACCOUNT_VIEW)) { settingsItem.addItem("Moje konto", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235104L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_MY_ACCOUNT_VIEW); } }); } if (authManager.isAuthorizedTo(Permissions.MENU_SETTINGS_VIEW)) { settingsItem.addItem("Ustawienia", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235105L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_SETTINGS_VIEW); } }); } settingsItem.addSeparator(); settingsItem.addItem("Wyloguj", new MenuBar.Command() { private static final long serialVersionUID = 1333473616079310225L; @Override public void menuSelected(MenuItem selectedItem) { final AuthManager authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); authManager.logout(); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { FontIcon icon = null; if (item.getKey().equals(Permissions.MENU_USERS_VIEW)) { icon = FontAwesome.USERS; } else if (item.getKey().endsWith(Permissions.MENU_EXHIBIT_VIEW)) { icon = FontAwesome.UNIVERSITY; } else if (item.getKey().endsWith(Permissions.MENU_CATEGORIES_VIEW)) { icon = FontAwesome.ARCHIVE; } else if (item.getKey().endsWith(Permissions.MENU_RESOURCES_VIEW)) { icon = FontAwesome.IMAGE; } final Button b = new Button(item.getValue(), new ClickListener() { private static final long serialVersionUID = -7089398070311521853L; @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); if (icon != null) { b.setIcon(icon); } menuItemsLayout.addComponent(b); } return menu; }
From source file:my.vaadin.profile.Forms.java
public Forms() { setSpacing(true);//from w w w . ja va2 s .c o m setMargin(true); Label title = new Label("Signup Form"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("900px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); //StringGenerator sg = new StringGenerator(); TextField zID = new TextField("zID"); zID.setValue("z123456"); zID.setRequired(true); form.addComponent(zID); TextField name = new TextField("Name"); name.setValue("loreum"); //name.setWidth("50%"); form.addComponent(name); PasswordField pw = new PasswordField("Set Password"); pw.setRequired(true); form.addComponent(pw); DateField birthday = new DateField("Birthday"); birthday.setDateFormat("dd-MM-yyyy"); birthday.setValue(new java.util.Date()); form.addComponent(birthday); OptionGroup gender = new OptionGroup("Gender"); gender.addItem("Male"); gender.addItem("Female"); //sex.select("Male"); gender.addStyleName("horizontal"); form.addComponent(gender); section = new Label("Class Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); TextField classID = new TextField("Class ID"); classID.setValue("INFS2605"); classID.setRequired(true); //classID.setWidth("50%"); form.addComponent(classID); TextField groupID = new TextField("Group ID"); groupID.setValue("1"); //groupID.setWidth("50%"); groupID.setRequired(true); form.addComponent(groupID); Button confirm = new Button("Confirm"); confirm.addStyleName("primary"); form.addComponent(confirm); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(confirm); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.LoginDialog.java
License:Apache License
public void init() { //Layout//from w w w . j av a2 s . co m FormLayout layout = new FormLayout(); setContent(layout); HorizontalLayout hlayout = new HorizontalLayout(); hlayout.addComponent(loginButton); hlayout.addComponent(cancelButton); layout.addComponent(name); layout.addComponent(password); name.focus(); name.setWidth(100, Unit.PERCENTAGE); StringLengthValidator nameVal = new StringLengthValidator(Lookup.getDefault() .lookup(InternationalizationProvider.class).translate("password.length.message")); nameVal.setMinLength(5); name.addValidator(nameVal); name.setImmediate(true); StringLengthValidator passVal = new StringLengthValidator( Lookup.getDefault().lookup(InternationalizationProvider.class).translate("password.empty.message")); passVal.setMinLength(3); password.addValidator(passVal); password.setImmediate(true); password.setWidth(100, Unit.PERCENTAGE); layout.addComponent(hlayout); layout.setComponentAlignment(name, Alignment.TOP_LEFT); layout.setComponentAlignment(password, Alignment.MIDDLE_LEFT); layout.setComponentAlignment(hlayout, Alignment.BOTTOM_LEFT); layout.setSpacing(true); layout.setMargin(true); // Keyboard navigation - enter key is a shortcut to login addActionHandler(new Handler() { @Override public Action[] getActions(Object target, Object sender) { return new Action[] { enterKey }; } @Override public void handleAction(Action action, Object sender, Object target) { tryToLogIn(); } }); }
From source file:nl.amc.biolab.nsg.display.component.MainUI.java
License:Open Source License
private HorizontalLayout buildTopPanel() { topPanel = new HorizontalLayout(); topPanel.setStyleName("topPanel"); topPanel.setImmediate(true);/*from w ww . j av a 2 s . c om*/ topPanel.setWidth("100%"); topPanel.setHeight("32px"); topPanel.setMargin(false); topPanel.setSpacing(false); HorizontalLayout topPanelLeft = buildTopPanelLeft(); topPanel.addComponent(topPanelLeft); topPanel.setComponentAlignment(topPanelLeft, Alignment.MIDDLE_LEFT); HorizontalLayout topPanelMid = buildTopPanelMid(); topPanel.addComponent(topPanelMid); topPanel.setComponentAlignment(topPanelMid, Alignment.MIDDLE_CENTER); pagePanel = buildTopPanelRight(); topPanel.addComponent(pagePanel); topPanel.setComponentAlignment(pagePanel, Alignment.MIDDLE_RIGHT); return topPanel; }
From source file:org.accelerators.activiti.admin.ui.MainView.java
License:Open Source License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);// w ww. ja va 2 s. com setSpacing(false); setSizeFull(); // Add header GridLayout header = new GridLayout(2, 1); header.setWidth("100%"); header.setHeight("34px"); addComponent(header); // Add header styles header.addStyleName(Consts.HEADER); header.addStyleName("header"); header.setSpacing(true); // Add title to header GridLayout logoGrid = new GridLayout(1, 1); header.addComponent(logoGrid, 0, 0); header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT); Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png")); logoImage.setType(Embedded.TYPE_IMAGE); logoImage.addStyleName("header-image"); logoGrid.addComponent(logoImage, 0, 0); logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER); // Add logout button to header GridLayout logoutGrid = new GridLayout(2, 1); Label userLabel = new Label("Signed in as: " + app.getUser().toString()); userLabel.addStyleName("user"); logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logoutGrid.addComponent(userLabel, 0, 0); logoutGrid.addComponent(logout, 1, 0); header.addComponent(logoutGrid, 1, 0); header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }
From source file:org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.java
License:Apache License
protected void initActions() { newModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW)); newModelButton.addListener(new NewModelClickListener()); importModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_IMPORT)); importModelButton.addListener(new ImportModelClickListener()); editModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_EDIT)); editModelButton.addListener(new EditModelClickListener(modelData)); actionLabel = new Label(i18nManager.getMessage(Messages.MODEL_ACTION)); actionLabel.setSizeUndefined();/*from w w w .j a v a2 s . com*/ actionSelect = new Select(); actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_COPY)); actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DELETE)); actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DEPLOY)); actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_EXPORT)); actionSelect.setWidth("100px"); actionSelect.setFilteringMode(Filtering.FILTERINGMODE_OFF); actionSelect.setImmediate(true); actionSelect.addListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (i18nManager.getMessage(Messages.PROCESS_COPY).equals(event.getProperty().getValue())) { ExplorerApp.get().getViewManager().showPopupWindow(new CopyModelPopupWindow(modelData)); } else if (i18nManager.getMessage(Messages.PROCESS_DELETE).equals(event.getProperty().getValue())) { ExplorerApp.get().getViewManager().showPopupWindow(new DeleteModelPopupWindow(modelData)); } else if (i18nManager.getMessage(Messages.PROCESS_DEPLOY).equals(event.getProperty().getValue())) { deployModel(); } else if (i18nManager.getMessage(Messages.PROCESS_EXPORT).equals(event.getProperty().getValue())) { exportModel(); } } }); // Clear toolbar and add 'start' button processDefinitionPage.getToolBar().removeAllButtons(); processDefinitionPage.getToolBar().removeAllAdditionalComponents(); processDefinitionPage.getToolBar().addButton(newModelButton); processDefinitionPage.getToolBar().addButton(importModelButton); processDefinitionPage.getToolBar().addButton(editModelButton); processDefinitionPage.getToolBar().addAdditionalComponent(actionLabel); processDefinitionPage.getToolBar().setComponentAlignment(actionLabel, Alignment.MIDDLE_LEFT); processDefinitionPage.getToolBar().addAdditionalComponent(actionSelect); processDefinitionPage.getToolBar().setComponentAlignment(actionSelect, Alignment.MIDDLE_RIGHT); }