List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createSubstitutionSection() { VerticalLayout substitution = new VerticalLayout(); substitution.addStyleName("l-substitutes"); substitution.setSpacing(true);/*w w w . j a va 2 s .c o m*/ substitution.setSizeFull(); Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>", ContentMode.HTML); substitution.addComponent(substitutionHeader); Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp")); substitutionHelp.setStyleName("form-help"); substitution.addComponent(substitutionHelp); this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive")); substitutionActive.addStyleName("ui-spacing"); substitutionActive.setValue(user.isSubstitutionActive()); substitution.addComponent(substitutionActive); //substitutes selectedPersons = user.getDirectSubstitutes(); this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes")); refreshSubstitutes(""); TextField substituteFilter = new TextField(ui.getMessage("action.filter")); substituteFilter.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { substitutes.removeAllItems(); refreshSubstitutes(event.getProperty().getValue().toString()); } }); substitution.addComponent(substituteFilter); Panel substitutesPanel = new Panel(); substitutesPanel.addStyleName("l-border-none"); substitutesPanel.setSizeFull(); substitutesPanel.setContent(substitutes); substitution.addComponent(substitutesPanel); substitution.setExpandRatio(substitutesPanel, 2); return substitution; }
From source file:com.skysql.manager.ManagerUI.java
License:Open Source License
/** * Inits the layout.//from w ww . j av a 2 s .c o m */ private void initLayout() { VerticalLayout main = new VerticalLayout(); main.setMargin(new MarginInfo(false, true, false, true)); main.setSpacing(true); main.setSizeFull(); setContent(main); VaadinSession session = getSession(); AnimatorProxy proxy = new AnimatorProxy(); main.addComponent(proxy); session.setAttribute(AnimatorProxy.class, proxy); VerticalLayout topMiddleLayout = new VerticalLayout(); main.addComponent(topMiddleLayout); session.setAttribute(VerticalLayout.class, topMiddleLayout); TopPanel topPanel = new TopPanel(); topMiddleLayout.addComponent(topPanel); session.setAttribute(TopPanel.class, topPanel); overviewPanel = new OverviewPanel(); topMiddleLayout.addComponent(overviewPanel); session.setAttribute(OverviewPanel.class, overviewPanel); tabbedPanel = new TabbedPanel(session); main.addComponent(tabbedPanel.getTabSheet()); main.setExpandRatio(tabbedPanel.getTabSheet(), 1f); session.setAttribute(TabbedPanel.class, tabbedPanel); overviewPanel.refresh(); }
From source file:com.skysql.manager.ui.ChartsDialog.java
License:Open Source License
/** * Instantiates a new charts dialog./*from w ww . j av a 2 s .c o m*/ * * @param chartsLayout the charts layout * @param chartButton the chart button */ public ChartsDialog(final ChartsLayout chartsLayout, final ChartButton chartButton) { this.chartButton = chartButton; this.chartsLayout = chartsLayout; dialogWindow = new ModalWindow("Monitors to Chart mapping", "775px"); HorizontalLayout wrapper = new HorizontalLayout(); //wrapper.setWidth("100%"); wrapper.setMargin(true); UI.getCurrent().addWindow(dialogWindow); newUserChart = (chartButton != null) ? new UserChart((UserChart) chartButton.getData()) : newUserChart(); ArrayList<String> monitorIDs = newUserChart.getMonitorIDs(); MonitorsLayout monitorsLayout = new MonitorsLayout(monitorIDs); wrapper.addComponent(monitorsLayout); VerticalLayout separator = new VerticalLayout(); separator.setSizeFull(); Embedded rightArrow = new Embedded(null, new ThemeResource("img/right_arrow.png")); separator.addComponent(rightArrow); separator.setComponentAlignment(rightArrow, Alignment.MIDDLE_CENTER); wrapper.addComponent(separator); ChartPreviewLayout chartPreviewLayout = new ChartPreviewLayout(newUserChart, chartsLayout.getTime(), chartsLayout.getInterval()); wrapper.addComponent(chartPreviewLayout); monitorsLayout.addChartPreview(chartPreviewLayout); HorizontalLayout buttonsBar = new HorizontalLayout(); buttonsBar.setStyleName("buttonsBar"); buttonsBar.setSizeFull(); buttonsBar.setSpacing(true); buttonsBar.setMargin(true); buttonsBar.setHeight("49px"); Label filler = new Label(); buttonsBar.addComponent(filler); buttonsBar.setExpandRatio(filler, 1.0f); Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { dialogWindow.close(); } }); Button okButton = new Button(chartButton != null ? "Save Changes" : "Add Chart"); okButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { try { ChartButton newChartButton = new ChartButton(newUserChart); newChartButton.setChartsLayout(chartsLayout); newChartButton.setEditable(true); if (chartButton != null) { chartsLayout.replaceComponent(chartButton, newChartButton); } else { chartsLayout.addComponent(newChartButton); } } catch (Exception e) { ManagerUI.error(e.getMessage()); } dialogWindow.close(); } }); buttonsBar.addComponent(okButton); buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT); VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent(); windowLayout.setSpacing(false); windowLayout.setMargin(false); windowLayout.addComponent(wrapper); windowLayout.addComponent(buttonsBar); }
From source file:com.skysql.manager.ui.TimelineDialog.java
License:Open Source License
/** * Instantiates a new timeline dialog.//from w w w . j a v a 2s .c om * * @param userChart the user chart */ public TimelineDialog(UserChart userChart) { dialogWindow = new ModalWindow("Timeline", "800px"); dialogWindow.setHeight("800px"); VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent(); windowLayout.setSizeFull(); UI.getCurrent().addWindow(dialogWindow); ArrayList<String> monitorIDs = userChart.getMonitorIDs(); TimelineLayout timelineLayout = new TimelineLayout(userChart.getName(), monitorIDs); windowLayout.addComponent(timelineLayout.getTimeLine()); }
From source file:com.skysql.manager.ui.WarningWindow.java
License:Open Source License
/** * Instantiates a new warning window.// w w w. j ava 2s . co m * * @param caption the caption * @param message the message * @param label the label * @param okListener the ok listener */ public WarningWindow(String caption, String message, String label, Button.ClickListener okListener) { super(caption, "60%"); HorizontalLayout wrapper = new HorizontalLayout(); wrapper.setWidth("100%"); wrapper.setMargin(true); VerticalLayout iconLayout = new VerticalLayout(); iconLayout.setWidth("100px"); wrapper.addComponent(iconLayout); Embedded image = new Embedded(null, new ThemeResource("img/warning.png")); iconLayout.addComponent(image); VerticalLayout textLayout = new VerticalLayout(); textLayout.setSizeFull(); wrapper.addComponent(textLayout); wrapper.setExpandRatio(textLayout, 1.0f); Label msgLabel = new Label(message); msgLabel.addStyleName("warning"); textLayout.addComponent(msgLabel); textLayout.setComponentAlignment(msgLabel, Alignment.MIDDLE_CENTER); HorizontalLayout buttonsBar = new HorizontalLayout(); buttonsBar.setStyleName("buttonsBar"); buttonsBar.setSizeFull(); buttonsBar.setSpacing(true); buttonsBar.setMargin(true); buttonsBar.setHeight("49px"); Label filler = new Label(); buttonsBar.addComponent(filler); buttonsBar.setExpandRatio(filler, 1.0f); Button cancelButton = new Button("Cancel"); buttonsBar.addComponent(cancelButton); buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT); cancelButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(Button.ClickEvent event) { warningWindow.close(); } }); Button okButton = new Button(label); okButton.addClickListener(okListener); buttonsBar.addComponent(okButton); buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT); VerticalLayout windowLayout = (VerticalLayout) this.getContent(); windowLayout.setSpacing(false); windowLayout.setMargin(false); windowLayout.addComponent(wrapper); windowLayout.addComponent(buttonsBar); }
From source file:com.snowy.Game.java
public Game(int id, data d) { Notification.show("Game/Chat Created", Notification.Type.TRAY_NOTIFICATION); this.d = d;//from w w w . ja v a 2s . c o m gameId = id; CheckForUpdate(); selfGame = p1 == p2; this.setId("GameForMe"); js.addFunction("sendMove", (e) -> { int clickPos = (int) e.getNumber(0); for (int i = 0; i < e.getArray(1).length(); i++) { int circle = (int) e.getArray(1).getArray(i).getNumber(0); int center = (int) e.getArray(1).getArray(i).getNumber(1); if (clickPos <= (center + 30) && clickPos >= (center - 30)) { //Logger.getLogger(Game.class.getName()).info("Played "+circle); boolean win = d.move(circle, (currentTurn == p1 ? p2 : p1), this.gameId); if (win == true) { /*Notification nn = new Notification("Game Over You Win","",Notification.Type.WARNING_MESSAGE); nn.setDelayMsec(5000); nn.show(Page.getCurrent());*/ js.execute("if(document.getElementById('GameForMe')!=null && " + "document.getElementById('GameForMe').hasChildNodes() &&" + "document.getElementById('GameForMe').lastChild.hasChildNodes()){" + "var bb = document.getElementsByTagName('svg')[0];" + "bb.parentNode.removeChild(bb);" + "}"); VerticalLayout winLayout = new VerticalLayout(); Label winMessage = new Label("<h1>Congratulations You Win!</h1>", ContentMode.HTML); Label winCloseMessage = new Label( "<h3>Game and Chat Tabs will stay open till next Login</h3>", ContentMode.HTML); Notification.show("Game Won", Notification.Type.TRAY_NOTIFICATION); winLayout.addComponent(winMessage); winLayout.addComponent(winCloseMessage); winLayout.setSizeFull(); winLayout.setMargin(true); winLayout.setSpacing(false); winLayout.setComponentAlignment(winMessage, Alignment.MIDDLE_CENTER); winLayout.setComponentAlignment(winCloseMessage, Alignment.MIDDLE_CENTER); this.addComponent(winLayout); this.setComponentAlignment(winLayout, Alignment.MIDDLE_CENTER); notDisp = true; //Logger.getLogger(Game.class.getName()).info("go win"); } currentTurn = currentTurn == p1 ? p2 : p1; rendered = false; break; } } }); /*this.addComponent(new Button("c",e->{ create(); //js.execute("hello();"); }));*/ this.setSizeFull(); }
From source file:com.snowy.Game.java
public void CheckForUpdate() { if (d.isGameActive(gameId) == 0) { ArrayList<ArrayList<Integer>> tempGameBoard = d.getGameBoard(gameId); if (!tempGameBoard.equals(gameBoard)) { hasUpdate = true;/*from w w w. ja v a2s . c om*/ gameBoard = tempGameBoard; p1 = d.getPlayerOne(gameId); p2 = d.getPlayerTwo(gameId); currentTurn = d.getLastTurn(gameId) == 0 ? p1 : d.getLastTurn(gameId); } //Logger.getLogger(Game.class.getName()).info(hasUpdate+"|"+this.isConnectorEnabled()+"|"+rendered+"|"+jj++); if (this.isConnectorEnabled() && hasUpdate) {//&& !rendered){ Update(); hasUpdate = false; //Logger.getLogger(Game.class.getName()).info("has update"); rendered = true; } else if (this.isConnectorEnabled() && !rendered) { Update(); //Logger.getLogger(Game.class.getName()).info("rendering"); this.rendered = true; } else if (!this.isConnectorEnabled() && rendered) { rendered = false; //Logger.getLogger(Game.class.getName()).info("mark as need to render"); } } else { //Logger.getLogger(Game.class.getName()).info("go lose"); if (this.isConnectorEnabled() && notDisp == false) { //Logger.getLogger(Game.class.getName()).info("go lose " +((d.getLastTurn(gameId)==p1?p2:p1))+" | "+d.getUserIdFromToken()); if ((d.getLastTurn(gameId) == p1 ? p2 : p1) != d.getUserIdFromToken()) { /*Notification nn = new Notification("Game Over You Lose","",Notification.Type.WARNING_MESSAGE); nn.setDelayMsec(5000); nn.show(Page.getCurrent());*/ js.execute("if(document.getElementById('GameForMe')!=null && " + "document.getElementById('GameForMe').hasChildNodes() &&" + "document.getElementById('GameForMe').lastChild.hasChildNodes()){" + "var bb = document.getElementsByTagName('svg')[0];" + "bb.parentNode.removeChild(bb);" + "}"); VerticalLayout loseLayout = new VerticalLayout(); Label loseMessage = new Label("<h1>Unfortunately You Have Lost</h1>", ContentMode.HTML); Label loseCloseMessage = new Label("<h3>Game and Chat Tabs will stay open till next Login</h3>", ContentMode.HTML); loseLayout.addComponent(loseMessage); loseLayout.addComponent(loseCloseMessage); loseLayout.setSizeFull(); loseLayout.setComponentAlignment(loseMessage, Alignment.MIDDLE_CENTER); Notification.show("Game Lost", Notification.Type.TRAY_NOTIFICATION); loseLayout.setComponentAlignment(loseCloseMessage, Alignment.MIDDLE_CENTER); loseLayout.setMargin(true); loseLayout.setSpacing(false); this.addComponent(loseLayout); this.setComponentAlignment(loseLayout, Alignment.MIDDLE_CENTER); //Logger.getLogger(Game.class.getName()).info("go lose"); notDisp = true; } } //n. } }
From source file:com.squadd.views.ChatView.java
private void buildLayout() { VerticalLayout chatAndFooter = new VerticalLayout(); chatAndFooter.setHeight("90%"); VerticalLayout contacts = new VerticalLayout(); contacts.setSizeFull(); contactsPanel.setHeight("800px"); contactsPanel.setWidth("300px"); contactsPanel.setContent(contactsLayout); contacts.addComponent(contactsPanel); contacts.setHeight("90%"); TextField idTo = new TextField("idTo"); idTo.setWidth("200px"); Button setIdTo = new Button("set"); setIdTo.setWidth("100px"); HorizontalLayout setUserToId = new HorizontalLayout(); Button.ClickListener st = new Button.ClickListener() { @Override// w w w . j av a 2s . c om public void buttonClick(Button.ClickEvent event) { if (!idTo.getValue().equals("")) { UserInfoBean newUserTo = new UserInfoBean(); newUserTo.setId(Integer.parseInt(idTo.getValue())); newUserTo.setName("id" + idTo.getValue()); control.setUserTo(newUserTo); if (footer.isVisible() == false) { footer.setVisible(true); } UserInfoFace look = new UserInfoFace(newUserTo, control, footer); Panel panel = look.getUserPanel(); boolean exists = false; for (int i = 0; i < contactsLayout.getComponentCount(); i++) { if (contactsLayout.getComponent(i).getClass() == Panel.class) { Panel pan = (Panel) contactsLayout.getComponent(i); if ((!(pan.getId() == null)) && pan.getId().equals(idTo.getValue())) { exists = true; } } } if (exists == false) { contactsLayout.addComponent(panel); } control.clearChat(); control.updateChatLog(10); } idTo.clear(); } }; setIdTo.addClickListener(st); setUserToId.addComponents(idTo, setIdTo); setUserToId.setComponentAlignment(setIdTo, Alignment.BOTTOM_CENTER); contacts.addComponent(setUserToId); mainLayout.addComponents(contacts); footer.setVisible(false);///////// chatAndFooter.addComponents(chatPanel, footer); chatLayout = new VerticalLayout(); chatPanel.setHeight("750px"); chatPanel.setWidth("900px"); chatPanel.setContent(chatLayout); chatInput = new TextField(); chatInput.setWidthUndefined(); footer.addComponent(chatInput); chatInput.focus(); send.setWidth("120px"); footer.addComponent(send); clear.setWidth("120px"); footer.addComponent(clear); update.setWidth("120px"); footer.addComponent(update); footer.setHeight("50px"); footer.setWidth("900px"); chatInput.setWidth("100%"); footer.setExpandRatio(chatInput, 1f); chatAndFooter.setExpandRatio(chatPanel, 1f); mainLayout.addComponents(chatAndFooter); mainLayout.setExpandRatio(chatAndFooter, 1f); control.loadFriends(); }
From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java
private void openComplaintWindow(Complaint complaint) { WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); Window window = new Window("Registro de Queja"); window.setModal(true);//from w w w . ja v a 2 s. c o m if (webBrowser.getScreenWidth() < 1024) { window.setSizeFull(); } else { window.setHeight(90.0f, Unit.PERCENTAGE); window.setWidth(90.0f, Unit.PERCENTAGE); } // TextField nameField = new TextField(); // nameField.setInputPrompt("Introduzca el ttulo de la queja"); // nameField.setWidth("100%"); TextArea notesArea = new TextArea(); notesArea.setInputPrompt("Introduzca el contenido de la queja"); notesArea.setSizeFull(); // CheckBox doneField = new CheckBox("Atendido"); HorizontalLayout horizontal = new HorizontalLayout(); horizontal.setSpacing(true); horizontal.addComponent(createDeleteButton(window)); horizontal.addComponent(createOkButton(window)); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.addComponent(complaintType); layout.addComponent(notesArea); // layout.addComponent(doneField); layout.addComponent(horizontal); layout.setComponentAlignment(horizontal, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(complaintType, 1); layout.setExpandRatio(notesArea, 8); // layout.setExpandRatio(doneField, 1); layout.setExpandRatio(horizontal, 1); BeanItem beanItem = new BeanItem<>(complaint); fieldGroup = new BeanFieldGroup<>(Complaint.class); fieldGroup.setItemDataSource(beanItem); fieldGroup.bind(complaintType, "complaintType"); fieldGroup.bind(notesArea, "notes"); // fieldGroup.bind(doneField, "done"); window.setContent(layout); getUI().addWindow(window); // Window windowComplaint = new Window(complaintView); // WidgetActions actions = new WidgetActions(){ // // @Override // public void saveAction() { // refreshBind(); // windowComplaint.close(); // } // // @Override // public void deleteAction() { // appointment.getComplaints().remove(complaint); // refreshBind(); // windowComplaint.close(); // } // // }; // complaintView.bind(complaint); // complaintView.setActions(actions); // getUI().addWindow(windowComplaint); }
From source file:com.terralcode.gestion.frontend.view.window.CustomerFinderDialogWindow.java
private void buildLayout() { VerticalLayout vlayout = new VerticalLayout(); vlayout.setSizeFull(); searchText = new TextField(); searchText.setInputPrompt("Introduzca una cadena de bsqueda"); searchText.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override//from w ww . ja v a 2 s . co m public void textChange(FieldEvents.TextChangeEvent event) { String search = event.getText(); if (search.length() > 3) { findCustomer(search); } } }); searchText.setWidth("100%"); vlayout.addComponent(searchText); resultsTable = new Table(); resultsTable.setContainerDataSource(containerCustomers); resultsTable.setVisibleColumns(new Object[] { "code", "name", "customerStatus", "customerType" }); resultsTable.setSelectable(true); resultsTable.setNullSelectionAllowed(false); resultsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { selectedCustomer = (CustomerCRM) event.getItemId(); okButton.setEnabled(selectedCustomer != null); } }); resultsTable.setSizeFull(); vlayout.addComponent(resultsTable); vlayout.setExpandRatio(resultsTable, 1); setBody(vlayout); setFooterButtons(DialogButton.OK, DialogButton.CANCEL); }