List of usage examples for com.vaadin.ui Alignment TOP_RIGHT
Alignment TOP_RIGHT
To view the source code for com.vaadin.ui Alignment TOP_RIGHT.
Click Source Link
From source file:fr.univlorraine.mondossierweb.views.windows.HelpBasicWindow.java
License:Apache License
/** * Cre une fentre de confirmation/* w w w. j a v a 2 s . c om*/ * @param message * @param titre */ public HelpBasicWindow(String message, String titre, boolean displayLienContact) { /* Style */ setWidth(900, Unit.PIXELS); setModal(true); setResizable(false); setClosable(false); /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(false); setContent(layout); /* Titre */ setCaption(titre); // Lien de contact if (displayLienContact) { String mailContact = configController.getAssistanceContactMail(); if (StringUtils.hasText(mailContact)) { Button contactBtn = new Button( applicationContext.getMessage(NAME + ".btnContact", null, getLocale()), FontAwesome.ENVELOPE); contactBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact); contactBwo.extend(contactBtn); layout.addComponent(contactBtn); layout.setComponentAlignment(contactBtn, Alignment.TOP_RIGHT); } } /* Texte */ Label textLabel = new Label(message, ContentMode.HTML); layout.addComponent(textLabel); /* Boutons */ HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setSpacing(true); layout.addComponent(buttonsLayout); btnFermer.setCaption(applicationContext.getMessage("helpWindow.btnFermer", null, getLocale())); btnFermer.setIcon(FontAwesome.TIMES); btnFermer.addClickListener(e -> close()); buttonsLayout.addComponent(btnFermer); buttonsLayout.setComponentAlignment(btnFermer, Alignment.MIDDLE_RIGHT); /* Centre la fentre */ center(); }
From source file:kn.uni.gis.ui.GameApplication.java
License:Apache License
private Window createGameWindow() { tabsheet = new TabSheet(); tabsheet.setImmediate(true);// www.j a v a2s . co m tabsheet.setCloseHandler(new CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { Game game = ((GameComposite) tabContent).getGame(); GameComposite remove = gameMap.remove(game); // closes the game and the running thread! remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent()); eventBus.unregister(remove); eventBus.unregister(remove.getLayer()); map.removeLayer(remove.getLayer()); tabsheet.removeComponent(tabContent); if (gameMap.isEmpty()) { pi.setVisible(false); } } }); final Window mywindow = new Window("Games"); mywindow.setPositionX(0); mywindow.setPositionY(0); mywindow.setHeight("50%"); mywindow.setWidth("25%"); VerticalLayout layout = new VerticalLayout(); HorizontalLayout lay = new HorizontalLayout(); final Button button_1 = new Button(); button_1.setCaption("Open Game"); button_1.setWidth("-1px"); button_1.setHeight("-1px"); button_1.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { final String id = textField_1.getValue().toString(); if (id.length() < 5) { window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE); } else { String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s" + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER); final Game game = new Game(id); final PreparedStatement statement = geoUtil.getConn() .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT " + MAX_STATES_IN_MEM); try { geoUtil.getConn().executeSafeQuery(sql, new DoWithin() { @Override public void doIt(ResultSet executeQuery) throws SQLException { while (executeQuery.next()) { if (statement == null) { } String playerId = executeQuery.getString(1); Timestamp min = executeQuery.getTimestamp(3); Timestamp max = executeQuery.getTimestamp(4); game.addPlayer(playerId, executeQuery.getString(2), min, max, new TimingIterator(geoUtil, id, playerId, min.getTime(), statement)); } } }, id + "%"); } catch (SQLException e) { LOGGER.info("error on sql!", e); } game.finish(statement); if (!!!gameMap.containsKey(game)) { if (game.getStates().size() == 0) { window.showNotification("game not found!"); } else { LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size()); GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus, game, createColorMap(game)); final GameComposite gameComposite = new GameComposite(GameApplication.this, game, gameVectorLayer, eventBus); eventBus.register(gameComposite); eventBus.register(gameVectorLayer); map.addLayer(gameVectorLayer); gameMap.put(game, gameComposite); // Add the component to the tab sheet as a new tab. Tab addTab = tabsheet.addTab(gameComposite); addTab.setCaption(game.getId().substring(0, 5)); addTab.setClosable(true); pi.setVisible(true); // pl.get PlayerState playerState = game.getStates().get(game.getFox()).peek(); map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint()))); } } } } private Map<Player, Integer> createColorMap(Game game) { Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size()); ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder(); int i = 0; for (Player play : game.getStates().keySet()) { builder.put(play, getColor(scale.apply((double) i++))); } return builder.build(); } private Integer getColor(double dob) { int toReturn = 0; toReturn = toReturn | 255 - (int) Math.round(255 * dob); toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16); return toReturn; // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob + // 5 * dob); } }); Button button_2 = new Button(); button_2.setCaption("All seeing Hunter"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (adminWindow == null) { adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { textField_1.setValue(event.getItemId().toString()); mywindow.bringToFront(); button_1.focus(); } }); window.addWindow(adminWindow); adminWindow.setWidth("30%"); adminWindow.setHeight("40%"); adminWindow.addListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { adminWindow = null; } }); } } }); lay.addComponent(button_1); textField_1 = new TextField(); textField_1.setImmediate(false); textField_1.setWidth("-1px"); textField_1.setHeight("-1px"); lay.addComponent(textField_1); lay.addComponent(button_2); lay.addComponent(pi); lay.setComponentAlignment(pi, Alignment.TOP_RIGHT); layout.addComponent(lay); layout.addComponent(tabsheet); mywindow.addComponent(layout); mywindow.setClosable(false); /* Add the window inside the main window. */ return mywindow; }
From source file:my.vaadin.profile.MainLayout.java
public MainLayout() { Label header = new Label("Student"); header.addStyleName("colored"); header.addStyleName("h2"); //header.addStyleName("alignRight"); header.setSizeUndefined();//ww w . ja va 2s .com Button signOut = new Button("Sign-Out"); signOut.setSizeUndefined(); signOut.addStyleName("small"); Label menu = new Label("Menu"); menu.addStyleName("colored"); menu.addStyleName("h2"); upperSection.setSizeFull(); innerUpperSection.addComponent(header); innerUpperSection.addComponent(signOut); innerUpperSection.setExpandRatio(signOut, 1); innerUpperSection.setSpacing(true); innerUpperSection.setComponentAlignment(signOut, Alignment.MIDDLE_RIGHT); upperSection.addComponent(innerUpperSection); upperSection.setMargin(new MarginInfo(false, true, false, false)); upperSection.setComponentAlignment(innerUpperSection, Alignment.TOP_RIGHT); upperSection.addStyleName("borderBottom"); menuTitle.addComponent(menu); menuLayout.addComponent(menuTitle); menuLayout.setWidth("100%"); menuLayout.setComponentAlignment(menuTitle, Alignment.MIDDLE_CENTER); //menuLayout.addStyleName("whiteStuff"); // menuLayout.setExpandRatio(, 1); //contentLayout.addComponent(); lowerSection.addComponent(menuLayout); lowerSection.addComponent(contentLayout); addComponent(upperSection); addComponent(lowerSection); upperSection.setHeight(4, UNITS_EM); //showBorders(); setSizeFull(); lowerSection.setSizeFull(); //menuLayout.setSizeFull(); contentLayout.setSizeFull(); setExpandRatio(lowerSection, 1); lowerSection.setSplitPosition(15); Button lolol = new Button("hi"); menuLayout.addComponent(lolol); lolol.setWidth("100%"); lolol.setStyleName("borderless"); }
From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java
License:Open Source License
public void setButtons() { HorizontalLayout buttons = new HorizontalLayout(); buttons.setHeight("40px"); buttons.setSpacing(true);/*from w w w . j a v a2 s .c o m*/ getLayout().addComponent(buttons); final Button startButton = new NativeButton(); startButton.setCaption(SUBMIT); startButton.setImmediate(true); startButton.setWidth("-1px"); startButton.setHeight("-1px"); startButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1906358615316029946L; public void buttonClick(ClickEvent event) { System.out.println(app.getValue()); Set<Long> inputDbIds = new HashSet<Long>(); for (Object iid : inputData.getItemIds()) { inputData.select(iid); inputDbIds.add(((DataElement) iid).getDbId()); } ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds); form.commit(); processing.setApplication((Application) app.getValue()); startButton.setData(processing); form.fireEvent(new Event(startButton)); } }); buttons.addComponent(startButton); buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT); final Button delButton = new NativeButton(); delButton.setCaption("remove inputs"); delButton.setImmediate(true); delButton.setWidth("-1px"); delButton.setHeight("-1px"); delButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -3377452914254101817L; @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { if (inputData.getValue() != null) { for (DataElement de : (Set<DataElement>) inputData.getValue()) { inputData.removeItem(de); dataElements.remove(de); } } } }); buttons.addComponent(delButton); buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT); }
From source file:org.accelerators.activiti.admin.ui.GroupTab.java
License:Open Source License
public GroupTab(AdminApp application) { // Set application reference this.app = application; // Set tab name setCaption(app.getMessage(Messages.Groups)); // Add main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/* w w w. ja v a 2 s. co m*/ layout.setSpacing(true); layout.setSizeFull(); // Add toolbar layout GridLayout toolbar = new GridLayout(2, 1); toolbar.setWidth("100%"); layout.addComponent(toolbar); // Add create button create = new Button(app.getMessage(Messages.Create), (ClickListener) this); create.setDescription(app.getMessage(Messages.CreateGroup)); create.setIcon(new ThemeResource("../runo/icons/16/ok.png")); toolbar.addComponent(create, 0, 0); toolbar.setComponentAlignment(create, Alignment.TOP_LEFT); // Add refresh button refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this); refresh.setDescription(app.getMessage(Messages.RefreshTable)); refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png")); toolbar.addComponent(refresh, 1, 0); toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT); // Add table table = new GroupTable(app); table.setSizeFull(); layout.addComponent(table); // Set table to expand layout.setExpandRatio(table, 1.0f); // Root setCompositionRoot(layout); }
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);//from w w w . ja v a 2 s . c o m 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.accelerators.activiti.admin.ui.UserTab.java
License:Open Source License
public UserTab(AdminApp application) { // Set application reference this.app = application; // Set tab name setCaption(app.getMessage(Messages.Users)); // Add main layout VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w .j a v a 2 s .c o m*/ layout.setSpacing(true); layout.setSizeFull(); // Add toolbar layout GridLayout toolbar = new GridLayout(2, 1); toolbar.setWidth("100%"); layout.addComponent(toolbar); // Add create button create = new Button(app.getMessage(Messages.Create), (ClickListener) this); create.setDescription(app.getMessage(Messages.CreateUser)); create.setIcon(new ThemeResource("../runo/icons/16/ok.png")); toolbar.addComponent(create, 0, 0); toolbar.setComponentAlignment(create, Alignment.TOP_LEFT); // Add refresh button refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this); refresh.setDescription(app.getMessage(Messages.RefreshTable)); refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png")); toolbar.addComponent(refresh, 1, 0); toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT); // Add table table = new UserTable(app); table.setSizeFull(); layout.addComponent(table); // Set table to expand layout.setExpandRatio(table, 1.0f); // Root setCompositionRoot(layout); }
From source file:org.activiti.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected void initProfileButton() { final LoggedInUser user = ExplorerApp.get().getLoggedInUser(); // User name + link to profile MenuBar profileMenu = new MenuBar(); profileMenu.addStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_BOX); MenuItem rootItem = profileMenu.addItem(user.getFirstName() + " " + user.getLastName(), null); rootItem.setStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_MENU); if (useProfile()) { // Show profile rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_SHOW), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().getViewManager().showProfilePopup(user.getId()); }// w ww . j a v a 2 s . co m }); // Edit profile rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_EDIT), new Command() { public void menuSelected(MenuItem selectedItem) { // TODO: Show in edit-mode ExplorerApp.get().getViewManager().showProfilePopup(user.getId()); } }); // Change password rootItem.addItem(i18nManager.getMessage(Messages.PASSWORD_CHANGE), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().getViewManager().showPopupWindow(new ChangePasswordPopupWindow()); } }); rootItem.addSeparator(); } // Logout rootItem.addItem(i18nManager.getMessage(Messages.HEADER_LOGOUT), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().close(); } }); addComponent(profileMenu); setComponentAlignment(profileMenu, Alignment.TOP_RIGHT); setExpandRatio(profileMenu, 1.0f); }
From source file:org.activiti.explorer.ui.MainMenuBar.java
License:Apache License
protected void initProfileButton() { final LoggedInUser user = ExplorerApp.get().getLoggedInUser(); // User name + link to profile MenuBar profileMenu = new MenuBar(); profileMenu.addStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_BOX); MenuItem rootItem = profileMenu.addItem(user.getFirstName() + " " + user.getLastName(), null); rootItem.setStyleName(ExplorerLayout.STYLE_HEADER_PROFILE_MENU); // Show profile rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_SHOW), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().getViewManager().showProfilePopup(user.getId()); }/*from www. j a v a 2 s . c o m*/ }); // Edit profile rootItem.addItem(i18nManager.getMessage(Messages.PROFILE_EDIT), new Command() { public void menuSelected(MenuItem selectedItem) { // TODO: Show in edit-mode ExplorerApp.get().getViewManager().showProfilePopup(user.getId()); } }); // Change password rootItem.addItem(i18nManager.getMessage(Messages.PASSWORD_CHANGE), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().getViewManager().showPopupWindow(new ChangePasswordPopupWindow()); } }); rootItem.addSeparator(); // Logout rootItem.addItem(i18nManager.getMessage(Messages.HEADER_LOGOUT), new Command() { public void menuSelected(MenuItem selectedItem) { ExplorerApp.get().close(); } }); addComponent(profileMenu); setComponentAlignment(profileMenu, Alignment.TOP_RIGHT); setExpandRatio(profileMenu, 1.0f); }
From source file:org.adho.dhconvalidator.ui.HeaderPanel.java
/** * Setup UI./*from w w w . j a va 2 s .c o m*/ * * @param backstepService */ private void initComponents(ServicesViewName backstepService) { setSpacing(true); setWidth("100%"); backLink = new BackLink(backstepService); addComponent(backLink); setComponentAlignment(backLink, Alignment.TOP_LEFT); AboutLink aboutLink = new AboutLink(); addComponent(aboutLink); setComponentAlignment(aboutLink, Alignment.TOP_RIGHT); setExpandRatio(aboutLink, 1.0f); LogoutLink logoutLink = new LogoutLink(); addComponent(logoutLink); setComponentAlignment(logoutLink, Alignment.TOP_RIGHT); }